zhangyuewww 1 year ago
parent
commit
a2d12a15ee

+ 5 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/entity/CargoTitleDetails.java

@@ -201,6 +201,11 @@ public class CargoTitleDetails extends BaseModel<CargoTitleDetails> {
      */
     @TableField(exist = false)
     private String bankBranch;
+    /**
+     * 待赎回合同数组
+     */
+    @TableField(exist = false)
+    private List<CargoTitleDetails> redeemContractNoList;
 
     @Override
     protected Serializable pkVal() {

+ 5 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/entity/SourceRelationInfo.java

@@ -121,6 +121,11 @@ public class SourceRelationInfo extends BaseModel<SourceRelationInfo> {
      * 合同编号
      */
     private String contractNo;
+    /**
+     * 入库单类型
+     */
+    @TableField(exist = false)
+    private String inType;
     @Override
     protected Serializable pkVal() {
         return this.id;

+ 13 - 12
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/CargoTitleDetailsServiceImpl.java

@@ -357,19 +357,20 @@ public class CargoTitleDetailsServiceImpl extends ServiceImpl<CargoTitleDetailsM
         String transferOutNo = "HQZR"+df.format(new Date())+newNo;
         cargoTitleDetails.setTransferOutNo(transferOutNo);
         //货权赎回
-        if (cargoTitleDetails.getRedeemContractNo()!=null){
-            ContractManagementInfo contractManagementInfo=contractManagementInfoService.selectOne(new EntityWrapper<ContractManagementInfo>()
-                    .eq("comp_id",cargoTitleDetails.getCompId())
-                    .eq("contract_no",cargoTitleDetails.getRedeemContractNo()));
-            if (contractManagementInfo!=null){
-                //本次赎回大于待赎回时 全部赎回
-                if (cargoTitleDetails.getTransferOutWeight()>(contractManagementInfo.getExpectedRedemption()-contractManagementInfo.getRedeemed())){
-                    contractManagementInfo.setRedeemed(contractManagementInfo.getExpectedRedemption());
-                }
-                else {
-                    contractManagementInfo.setRedeemed(contractManagementInfo.getRedeemed() + cargoTitleDetails.getTransferOutWeight());
+        if (!CollectionUtils.isEmpty(cargoTitleDetails.getRedeemContractNoList())){
+            for (CargoTitleDetails cargoTitleDetails1:cargoTitleDetails.getRedeemContractNoList()) {
+                ContractManagementInfo contractManagementInfo = contractManagementInfoService.selectOne(new EntityWrapper<ContractManagementInfo>()
+                        .eq("comp_id", cargoTitleDetails.getCompId())
+                        .eq("contract_no", cargoTitleDetails1.getRedeemContractNo()));
+                if (contractManagementInfo != null) {
+                    //本次赎回大于待赎回时 全部赎回
+                    if (cargoTitleDetails1.getTransferOutWeight() > (contractManagementInfo.getExpectedRedemption() - contractManagementInfo.getRedeemed())) {
+                        contractManagementInfo.setRedeemed(contractManagementInfo.getExpectedRedemption());
+                    } else {
+                        contractManagementInfo.setRedeemed(contractManagementInfo.getRedeemed() + cargoTitleDetails1.getTransferOutWeight());
+                    }
+                    contractManagementInfoService.updateById(contractManagementInfo);
                 }
-                contractManagementInfoService.updateById(contractManagementInfo);
             }
         }
         List<CargoPositionDetails> cargoPositionDetailsList = cargoTitleDetails.getCargoPositionDetailsList();

+ 1 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/InOutWarehouseTaskServiceImpl.java

@@ -122,6 +122,7 @@ public class InOutWarehouseTaskServiceImpl extends ServiceImpl<InOutWarehouseTas
                                 .eq("comp_id",inOutWarehouseTask.getCompId())
                                 .eq("warehouse_name",inOutWarehouseTask.getWarehouseName())
                                 .eq("goods_name",sourceRelationInfo.getGoodsName())
+                                .eq("in_type",sourceRelationInfo.getInType())
                                 .gt("surplus_weight",0)
                                 .eq("contract_no",sourceRelationInfo.getContractNo())
                                 .orderBy("issuing_time"));

+ 3 - 1
winsea-haixin-plugin-yiliangyiyun/src/main/resources/mapper/WarehousingOrderMapper.xml

@@ -401,6 +401,7 @@
         AND wo1.surplus_weight > 0
         AND wo1.warehouse_name = wo.warehouse_name
         AND wo1.goods_name = wo.goods_name
+        AND wo1.in_type = wo.in_type
         ) AS surplusWeight,
         (
         SELECT
@@ -414,6 +415,7 @@
         AND wo2.delete_flag = 0
         AND wo2.comp_id = wo.comp_id
         AND wo2.surplus_weight > 0
+        AND wo2.in_type = wo.in_type
         ) AS avgCost,
         wo.issuing_time AS issuingTimeElse,
         wo.issuing_time AS issuingTimeOther
@@ -445,7 +447,7 @@
             AND  wo.base_id= #{baseId}
         </if>
         GROUP BY
-        wo.contract_no,wo.goods_name
+        wo.contract_no,wo.goods_name,wo.in_type
         <if test="flag != null and flag != ''">
             <if test="flag == 0">
                 order by  wo.issuing_time