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}