Browse Source

[feat] 仓库管理 品质管理

采购入库暂收
新增 入库单主表实际到货数的计算
新增 入库单主表暂收合格数的计算
新增 入库单主表暂收不合格数的计算
新增 入库单主表暂收合格数和实际到货数大小校验

新增 入库单子表暂收合格数和实际到货数大小校验
修改采购入库单转品质单后端接口
dev
liuxiaoxu 5 months ago
parent
commit
448f05caae
  1. 8
      ruoyi-admin/src/main/java/com/ruoyi/quality/service/impl/QualityOrderServiceImpl.java
  2. 2
      ruoyi-admin/src/main/java/com/ruoyi/warehouse/controller/WarehouseStorageOrderController.java
  3. 5
      ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/IWarehouseStorageOrderService.java
  4. 75
      ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseStorageOrderServiceImpl.java

8
ruoyi-admin/src/main/java/com/ruoyi/quality/service/impl/QualityOrderServiceImpl.java

@ -193,10 +193,12 @@ public class QualityOrderServiceImpl implements IQualityOrderService
qualityOrder.setQualityStatus("0"); qualityOrder.setQualityStatus("0");
qualityOrder.setQualityOrderType("0"); qualityOrder.setQualityOrderType("0");
qualityOrder.setQualityStorageStatus("0"); qualityOrder.setQualityStorageStatus("0");
qualityOrder.setThisArrivedNum(warehouseStorageOrder.getActualArrivedNum()); //qualityOrder.setThisArrivedNum(warehouseStorageOrder.getActualArrivedNum());
qualityOrder.setWarehouseCode(warehouseStorageOrder.getWarehouseCode()); qualityOrder.setWarehouseCode(warehouseStorageOrder.getWarehouseCode());
qualityOrder.setWarehouseName(warehouseStorageOrder.getWarehouseName()); qualityOrder.setWarehouseName(warehouseStorageOrder.getWarehouseName());
qualityOrder.setDeliveryInspectionTime(warehouseStorageOrder.getDeliveryInspectionTime()); qualityOrder.setDeliveryInspectionTime(warehouseStorageOrder.getDeliveryInspectionTime());
qualityOrder.setCreateBy(ShiroUtils.getLoginName());
qualityOrder.setCreateTime(new Date());
qualityOrderMapper.insertQualityOrder(qualityOrder); qualityOrderMapper.insertQualityOrder(qualityOrder);
@ -211,6 +213,7 @@ public class QualityOrderServiceImpl implements IQualityOrderService
} }
//品质单不合格分类表
private void insertQualityOrderUnqualifiedByWarehouseStorageOrder( WarehouseStorageOrderDetail warehouseStorageOrderDetail) { private void insertQualityOrderUnqualifiedByWarehouseStorageOrder( WarehouseStorageOrderDetail warehouseStorageOrderDetail) {
QualityOrderReportUnqualified qualityOrderReportUnqualified = new QualityOrderReportUnqualified(); QualityOrderReportUnqualified qualityOrderReportUnqualified = new QualityOrderReportUnqualified();
//插入品质报告不合格数 //插入品质报告不合格数
@ -224,6 +227,7 @@ public class QualityOrderServiceImpl implements IQualityOrderService
} }
//品质单报告表
private void insertQualityOrderReportByWarehouseStorageOrder(WarehouseStorageOrderDetail warehouseStorageOrderDetail) { private void insertQualityOrderReportByWarehouseStorageOrder(WarehouseStorageOrderDetail warehouseStorageOrderDetail) {
QualityOrderReport qualityOrderReport = new QualityOrderReport(); QualityOrderReport qualityOrderReport = new QualityOrderReport();
//插入品质单报告开始品质单 //插入品质单报告开始品质单
@ -237,6 +241,7 @@ public class QualityOrderServiceImpl implements IQualityOrderService
orderReportMapper.insertQualityOrderReport(qualityOrderReport); orderReportMapper.insertQualityOrderReport(qualityOrderReport);
} }
//品质单详情表
private void insertQualityOrderDetailByWarehouseStorageOrder(WarehouseStorageOrder warehouseStorageOrder, WarehouseStorageOrderDetail warehouseStorageOrderDetail, String qualityOrderCode) { private void insertQualityOrderDetailByWarehouseStorageOrder(WarehouseStorageOrder warehouseStorageOrder, WarehouseStorageOrderDetail warehouseStorageOrderDetail, String qualityOrderCode) {
QualityOrderDetail qualityOrderDetail = new QualityOrderDetail(); QualityOrderDetail qualityOrderDetail = new QualityOrderDetail();
@ -253,6 +258,7 @@ public class QualityOrderServiceImpl implements IQualityOrderService
qualityOrderDetail.setMaterialDescribe(warehouseStorageOrderDetail.getMaterialDescribe()); qualityOrderDetail.setMaterialDescribe(warehouseStorageOrderDetail.getMaterialDescribe());
qualityOrderDetail.setMaterialName(warehouseStorageOrderDetail.getMaterialName()); qualityOrderDetail.setMaterialName(warehouseStorageOrderDetail.getMaterialName());
qualityOrderDetail.setMaterialProcessMethod(warehouseStorageOrderDetail.getMaterialProcessMethod()); qualityOrderDetail.setMaterialProcessMethod(warehouseStorageOrderDetail.getMaterialProcessMethod());
//To do 缺少入库部门 ,如果后续需要从这里添加
qualityOrderDetail.setMaterialPhotourl(warehouseStorageOrderDetail.getMaterialPhotourl()); qualityOrderDetail.setMaterialPhotourl(warehouseStorageOrderDetail.getMaterialPhotourl());
qualityOrderDetail.setMaterialUnit(warehouseStorageOrderDetail.getMaterialUnit()); qualityOrderDetail.setMaterialUnit(warehouseStorageOrderDetail.getMaterialUnit());
qualityOrderDetail.setMaterialType(warehouseStorageOrderDetail.getMaterialType()); qualityOrderDetail.setMaterialType(warehouseStorageOrderDetail.getMaterialType());

2
ruoyi-admin/src/main/java/com/ruoyi/warehouse/controller/WarehouseStorageOrderController.java

@ -198,7 +198,7 @@ public class WarehouseStorageOrderController extends BaseController
@ResponseBody @ResponseBody
public AjaxResult temporaryPurchaseSave(@RequestBody WarehouseStorageOrder warehouseStorageOrder) public AjaxResult temporaryPurchaseSave(@RequestBody WarehouseStorageOrder warehouseStorageOrder)
{ {
return toAjax(warehouseStorageOrderService.temporaryPurchaseWarehouseStorageOrder(warehouseStorageOrder)); return toAjax(warehouseStorageOrderService.temporaryPurchaseSave(warehouseStorageOrder));
} }

5
ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/IWarehouseStorageOrderService.java

@ -93,4 +93,9 @@ public interface IWarehouseStorageOrderService
* 入库-采购单(采购入库) * 入库-采购单(采购入库)
* */ * */
int storagePurchaseWarehouseStorageOrder(WarehouseStorageOrder warehouseStorageOrder); int storagePurchaseWarehouseStorageOrder(WarehouseStorageOrder warehouseStorageOrder);
/**
* 修改保存暂收-采购单(采购入库)
* */
int temporaryPurchaseSave(WarehouseStorageOrder warehouseStorageOrder);
} }

75
ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseStorageOrderServiceImpl.java

@ -165,6 +165,7 @@ public class WarehouseStorageOrderServiceImpl implements IWarehouseStorageOrderS
warehouseStorageOrder.setUpdateBy(loginName); warehouseStorageOrder.setUpdateBy(loginName);
warehouseStorageOrder.setUpdateTime(DateUtils.getNowDate()); warehouseStorageOrder.setUpdateTime(DateUtils.getNowDate());
warehouseStorageOrder.setWarehouseStorageStatus("1"); warehouseStorageOrder.setWarehouseStorageStatus("1");
warehouseStorageOrder.setWarehouseEmployee(loginName);
//设置暂存时间 //设置暂存时间
warehouseStorageOrder.setTemporaryTime(new Date()); warehouseStorageOrder.setTemporaryTime(new Date());
updateWarehouseStorageOrderDetails(warehouseStorageOrder); updateWarehouseStorageOrderDetails(warehouseStorageOrder);
@ -250,6 +251,80 @@ public class WarehouseStorageOrderServiceImpl implements IWarehouseStorageOrderS
return updateResult; return updateResult;
} }
/**
* 修改保存暂收-采购单(采购入库)
* */
@Transactional(rollbackFor = Exception.class)
@Override
public int temporaryPurchaseSave(WarehouseStorageOrder warehouseStorageOrder) {
String loginName = ShiroUtils.getLoginName();
warehouseStorageOrder.setUpdateBy(loginName);
warehouseStorageOrder.setUpdateTime(DateUtils.getNowDate());
//改变状态为已暂收
warehouseStorageOrder.setWarehouseStorageStatus("1");
//设置品质状态,为待品质
warehouseStorageOrder.setWarehouseQualityStatus("0");
warehouseStorageOrder.setWarehouseEmployee(loginName);
List<WarehouseStorageOrderDetail> 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;
}
/**
* 修改保存暂收-采购单(采购入库) 子表数据
* */
private int updateTemporaryPurchaseDetails(WarehouseStorageOrder warehouseStorageOrder) {
int updateResultDetails = 0;
List<WarehouseStorageOrderDetail> details = warehouseStorageOrder.getWarehouseStorageOrderDetailList();
if (org.springframework.util.CollectionUtils.isEmpty(details)){
return 0;
}
for (WarehouseStorageOrderDetail detail : details) {
detail.setWarehouseStorageCode(warehouseStorageOrder.getWarehouseStorageCode());
Integer actualArriveNum = detail.getActualArriveNum();
Integer temporaryQualifiedNum = detail.getTemporaryQualifiedNum();
if (actualArriveNum < temporaryQualifiedNum){
throw new BusinessException("暂收合格数要小于等于实际到货数");
}
updateResultDetails += storageOrderDetailMapper.updateWarehouseStorageOrderDetailByObject(detail);
}
return updateResultDetails;
}
/* /*
* 更新仓库入库单详情的数据 * 更新仓库入库单详情的数据
* */ * */

Loading…
Cancel
Save