Browse Source

[feat]

生产管理 生产订单
新增获取工程审核、采购审核页面生产bom、编辑生产bomcontroller接口;
修改生产bom的mapper,新增根据生产订单号、销售订单号、0阶物料料号删除生产bom方法,新增字段;
新增生产领料详情类型号字段;
修改新增保存生产领料单controller接口;
修改新增保存生产领料单service方法;
修改生产领料mapper,新增字段;
dev
王晓迪 1 week ago
parent
commit
5078570173
  1. 61
      ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysMakeorderBomController.java
  2. 2
      ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysMakeorderPickController.java
  3. 10
      ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysMakeorderPickDetail.java
  4. 4
      ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysMakeorderBomMapper.java
  5. 18
      ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysMakeorderPickServiceImpl.java
  6. 38
      ruoyi-admin/src/main/resources/mapper/system/SysMakeorderBomMapper.xml
  7. 9
      ruoyi-admin/src/main/resources/mapper/system/SysMakeorderPickDetailMapper.xml

61
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<SysMakeorderBom> list = sysMakeorderBomService.selectSysMakeorderBomList(sysMakeorderBom);
List<SysMakeorderBom> 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<SysMakeorderBom> list = sysMakeorderBomService.selectSysMakeorderBomList(sysMakeorderBom);
List<SysMakeorderBom> 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信息
*/

2
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("领料子表数据为空!");

10
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)

4
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);
}

18
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<SysMakeorderPickDetail> 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);
}
}

38
ruoyi-admin/src/main/resources/mapper/system/SysMakeorderBomMapper.xml

@ -24,19 +24,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="unit" column="unit" />
<result property="brand" column="brand" />
<result property="describe" column="describe" />
<result property="materialModel" column="material_model" />
<result property="warehouseDept" column="warehouseDept" />
<result property="useNum" column="use_num" />
<result property="lossRate" column="loss_rate" />
<result property="level" column="level" />
<result property="sortNo" column="sort_no" />
<result property="hasOutNum" column="has_out_num" />
<result property="orderNum" column="order_num" />
<result property="deliveryTime" column="delivery_time" />
<result property="finishNum" column="finish_num" />
</resultMap>
<sql id="selectSysMakeorderBomVo">
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
</sql>
<select id="selectSysMakeorderBomList" parameterType="SysMakeorderBom" resultMap="SysMakeorderBomResult">
@ -54,10 +61,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="unit != null and unit != ''"> and unit = #{unit}</if>
<if test="brand != null and brand != ''"> and brand = #{brand}</if>
<if test="describe != null and describe != ''"> and `describe` = #{describe}</if>
<if test="materialModel != null and materialModel != ''"> and material_model = #{materialModel}</if>
<if test="warehouseDept != null and warehouseDept != ''"> and warehouseDept = #{warehouseDept}</if>
<if test="useNum != null "> and use_num = #{useNum}</if>
<if test="lossRate != null "> and loss_rate = #{lossRate}</if>
<if test="level != null "> and level = #{level}</if>
<if test="level != null "> and `level` = #{level}</if>
<if test="sortNo != null "> and sort_no = #{sortNo}</if>
</where>
order by sort_no
@ -97,9 +105,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="warehouseDept != null">warehouseDept,</if>
<if test="useNum != null">use_num,</if>
<if test="lossRate != null">loss_rate,</if>
<if test="level != null">level,</if>
<if test="level != null">`level`,</if>
<if test="sortNo != null">sort_no,</if>
<if test="hasOutNum != null">has_out_num,</if>
<if test="materialModel != null">material_model,</if>
<if test="orderNum != null">order_num,</if>
<if test="deliveryTime != null">delivery_time,</if>
<if test="finishNum != null">finish_num,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="delFlag != null">#{delFlag},</if>
@ -126,6 +138,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="level != null">#{level},</if>
<if test="sortNo != null">#{sortNo},</if>
<if test="hasOutNum != null">#{hasOutNum},</if>
<if test="materialModel != null">#{materialModel},</if>
<if test="orderNum != null">#{orderNum},</if>
<if test="deliveryTime != null">#{deliveryTime},</if>
<if test="finishNum != null">#{finishNum},</if>
</trim>
</insert>
@ -153,9 +169,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="warehouseDept != null">warehouseDept = #{warehouseDept},</if>
<if test="useNum != null">use_num = #{useNum},</if>
<if test="lossRate != null">loss_rate = #{lossRate},</if>
<if test="level != null">level = #{level},</if>
<if test="level != null">`level` = #{level},</if>
<if test="sortNo != null">sort_no = #{sortNo},</if>
<if test="hasOutNum != null">has_out_num = #{hasOutNum},</if>
<if test="materialModel != null">material_model = #{materialModel},</if>
<if test="orderNum != null">order_num = #{orderNum},</if>
<if test="deliveryTime != null">delivery_time = #{deliveryTime},</if>
<if test="finishNum != null">finish_num = #{finishNum},</if>
</trim>
where id = #{id}
</update>
@ -186,4 +206,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="materialNo != null and materialNo != ''"> and material_no = #{materialNo}</if>
</where>
</select>
<delete id="deleteSysMakeorderBomByNos" parameterType="SysMakeorderBom">
delete from sys_makeorder_bom
where make_no = #{makeNo}
and sales_order_code = #{salesOrderCode}
and sales_order_material_no = #{salesOrderMaterialNo}
</delete>
</mapper>

9
ruoyi-admin/src/main/resources/mapper/system/SysMakeorderPickDetailMapper.xml

@ -30,12 +30,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="lossRate" column="loss_rate" />
<result property="level" column="level" />
<result property="sortNo" column="sort_no" />
<result property="orderNum" column="order_num" />
<result property="orderNum" column="order_num" />
</resultMap>
<sql id="selectSysMakeorderPickDetailVo">
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"
<if test="makeorderBomId != null">makeorder_bom_id,</if>
<if test="pickNum != null">pick_num,</if>
<if test="hasPickNum != null">has_pick_num,</if>
<if test="orderNum != null">order_num,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="delFlag != null">#{delFlag},</if>
@ -112,6 +115,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="makeorderBomId != null">#{makeorderBomId},</if>
<if test="pickNum != null">#{pickNum},</if>
<if test="hasPickNum != null">#{hasPickNum},</if>
<if test="orderNum != null">#{orderNum},</if>
</trim>
</insert>
@ -130,6 +134,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="makeorderBomId != null">makeorder_bom_id = #{makeorderBomId},</if>
<if test="pickNum != null">pick_num = #{pickNum},</if>
<if test="hasPickNum != null">has_pick_num = #{hasPickNum},</if>
<if test="orderNum != null">order_num = #{orderNum},</if>
</trim>
where id = #{id}
</update>

Loading…
Cancel
Save