Browse Source

[feat] 生产管理 品质管理

品质单详情表新增生产完成数字段
修改生产入库的前端页面
新增生产入库转成品质单后端接口
新增生产入库转成品质单详情后端接口
新增生产入库转成品质单报告后端接口
dev
liuxiaoxu 4 months ago
parent
commit
d9cb6adf3a
  1. 13
      ruoyi-admin/src/main/java/com/ruoyi/quality/domain/QualityOrderDetail.java
  2. 16
      ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysMakeOrderController.java
  3. 5
      ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysMakeOrderService.java
  4. 127
      ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysMakeOrderServiceImpl.java
  5. 5
      ruoyi-admin/src/main/resources/mapper/quality/QualityOrderDetailMapper.xml
  6. 12
      ruoyi-admin/src/main/resources/templates/system/makeorder/addProduceInbound.html

13
ruoyi-admin/src/main/java/com/ruoyi/quality/domain/QualityOrderDetail.java

@ -118,6 +118,9 @@ public class QualityOrderDetail extends BaseEntity
@Excel(name = "生产订单数") @Excel(name = "生产订单数")
private Integer makeTotal; private Integer makeTotal;
/** 生产完成数 */
private Integer makeCompletionNum;
/** 实际到货数量 */ /** 实际到货数量 */
@Excel(name = "实际到货数量") @Excel(name = "实际到货数量")
private Integer actualArriveNum; private Integer actualArriveNum;
@ -362,6 +365,15 @@ public class QualityOrderDetail extends BaseEntity
this.makeTotal = makeTotal; this.makeTotal = makeTotal;
} }
public Integer getMakeCompletionNum() {
return makeCompletionNum;
}
public void setMakeCompletionNum(Integer makeCompletionNum) {
this.makeCompletionNum = makeCompletionNum;
}
public Integer getActualArriveNum() { public Integer getActualArriveNum() {
return actualArriveNum; return actualArriveNum;
} }
@ -460,6 +472,7 @@ public class QualityOrderDetail extends BaseEntity
.append("qualityQualifiedNum", getQualityQualifiedNum()) .append("qualityQualifiedNum", getQualityQualifiedNum())
.append("qualityUnqualifiedNum", getQualityUnqualifiedNum()) .append("qualityUnqualifiedNum", getQualityUnqualifiedNum())
.append("makeInNum",getMakeInNum()) .append("makeInNum",getMakeInNum())
.append("makeCompletionNum",getMakeCompletionNum())
.append("makeInUnitPrice",getMakeInUnitPrice()) .append("makeInUnitPrice",getMakeInUnitPrice())
.append("remark", getRemark()) .append("remark", getRemark())
.append("createBy", getCreateBy()) .append("createBy", getCreateBy())

16
ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysMakeOrderController.java

@ -13,6 +13,7 @@ import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.ShiroUtils; import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.erp.domain.ErpInboundOrder;
import com.ruoyi.erp.service.IErpMaterialService; import com.ruoyi.erp.service.IErpMaterialService;
import com.ruoyi.financial.domain.FinancialReceivables; import com.ruoyi.financial.domain.FinancialReceivables;
import com.ruoyi.financial.domain.FinancialReceivablesRecords; import com.ruoyi.financial.domain.FinancialReceivablesRecords;
@ -198,6 +199,21 @@ public class SysMakeOrderController extends BaseController
return prefix + "/addProduceInbound"; return prefix + "/addProduceInbound";
} }
/**
* 添加修改 创建生产入库和设备履历设置
* */
@ResponseBody
@PostMapping("/addProduceInboundSave")
public AjaxResult addProduceInboundSave(@RequestBody ErpInboundOrder erpInboundOrder)
{
return toAjax(sysMakeOrderService.addProduceInboundSave(erpInboundOrder));
}
/** /**
* 跳转添加设备履历 * 跳转添加设备履历
*/ */

5
ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysMakeOrderService.java

@ -1,5 +1,6 @@
package com.ruoyi.system.service; package com.ruoyi.system.service;
import com.ruoyi.erp.domain.ErpInboundOrder;
import com.ruoyi.system.domain.SysMakeOrder; import com.ruoyi.system.domain.SysMakeOrder;
import com.ruoyi.system.dto.SysEquipMaterialDto; import com.ruoyi.system.dto.SysEquipMaterialDto;
import com.ruoyi.system.dto.SysMakeorderMaterialDto; import com.ruoyi.system.dto.SysMakeorderMaterialDto;
@ -119,4 +120,8 @@ public interface ISysMakeOrderService
*/ */
int addEquipmentResumeSave(SysEquipMaterialDto equipMaterialDto); int addEquipmentResumeSave(SysEquipMaterialDto equipMaterialDto);
/**
* 添加保存创建生产入库和设备履历设置
*/
int addProduceInboundSave(ErpInboundOrder erpInboundOrder);
} }

127
ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysMakeOrderServiceImpl.java

@ -10,8 +10,16 @@ import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ShiroUtils; import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.erp.domain.ErpBom; import com.ruoyi.erp.domain.ErpBom;
import com.ruoyi.erp.domain.ErpInboundOrder;
import com.ruoyi.erp.domain.ErpInboundOrderDetail;
import com.ruoyi.erp.service.IErpBomService; import com.ruoyi.erp.service.IErpBomService;
import com.ruoyi.purchase.service.IPurchasePlanService; import com.ruoyi.purchase.service.IPurchasePlanService;
import com.ruoyi.quality.domain.QualityOrder;
import com.ruoyi.quality.domain.QualityOrderDetail;
import com.ruoyi.quality.domain.QualityOrderReport;
import com.ruoyi.quality.mapper.QualityOrderDetailMapper;
import com.ruoyi.quality.mapper.QualityOrderMapper;
import com.ruoyi.quality.mapper.QualityOrderReportMapper;
import com.ruoyi.system.domain.SysMakeOrder; import com.ruoyi.system.domain.SysMakeOrder;
import com.ruoyi.system.domain.SysMakeorderBom; import com.ruoyi.system.domain.SysMakeorderBom;
import com.ruoyi.system.domain.SysSalesOrderChild; import com.ruoyi.system.domain.SysSalesOrderChild;
@ -20,6 +28,7 @@ import com.ruoyi.system.dto.SysEquipDetailDto;
import com.ruoyi.system.dto.SysEquipMaterialDto; import com.ruoyi.system.dto.SysEquipMaterialDto;
import com.ruoyi.system.dto.SysMakeorderMaterialDto; import com.ruoyi.system.dto.SysMakeorderMaterialDto;
import com.ruoyi.system.mapper.SysMakeOrderMapper; import com.ruoyi.system.mapper.SysMakeOrderMapper;
import com.ruoyi.system.mapper.SysSalesOrderChildMapper;
import com.ruoyi.system.service.*; import com.ruoyi.system.service.*;
import com.ruoyi.warehouse.domain.WarehouseStorageOrder; import com.ruoyi.warehouse.domain.WarehouseStorageOrder;
import com.ruoyi.warehouse.domain.WarehouseStorageOrderDetail; import com.ruoyi.warehouse.domain.WarehouseStorageOrderDetail;
@ -31,9 +40,7 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.ArrayList; import java.util.*;
import java.util.Date;
import java.util.List;
/** /**
* 生产订单Service业务层处理 * 生产订单Service业务层处理
@ -57,6 +64,9 @@ public class SysMakeOrderServiceImpl implements ISysMakeOrderService
@Autowired @Autowired
private ISysSalesOrderService salesOrderService; private ISysSalesOrderService salesOrderService;
@Autowired
private SysSalesOrderChildMapper salesOrderChildMapper;
@Autowired @Autowired
private ISysSalesOrderChildService salesOrderChildService; private ISysSalesOrderChildService salesOrderChildService;
@ -72,6 +82,14 @@ public class SysMakeOrderServiceImpl implements ISysMakeOrderService
@Autowired @Autowired
private AfterSalesShippingDeviceMapper afterSalesShippingDeviceMapper; private AfterSalesShippingDeviceMapper afterSalesShippingDeviceMapper;
@Autowired
private QualityOrderMapper qualityOrderMapper;
@Autowired
private QualityOrderDetailMapper orderDetailMapper;
@Autowired
private QualityOrderReportMapper orderReportMapper;
/** /**
* 查询生产订单 * 查询生产订单
@ -408,4 +426,107 @@ public class SysMakeOrderServiceImpl implements ISysMakeOrderService
return result; return result;
} }
/**
* 添加保存创建生产入库和设备履历设置
*/
@Transactional(rollbackFor = Exception.class)
@Override
public int addProduceInboundSave(ErpInboundOrder erpInboundOrder) {
String loginName = ShiroUtils.getLoginName();
erpInboundOrder.setCreateBy(loginName);
erpInboundOrder.setCreateTime(DateUtils.getNowDate());
String qualityOrderCode = redisCache.generateBillNo("PZ");
QualityOrder qualityOrder = createQualityOrder(qualityOrderCode, erpInboundOrder, loginName);
Map<String, SysSalesOrderChild> materialInfoMap = fetchMaterialInfoMap(erpInboundOrder);
addQualityOrderDetails(qualityOrder, erpInboundOrder, materialInfoMap);
addQualityOrderReports(qualityOrder, erpInboundOrder, materialInfoMap);
return qualityOrderMapper.insertQualityOrder(qualityOrder);
}
private QualityOrder createQualityOrder(String code, ErpInboundOrder erpInboundOrder, String loginName) {
QualityOrder qualityOrder = new QualityOrder();
qualityOrder.setQualityOrderCode(code);
qualityOrder.setRelatedOrderCode(erpInboundOrder.getMakeNo());
qualityOrder.setQualityStatus("0");
qualityOrder.setQualityStorageStatus("4");
qualityOrder.setQualityOrderType("1");
qualityOrder.setCreateTime(new Date());
qualityOrder.setCreateBy(loginName);
return qualityOrder;
}
//先查询所有必要的信息并将其存储在一个Map中,提高查询效率
private Map<String, SysSalesOrderChild> fetchMaterialInfoMap(ErpInboundOrder erpInboundOrder) {
List<ErpInboundOrderDetail> inboundDetails = erpInboundOrder.getInboundDetails();
Map<String, SysSalesOrderChild> materialInfoMap = new HashMap<>();
for (ErpInboundOrderDetail detail : inboundDetails) {
SysSalesOrderChild sysSalesOrderChild = new SysSalesOrderChild();
sysSalesOrderChild.setMaterialCode(detail.getMaterialNo());
sysSalesOrderChild.setQuoteId(erpInboundOrder.getSaleNo());
SysSalesOrderChild child = salesOrderChildMapper.selectSalesOrderChildByCodeAndNo(sysSalesOrderChild);
materialInfoMap.put(detail.getMaterialNo(), child);
}
return materialInfoMap;
}
private void addQualityOrderDetails(QualityOrder qualityOrder, ErpInboundOrder erpInboundOrder, Map<String, SysSalesOrderChild> materialInfoMap) {
for (ErpInboundOrderDetail detail : erpInboundOrder.getInboundDetails()) {
SysSalesOrderChild salesOrderChild = materialInfoMap.get(detail.getMaterialNo());
QualityOrderDetail qualityOrderDetail = createQualityOrderDetail(qualityOrder, detail, salesOrderChild);
int result = orderDetailMapper.insertQualityOrderDetail(qualityOrderDetail);
if (result <= 0) {
throw new BusinessException("新增品质单详情失败");
}
}
}
private QualityOrderDetail createQualityOrderDetail(QualityOrder qualityOrder, ErpInboundOrderDetail detail, SysSalesOrderChild salesOrderChild) {
QualityOrderDetail qualityOrderDetail = new QualityOrderDetail();
qualityOrderDetail.setQualityOrderCode(qualityOrder.getQualityOrderCode());
qualityOrderDetail.setMaterialNo(detail.getMaterialNo());
qualityOrderDetail.setMaterialName(salesOrderChild.getMaterialName());
qualityOrderDetail.setMaterialType(salesOrderChild.getMaterialType());
qualityOrderDetail.setMaterialBrand(salesOrderChild.getBrand());
qualityOrderDetail.setMaterialDescribe(salesOrderChild.getDescribe());
qualityOrderDetail.setMaterialUnit(salesOrderChild.getUnit());
qualityOrderDetail.setMaterialProcessMethod(salesOrderChild.getProcessMethod());
qualityOrderDetail.setMaterialDeptType("0");
qualityOrderDetail.setMakeTotal(salesOrderChild.getMaterialNum());
qualityOrderDetail.setMakeCompletionNum(Math.toIntExact(detail.getCurrentNum()));
qualityOrderDetail.setCreateBy(ShiroUtils.getLoginName());
qualityOrderDetail.setCreateTime(new Date());
return qualityOrderDetail;
}
//添加品质单报告数据
private void addQualityOrderReports(QualityOrder qualityOrder, ErpInboundOrder erpInboundOrder, Map<String, SysSalesOrderChild> materialInfoMap) {
for (ErpInboundOrderDetail detail : erpInboundOrder.getInboundDetails()) {
SysSalesOrderChild salesOrderChild = materialInfoMap.get(detail.getMaterialNo());
QualityOrderReport qualityOrderReport = createQualityOrderReport(qualityOrder, detail, salesOrderChild);
int result = orderReportMapper.insertQualityOrderReport(qualityOrderReport);
if (result <= 0) {
throw new BusinessException("新增品质单报告失败");
}
}
}
private QualityOrderReport createQualityOrderReport(QualityOrder qualityOrder, ErpInboundOrderDetail detail, SysSalesOrderChild salesOrderChild) {
QualityOrderReport qualityOrderReport = new QualityOrderReport();
qualityOrderReport.setQualityOrderCode(qualityOrder.getQualityOrderCode());
qualityOrderReport.setMaterialNo(detail.getMaterialNo());
qualityOrderReport.setMaterialName(salesOrderChild.getMaterialName());
qualityOrderReport.setMakeTotal(salesOrderChild.getMaterialNum());
qualityOrderReport.setCreateBy(ShiroUtils.getLoginName());
qualityOrderReport.setCreateTime(new Date());
return qualityOrderReport;
}
} }

5
ruoyi-admin/src/main/resources/mapper/quality/QualityOrderDetailMapper.xml

@ -30,6 +30,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="materialProcessMethod" column="material_process_method" /> <result property="materialProcessMethod" column="material_process_method" />
<result property="materialDeptType" column="material_dept_type"/> <result property="materialDeptType" column="material_dept_type"/>
<result property="makeTotal" column="make_total" /> <result property="makeTotal" column="make_total" />
<result property="makeCompletionNum" column="make_completion_num" />
<result property="actualArriveNum" column="actual_arrive_num" /> <result property="actualArriveNum" column="actual_arrive_num" />
<result property="thisArrivedNum" column="this_arrived_num" /> <result property="thisArrivedNum" column="this_arrived_num" />
<result property="qualityHasqualifiedNum" column="quality_hasqualified_num" /> <result property="qualityHasqualifiedNum" column="quality_hasqualified_num" />
@ -70,6 +71,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
material_process_method, material_process_method,
material_dept_type, material_dept_type,
make_total, make_total,
make_completion_num,
actual_arrive_num, actual_arrive_num,
this_arrived_num, this_arrived_num,
quality_hasqualified_num, quality_hasqualified_num,
@ -154,6 +156,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="materialProcessMethod != null">material_process_method,</if> <if test="materialProcessMethod != null">material_process_method,</if>
<if test="materialDeptType">material_dept_type,</if> <if test="materialDeptType">material_dept_type,</if>
<if test="makeTotal != null">make_total,</if> <if test="makeTotal != null">make_total,</if>
<if test="makeCompletionNum != null">make_completion_num,</if>
<if test="actualArriveNum != null">actual_arrive_num,</if> <if test="actualArriveNum != null">actual_arrive_num,</if>
<if test="thisArrivedNum != null">this_arrived_num,</if> <if test="thisArrivedNum != null">this_arrived_num,</if>
<if test="qualityHasqualifiedNum != null">quality_hasqualified_num,</if> <if test="qualityHasqualifiedNum != null">quality_hasqualified_num,</if>
@ -192,6 +195,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="materialProcessMethod != null">#{materialProcessMethod},</if> <if test="materialProcessMethod != null">#{materialProcessMethod},</if>
<if test="materialDeptType">#{materialDeptType},</if> <if test="materialDeptType">#{materialDeptType},</if>
<if test="makeTotal != null">#{makeTotal},</if> <if test="makeTotal != null">#{makeTotal},</if>
<if test="makeCompletionNum != null">#{makeCompletionNum},</if>
<if test="actualArriveNum != null">#{actualArriveNum},</if> <if test="actualArriveNum != null">#{actualArriveNum},</if>
<if test="thisArrivedNum != null">#{thisArrivedNum},</if> <if test="thisArrivedNum != null">#{thisArrivedNum},</if>
<if test="qualityHasqualifiedNum != null">#{qualityHasqualifiedNum},</if> <if test="qualityHasqualifiedNum != null">#{qualityHasqualifiedNum},</if>
@ -234,6 +238,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="materialProcessMethod != null">material_process_method = #{materialProcessMethod},</if> <if test="materialProcessMethod != null">material_process_method = #{materialProcessMethod},</if>
<if test="materialDeptType != null">material_dept_type = #{materialDeptType},</if> <if test="materialDeptType != null">material_dept_type = #{materialDeptType},</if>
<if test="makeTotal != null">make_total = #{makeTotal},</if> <if test="makeTotal != null">make_total = #{makeTotal},</if>
<if test="makeCompletionNum != null">make_completion_num = #{makeCompletionNum},</if>
<if test="actualArriveNum != null">actual_arrive_num = #{actualArriveNum},</if> <if test="actualArriveNum != null">actual_arrive_num = #{actualArriveNum},</if>
<if test="thisArrivedNum != null">this_arrived_num = #{thisArrivedNum},</if> <if test="thisArrivedNum != null">this_arrived_num = #{thisArrivedNum},</if>
<if test="qualityHasqualifiedNum != null">quality_hasqualified_num = #{qualityHasqualifiedNum},</if> <if test="qualityHasqualifiedNum != null">quality_hasqualified_num = #{qualityHasqualifiedNum},</if>

12
ruoyi-admin/src/main/resources/templates/system/makeorder/addProduceInbound.html

@ -104,10 +104,10 @@
field: 'materialCode', field: 'materialCode',
align: 'center', align: 'center',
title: '料号', title: '料号',
formatter: function (value,row,index){ // formatter: function (value,row,index){
var curIndex = index; // var curIndex = index;
return '<input readonly class = "form-control" data-id = "materialNo_'+curIndex+'" name="inboundDetails['+curIndex+'].materialNo" value="'+value+'">'; // return '<input readonly class = "form-control" data-id = "materialNo_'+curIndex+'" name="inboundDetails['+curIndex+'].materialNo" value="'+value+'">';
} // }
}, },
{ {
field: 'materialName', field: 'materialName',
@ -393,7 +393,7 @@
var materialDataList = table.map(function(item) { var materialDataList = table.map(function(item) {
// 根据实际字段名调整 // 根据实际字段名调整
return { return {
"materialCode":item.materialCode, "materialNo":item.materialCode,
"materialName": item.materialName, "materialName": item.materialName,
"unit": item.unit, "unit": item.unit,
"brand": item.brand, "brand": item.brand,
@ -409,7 +409,7 @@
}); });
// 合并表单数据和表格数据 // 合并表单数据和表格数据
const combinedData = Object.assign({}, makeorderData, { sysEquipDetailDtos: materialDataList }); const combinedData = Object.assign({}, makeorderData, { inboundDetails: materialDataList });
console.log(combinedData) console.log(combinedData)
// 使用 JSON.stringify() 序列化数据 // 使用 JSON.stringify() 序列化数据

Loading…
Cancel
Save