Browse Source

[fix]

委外加工 委外计划
修改委外计划mapper及service有关委外物料的mapper调用;
修改添加委外报价页面回调去重方法逻辑;
新增委外物料mapper文件;
新增按料号批量删除委外物料mapper方法;
dev
王晓迪 3 days ago
parent
commit
d3511fd490
  1. 90
      ruoyi-admin/src/main/java/com/ruoyi/system/mapper/OutsourceMaterialMapper.java
  2. 10
      ruoyi-admin/src/main/java/com/ruoyi/system/mapper/OutsourcePlanMapper.java
  3. 8
      ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/OutsourcePlanServiceImpl.java
  4. 132
      ruoyi-admin/src/main/resources/mapper/system/OutsourceMaterialMapper.xml
  5. 31
      ruoyi-admin/src/main/resources/mapper/system/OutsourcePlanMapper.xml
  6. 24
      ruoyi-admin/src/main/resources/templates/system/outsource_quote/add.html

90
ruoyi-admin/src/main/java/com/ruoyi/system/mapper/OutsourceMaterialMapper.java

@ -0,0 +1,90 @@
package com.ruoyi.system.mapper;
import java.util.List;
import com.ruoyi.system.domain.OutsourceMaterial;
/**
* 委外物料Mapper接口
*
* @author ruoyi
* @date 2024-09-18
*/
public interface OutsourceMaterialMapper
{
/**
* 查询委外物料
*
* @param outsourceMaterialId 委外物料ID
* @return 委外物料
*/
public OutsourceMaterial selectOutsourceMaterialById(Long outsourceMaterialId);
/**
* 查询委外物料列表
*
* @param outsourceMaterial 委外物料
* @return 委外物料集合
*/
public List<OutsourceMaterial> selectOutsourceMaterialList(OutsourceMaterial outsourceMaterial);
/**
* 新增委外物料
*
* @param outsourceMaterial 委外物料
* @return 结果
*/
public int insertOutsourceMaterial(OutsourceMaterial outsourceMaterial);
/**
* 修改委外物料
*
* @param outsourceMaterial 委外物料
* @return 结果
*/
public int updateOutsourceMaterial(OutsourceMaterial outsourceMaterial);
/**
* 删除委外物料
*
* @param outsourceMaterialId 委外物料ID
* @return 结果
*/
public int deleteOutsourceMaterialById(Long outsourceMaterialId);
/**
* 批量删除委外物料
*
* @param outsourceMaterialIds 需要删除的数据ID
* @return 结果
*/
public int deleteOutsourceMaterialByIds(String[] outsourceMaterialIds);
/**
* 作废委外物料
*
* @param outsourceMaterialId 委外物料ID
* @return 结果
*/
public int cancelOutsourceMaterialById(Long outsourceMaterialId);
/**
* 恢复委外物料
*
* @param outsourceMaterialId 委外物料ID
* @return 结果
*/
public int restoreOutsourceMaterialById(Long outsourceMaterialId);
/**
* 查询委外物料
*
* @param materialNo 需要查询的数据编码
* @return 结果
*/
// public OutsourceMaterial selectMaterialByCode(String materialNo);
public List<OutsourceMaterial> selectProcessNoByNo (String materialNo);
public int deleteOutsourceMaterialByNo(String materialNo);
}

10
ruoyi-admin/src/main/java/com/ruoyi/system/mapper/OutsourcePlanMapper.java

@ -88,16 +88,6 @@ public interface OutsourcePlanMapper
*/
public List<OutsourcePlan> selectOutsourcePlanByCodes(String[] outsourcePlanCodes);
/**
* 查询委外物料
*
* @param materialNo 需要查询的数据编码
* @return 结果
*/
public OutsourceMaterial selectMaterialByCode(String materialNo);
public List<OutsourceMaterial> selectProcessNoByNo (String materialNo);
/**
* 批量删除委外计划详情

8
ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/OutsourcePlanServiceImpl.java

@ -9,6 +9,7 @@ import com.ruoyi.system.domain.OutsourcePlanDetail;
import com.ruoyi.system.domain.OutsourceQuoteChild;
import com.ruoyi.system.domain.Vo.OutsourceProcessVo;
import com.ruoyi.system.domain.Vo.Supplier;
import com.ruoyi.system.mapper.OutsourceMaterialMapper;
import com.ruoyi.system.mapper.OutsourcePlanMapper;
import com.ruoyi.system.mapper.OutsourceProcessMapper;
import com.ruoyi.system.mapper.OutsourceQuoteMapper;
@ -40,6 +41,9 @@ public class OutsourcePlanServiceImpl implements IOutsourcePlanService
@Autowired
private OutsourceQuoteMapper outsourceQuoteMapper;
@Autowired
private OutsourceMaterialMapper outsourceMaterialMapper;
/**
* 查询委外计划
*
@ -118,7 +122,7 @@ public class OutsourcePlanServiceImpl implements IOutsourcePlanService
// 获取物料信息
@Override
public OutsourceMaterial selectMaterialByCode(String materialNo) {
List<OutsourceMaterial> materialList = outsourcePlanMapper.selectProcessNoByNo(materialNo);
List<OutsourceMaterial> materialList = outsourceMaterialMapper.selectProcessNoByNo(materialNo);
OutsourceMaterial shareMaterial = materialList.get(0);
OutsourceMaterial material = new OutsourceMaterial();
material.setMaterialNo(shareMaterial.getMaterialNo());
@ -131,7 +135,7 @@ public class OutsourcePlanServiceImpl implements IOutsourcePlanService
material.setDescription(shareMaterial.getDescription());
material.setProcessMethod(shareMaterial.getProcessMethod());
// 获取委外计划表中的物料信息中的工序编号,以查询同料号的所有工序
List<OutsourceMaterial> materials = outsourcePlanMapper.selectProcessNoByNo(material.getMaterialNo());
List<OutsourceMaterial> materials = outsourceMaterialMapper.selectProcessNoByNo(material.getMaterialNo());
List<String> noList = materials.stream().map(OutsourceMaterial::getOutsourceProcessNo).collect(Collectors.toList());
List<OutsourceProcessVo> processVoS = supplierClassification(noList);

132
ruoyi-admin/src/main/resources/mapper/system/OutsourceMaterialMapper.xml

@ -0,0 +1,132 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.system.mapper.OutsourceMaterialMapper">
<resultMap type="OutsourceMaterial" id="OutsourceMaterialResult">
<result property="outsourceMaterialId" column="outsource_material_id" />
<result property="materialNo" column="material_no" />
<result property="materialName" column="material_name" />
<result property="materialType" column="material_type" />
<result property="materialPhotourl" column="material_photoUrl" />
<result property="description" column="description" />
<result property="brand" column="brand" />
<result property="unit" column="unit" />
<result property="plannedOutsourceAmount" column="planned_outsource_amount" />
<result property="processMethod" column="process_method" />
<result property="outsourceProcessNo" column="outsource_process_no" />
<result property="outsourceProcessName" column="outsource_process_name" />
</resultMap>
<sql id="selectOutsourceMaterialVo">
select outsource_material_id, material_no, material_name, material_type, material_photoUrl, description, brand, unit, planned_outsource_amount, process_method, outsource_process_no, outsource_process_name from outsource_material
</sql>
<select id="selectOutsourceMaterialList" parameterType="OutsourceMaterial" resultMap="OutsourceMaterialResult">
<include refid="selectOutsourceMaterialVo"/>
<where>
<if test="materialNo != null and materialNo != ''"> and material_no = #{materialNo}</if>
<if test="materialName != null and materialName != ''"> and material_name like concat('%', #{materialName}, '%')</if>
<if test="materialType != null and materialType != ''"> and material_type = #{materialType}</if>
<if test="materialPhotourl != null and materialPhotourl != ''"> and material_photoUrl = #{materialPhotourl}</if>
<if test="description != null and description != ''"> and description = #{description}</if>
<if test="brand != null and brand != ''"> and brand = #{brand}</if>
<if test="unit != null and unit != ''"> and unit = #{unit}</if>
<if test="plannedOutsourceAmount != null "> and planned_outsource_amount = #{plannedOutsourceAmount}</if>
<if test="processMethod != null and processMethod != ''"> and process_method = #{processMethod}</if>
<if test="outsourceProcessNo != null and outsourceProcessNo != ''"> and outsource_process_no = #{outsourceProcessNo}</if>
<if test="outsourceProcessName != null and outsourceProcessName != ''"> and outsource_process_name like concat('%', #{outsourceProcessName}, '%')</if>
</where>
</select>
<select id="selectOutsourceMaterialById" parameterType="Long" resultMap="OutsourceMaterialResult">
<include refid="selectOutsourceMaterialVo"/>
where outsource_material_id = #{outsourceMaterialId}
</select>
<insert id="insertOutsourceMaterial" parameterType="OutsourceMaterial" useGeneratedKeys="true" keyProperty="outsourceMaterialId">
insert into outsource_material
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="materialNo != null and materialNo != ''">material_no,</if>
<if test="materialName != null and materialName != ''">material_name,</if>
<if test="materialType != null">material_type,</if>
<if test="materialPhotourl != null">material_photoUrl,</if>
<if test="description != null">description,</if>
<if test="brand != null">brand,</if>
<if test="unit != null">unit,</if>
<if test="plannedOutsourceAmount != null">planned_outsource_amount,</if>
<if test="processMethod != null">process_method,</if>
<if test="outsourceProcessNo != null and outsourceProcessNo != ''">outsource_process_no,</if>
<if test="outsourceProcessName != null">outsource_process_name,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="materialNo != null and materialNo != ''">#{materialNo},</if>
<if test="materialName != null and materialName != ''">#{materialName},</if>
<if test="materialType != null">#{materialType},</if>
<if test="materialPhotourl != null">#{materialPhotourl},</if>
<if test="description != null">#{description},</if>
<if test="brand != null">#{brand},</if>
<if test="unit != null">#{unit},</if>
<if test="plannedOutsourceAmount != null">#{plannedOutsourceAmount},</if>
<if test="processMethod != null">#{processMethod},</if>
<if test="outsourceProcessNo != null and outsourceProcessNo != ''">#{outsourceProcessNo},</if>
<if test="outsourceProcessName != null">#{outsourceProcessName},</if>
</trim>
</insert>
<update id="updateOutsourceMaterial" parameterType="OutsourceMaterial">
update outsource_material
<trim prefix="SET" suffixOverrides=",">
<if test="materialNo != null and materialNo != ''">material_no = #{materialNo},</if>
<if test="materialName != null and materialName != ''">material_name = #{materialName},</if>
<if test="materialType != null">material_type = #{materialType},</if>
<if test="materialPhotourl != null">material_photoUrl = #{materialPhotourl},</if>
<if test="description != null">description = #{description},</if>
<if test="brand != null">brand = #{brand},</if>
<if test="unit != null">unit = #{unit},</if>
<if test="plannedOutsourceAmount != null">planned_outsource_amount = #{plannedOutsourceAmount},</if>
<if test="processMethod != null">process_method = #{processMethod},</if>
<if test="outsourceProcessNo != null and outsourceProcessNo != ''">outsource_process_no = #{outsourceProcessNo},</if>
<if test="outsourceProcessName != null">outsource_process_name = #{outsourceProcessName},</if>
</trim>
where outsource_material_id = #{outsourceMaterialId}
</update>
<delete id="deleteOutsourceMaterialById" parameterType="Long">
delete from outsource_material where outsource_material_id = #{outsourceMaterialId}
</delete>
<delete id="deleteOutsourceMaterialByIds" parameterType="String">
delete from outsource_material where outsource_material_id in
<foreach item="outsourceMaterialId" collection="array" open="(" separator="," close=")">
#{outsourceMaterialId}
</foreach>
</delete>
<update id="cancelOutsourceMaterialById" parameterType="Long">
update outsource_material set del_flag = '1' where outsource_material_id = #{outsourceMaterialId}
</update>
<update id="restoreOutsourceMaterialById" parameterType="Long">
update outsource_material set del_flag = '0' where outsource_material_id = #{outsourceMaterialId}
</update>
<!-- 按料号查询委外物料-->
<!-- <select id="selectMaterialByCode" parameterType="String" resultMap="OutsourceMaterialResult">-->
<!-- select material_no, material_name, material_type, material_photoUrl, description, brand, unit, planned_outsource_amount, process_method, outsource_process_no, outsource_process_name-->
<!-- from outsource_material-->
<!-- where material_no =#{materialNo}-->
<!-- </select>-->
<!-- 按料号查询委外物料-->
<select id="selectProcessNoByNo" parameterType="String" resultMap="OutsourceMaterialResult">
select material_no, material_name, material_type, material_photoUrl, description, brand, unit, planned_outsource_amount, process_method, outsource_process_no, outsource_process_name
from outsource_material
where material_no =#{materialNo}
</select>
<delete id="deleteOutsourceMaterialByNo" parameterType="String">
delete from outsource_material where material_no = #{materialNo}
</delete>
</mapper>

31
ruoyi-admin/src/main/resources/mapper/system/OutsourcePlanMapper.xml

@ -21,23 +21,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateTime" column="update_time" />
</resultMap>
<!-- 委外物料-->
<resultMap type="OutsourceMaterial" id="OutsourceMaterialResult">
<result property="outsourceMaterialId" column="outsource_material_id" />
<result property="materialNo" column="material_no" />
<result property="materialName" column="material_name" />
<result property="outsourceProcessNo" column="outsource_process_no" />
<result property="outsourceProcessName" column="outsource_process_name" />
<result property="materialType" column="material_type" />
<result property="materialPhotourl" column="material_photoUrl" />
<result property="unit" column="unit" />
<result property="description" column="description" />
<result property="brand" column="brand" />
<result property="processMethod" column="process_method" />
<result property="plannedOutsourceAmount" column="planned_outsource_amount" />
</resultMap>
<resultMap id="OutsourcePlanOutsourcePlanDetailResult" type="OutsourcePlan" extends="OutsourcePlanResult">
<collection property="outsourcePlanDetailList" ofType="OutsourcePlanDetail" column="outsource_plan_id" select="selectOutsourcePlanDetailList" />
</resultMap>
@ -169,20 +152,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
</select>
<!-- 按料号查询委外物料-->
<select id="selectMaterialByCode" parameterType="String" resultMap="OutsourceMaterialResult">
select material_no, material_name, material_type, material_photoUrl, description, brand, unit, planned_outsource_amount, process_method, outsource_process_no, outsource_process_name
from outsource_material
where material_no =#{materialNo}
</select>
<!-- 按料号查询委外物料-->
<select id="selectProcessNoByNo" parameterType="String" resultMap="OutsourceMaterialResult">
select material_no, material_name, material_type, material_photoUrl, description, brand, unit, planned_outsource_amount, process_method, outsource_process_no, outsource_process_name
from outsource_material
where material_no =#{materialNo}
</select>
<delete id="deleteOutsourcePlanDetailByOutsourcePlanCodes" parameterType="String">
delete from outsource_plan_detail where outsource_plan_code in
<foreach item="outsourcePlanCode" collection="array" open="(" separator="," close=")">

24
ruoyi-admin/src/main/resources/templates/system/outsource_quote/add.html

@ -318,40 +318,36 @@
// // 这里取到的是多行的
var rowData = layero.find("iframe")[0].contentWindow.getSelections();
//判断是否重复
console.log(rowData);
var rows = $("#bootstrap-table").bootstrapTable('getData').length;
var data = $("#bootstrap-table-process").bootstrapTable('getData');
var rows = data.length;
if(rows>0){
for(var i=0;i<rows;i++){
var data = $("#bootstrap-table").bootstrapTable('getData')[i];
// console.log(data);
for(var j=0;j<rowData.length;j++){
if(data.outsourceProcessCode==rowData[j].outsourceProcessCode){
if(data[i].outsourceProcessCode===rowData[j].outsourceProcessCode){
$.modal.alertError("不能选择已添加过的相同工序");
return;
rowData.split(j,1);
break;
}
}
insertTable(rowData[i]);
};
}else{
}
for(i=0;i<rowData.length;i++){
insertTable(rowData[i]);
}
}
layer.close(index);
}
// 插入子表数据
function insertTable(rowData) {
$("#bootstrap-table-process").bootstrapTable('insertRow', {
index: 1,
row: {
var newRow = {
outsourceProcessNo: rowData.outsourceProcessNo,
outsourceProcessCode: rowData.outsourceProcessCode,
outsourceProcessName: rowData.outsourceProcessName,
materialNoRmb: 0.00,
materialRmb: 0.00,
}
});
};
// 将新行追加到表格末尾
$("#bootstrap-table-process").bootstrapTable('append', newRow);
}
function removeRow(outsourceProcessCode){
$("#bootstrap-table-process").bootstrapTable('remove', {

Loading…
Cancel
Save