From 50785701735946451a323fbd2ff738dc37a2f805 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=99=93=E8=BF=AA?= <2596750866@qq.com> Date: Fri, 15 Nov 2024 14:56:57 +0800 Subject: [PATCH] =?UTF-8?q?[feat]=20=E7=94=9F=E4=BA=A7=E7=AE=A1=E7=90=86?= =?UTF-8?q?=20=E7=94=9F=E4=BA=A7=E8=AE=A2=E5=8D=95=20=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E5=B7=A5=E7=A8=8B=E5=AE=A1=E6=A0=B8=E3=80=81?= =?UTF-8?q?=E9=87=87=E8=B4=AD=E5=AE=A1=E6=A0=B8=E9=A1=B5=E9=9D=A2=E7=94=9F?= =?UTF-8?q?=E4=BA=A7bom=E3=80=81=E7=BC=96=E8=BE=91=E7=94=9F=E4=BA=A7bomcon?= =?UTF-8?q?troller=E6=8E=A5=E5=8F=A3=EF=BC=9B=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E7=94=9F=E4=BA=A7bom=E7=9A=84mapper=EF=BC=8C=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E7=94=9F=E4=BA=A7=E8=AE=A2=E5=8D=95=E5=8F=B7?= =?UTF-8?q?=E3=80=81=E9=94=80=E5=94=AE=E8=AE=A2=E5=8D=95=E5=8F=B7=E3=80=81?= =?UTF-8?q?0=E9=98=B6=E7=89=A9=E6=96=99=E6=96=99=E5=8F=B7=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E7=94=9F=E4=BA=A7bom=E6=96=B9=E6=B3=95=EF=BC=8C?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=AD=97=E6=AE=B5=EF=BC=9B=20=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E7=94=9F=E4=BA=A7=E9=A2=86=E6=96=99=E8=AF=A6=E6=83=85?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E5=8F=B7=E5=AD=97=E6=AE=B5=EF=BC=9B=20?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=96=B0=E5=A2=9E=E4=BF=9D=E5=AD=98=E7=94=9F?= =?UTF-8?q?=E4=BA=A7=E9=A2=86=E6=96=99=E5=8D=95controller=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=EF=BC=9B=20=E4=BF=AE=E6=94=B9=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E4=BF=9D=E5=AD=98=E7=94=9F=E4=BA=A7=E9=A2=86=E6=96=99=E5=8D=95?= =?UTF-8?q?service=E6=96=B9=E6=B3=95=EF=BC=9B=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E7=94=9F=E4=BA=A7=E9=A2=86=E6=96=99mapper=EF=BC=8C=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E5=AD=97=E6=AE=B5=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/SysMakeorderBomController.java | 61 +++++++++++++++++-- .../SysMakeorderPickController.java | 2 +- .../system/domain/SysMakeorderPickDetail.java | 10 +++ .../system/mapper/SysMakeorderBomMapper.java | 4 ++ .../impl/SysMakeorderPickServiceImpl.java | 18 +++--- .../mapper/system/SysMakeorderBomMapper.xml | 38 ++++++++++-- .../system/SysMakeorderPickDetailMapper.xml | 9 ++- 7 files changed, 121 insertions(+), 21 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysMakeorderBomController.java b/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysMakeorderBomController.java index 7473bcad..3a802eea 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysMakeorderBomController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysMakeorderBomController.java @@ -1,15 +1,17 @@ package com.ruoyi.system.controller; import java.util.List; +import java.util.stream.Collectors; + +import com.ruoyi.erp.domain.ErpBom; +import com.ruoyi.erp.service.IErpBomService; +import com.ruoyi.system.domain.SysSalesOrderChild; +import com.ruoyi.system.service.ISysSalesOrderChildService; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.*; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.system.domain.SysMakeorderBom; @@ -34,6 +36,9 @@ public class SysMakeorderBomController extends BaseController @Autowired private ISysMakeorderBomService sysMakeorderBomService; + @Autowired + private IErpBomService erpBomService; + @RequiresPermissions("system:makeorderbom:view") @GetMapping() public String makeorderbom() @@ -54,6 +59,39 @@ public class SysMakeorderBomController extends BaseController return getDataTable(list); } + /* + * 获取工程审核页面生产bom(去除辅料原料及加工方式为采购)*/ + @PostMapping("/selectedList") + @ResponseBody + public TableDataInfo oneLevelList(SysMakeorderBom sysMakeorderBom) + { + startPage(); + List list = sysMakeorderBomService.selectSysMakeorderBomList(sysMakeorderBom); + List filteredList = list.stream() + .filter(item -> item.getMaterialNo() != null && (item.getMaterialNo().startsWith("5") + || item.getMaterialNo().startsWith("6")|| item.getMaterialNo().startsWith("7") + || item.getMaterialNo().startsWith("8")|| item.getMaterialNo().startsWith("9")) + && !item.getProcessMethod().equals("0")) + .collect(Collectors.toList()); + + return getDataTable(filteredList); + } + + /* + * 获取采购审核页面生产bom(5,6开头且加工方式为4委外加工或采购(4前端已传,不必做过滤))*/ + @PostMapping("/cgLimitedList") + @ResponseBody + public TableDataInfo cgLimitedList(SysMakeorderBom sysMakeorderBom) + { + startPage(); + List list = sysMakeorderBomService.selectSysMakeorderBomList(sysMakeorderBom); + List filteredList = list.stream() + .filter(item -> item.getMaterialNo() != null && (item.getMaterialNo().startsWith("5") + || item.getMaterialNo().startsWith("6"))) + .collect(Collectors.toList()); + + return getDataTable(filteredList); + } /** * 导出生产订单BOM信息列表 */ @@ -112,6 +150,19 @@ public class SysMakeorderBomController extends BaseController return toAjax(sysMakeorderBomService.updateSysMakeorderBom(sysMakeorderBom)); } + /** + * 修改生产订单BOM信息 + */ + @GetMapping("/editMakeorderBom") + public String editMakeOrderBom(@RequestParam("curIndex")Integer curIndex + ,@RequestParam("materialNo")String materialNo, @RequestParam("makeNo")String makeNo, ModelMap mmap) + { + ErpBom erpBom = erpBomService.selectErpBomByOneMaterialNo(materialNo); + mmap.put("erpBom", erpBom); + mmap.put("curIndex", curIndex); + mmap.put("makeNo", makeNo); + return "/system/makeorder/editMakeOrderBom"; + } /** * 删除生产订单BOM信息 */ diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysMakeorderPickController.java b/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysMakeorderPickController.java index 5cecaaba..368bc982 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysMakeorderPickController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysMakeorderPickController.java @@ -124,7 +124,7 @@ public class SysMakeorderPickController extends BaseController @Log(title = "生产领料单", businessType = BusinessType.INSERT) @PostMapping("/add") @ResponseBody - public AjaxResult addSave(SysMakeorderPick sysMakeorderPick) + public AjaxResult addSave(@RequestBody SysMakeorderPick sysMakeorderPick) { if (StringUtils.isEmpty(sysMakeorderPick.getPickDetails())){ return AjaxResult.error("领料子表数据为空!"); diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysMakeorderPickDetail.java b/ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysMakeorderPickDetail.java index 51726414..2b6ef6b1 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysMakeorderPickDetail.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysMakeorderPickDetail.java @@ -63,6 +63,8 @@ public class SysMakeorderPickDetail extends BaseEntity private String brand; /** 描述 */ private String describe; + /** 型号 */ + private String materialModel; /** 用量 */ private Long useNum; /** 损耗率 */ @@ -262,6 +264,14 @@ public class SysMakeorderPickDetail extends BaseEntity this.orderNum = orderNum; } + public String getMaterialModel() { + return materialModel; + } + + public void setMaterialModel(String materialModel) { + this.materialModel = materialModel; + } + @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 442c85f8..40946b75 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 @@ -85,4 +85,8 @@ public interface SysMakeorderBomMapper // 按生产订单编号和料号查询生产订单bom信息 public SysMakeorderBom selectSysMakeorderBomByNo(SysMakeorderBom makeorderBom); + + /* + * 根据生产订单号、销售订单号、0阶物料料号删除生产bom*/ + public int deleteSysMakeorderBomByNos(SysMakeorderBom makeorderBom); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysMakeorderPickServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysMakeorderPickServiceImpl.java index 8396e437..663160f8 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysMakeorderPickServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysMakeorderPickServiceImpl.java @@ -177,9 +177,6 @@ public class SysMakeorderPickServiceImpl implements ISysMakeorderPickService String loginName = ShiroUtils.getLoginName(); sysMakeorderPick.setCreateBy(loginName); sysMakeorderPick.setCreateTime(DateUtils.getNowDate()); - // 生成编号,年月日规则 - String billNo = redisCache.generateBillNo("SCLL"); - sysMakeorderPick.setPickNo(billNo); //保留领料单数不为空的数据 List filterPickDetails = pickDetails.stream().filter(details -> details.getPickNum() != null&& details.getPickNum() > 0).collect(Collectors.toList()); @@ -194,23 +191,28 @@ public class SysMakeorderPickServiceImpl implements ISysMakeorderPickService sysMakeorderPick.setEnterpriseSum(enterpriseSum); sysMakeorderPick.setMaterialSum(filterPickDetails.size()); - for (SysMakeorderPickDetail pickDetail:filterPickDetails) { - pickDetail.setPickNo(billNo); - pickDetail.setMakeNo(makeNo); if(pickDetail.getPickNum()>pickDetail.getStorageNum().intValue()){ throw new BusinessException("物料" + pickDetail.getMaterialNo() + "领料数超出可用库存数!"); } if(pickDetail.getPickNum()>pickDetail.getOrderNum().intValue()){ throw new BusinessException("物料" + pickDetail.getMaterialNo() + "领料数超出订单用量数!"); } + } + + // 生成编号,年月日规则 + String billNo = redisCache.generateBillNo("SCLL"); + sysMakeorderPick.setPickNo(billNo); + + for (SysMakeorderPickDetail pickDetail:filterPickDetails) { + pickDetail.setPickNo(billNo); + pickDetail.setMakeNo(makeNo); int insertMakeorderPickDetailResult = makeorderPickDetailService.insertSysMakeorderPickDetail(pickDetail); if (insertMakeorderPickDetailResult <= 0){ throw new BusinessException("新增生产领料单详情失败"); } } - int id = sysMakeorderPickMapper.insertSysMakeorderPick(sysMakeorderPick); return id; } @@ -340,7 +342,7 @@ public class SysMakeorderPickServiceImpl implements ISysMakeorderPickService variables.put("authority",1); }else if(roleKeys.contains("scjlRole")){ variables.put("authority",2); - }else if(roleKeys.contains("sczgRole")){ + }else if(roleKeys.contains("sczgRole")||roleKeys.contains("admin")){ variables.put("authority",3); } } diff --git a/ruoyi-admin/src/main/resources/mapper/system/SysMakeorderBomMapper.xml b/ruoyi-admin/src/main/resources/mapper/system/SysMakeorderBomMapper.xml index 7649e70e..cb0e7f71 100644 --- a/ruoyi-admin/src/main/resources/mapper/system/SysMakeorderBomMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/system/SysMakeorderBomMapper.xml @@ -24,19 +24,26 @@ 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, has_out_num from sys_makeorder_bom + bom_no, material_no, photoUrl, material_name,material_type, + process_method, unit, brand, `describe`,material_model, + warehouseDept, use_num, loss_rate, `level`, sort_no, has_out_num, + order_num,delivery_time, finish_num + from sys_makeorder_bom + + + delete from sys_makeorder_bom + where make_no = #{makeNo} + and sales_order_code = #{salesOrderCode} + and sales_order_material_no = #{salesOrderMaterialNo} + + \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/mapper/system/SysMakeorderPickDetailMapper.xml b/ruoyi-admin/src/main/resources/mapper/system/SysMakeorderPickDetailMapper.xml index 4afaea3f..0db7c6f6 100644 --- a/ruoyi-admin/src/main/resources/mapper/system/SysMakeorderPickDetailMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/system/SysMakeorderPickDetailMapper.xml @@ -30,12 +30,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + select a.id, a.del_flag, a.create_by, a.create_time, a.update_by, a.update_time, a.remark - , a.make_no, a.pick_no, a.material_no, a.makeorder_bom_id, a.pick_num, a.has_pick_num - ,b.bom_no,b.photoUrl,b.material_name,b.material_type,b.process_method,b.unit,b.brand + , a.make_no, a.pick_no, a.material_no, a.makeorder_bom_id, a.pick_num, a.has_pick_num,a.order_num + ,b.bom_no,b.photoUrl,b.material_name,b.material_type,b.process_method,b.unit,b.brand,b.material_model ,b.describe,b.use_num,b.loss_rate,b.level,b.sort_no from sys_makeorder_pick_detail a left join sys_makeorder_bom b @@ -98,6 +100,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" makeorder_bom_id, pick_num, has_pick_num, + order_num, #{delFlag}, @@ -112,6 +115,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{makeorderBomId}, #{pickNum}, #{hasPickNum}, + #{orderNum}, @@ -130,6 +134,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" makeorder_bom_id = #{makeorderBomId}, pick_num = #{pickNum}, has_pick_num = #{hasPickNum}, + order_num = #{orderNum}, where id = #{id}