Browse Source

[feat]仓库管理

采购订单子表新增通过采购订单号和物料号查询采购订单子表方法
修改暂收-采购入库和暂收仓库入库两个方法,加上对采购订单子表暂收数的更新
dev
liuxiaoxu 5 hours ago
parent
commit
e7c4b8fbb9
  1. 9
      ruoyi-admin/src/main/java/com/ruoyi/purchase/mapper/PurchaseOrderChildMapper.java
  2. 39
      ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseStorageOrderServiceImpl.java
  3. 8
      ruoyi-admin/src/main/resources/mapper/purchase/PurchaseOrderChildMapper.xml

9
ruoyi-admin/src/main/java/com/ruoyi/purchase/mapper/PurchaseOrderChildMapper.java

@ -48,6 +48,15 @@ public interface PurchaseOrderChildMapper
List<PurchaseOrderChild> selectPurchaseOrderChildByOrderCode(String purchaseOrderCode);
/**
* 通过采购订单号和物料号查询采购订单子表
*
* @param purchaseOrderChild 采购订单子表
* @return 采购订单子表集合
*/
PurchaseOrderChild selectPurchaseOrderChildByCodeAndNo(PurchaseOrderChild purchaseOrderChild);
/**
* 新增采购订单子表
*

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

@ -13,6 +13,7 @@ import com.ruoyi.erp.domain.ErpDevelopModifyorder;
import com.ruoyi.erp.domain.ErpMaterial;
import com.ruoyi.erp.mapper.ErpDevelopModifyorderMapper;
import com.ruoyi.erp.mapper.ErpMaterialMapper;
import com.ruoyi.purchase.domain.PurchaseOrder;
import com.ruoyi.purchase.domain.PurchaseOrderChild;
import com.ruoyi.purchase.mapper.PurchaseOrderChildMapper;
import com.ruoyi.quality.domain.QualityOrder;
@ -407,6 +408,14 @@ public class WarehouseStorageOrderServiceImpl implements IWarehouseStorageOrderS
if (updateDetailResult != warehouseStorageOrder.getWarehouseStorageOrderDetailList().size()) {
throw new BusinessException("更新入库单明细记录失败");
}
//更新采购订单子表
int updatePurchaseOrderChildResult = updateTemporaryPurchaseOrderChild(warehouseStorageOrder);
if (updatePurchaseOrderChildResult != warehouseStorageOrder.getWarehouseStorageOrderDetailList().size()){
throw new BusinessException("更新采购订单子表记录失败");
}
int updateResult = warehouseStorageOrderMapper.updateWarehouseStorageOrder(warehouseStorageOrder);
if (updateResult <= 0) {
throw new BusinessException("更新入库单主记录失败");
@ -435,6 +444,26 @@ public class WarehouseStorageOrderServiceImpl implements IWarehouseStorageOrderS
return updateResult;
}
//更新采购订单子表
private int updateTemporaryPurchaseOrderChild(WarehouseStorageOrder warehouseStorageOrder) {
int result = 0;
String purchaseOrderCode = warehouseStorageOrder.getRelatedOrderCode();
List<WarehouseStorageOrderDetail> warehouseStorageOrderDetailList = warehouseStorageOrder.getWarehouseStorageOrderDetailList();
if (CollectionUtils.isEmpty(warehouseStorageOrderDetailList)){
return 0;
}
for (WarehouseStorageOrderDetail warehouseStorageOrderDetail : warehouseStorageOrderDetailList) {
PurchaseOrderChild purchaseOrderChild = new PurchaseOrderChild();
purchaseOrderChild.setPurchaseOrderCode(purchaseOrderCode);
purchaseOrderChild.setMaterialNo(warehouseStorageOrderDetail.getMaterialNo());
purchaseOrderChild = purchaseOrderChildMapper.selectPurchaseOrderChildByCodeAndNo(purchaseOrderChild);
purchaseOrderChild.setTemporaryNum(warehouseStorageOrderDetail.getTemporaryQualifiedNum());
result += purchaseOrderChildMapper.updatePurchaseOrderChild(purchaseOrderChild);
}
return result;
}
/**
* 修改保存暂收-委外单(委外入库)
* */
@ -1056,6 +1085,14 @@ public class WarehouseStorageOrderServiceImpl implements IWarehouseStorageOrderS
if (updateDetailResult != warehouseStorageOrder.getWarehouseStorageOrderDetailList().size()) {
throw new BusinessException("更新入库单明细记录失败");
}
//更新采购订单子表
int updatePurchaseOrderChildResult = updateTemporaryPurchaseOrderChild(warehouseStorageOrder);
if (updatePurchaseOrderChildResult != warehouseStorageOrder.getWarehouseStorageOrderDetailList().size()){
throw new BusinessException("更新采购订单子表记录失败");
}
int updateResult = warehouseStorageOrderMapper.updateWarehouseStorageOrder(warehouseStorageOrder);
if (updateResult <= 0) {
throw new BusinessException("更新入库单主记录失败");
@ -1134,7 +1171,7 @@ public class WarehouseStorageOrderServiceImpl implements IWarehouseStorageOrderS
private int updateTemporaryPurchaseDetails(WarehouseStorageOrder warehouseStorageOrder) {
int updateResultDetails = 0;
List<WarehouseStorageOrderDetail> details = warehouseStorageOrder.getWarehouseStorageOrderDetailList();
if (org.springframework.util.CollectionUtils.isEmpty(details)){
if (CollectionUtils.isEmpty(details)){
return 0;
}
for (WarehouseStorageOrderDetail detail : details) {

8
ruoyi-admin/src/main/resources/mapper/purchase/PurchaseOrderChildMapper.xml

@ -63,6 +63,14 @@
where purchase_order_code = #{purchaseOrderCode}
</select>
<select id="selectPurchaseOrderChildByCodeAndNo" parameterType="PurchaseOrderChild" resultMap="PurchaseOrderChildResult">
<include refid="selectPurchaseOrderChildVo"/>
where purchase_order_code = #{purchaseOrderCode}
and material_no = #{materialNo}
</select>
<insert id="insertPurchaseOrderChild" parameterType="PurchaseOrderChild" useGeneratedKeys="true" keyProperty="purchaseOrderChildId">
insert into purchase_order_child
<trim prefix="(" suffix=")" suffixOverrides=",">

Loading…
Cancel
Save