diff --git a/ruoyi-admin/src/main/java/com/ruoyi/erp/controller/ErpInboundOrderController.java b/ruoyi-admin/src/main/java/com/ruoyi/erp/controller/ErpInboundOrderController.java
index 2b139df8..21ed7e6a 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/erp/controller/ErpInboundOrderController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/erp/controller/ErpInboundOrderController.java
@@ -62,9 +62,8 @@ public class ErpInboundOrderController extends BaseController
public TableDataInfo list(QualityOrder qualityOrder)
{
startPage();
- List list = qualityOrderService.selectQualityOrderList(qualityOrder);
- List qualityOrderList = list.stream().filter(q -> q.getQualityStorageStatus().equals("1") || q.getQualityStorageStatus().equals("4")).collect(Collectors.toList());
- return getDataTable(qualityOrderList);
+ List list = qualityOrderService.selectAllMakeQualityOrderList(qualityOrder);
+ return getDataTable(list);
}
/**
@@ -76,10 +75,9 @@ public class ErpInboundOrderController extends BaseController
@ResponseBody
public AjaxResult export(QualityOrder qualityOrder)
{
- List list = qualityOrderService.selectQualityOrderList(qualityOrder);
+ List list = qualityOrderService.selectAllMakeQualityOrderList(qualityOrder);
ExcelUtil util = new ExcelUtil(QualityOrder.class);
- List qualityOrderList = list.stream().filter(q -> q.getQualityStorageStatus().equals("1") || q.getQualityStorageStatus().equals("4")).collect(Collectors.toList());
- return util.exportExcel(qualityOrderList, "入库单数据");
+ return util.exportExcel(list, "入库单数据");
}
/**
@@ -127,55 +125,67 @@ public class ErpInboundOrderController extends BaseController
}
-// /**
-// * 委内入库单详情页面
-// */
-// @GetMapping("/detail/{qualityOrderId}")
-// public String detail(@PathVariable("qualityOrderId") Long qualityOrderId, ModelMap mmap)
-// {
-// QualityOrder qualityOrder = qualityOrderService.selectQualityOrderById(qualityOrderId);
-// mmap.put("qualityOrder", qualityOrder);
-// return prefix + "/edit";
-// }
-
-
- @GetMapping("/detail/{id}")
- public String detail(@PathVariable("id") Long id, ModelMap mmap)
+ /**
+ * 委内入库单详情页面
+ */
+ @GetMapping("/inboundOrderDetail/{qualityOrderId}")
+ public String inboundOrderDetail(@PathVariable("qualityOrderId") Long qualityOrderId, ModelMap mmap)
{
- mmap.put("currentUser", ShiroUtils.getSysUser());
- ErpInboundOrder erpInboundOrder = erpInboundOrderService.selectErpInboundOrderById(id);
- String inboundType = erpInboundOrder.getInboundType();
- mmap.put("erpInboundOrder", erpInboundOrder);
- // 生产入库
- if("0".equals(inboundType)){
- return prefix + "/produceInboundDetail";
- }
- // 委内入库
- else if("1".equals(inboundType)){
- return prefix + "/processInboundDetail";
- }
- return "";
+ QualityOrder qualityOrder = qualityOrderService.selectQualityOrderById(qualityOrderId);
+ mmap.put("qualityOrder", qualityOrder);
+ return prefix + "/inboundOrderDetail";
}
- @GetMapping("/detailEquipmentResume")
- public String detailEquipmentResume(@RequestParam("curIndex")Integer curIndex
- ,@RequestParam("makeNo")String makeNo
- ,@RequestParam("saleNo")String saleNo
- ,@RequestParam("materialNo")String materialNo
- ,@RequestParam("inboundOrderNo")String inboundOrderNo, ModelMap mmap)
+
+
+ /**
+ * 委内入库单详情页面
+ */
+ @ResponseBody
+ @GetMapping("/inboundOrderDetail")
+ public AjaxResult inboundOrderDetailSave(QualityOrder qualityOrder)
{
- SysEquipMaterialDto equipMaterialDto = new SysEquipMaterialDto();
- mmap.put("currentUser", ShiroUtils.getSysUser());
- SysSalesOrderChild salesOrderChild = salesOrderChildService.selectOneByQuoteIdAndMaterialCode(saleNo, materialNo);
- BeanUtils.copyProperties(salesOrderChild,equipMaterialDto);
- equipMaterialDto.setMakeNo(makeNo);
- equipMaterialDto.setCurIndex(curIndex);
- equipMaterialDto.setInboundOrderNo(inboundOrderNo);
- mmap.put("equipMaterial", equipMaterialDto);
- return prefix + "/equipmentResumeDetail";
+ return toAjax(qualityOrderService.qualityOrderDetailSave(qualityOrder));
}
+// @GetMapping("/detail/{id}")
+// public String detail(@PathVariable("id") Long id, ModelMap mmap)
+// {
+// mmap.put("currentUser", ShiroUtils.getSysUser());
+// ErpInboundOrder erpInboundOrder = erpInboundOrderService.selectErpInboundOrderById(id);
+// String inboundType = erpInboundOrder.getInboundType();
+// mmap.put("erpInboundOrder", erpInboundOrder);
+// // 生产入库
+// if("0".equals(inboundType)){
+// return prefix + "/produceInboundDetail";
+// }
+// // 委内入库
+// else if("1".equals(inboundType)){
+// return prefix + "/processInboundDetail";
+// }
+// return "";
+// }
+//
+// @GetMapping("/detailEquipmentResume")
+// public String detailEquipmentResume(@RequestParam("curIndex")Integer curIndex
+// ,@RequestParam("makeNo")String makeNo
+// ,@RequestParam("saleNo")String saleNo
+// ,@RequestParam("materialNo")String materialNo
+// ,@RequestParam("inboundOrderNo")String inboundOrderNo, ModelMap mmap)
+// {
+// SysEquipMaterialDto equipMaterialDto = new SysEquipMaterialDto();
+// mmap.put("currentUser", ShiroUtils.getSysUser());
+// SysSalesOrderChild salesOrderChild = salesOrderChildService.selectOneByQuoteIdAndMaterialCode(saleNo, materialNo);
+// BeanUtils.copyProperties(salesOrderChild,equipMaterialDto);
+// equipMaterialDto.setMakeNo(makeNo);
+// equipMaterialDto.setCurIndex(curIndex);
+// equipMaterialDto.setInboundOrderNo(inboundOrderNo);
+// mmap.put("equipMaterial", equipMaterialDto);
+// return prefix + "/equipmentResumeDetail";
+// }
+
+
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/quality/controller/QualityOrderController.java b/ruoyi-admin/src/main/java/com/ruoyi/quality/controller/QualityOrderController.java
index d77b37b4..ddc0b264 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/quality/controller/QualityOrderController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/quality/controller/QualityOrderController.java
@@ -265,7 +265,7 @@ public class QualityOrderController extends BaseController
/**
- * 委内加工品质单开始品质 物料相关信息
+ * 委内加工品质单开始品质 物料相关信息 (生产订单也适用)
*/
@PostMapping("/getMaterialListByQualityOrderCode")
@ResponseBody
@@ -303,4 +303,80 @@ public class QualityOrderController extends BaseController
}
+ /*1111111111*/
+ /**
+ * 生产入库品质单开始品质
+ */
+ @GetMapping("/makeStartingQuality/{qualityOrderId}")
+ public String makeStartingQuality(@PathVariable("qualityOrderId") Long qualityOrderId, ModelMap mmap)
+ {
+ QualityOrder qualityOrder = qualityOrderService.selectQualityOrderById(qualityOrderId);
+ mmap.put("qualityOrder", qualityOrder);
+ return prefix + "/makeStartingQuality";
+ }
+
+ /**
+ * 修改保存生产入库品质单开始品质
+ */
+ @RequiresPermissions("quality:qualityOrder:makeStartingQuality")
+ @Log(title = "品质管理品质单", businessType = BusinessType.UPDATE)
+ @PostMapping("/makeStartingQuality")
+ @ResponseBody
+ public AjaxResult makeStartingQualitySave(@RequestBody QualityOrder qualityOrder)
+ {
+ return toAjax(qualityOrderService.updateMakeStartingQuality(qualityOrder));
+ }
+
+
+
+ /**
+ * 生产入库品质单开始品质列表详情接口
+ */
+ @GetMapping("/makeStartingQualityDetail/{qualityOrderId}")
+ public String makeStartingQualityDetail(@PathVariable("qualityOrderId") Long qualityOrderId, ModelMap mmap)
+ {
+ QualityOrder qualityOrder = qualityOrderService.selectQualityOrderById(qualityOrderId);
+ mmap.put("qualityOrder", qualityOrder);
+ return prefix + "/makeInStartingQualityDetail";
+ }
+
+ /**
+ * 修改保存生产入库品质单开始品质详情
+ */
+ @RequiresPermissions("quality:qualityOrder:makeStartingQualityDetail")
+ @Log(title = "品质管理品质单", businessType = BusinessType.UPDATE)
+ @PostMapping("/makeStartingQualityDetail")
+ @ResponseBody
+ public AjaxResult makeStartingQualityDetailSave(QualityOrder qualityOrder)
+ {
+ return toAjax(qualityOrderService.qualityOrderDetailSave(qualityOrder));
+ }
+
+
+
+ /**
+ * 修改委生产入库品质报告按钮
+ */
+ @GetMapping("/makeOrderReport")
+ public String makeOrderReport( @RequestParam("materialNo") String materialNo,
+ @RequestParam("qualityOrderCode") String qualityOrderCode,
+ ModelMap mmap)
+ {
+ QualityOrderReport qualityOrderReport = orderReportService.selectMakeInOrderReportByNoAndCode(materialNo,qualityOrderCode);
+ mmap.put("qualityOrderReport", qualityOrderReport);
+ mmap.put("qualityOrderCode",qualityOrderCode);
+ return prefix + "/makeOrderReport";
+ }
+
+ /**
+ * 修改保存生产入库品质报告按钮
+ */
+ @Log(title = "品质管理品质单", businessType = BusinessType.UPDATE)
+ @PostMapping("/makeOrderReport")
+ @ResponseBody
+ public AjaxResult makeOrderReportSave(@RequestBody QualityOrderReport qualityOrderReport)
+ {
+ return toAjax(orderReportService.updateMakeInOrderReport(qualityOrderReport));
+ }
+
}
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/quality/domain/QualityOrder.java b/ruoyi-admin/src/main/java/com/ruoyi/quality/domain/QualityOrder.java
index 1f2e4166..755250f3 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/quality/domain/QualityOrder.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/quality/domain/QualityOrder.java
@@ -59,6 +59,9 @@ public class QualityOrder extends BaseEntity
@Excel(name = "品质不合格数")
private Integer qualityUnqualifiedNum;
+ /** 入库数 */
+ private Integer storageNum;
+
/** 委内加工费总价 */
private BigDecimal makeInTotalPrice;
@@ -224,6 +227,14 @@ public class QualityOrder extends BaseEntity
this.qualityOrderDetailList = qualityOrderDetailList;
}
+ public Integer getStorageNum() {
+ return storageNum;
+ }
+
+ public void setStorageNum(Integer storageNum) {
+ this.storageNum = storageNum;
+ }
+
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
@@ -248,6 +259,7 @@ public class QualityOrder extends BaseEntity
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
+ .append("storageNum",getStorageNum())
.toString();
}
}
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/quality/domain/QualityOrderDetail.java b/ruoyi-admin/src/main/java/com/ruoyi/quality/domain/QualityOrderDetail.java
index 1f0ab2c8..a5cffbe7 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/quality/domain/QualityOrderDetail.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/quality/domain/QualityOrderDetail.java
@@ -118,6 +118,9 @@ public class QualityOrderDetail extends BaseEntity
@Excel(name = "生产订单数")
private Integer makeTotal;
+ /** 生产完成数 */
+ private Integer makeCompletionNum;
+
/** 实际到货数量 */
@Excel(name = "实际到货数量")
private Integer actualArriveNum;
@@ -362,6 +365,15 @@ public class QualityOrderDetail extends BaseEntity
this.makeTotal = makeTotal;
}
+
+ public Integer getMakeCompletionNum() {
+ return makeCompletionNum;
+ }
+
+ public void setMakeCompletionNum(Integer makeCompletionNum) {
+ this.makeCompletionNum = makeCompletionNum;
+ }
+
public Integer getActualArriveNum() {
return actualArriveNum;
}
@@ -460,6 +472,7 @@ public class QualityOrderDetail extends BaseEntity
.append("qualityQualifiedNum", getQualityQualifiedNum())
.append("qualityUnqualifiedNum", getQualityUnqualifiedNum())
.append("makeInNum",getMakeInNum())
+ .append("makeCompletionNum",getMakeCompletionNum())
.append("makeInUnitPrice",getMakeInUnitPrice())
.append("remark", getRemark())
.append("createBy", getCreateBy())
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/quality/mapper/QualityOrderMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/quality/mapper/QualityOrderMapper.java
index b15cb088..c918a90c 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/quality/mapper/QualityOrderMapper.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/quality/mapper/QualityOrderMapper.java
@@ -85,4 +85,8 @@ public interface QualityOrderMapper
*/
public QualityOrder selectQualityOrderByCode(String qualityOrderCode);
+ /**
+ * 生产入库和委内入库相关品质单数据
+ * */
+ List selectAllMakeQualityOrderList(QualityOrder qualityOrder);
}
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/quality/service/IQualityOrderService.java b/ruoyi-admin/src/main/java/com/ruoyi/quality/service/IQualityOrderService.java
index 2388ccb4..dfa0fa4f 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/quality/service/IQualityOrderService.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/quality/service/IQualityOrderService.java
@@ -78,7 +78,7 @@ public interface IQualityOrderService
int restoreQualityOrderById(Long qualityOrderId);
/*
- *
+ * 仓库->品质
* */
void insertQualityOrderByWarehouseStorageOrder(WarehouseStorageOrder warehouseStorageOrder, List warehouseStorageOrderDetailList);
@@ -96,4 +96,14 @@ public interface IQualityOrderService
* 品质单详情通用保存方法
* */
int qualityOrderDetailSave(QualityOrder qualityOrder);
+
+ /**
+ * 生产入库和委内入库相关品质单数据
+ * */
+ List selectAllMakeQualityOrderList(QualityOrder qualityOrder);
+
+ /**
+ * 修改保存生产入库品质单开始品质
+ */
+ int updateMakeStartingQuality(QualityOrder qualityOrder);
}
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/quality/service/impl/QualityOrderServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/quality/service/impl/QualityOrderServiceImpl.java
index 40bf8c58..bcb3eec9 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/quality/service/impl/QualityOrderServiceImpl.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/quality/service/impl/QualityOrderServiceImpl.java
@@ -349,6 +349,7 @@ public class QualityOrderServiceImpl implements IQualityOrderService
//根据品质单号从数据库查询 用于更新入库单
QualityOrder tempQualityOrder = qualityOrderMapper.selectQualityOrderByCode(qualityOrder.getQualityOrderCode());
+ tempQualityOrder.setWarehouseCode(warehouseStorageCode);
String qualityStatus = tempQualityOrder.getQualityStatus();
String qualityStorageStatus = tempQualityOrder.getQualityStorageStatus();
@@ -413,6 +414,7 @@ public class QualityOrderServiceImpl implements IQualityOrderService
tempQualityOrder.setQualityUnqualifiedNum(qualityUnqualifiedNumSum);
tempQualityOrder.setThisArrivedNum(thisArrivedNumSum);
+
//数据生成到入库单中,后续进行入库操作
int updateStorageOrderResult = warehouseStorageOrderService.insertWarehouseStorageOrderByMakeInQualityOrder(tempQualityOrder, qualityOrderDetailList);
if (updateStorageOrderResult <= 0){
@@ -449,6 +451,133 @@ public class QualityOrderServiceImpl implements IQualityOrderService
return 1;
}
+ /**
+ * 生产入库和委内入库相关品质单数据
+ * */
+ @Override
+ public List selectAllMakeQualityOrderList(QualityOrder qualityOrder) {
+
+ return qualityOrderMapper.selectAllMakeQualityOrderList(qualityOrder);
+ }
+
+ /**
+ * 修改保存生产入库品质单开始品质
+ */
+ @Override
+ public int updateMakeStartingQuality(QualityOrder qualityOrder) {
+
+ String loginName = ShiroUtils.getLoginName();
+ qualityOrder.setUpdateBy(loginName);
+ qualityOrder.setUpdateTime(new Date());
+ qualityOrder.setQualityEmployee(loginName);
+ //生成入库单号
+ String warehouseStorageCode = redisCache.generateBillNo("RK");
+ qualityOrder.setInStorageCode(warehouseStorageCode);
+ List qualityOrderDetailList = qualityOrder.getQualityOrderDetailList();
+
+ if (CollectionUtils.isEmpty(qualityOrderDetailList)){
+ throw new BusinessException("品质单详情数据为空");
+ }
+
+ for (QualityOrderDetail qualityOrderDetail : qualityOrderDetailList) {
+ qualityOrderDetail.setUpdateBy(loginName);
+ qualityOrderDetail.setUpdateTime(new Date());
+ Long qualityOrderDetailId = qualityOrderDetail.getQualityOrderDetailId();
+ QualityOrderDetail tempQualityOrderDetail = orderDetailMapper.selectQualityOrderDetailById(qualityOrderDetailId);
+ Integer qualifiedNum = tempQualityOrderDetail.getQualityQualifiedNum();
+ Integer unqualifiedNum = tempQualityOrderDetail.getQualityUnqualifiedNum();
+ if (qualifiedNum == null || unqualifiedNum == null){
+ throw new BusinessException("请先进行品质报告操作");
+ }
+ //更新品质单详情数据
+ int updateQualityOrderDetailResult = orderDetailMapper.updateQualityOrderDetail(qualityOrderDetail);
+ if (updateQualityOrderDetailResult <= 0){
+ throw new BusinessException("更新品质单详情数据失败");
+ }
+ }
+
+
+ //根据品质单号从数据库查询 用于更新入库单
+ QualityOrder tempQualityOrder = qualityOrderMapper.selectQualityOrderByCode(qualityOrder.getQualityOrderCode());
+ tempQualityOrder.setWarehouseCode(warehouseStorageCode);
+ String qualityStatus = tempQualityOrder.getQualityStatus();
+ String qualityStorageStatus = tempQualityOrder.getQualityStorageStatus();
+
+ Integer thisArrivedNumSum = 0;
+ Integer qualityQualifiedNumSum = 0;
+ Integer qualityUnqualifiedNumSum = 0;
+
+// 检查thisArrivedNum是否含有null值
+ boolean hasThisArrivedNumNull = qualityOrderDetailList.stream()
+ .anyMatch(item -> item.getThisArrivedNum() == null);
+
+// 检查qualityQualifiedNum是否含有null值
+ boolean hasQualityQualifiedNumNull = qualityOrderDetailList.stream()
+ .anyMatch(item -> item.getQualityQualifiedNum() == null);
+
+// 检查qualityUnqualifiedNum是否含有null值
+ boolean hasQualityUnqualifiedNumNull = qualityOrderDetailList.stream()
+ .anyMatch(item -> item.getQualityUnqualifiedNum() == null);
+
+ if (hasThisArrivedNumNull) {
+ throw new BusinessException("存在本次到货数为空,请检查!");
+ }
+ if (hasQualityQualifiedNumNull) {
+ throw new BusinessException("存在品质已合格数为空,请检查!");
+ }
+ if (hasQualityUnqualifiedNumNull) {
+ throw new BusinessException("存在品质不合格数为空,请检查!");
+ }
+// 计算各个字段的总和
+ thisArrivedNumSum = qualityOrderDetailList.stream()
+ .mapToInt(QualityOrderDetail::getThisArrivedNum)
+ .sum();
+
+ qualityQualifiedNumSum = qualityOrderDetailList.stream()
+ .mapToInt(QualityOrderDetail::getQualityQualifiedNum)
+ .sum();
+
+ qualityUnqualifiedNumSum = qualityOrderDetailList.stream()
+ .mapToInt(QualityOrderDetail::getQualityUnqualifiedNum)
+ .sum();
+ //插入主表中本次到货数
+ qualityOrder.setThisArrivedNum(thisArrivedNumSum);
+ //插入主表中品质合格数
+ qualityOrder.setQualityQualifiedNum(qualityQualifiedNumSum);
+ //插入主表中品质不合格数
+ qualityOrder.setQualityUnqualifiedNum(qualityUnqualifiedNumSum);
+
+// if (thisArrivedNum == qualityQualifiedNum){
+ //全部品质
+ qualityOrder.setQualityStatus("2");
+ tempQualityOrder.setQualityStatus("2");
+// }else {
+// //部分品质
+// qualityOrder.setQualityStatus("1");
+// tempQualityOrder.setQualityStatus("1");
+// }
+
+
+ //如果品质时修改交检时间
+ tempQualityOrder.setDeliveryInspectionTime(qualityOrder.getDeliveryInspectionTime());
+ tempQualityOrder.setQualityQualifiedNum(qualityQualifiedNumSum);
+ tempQualityOrder.setQualityUnqualifiedNum(qualityUnqualifiedNumSum);
+ tempQualityOrder.setThisArrivedNum(thisArrivedNumSum);
+
+
+ //数据生成到入库单中,后续进行入库操作
+ int updateStorageOrderResult = warehouseStorageOrderService.insertWarehouseStorageOrderByMakeQualityOrder(tempQualityOrder, qualityOrderDetailList);
+ if (updateStorageOrderResult <= 0){
+ throw new BusinessException("更新入库单数据失败");
+ }
+
+ int updateResult = qualityOrderMapper.updateQualityOrder(qualityOrder);
+ if (updateResult <= 0){
+ log.warn("更新品质单失败,未影响任何行");
+ }
+ return updateResult;
+ }
+
//品质单不合格分类表
private void insertQualityOrderUnqualifiedByWarehouseStorageOrder(WarehouseStorageOrderDetail warehouseStorageOrderDetail) {
QualityOrderReportUnqualified qualityOrderReportUnqualified = new QualityOrderReportUnqualified();
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysMakeOrderController.java b/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysMakeOrderController.java
index 77aeba35..e227446b 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysMakeOrderController.java
+++ b/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.StringUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.erp.domain.ErpInboundOrder;
import com.ruoyi.erp.service.IErpMaterialService;
import com.ruoyi.financial.domain.FinancialReceivables;
import com.ruoyi.financial.domain.FinancialReceivablesRecords;
@@ -198,6 +199,21 @@ public class SysMakeOrderController extends BaseController
return prefix + "/addProduceInbound";
}
+
+ /**
+ * 添加修改 创建生产入库和设备履历设置
+ * */
+ @ResponseBody
+ @PostMapping("/addProduceInboundSave")
+ public AjaxResult addProduceInboundSave(@RequestBody ErpInboundOrder erpInboundOrder)
+ {
+
+ return toAjax(sysMakeOrderService.addProduceInboundSave(erpInboundOrder));
+ }
+
+
+
+
/**
* 跳转添加设备履历
*/
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 6fafaaf2..475566ec 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
@@ -66,7 +66,7 @@ public class SysMakeorderPickDetail extends BaseEntity
/** 用量 */
private Long useNum;
/** 损耗率 */
- private BigDecimal lossRate;
+ private String lossRate;
/** 层级 */
private Long level;
/** 排序 */
@@ -216,11 +216,11 @@ public class SysMakeorderPickDetail extends BaseEntity
this.useNum = useNum;
}
- public BigDecimal getLossRate() {
+ public String getLossRate() {
return lossRate;
}
- public void setLossRate(BigDecimal lossRate) {
+ public void setLossRate(String lossRate) {
this.lossRate = lossRate;
}
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysMakeOrderService.java b/ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysMakeOrderService.java
index 4adfdb1f..e48f18ac 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysMakeOrderService.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysMakeOrderService.java
@@ -1,5 +1,6 @@
package com.ruoyi.system.service;
+import com.ruoyi.erp.domain.ErpInboundOrder;
import com.ruoyi.system.domain.SysMakeOrder;
import com.ruoyi.system.dto.SysEquipMaterialDto;
import com.ruoyi.system.dto.SysMakeorderMaterialDto;
@@ -119,4 +120,8 @@ public interface ISysMakeOrderService
*/
int addEquipmentResumeSave(SysEquipMaterialDto equipMaterialDto);
+ /**
+ * 添加保存创建生产入库和设备履历设置
+ */
+ int addProduceInboundSave(ErpInboundOrder erpInboundOrder);
}
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysMakeOrderServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysMakeOrderServiceImpl.java
index edd751f8..6cfd4908 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysMakeOrderServiceImpl.java
+++ b/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.StringUtils;
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.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.SysMakeorderBom;
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.SysMakeorderMaterialDto;
import com.ruoyi.system.mapper.SysMakeOrderMapper;
+import com.ruoyi.system.mapper.SysSalesOrderChildMapper;
import com.ruoyi.system.service.*;
import com.ruoyi.warehouse.domain.WarehouseStorageOrder;
import com.ruoyi.warehouse.domain.WarehouseStorageOrderDetail;
@@ -31,9 +40,7 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
+import java.util.*;
/**
* 生产订单Service业务层处理
@@ -57,6 +64,9 @@ public class SysMakeOrderServiceImpl implements ISysMakeOrderService
@Autowired
private ISysSalesOrderService salesOrderService;
+ @Autowired
+ private SysSalesOrderChildMapper salesOrderChildMapper;
+
@Autowired
private ISysSalesOrderChildService salesOrderChildService;
@@ -72,6 +82,14 @@ public class SysMakeOrderServiceImpl implements ISysMakeOrderService
@Autowired
private AfterSalesShippingDeviceMapper afterSalesShippingDeviceMapper;
+ @Autowired
+ private QualityOrderMapper qualityOrderMapper;
+
+ @Autowired
+ private QualityOrderDetailMapper orderDetailMapper;
+
+ @Autowired
+ private QualityOrderReportMapper orderReportMapper;
/**
* 查询生产订单
@@ -408,4 +426,115 @@ public class SysMakeOrderServiceImpl implements ISysMakeOrderService
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);
+ //更新生产订单的本次完成数
+ long finishNum = erpInboundOrder.getInboundDetails().stream().mapToLong(ErpInboundOrderDetail::getCurrentNum).sum();
+ SysMakeOrder sysMakeOrder = sysMakeOrderMapper.selectMakeOrderByMakeNo(erpInboundOrder.getMakeNo());
+ sysMakeOrder.setFinishNum(finishNum);
+ int updateSysMakeOrderResult = sysMakeOrderMapper.updateSysMakeOrder(sysMakeOrder);
+ if (updateSysMakeOrderResult <= 0){
+ throw new BusinessException("更新生产订单失败");
+ }
+
+ Map 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 fetchMaterialInfoMap(ErpInboundOrder erpInboundOrder) {
+ List inboundDetails = erpInboundOrder.getInboundDetails();
+ Map 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 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 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;
+ }
+
}
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/warehouse/controller/WarehouseStorageOrderController.java b/ruoyi-admin/src/main/java/com/ruoyi/warehouse/controller/WarehouseStorageOrderController.java
index 871d0a8a..4a0941fa 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/warehouse/controller/WarehouseStorageOrderController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/warehouse/controller/WarehouseStorageOrderController.java
@@ -139,7 +139,7 @@ public class WarehouseStorageOrderController extends BaseController
@ResponseBody
public AjaxResult temporaryPurchaseWarehouseSave(@RequestBody WarehouseStorageOrder warehouseStorageOrder)
{
- return toAjax(warehouseStorageOrderService.updateWarehouseStorageOrder(warehouseStorageOrder));
+ return toAjax(warehouseStorageOrderService.updateTemporaryPurchaseWarehouse(warehouseStorageOrder));
}
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/warehouse/mapper/WarehouseOutOrderDetailMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/warehouse/mapper/WarehouseOutOrderDetailMapper.java
index a7955417..e857f643 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/warehouse/mapper/WarehouseOutOrderDetailMapper.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/warehouse/mapper/WarehouseOutOrderDetailMapper.java
@@ -83,6 +83,12 @@ public interface WarehouseOutOrderDetailMapper
*/
List selectOutOrderDetailListByCode(String outOrderCode);
+
+ /**
+ * 根据物料号、出库单号、关联单号查询出库单详情数据
+ */
+ public WarehouseOutOrderDetail selectOutOrderDetailListByThreeCode(WarehouseOutOrderDetail warehouseOutOrderDetail);
+
/**
* 销售单-出库 物料信息关联设备信息
*/
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/IWarehouseStorageOrderService.java b/ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/IWarehouseStorageOrderService.java
index 506ecf85..6aaaec00 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/IWarehouseStorageOrderService.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/IWarehouseStorageOrderService.java
@@ -118,4 +118,14 @@ public interface IWarehouseStorageOrderService
* 修改保存入库-生产订单(委内入库)
* */
int updateStorageMakeIn(WarehouseStorageOrder warehouseStorageOrder);
+
+ /**
+ * 修改保存暂收-采购单(仓库入库)
+ */
+ int updateTemporaryPurchaseWarehouse(WarehouseStorageOrder warehouseStorageOrder);
+
+ /**
+ * 通过生产入库单品质后生成入库单
+ * */
+ int insertWarehouseStorageOrderByMakeQualityOrder(QualityOrder tempQualityOrder, List qualityOrderDetailList);
}
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseOutOrderServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseOutOrderServiceImpl.java
index 38e3e236..eb5431d5 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseOutOrderServiceImpl.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseOutOrderServiceImpl.java
@@ -311,7 +311,7 @@ public class WarehouseOutOrderServiceImpl implements IWarehouseOutOrderService
throw new BusinessException("添加出库单信息失败");
}
//生成出库单详情相关信息
- generateWarehouseOutOrder(sysMakeorderPickVo, tempSysMakeorderPickVo, outOrderCode,mergeMakeorderPickDetails);
+ generateWarehouseOutOrder(sysMakeorderPickVo, tempSysMakeorderPickVo, outOrderCode,sysMakeorderPickDetails);
return insertResult;
}
@@ -343,44 +343,59 @@ public class WarehouseOutOrderServiceImpl implements IWarehouseOutOrderService
//生成出库单详情相关信息
- private void generateWarehouseOutOrder(SysMakeorderPickVo sysMakeorderPickVo, SysMakeorderPickVo tempSysMakeorderPickVo, String outOrderCode,List mergeMakeorderPickDetails) {
+ private void generateWarehouseOutOrder(SysMakeorderPickVo sysMakeorderPickVo, SysMakeorderPickVo tempSysMakeorderPickVo, String outOrderCode,List sysMakeorderPickDetails) {
- for (SysMakeorderPickDetail sysMakeorderPickDetail : mergeMakeorderPickDetails) {
+ for (SysMakeorderPickDetail sysMakeorderPickDetail : sysMakeorderPickDetails) {
WarehouseOutOrderDetail warehouseOutOrderDetail = new WarehouseOutOrderDetail();
warehouseOutOrderDetail.setOutOrderCode(outOrderCode);
- warehouseOutOrderDetail.setWarehouseOutStatus("4");
warehouseOutOrderDetail.setRelatedOrderCode(tempSysMakeorderPickVo.getMakeNo());
- warehouseOutOrderDetail.setMakeNo(tempSysMakeorderPickVo.getMakeNo());
- //标明来源是生产订单
- warehouseOutOrderDetail.setWarehouseOrderType("1");
- warehouseOutOrderDetail.setWarehouseOutType("1");
- warehouseOutOrderDetail.setMaterialSum(tempSysMakeorderPickVo.getMaterialSum());
- warehouseOutOrderDetail.setEnterpriseSum(tempSysMakeorderPickVo.getEnterpriseSum());
-
- warehouseOutOrderDetail.setCreateBy(ShiroUtils.getLoginName());
- warehouseOutOrderDetail.setCreateTime(new Date());
- warehouseOutOrderDetail.setApplyName(sysMakeorderPickVo.getApplyUser());
//物料相关信息
warehouseOutOrderDetail.setMaterialNo(sysMakeorderPickDetail.getMaterialNo());
- warehouseOutOrderDetail.setMaterialName(sysMakeorderPickDetail.getMaterialName());
- warehouseOutOrderDetail.setMaterialDescribe(sysMakeorderPickDetail.getDescribe());
- warehouseOutOrderDetail.setMaterialUnit(sysMakeorderPickDetail.getUnit());
- warehouseOutOrderDetail.setMaterialBrand(sysMakeorderPickDetail.getBrand());
- warehouseOutOrderDetail.setMaterialProcessMethod(sysMakeorderPickDetail.getProcessMethod());
- warehouseOutOrderDetail.setMakeNum(tempSysMakeorderPickVo.getMaterialSum());
+ //根据出库单号和关联单号以及物料号查找出库单详情数据
+ WarehouseOutOrderDetail tempWarehouseOutOrderDetail = outOrderDetailMapper.selectOutOrderDetailListByThreeCode(warehouseOutOrderDetail);
+ if (tempWarehouseOutOrderDetail != null){
+ warehouseOutOrderDetail.setOutOrderDetailId(tempWarehouseOutOrderDetail.getOutOrderDetailId());
+ Integer applyOutOrderSum = (int) (sysMakeorderPickDetail.getPickNum()+tempWarehouseOutOrderDetail.getApplyOutOrderSum());
+ Integer makeNum = (int) (sysMakeorderPickDetail.getPickNum() + tempWarehouseOutOrderDetail.getMakeNum());
+ warehouseOutOrderDetail.setApplyOutOrderSum(applyOutOrderSum);
+ warehouseOutOrderDetail.setMakeNum(makeNum);
+ int updateWarehouseOutOrderDetailResult = outOrderDetailMapper.updateWarehouseOutOrderDetail(warehouseOutOrderDetail);
+ if (updateWarehouseOutOrderDetailResult <= 0){
+ throw new BusinessException("更新出库单详情失败");
+ }
+ }else {
+ warehouseOutOrderDetail.setWarehouseOutStatus("4");
+ warehouseOutOrderDetail.setMakeNo(tempSysMakeorderPickVo.getMakeNo());
+ //标明来源是生产订单
+ warehouseOutOrderDetail.setWarehouseOrderType("1");
+ warehouseOutOrderDetail.setWarehouseOutType("1");
+ warehouseOutOrderDetail.setMaterialSum(tempSysMakeorderPickVo.getMaterialSum());
+ warehouseOutOrderDetail.setEnterpriseSum(tempSysMakeorderPickVo.getEnterpriseSum());
+
+ warehouseOutOrderDetail.setCreateBy(ShiroUtils.getLoginName());
+ warehouseOutOrderDetail.setCreateTime(new Date());
+ warehouseOutOrderDetail.setApplyName(sysMakeorderPickVo.getApplyUser());
+ warehouseOutOrderDetail.setMaterialName(sysMakeorderPickDetail.getMaterialName());
+ warehouseOutOrderDetail.setMaterialDescribe(sysMakeorderPickDetail.getDescribe());
+ warehouseOutOrderDetail.setMaterialUnit(sysMakeorderPickDetail.getUnit());
+ warehouseOutOrderDetail.setMaterialBrand(sysMakeorderPickDetail.getBrand());
+ warehouseOutOrderDetail.setMaterialProcessMethod(sysMakeorderPickDetail.getProcessMethod());
+ //订单数量为本次领料数量
+ warehouseOutOrderDetail.setMakeNum(Math.toIntExact(sysMakeorderPickDetail.getPickNum()));
//添加申请出库数量
- warehouseOutOrderDetail.setApplyOutOrderSum(Math.toIntExact(sysMakeorderPickDetail.getPickNum()));
-
- if (StringUtils.isNotEmpty(sysMakeorderPickDetail.getDescribe())) {
- String[] splitDescribe = sysMakeorderPickDetail.getDescribe().split(",");
- if (splitDescribe.length >= 2) {
- warehouseOutOrderDetail.setMaterialModel(splitDescribe[0]);
- warehouseOutOrderDetail.setMaterialSpecification(splitDescribe[1]);
+ warehouseOutOrderDetail.setApplyOutOrderSum(Math.toIntExact(sysMakeorderPickDetail.getPickNum()));
+
+ if (StringUtils.isNotEmpty(sysMakeorderPickDetail.getDescribe())) {
+ String[] splitDescribe = sysMakeorderPickDetail.getDescribe().split(",");
+ if (splitDescribe.length >= 2) {
+ warehouseOutOrderDetail.setMaterialModel(splitDescribe[0]);
+ warehouseOutOrderDetail.setMaterialSpecification(splitDescribe[1]);
+ }
+ }
+ int insertOutOrderDetailResult = outOrderDetailMapper.insertWarehouseOutOrderDetail(warehouseOutOrderDetail);
+ if (insertOutOrderDetailResult <= 0){
+ throw new BusinessException("新增出库单详情数据失败");
}
- }
- int insertOutOrderDetailResult = outOrderDetailMapper.insertWarehouseOutOrderDetail(warehouseOutOrderDetail);
- if (insertOutOrderDetailResult <= 0){
- throw new BusinessException("新增出库单详情数据失败");
}
}
}
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseStorageOrderServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseStorageOrderServiceImpl.java
index e2352fc5..a26478ae 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseStorageOrderServiceImpl.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseStorageOrderServiceImpl.java
@@ -403,8 +403,8 @@ public class WarehouseStorageOrderServiceImpl implements IWarehouseStorageOrderS
public int insertWarehouseStorageOrderByMakeInQualityOrder(QualityOrder tempQualityOrder, List qualityOrderDetailList) {
WarehouseStorageOrder warehouseStorageOrder = new WarehouseStorageOrder();
String loginName = ShiroUtils.getLoginName();
- String warehouseStorageCode = redisCache.generateBillNo("RK");
- warehouseStorageOrder.setWarehouseStorageCode(warehouseStorageCode);
+
+ warehouseStorageOrder.setWarehouseStorageCode(tempQualityOrder.getWarehouseCode());
warehouseStorageOrder.setRelatedOrderCode(tempQualityOrder.getRelatedOrderCode());
//暂收设置为全部品质
warehouseStorageOrder.setWarehouseQualityStatus("2");
@@ -423,7 +423,7 @@ public class WarehouseStorageOrderServiceImpl implements IWarehouseStorageOrderS
for (QualityOrderDetail qualityOrderDetail : qualityOrderDetailList) {
WarehouseStorageOrderDetail warehouseStorageOrderDetail = new WarehouseStorageOrderDetail();
- warehouseStorageOrderDetail.setWarehouseStorageCode(warehouseStorageCode);
+ warehouseStorageOrderDetail.setWarehouseStorageCode(tempQualityOrder.getWarehouseCode());
warehouseStorageOrderDetail.setRelatedOrderCode(tempQualityOrder.getRelatedOrderCode());
warehouseStorageOrderDetail.setWarehouseQualityStatus("2");
warehouseStorageOrderDetail.setWarehouseStorageStatus("2");
@@ -433,6 +433,8 @@ public class WarehouseStorageOrderServiceImpl implements IWarehouseStorageOrderS
warehouseStorageOrderDetail.setMakeStorageNum(qualityOrderDetail.getMakeInNum());
//设置委内加工费单价
warehouseStorageOrderDetail.setMakeInUnitPrice(qualityOrderDetail.getMakeInUnitPrice());
+ //设置品质已合格数
+ warehouseStorageOrderDetail.setQualityHasQualifiedNum(qualityOrderDetail.getQualityHasqualifiedNum());
warehouseStorageOrderDetail.setMaterialNo(qualityOrderDetail.getMaterialNo());
warehouseStorageOrderDetail.setMaterialName(qualityOrderDetail.getMaterialName());
warehouseStorageOrderDetail.setMaterialBrand(qualityOrderDetail.getMaterialBrand());
@@ -523,6 +525,114 @@ public class WarehouseStorageOrderServiceImpl implements IWarehouseStorageOrderS
}
+ /**
+ * 修改保存暂收-采购单(仓库入库)
+ */
+ @Transactional(rollbackFor = Exception.class)
+ @Override
+ public int updateTemporaryPurchaseWarehouse(WarehouseStorageOrder warehouseStorageOrder) {
+ String loginName = ShiroUtils.getLoginName();
+ warehouseStorageOrder.setUpdateBy(loginName);
+ warehouseStorageOrder.setUpdateTime(DateUtils.getNowDate());
+ //改变状态为已暂收
+ warehouseStorageOrder.setWarehouseStorageStatus("1");
+ //设置品质状态,为待品质
+ warehouseStorageOrder.setWarehouseQualityStatus("0");
+ warehouseStorageOrder.setWarehouseEmployee(loginName);
+ List warehouseStorageOrderDetailList = warehouseStorageOrder.getWarehouseStorageOrderDetailList();
+ //入库单主表的实际到货数为子表的合计
+ int actualArriveNum = warehouseStorageOrderDetailList.stream().mapToInt(WarehouseStorageOrderDetail::getActualArriveNum).sum();
+ //入库单主表的暂收合格数为子表的合计
+ int temporaryQualifiedNum = warehouseStorageOrderDetailList.stream().mapToInt(WarehouseStorageOrderDetail::getTemporaryQualifiedNum).sum();
+ if (actualArriveNum < temporaryQualifiedNum) {
+ throw new BusinessException("暂收合格数不能大于实际到货数");
+ }
+
+ //插入实际到货数
+ warehouseStorageOrder.setActualArrivedNum(actualArriveNum);
+ //插入暂收合格数
+ warehouseStorageOrder.setTemporaryQualifiedNum(temporaryQualifiedNum);
+ //插入暂收不合格数
+ warehouseStorageOrder.setTemporaryUnqualifiedNum(Math.max(0, actualArriveNum - temporaryQualifiedNum));
+ //设置暂存时间
+ warehouseStorageOrder.setTemporaryTime(new Date());
+ int updateDetailResult = updateTemporaryPurchaseDetails(warehouseStorageOrder);
+ if (updateDetailResult != warehouseStorageOrder.getWarehouseStorageOrderDetailList().size()) {
+ throw new BusinessException("更新入库单明细记录失败");
+ }
+ int updateResult = warehouseStorageOrderMapper.updateWarehouseStorageOrder(warehouseStorageOrder);
+ if (updateResult <= 0) {
+ throw new BusinessException("更新入库单主记录失败");
+ }
+
+ try {
+ qualityOrderService.insertQualityOrderByWarehouseStorageOrder(warehouseStorageOrder, warehouseStorageOrder.getWarehouseStorageOrderDetailList());
+ } catch (Exception e) {
+ TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+ log.error("生成品质单时发生错误", e);
+ throw new BusinessException("生成品质单时发生错误");
+ }
+
+ return updateResult;
+
+ }
+
+ /**
+ * 通过生产入库单品质后生成入库单
+ * */
+ @Override
+ public int insertWarehouseStorageOrderByMakeQualityOrder(QualityOrder tempQualityOrder, List qualityOrderDetailList) {
+
+ WarehouseStorageOrder warehouseStorageOrder = new WarehouseStorageOrder();
+ String loginName = ShiroUtils.getLoginName();
+
+ warehouseStorageOrder.setWarehouseStorageCode(tempQualityOrder.getWarehouseCode());
+ warehouseStorageOrder.setRelatedOrderCode(tempQualityOrder.getRelatedOrderCode());
+ //暂收设置为全部品质
+ warehouseStorageOrder.setWarehouseQualityStatus("2");
+ warehouseStorageOrder.setWarehouseStorageStatus("2");
+ warehouseStorageOrder.setWarehouseStorageType("5");
+ warehouseStorageOrder.setWarehouseOrderType("1");
+ warehouseStorageOrder.setDeliveryInspectionTime(tempQualityOrder.getDeliveryInspectionTime());
+ warehouseStorageOrder.setQualityUnqualifiedNum(tempQualityOrder.getQualityUnqualifiedNum());
+ warehouseStorageOrder.setQualityQualifiedNum(tempQualityOrder.getQualityQualifiedNum());
+ warehouseStorageOrder.setCreateBy(loginName);
+ warehouseStorageOrder.setQualityTime(new Date());
+ warehouseStorageOrder.setCreateTime(new Date());
+ //设置委内完成数总价
+ warehouseStorageOrder.setMakeInTotalPrice(tempQualityOrder.getMakeInTotalPrice());
+ //插入入库单详情数据
+ for (QualityOrderDetail qualityOrderDetail : qualityOrderDetailList) {
+
+ WarehouseStorageOrderDetail warehouseStorageOrderDetail = new WarehouseStorageOrderDetail();
+ warehouseStorageOrderDetail.setWarehouseStorageCode(tempQualityOrder.getWarehouseCode());
+ warehouseStorageOrderDetail.setRelatedOrderCode(tempQualityOrder.getRelatedOrderCode());
+ warehouseStorageOrderDetail.setWarehouseQualityStatus("2");
+ warehouseStorageOrderDetail.setWarehouseStorageStatus("2");
+ warehouseStorageOrderDetail.setWarehouseStorageType("5");
+ warehouseStorageOrderDetail.setWarehouseOrderType("1");
+ //设置生产订单数
+ warehouseStorageOrderDetail.setMakeTotal(qualityOrderDetail.getMakeTotal());
+ //生产入库数
+ warehouseStorageOrderDetail.setMakeStorageNum(qualityOrderDetail.getMakeCompletionNum());
+ //设置品质已合格数
+ warehouseStorageOrderDetail.setQualityHasQualifiedNum(qualityOrderDetail.getQualityHasqualifiedNum());
+ warehouseStorageOrderDetail.setMaterialNo(qualityOrderDetail.getMaterialNo());
+ warehouseStorageOrderDetail.setMaterialName(qualityOrderDetail.getMaterialName());
+ warehouseStorageOrderDetail.setMaterialBrand(qualityOrderDetail.getMaterialBrand());
+ warehouseStorageOrderDetail.setMaterialDescribe(qualityOrderDetail.getMaterialDescribe());
+ warehouseStorageOrderDetail.setMaterialPhotourl(qualityOrderDetail.getMaterialPhotourl());
+ warehouseStorageOrderDetail.setMaterialProcessMethod(qualityOrderDetail.getMaterialProcessMethod());
+ warehouseStorageOrderDetail.setMaterialType(qualityOrderDetail.getMaterialType());
+ warehouseStorageOrderDetail.setMaterialUnit(qualityOrderDetail.getMaterialUnit());
+ warehouseStorageOrderDetail.setCreateBy(loginName);
+ warehouseStorageOrderDetail.setCreateTime(new Date());
+ storageOrderDetailMapper.insertWarehouseStorageOrderDetail(warehouseStorageOrderDetail);
+ }
+
+ return warehouseStorageOrderMapper.insertWarehouseStorageOrder(warehouseStorageOrder);
+ }
+
/**
* 修改保存暂收-采购单(采购入库) 子表数据
* */
diff --git a/ruoyi-admin/src/main/resources/mapper/quality/QualityOrderDetailMapper.xml b/ruoyi-admin/src/main/resources/mapper/quality/QualityOrderDetailMapper.xml
index e1aaf38f..9fbacb72 100644
--- a/ruoyi-admin/src/main/resources/mapper/quality/QualityOrderDetailMapper.xml
+++ b/ruoyi-admin/src/main/resources/mapper/quality/QualityOrderDetailMapper.xml
@@ -30,6 +30,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+
@@ -70,6 +71,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
material_process_method,
material_dept_type,
make_total,
+ make_completion_num,
actual_arrive_num,
this_arrived_num,
quality_hasqualified_num,
@@ -154,6 +156,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
material_process_method,
material_dept_type,
make_total,
+ make_completion_num,
actual_arrive_num,
this_arrived_num,
quality_hasqualified_num,
@@ -192,6 +195,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{materialProcessMethod},
#{materialDeptType},
#{makeTotal},
+ #{makeCompletionNum},
#{actualArriveNum},
#{thisArrivedNum},
#{qualityHasqualifiedNum},
@@ -234,6 +238,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
material_process_method = #{materialProcessMethod},
material_dept_type = #{materialDeptType},
make_total = #{makeTotal},
+ make_completion_num = #{makeCompletionNum},
actual_arrive_num = #{actualArriveNum},
this_arrived_num = #{thisArrivedNum},
quality_hasqualified_num = #{qualityHasqualifiedNum},
diff --git a/ruoyi-admin/src/main/resources/mapper/quality/QualityOrderMapper.xml b/ruoyi-admin/src/main/resources/mapper/quality/QualityOrderMapper.xml
index 3ebdf1d7..33ec0f68 100644
--- a/ruoyi-admin/src/main/resources/mapper/quality/QualityOrderMapper.xml
+++ b/ruoyi-admin/src/main/resources/mapper/quality/QualityOrderMapper.xml
@@ -15,6 +15,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+
@@ -76,6 +77,48 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+
+
+
+
insert into quality_order
diff --git a/ruoyi-admin/src/main/resources/mapper/warehouse/WarehouseOutOrderDetailMapper.xml b/ruoyi-admin/src/main/resources/mapper/warehouse/WarehouseOutOrderDetailMapper.xml
index 86072cf3..e9bf857e 100644
--- a/ruoyi-admin/src/main/resources/mapper/warehouse/WarehouseOutOrderDetailMapper.xml
+++ b/ruoyi-admin/src/main/resources/mapper/warehouse/WarehouseOutOrderDetailMapper.xml
@@ -77,6 +77,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where out_order_code = #{outOrderCode}
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ruoyi-admin/src/main/resources/templates/erp/inboundOrder/inboundOrderDetail.html b/ruoyi-admin/src/main/resources/templates/erp/inboundOrder/inboundOrderDetail.html
new file mode 100644
index 00000000..f26a257f
--- /dev/null
+++ b/ruoyi-admin/src/main/resources/templates/erp/inboundOrder/inboundOrderDetail.html
@@ -0,0 +1,207 @@
+
+
+