瀏覽代碼

销售合同交期

yzc 1 年之前
父節點
當前提交
cf37883882

+ 2 - 2
hx-item/src/main/java/com/fjhx/item/service/product/impl/ProductInfoServiceImpl.java

@@ -438,10 +438,10 @@ public class ProductInfoServiceImpl extends ServiceImpl<ProductInfoMapper, Produ
             else if (ProductAvailableRecordType.SALE_UPDATE.equals(businessType)) {
                 BigDecimal newQuantity = inOutBo.getNewQuantity();
 
-                //后>前 可用=可用+(后-前)
+                //后>前 可用=可用-(后-前)
                 if (newQuantity.compareTo(inOutBo.getQuantity()) > 0) {
                     BigDecimal subtract = newQuantity.subtract(inOutBo.getQuantity());
-                    availableQuantity = availableQuantity.add(subtract);
+                    availableQuantity = availableQuantity.subtract(subtract);
 
                     //计数需要采购的数量(需采购量 = 安全库存 - (可用库存 - 合同量)若 需采购量<0,则按0算不采购)
                     BigDecimal subtract1 = availableQuantity.subtract(subtract);

+ 11 - 0
hx-sale/src/main/java/com/fjhx/sale/entity/contract/dto/ContractSelectDto.java

@@ -4,6 +4,8 @@ import com.ruoyi.common.core.domain.BaseSelectDto;
 import lombok.Getter;
 import lombok.Setter;
 
+import java.util.Date;
+
 /**
  * 外销合同表列表查询入参实体
  *
@@ -98,4 +100,13 @@ public class ContractSelectDto extends BaseSelectDto {
      * 销售部门id
      */
     private Long deptId;
+
+    /**
+     * 交期开始
+     */
+    private Date deliveryTimeSta;
+    /**
+     * 交期结束
+     */
+    private Date deliveryTimeEnd;
 }

+ 12 - 1
hx-sale/src/main/java/com/fjhx/sale/flow/ContractUpdateFlow.java

@@ -116,13 +116,14 @@ public class ContractUpdateFlow extends FlowDelegate {
 
         //清空bomId
         for (ContractProductDto contractProductDto : contractProductList) {
+            contractProductDto.setId(null);
+
             List<ContractProductBom> contractProductBomList = contractProductDto.getContractProductBomList();
             contractProductBomList = ObjectUtils.isEmpty(contractProductBomList) ? new ArrayList<>() : contractProductBomList;
             contractProductBomList.forEach(item -> item.setId(null));
         }
 
         //清空id
-        contractProductList.forEach(item -> item.setId(null));
         contractProjectList.forEach(item -> item.setId(null));
 
 
@@ -160,6 +161,14 @@ public class ContractUpdateFlow extends FlowDelegate {
             editAvailableStock(oldContract, oldContractId, businessId);
         }
         //-----------------
+        //交换合同产品BOM中的合同id
+        List<ContractProductBom> oldCpbList = contractProductBomService.list(q -> q.eq(ContractProductBom::getContractId, oldContractId));
+        List<ContractProductBom> newCpbList = contractProductBomService.list(q -> q.eq(ContractProductBom::getContractId, businessId));
+        oldCpbList.forEach(item -> item.setContractId(businessId));
+        newCpbList.forEach(item -> item.setContractId(oldContractId));
+        contractProductBomService.updateBatchById(oldCpbList);
+        contractProductBomService.updateBatchById(newCpbList);
+        //-----------------
 
         //替换新数据ID为临时ID
         long temNewId = IdWorker.getId();
@@ -224,6 +233,8 @@ public class ContractUpdateFlow extends FlowDelegate {
         }
         ObsFileUtil.exchangeBusinessId(oldContractId, businessId);
 
+//        throw new ServiceException("1111111111111111111111111");
+
     }
 
     void editAvailableStock(Contract oldContract, Long oldContractId, Long businessId) {

+ 4 - 0
hx-sale/src/main/java/com/fjhx/sale/service/contract/impl/ContractServiceImpl.java

@@ -391,6 +391,10 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
 
         //过滤作废的数据
         wrapper.ne("t1", Contract::getStatus, FlowStatusEnum1.CANCELLATION.getKey());
+
+        //交期时间范围过滤
+        wrapper.ge("t1", Contract::getDeliveryTime, dto.getDeliveryTimeSta());
+        wrapper.le("t1", Contract::getDeliveryTime, dto.getDeliveryTimeEnd());
     }
 
     /**