Browse Source

[feat] 工程管理

新增 根据bomId和开发修改单查询开发修改单详情物料信息后端接口
修改开发修改单领料新增后端接口:新增对前端物料数的校验;新增主表物料数和数量的合计
修改开发修改单新增页面:对物料单位和物料加个方式已经物料层级字段的修改
dev
liuxiaoxu 4 months ago
parent
commit
8742d8d4ff
  1. 5
      ruoyi-admin/src/main/java/com/ruoyi/erp/mapper/ErpDevelopModifyorderDetailMapper.java
  2. 48
      ruoyi-admin/src/main/java/com/ruoyi/erp/service/impl/ErpDevelopModifyorderPickingServiceImpl.java
  3. 6
      ruoyi-admin/src/main/resources/mapper/erp/ErpDevelopModifyorderDetailMapper.xml
  4. 10
      ruoyi-admin/src/main/resources/templates/erp/developModifyOrder/pickAdd.html

5
ruoyi-admin/src/main/java/com/ruoyi/erp/mapper/ErpDevelopModifyorderDetailMapper.java

@ -79,4 +79,9 @@ public interface ErpDevelopModifyorderDetailMapper
* 根据开发修改单号查询开发修改详情物料信息
* */
List<ErpDevelopModifyorderDetail> selectDevelopModifyDetailMaterialByCode(String developOrderCode);
/*
* 根据bomId和开发修改单查询开发修改单详情物料信息
* */
ErpDevelopModifyorderDetail selectModifyorderDetailByCodeAndId(ErpDevelopModifyorderDetail modifyorderDetail);
}

48
ruoyi-admin/src/main/java/com/ruoyi/erp/service/impl/ErpDevelopModifyorderPickingServiceImpl.java

@ -8,6 +8,7 @@ import com.ruoyi.common.exception.BusinessException;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.erp.domain.*;
import com.ruoyi.erp.mapper.ErpDevelopModifyorderDetailMapper;
import com.ruoyi.erp.mapper.ErpDevelopModifyorderPickingDetailMapper;
import com.ruoyi.erp.service.IErpBomService;
import com.ruoyi.purchase.domain.PurchasePlanChild;
@ -41,6 +42,9 @@ public class ErpDevelopModifyorderPickingServiceImpl implements IErpDevelopModif
@Autowired
private IErpBomService erpBomService;
@Autowired
private ErpDevelopModifyorderDetailMapper modifyorderDetailMapper;
/**
* 查询开发修改单领料
*
@ -155,14 +159,14 @@ public class ErpDevelopModifyorderPickingServiceImpl implements IErpDevelopModif
log.warn("开发修改单领料主表数据为空");
}
int countAllMaterialNum = 0;
for (ErpDevelopModifyorderDetail erpDevelopModifyorderDetail : developModifyorderDetailList) {
ErpBom erpBom = new ErpBom();
erpBom.setId(Long.valueOf(erpDevelopModifyorderDetail.getBomId()));
List<ErpBom> erpBoms = erpBomService.selectErpBomAllLevelList(erpBom);
countAllMaterialNum += erpBoms.size();
}
int countAllMaterialNum = developModifyorderDetailList.stream()
.mapToInt(detail -> {
ErpBom erpBom = new ErpBom();
erpBom.setId(Long.valueOf(detail.getBomId()));
List<ErpBom> erpBoms = erpBomService.selectErpBomAllLevelList(erpBom);
return erpBoms.size();
})
.sum();
countAllMaterialNum -= developModifyorderDetailList.size();
if (erpDevelopModifyorder.getDevelopModifyorderPickingDetails().size() < countAllMaterialNum){
throw new BusinessException("请将所有物料数据展开,并填写本次领料数!");
@ -228,11 +232,30 @@ public class ErpDevelopModifyorderPickingServiceImpl implements IErpDevelopModif
int enterpriseSum = filterPickingDetail.stream().mapToInt(ErpDevelopModifyorderPickingDetail::getPickNum).sum();
developModifyorderPicking.setEnterpriseSum(enterpriseSum);
//插入领料子表数据
bulidPickingDetail(erpDevelopModifyorder, pickingOrderCode, loginName, developModifyorderPickingDetails);
return erpDevelopModifyorderPickingMapper.insertErpDevelopModifyorderPicking(developModifyorderPicking);
}
//插入领料子表数据
private void bulidPickingDetail(ErpDevelopModifyorder erpDevelopModifyorder, String pickingOrderCode, String loginName, List<ErpDevelopModifyorderPickingDetail> developModifyorderPickingDetails) {
for (ErpDevelopModifyorderPickingDetail developModifyorderPickingDetail : developModifyorderPickingDetails) {
if (developModifyorderPickingDetail.getPickNum() != null){
ErpDevelopModifyorderDetail modifyorderDetail = new ErpDevelopModifyorderDetail();
modifyorderDetail.setBomId(Math.toIntExact(developModifyorderPickingDetail.getBomId()));
modifyorderDetail.setDevelopOrderCode(erpDevelopModifyorder.getDevelopOrderCode());
ErpDevelopModifyorderDetail tempModifyorderDetail = modifyorderDetailMapper.selectModifyorderDetailByCodeAndId(modifyorderDetail);
Integer materialNum = tempModifyorderDetail.getMaterialNum();
Integer useNum = developModifyorderPickingDetail.getUseNum();
developModifyorderPickingDetail.setOrderUseNum(materialNum * useNum);
developModifyorderPickingDetail.setUseNum(useNum);
developModifyorderPickingDetail.setPickingOrderCode(pickingOrderCode);
developModifyorderPickingDetail.setDevelopOderCode(erpDevelopModifyorder.getDevelopOrderCode());
developModifyorderPickingDetail.setMakeNo(erpDevelopModifyorder.getMakeNo());
developModifyorderPickingDetail.setPickNum(developModifyorderPickingDetail.getPickNum());
//已领料数
developModifyorderPickingDetail.setHasPickNum(developModifyorderPickingDetail.getPickNum());
@ -248,23 +271,18 @@ public class ErpDevelopModifyorderPickingServiceImpl implements IErpDevelopModif
developModifyorderPickingDetail.setBomId(Long.valueOf(developModifyorderPickingDetail.getBomId()));
developModifyorderPickingDetail.setWarehouseDept(developModifyorderPickingDetail.getWarehouseDept());
developModifyorderPickingDetail.setAvailableStockNum(developModifyorderPickingDetail.getAvailableStockNum());
developModifyorderPickingDetail.setMakeNo(developModifyorderPickingDetail.getMakeNo());
developModifyorderPickingDetail.setPickUser(erpDevelopModifyorder.getPickingUser());
developModifyorderPickingDetail.setBomNo(developModifyorderPickingDetail.getBomNo());
developModifyorderPickingDetail.setLevel(developModifyorderPickingDetail.getLevel());
developModifyorderPickingDetail.setCreateTime(new Date());
developModifyorderPickingDetail.setCreateBy(loginName);
pickingDetailMapper.insertErpDevelopModifyorderPickingDetail(developModifyorderPickingDetail);
}
}
return erpDevelopModifyorderPickingMapper.insertErpDevelopModifyorderPicking(developModifyorderPicking);
}
private List<ErpDevelopModifyorderPickingDetail> mergePickingDetailList(List<ErpDevelopModifyorderPickingDetail> pickingDetailList) {
Map<String, ErpDevelopModifyorderPickingDetail> aggregatedMap = new HashMap<>();

6
ruoyi-admin/src/main/resources/mapper/erp/ErpDevelopModifyorderDetailMapper.xml

@ -47,6 +47,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where develop_order_code = #{developOrderCode}
</select>
<select id="selectModifyorderDetailByCodeAndId" parameterType="ErpDevelopModifyorderDetail" resultMap="ErpDevelopModifyorderDetailResult">
<include refid="selectErpDevelopModifyorderDetailVo"/>
where develop_order_code = #{developOrderCode}
and bom_id = #{bomId}
</select>
<insert id="insertErpDevelopModifyorderDetail" parameterType="ErpDevelopModifyorderDetail" useGeneratedKeys="true" keyProperty="developOrderDetailId">
insert into erp_develop_modifyorder_detail
<trim prefix="(" suffix=")" suffixOverrides=",">

10
ruoyi-admin/src/main/resources/templates/erp/developModifyOrder/pickAdd.html

@ -126,10 +126,10 @@
"materialNo": item.materialNo,
"materialName": item.materialName,
"materialType": item.materialType,
"materialUnit": item.materialUnit,
"materialUnit": item.unit,
"materialBrand": item.brand,
"materialDescribe": item.describe,
"materialProcessMethod": item.materialProcessMethod,
"materialProcessMethod": item.processMethod,
"materialNum": item.materialNum,
"availableStockNum": item.availableStockNum,
"pickNum": item.pickNum,
@ -138,6 +138,7 @@
"useNum": item.useNum,
"lossRate":item.lossRate,
"sortNo":item.sortNo,
"level":item.level,
// ..其他字段
};
});
@ -403,9 +404,6 @@
field: 'warehouseDept',
align: 'center',
title: '入库部门', visible: false,
formatter: function (value, row, index) {
return $.table.selectDictLabel(warehouseDates, value);
}
},
{
field: 'useNum',
@ -444,7 +442,7 @@
title: '可用库存数',
},
{
field: 'lossRate',
field: 'hasPickNum',
title: '已领料数',
},
{

Loading…
Cancel
Save