diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysMakeorderBom.java b/ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysMakeorderBom.java index 0adc747f..a18d5396 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysMakeorderBom.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysMakeorderBom.java @@ -88,6 +88,12 @@ public class SysMakeorderBom extends BaseEntity @Excel(name = "排序") private Long sortNo; +// 委外工序数 + private int processNum; + +// 已委外数量 + private int hasOutNum; + public void setId(Long id) { this.id = id; @@ -259,6 +265,22 @@ public class SysMakeorderBom extends BaseEntity this.warehouseDept = warehouseDept; } + public int getProcessNum() { + return processNum; + } + + public void setProcessNum(int processNum) { + this.processNum = processNum; + } + + public int getHasOutNum() { + return hasOutNum; + } + + public void setHasOutNum(int hasOutNum) { + this.hasOutNum = hasOutNum; + } + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysMakeorderBomMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysMakeorderBomMapper.java index ac177e24..442c85f8 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysMakeorderBomMapper.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysMakeorderBomMapper.java @@ -82,4 +82,7 @@ public interface SysMakeorderBomMapper * @return 生产订单BOM信息 */ public List selectSysMakeorderBomByMakeNo(String makeNo); + +// 按生产订单编号和料号查询生产订单bom信息 + public SysMakeorderBom selectSysMakeorderBomByNo(SysMakeorderBom makeorderBom); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysMakeOrderService.java b/ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysMakeOrderService.java index e48f18ac..03feeb0d 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysMakeOrderService.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysMakeOrderService.java @@ -1,6 +1,7 @@ package com.ruoyi.system.service; import com.ruoyi.erp.domain.ErpInboundOrder; +import com.ruoyi.system.domain.OutsourcePlan; import com.ruoyi.system.domain.SysMakeOrder; import com.ruoyi.system.dto.SysEquipMaterialDto; import com.ruoyi.system.dto.SysMakeorderMaterialDto; @@ -124,4 +125,7 @@ public interface ISysMakeOrderService * 添加保存创建生产入库和设备履历设置 */ int addProduceInboundSave(ErpInboundOrder erpInboundOrder); + +// 添加保存委外计划单 + int addOutsourcePlan(OutsourcePlan outsourcePlan); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysMakeorderBomServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysMakeorderBomServiceImpl.java index e42f40f4..559df62c 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysMakeorderBomServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysMakeorderBomServiceImpl.java @@ -3,6 +3,10 @@ package com.ruoyi.system.service.impl; import java.util.List; import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.ShiroUtils; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.system.domain.OutsourceMaterial; +import com.ruoyi.system.mapper.OutsourceMaterialMapper; +import org.apache.poi.util.StringUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.ruoyi.system.mapper.SysMakeorderBomMapper; @@ -22,6 +26,9 @@ public class SysMakeorderBomServiceImpl implements ISysMakeorderBomService @Autowired private SysMakeorderBomMapper sysMakeorderBomMapper; + @Autowired + private OutsourceMaterialMapper outsourceMaterialMapper; + /** * 查询生产订单BOM信息 * @@ -43,7 +50,18 @@ public class SysMakeorderBomServiceImpl implements ISysMakeorderBomService @Override public List selectSysMakeorderBomList(SysMakeorderBom sysMakeorderBom) { - return sysMakeorderBomMapper.selectSysMakeorderBomList(sysMakeorderBom); + List makeorderBoms = sysMakeorderBomMapper.selectSysMakeorderBomList(sysMakeorderBom); + for (SysMakeorderBom bom:makeorderBoms) { + if(bom.getProcessMethod().equals("2")){ + List materials = outsourceMaterialMapper.selectProcessNoByNo(bom.getMaterialNo()); + if(StringUtils.isEmpty(materials)){ + bom.setProcessNum(0); + }else { + bom.setProcessNum(materials.size()); + } + } + } + return makeorderBoms; } /** diff --git a/ruoyi-admin/src/main/resources/mapper/system/SysMakeorderBomMapper.xml b/ruoyi-admin/src/main/resources/mapper/system/SysMakeorderBomMapper.xml index ae3e3faa..7649e70e 100644 --- a/ruoyi-admin/src/main/resources/mapper/system/SysMakeorderBomMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/system/SysMakeorderBomMapper.xml @@ -29,13 +29,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + select id, del_flag, create_by, create_time, update_by, update_time, remark, make_no, sales_order_code, sales_order_material_no, bom_no, material_no, photoUrl, material_name, material_type, process_method, unit, brand, `describe`, - warehouseDept, use_num, loss_rate, level, sort_no from sys_makeorder_bom + warehouseDept, use_num, loss_rate, level, sort_no, has_out_num from sys_makeorder_bom + + + and make_no = #{makeNo} + and material_no = #{materialNo} + + \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/system/makeorder/makeorder.html b/ruoyi-admin/src/main/resources/templates/system/makeorder/makeorder.html index 4efafa2c..837db243 100644 --- a/ruoyi-admin/src/main/resources/templates/system/makeorder/makeorder.html +++ b/ruoyi-admin/src/main/resources/templates/system/makeorder/makeorder.html @@ -265,6 +265,12 @@ (row.eceiptStatus == '7' || row.eceiptStatus == '8')){ actions.push('领料 '); } + // 委外计划 + if((row.makeStatus == '3' || row.makeStatus == '4' || row.makeStatus == '5') && + (row.eceiptStatus == '3' || row.eceiptStatus == '4'|| row.eceiptStatus == '5'|| row.eceiptStatus == '6'|| row.eceiptStatus == '7' + || row.eceiptStatus == '8')){ + actions.push('委外计划 '); + } // 委内入库 对应生产中 if(row.makeStatus == '4' || row.makeStatus == '5'){ actions.push('委内入库 ');