Bläddra i källkod

Merge branch 'master' of http://47.100.3.209:3000/gdc/yiliangyiyun

ccj 1 år sedan
förälder
incheckning
c2292e7c57

+ 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() {

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

@@ -90,6 +90,16 @@ public class CostManagementInfo extends BaseModel<CostManagementInfo> {
 
     @TableField(exist = false)
     private String searchMoth;
+    /**
+     * 货权转入重量
+     */
+    @TableField(exist = false)
+    private Double cargoWeight;
+    /**
+     * 待赎回重量
+     */
+    @TableField(exist = false)
+    private Double redemptionWeight;
     @Override
     protected Serializable pkVal() {
         return this.id;

+ 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;

+ 8 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/entity/view/WarehouseNumView.java

@@ -20,6 +20,14 @@ public class WarehouseNumView {
      * 出库量
      */
     private String outNetWeight;
+    /**
+     * 货权转入重量
+     */
+    private String cargoWeight;
+    /**
+     * 待赎回重量
+     */
+    private String redemptionWeight;
     /**
      * 应余量
      */

+ 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"));

+ 25 - 1
winsea-haixin-plugin-yiliangyiyun/src/main/resources/mapper/CostManagementInfoMapper.xml

@@ -42,7 +42,31 @@
         AND wo.delete_flag = 0
         AND wbi.comp_id = wo.comp_id
         and wo.goods_name = IFNULL( wpsi.goods_name, cgi.goods_name )
-        ) AS cost
+        ) AS cost,
+        (
+        SELECT
+        ifnull(sum( wo.surplus_weight ),0)
+        FROM
+        warehousing_order wo
+        WHERE
+        wo.warehouse_name = wbi.warehouse_name
+        AND wo.delete_flag = 0
+        AND wbi.comp_id = wo.comp_id
+        and wo.goods_name = wpsi.goods_name
+        and wo.in_type = '货转'
+        ) AS cargoWeight,
+        (
+        SELECT
+        ifnull(sum( wo.transfer_out_weight ),0)
+        FROM
+        warehousing_order wo
+        WHERE
+        wo.warehouse_name = wbi.warehouse_name
+        AND wo.delete_flag = 0
+        AND wbi.comp_id = wo.comp_id
+        and wo.goods_name = wpsi.goods_name
+        and wo.redeem_flag = '赎'
+        ) AS redemptionWeight
         FROM
         warehouse_base_info wbi
         LEFT JOIN warehouse_position_info wpi ON wpi.base_id = wbi.id

+ 44 - 20
winsea-haixin-plugin-yiliangyiyun/src/main/resources/mapper/WarehouseBaseInfoMapper.xml

@@ -595,27 +595,51 @@
     <select id="getReservesWarehouseListByCondition" parameterType="Map"
             resultType="com.yh.saas.plugin.yiliangyiyun.entity.view.WarehouseNumView">
         SELECT
-        	wpsi.goods_name AS goodsName,
-        	sum( wpsi.STORAGE ) AS stockNum,
-            (
-            SELECT
-            ROUND( AVG( wo.avg_cost ), 3 )
-            FROM
-            warehousing_order wo
-            WHERE
-            wo.warehouse_name = wbi.warehouse_name
-            AND wo.delete_flag = 0
-            AND wbi.comp_id = wo.comp_id
-            and wo.goods_name = wpsi.goods_name
-            ) AS cost
+        wpsi.goods_name AS goodsName,
+        sum( wpsi.STORAGE ) AS stockNum,
+        (
+        SELECT
+        ROUND( AVG( wo.avg_cost ), 3 )
+        FROM
+        warehousing_order wo
+        WHERE
+        wo.warehouse_name = wbi.warehouse_name
+        AND wo.delete_flag = 0
+        AND wbi.comp_id = wo.comp_id
+        and wo.goods_name = wpsi.goods_name
+        ) AS cost,
+        (
+        SELECT
+        ifnull(sum( wo.surplus_weight ),0)
+        FROM
+        warehousing_order wo
+        WHERE
+        wo.warehouse_name = wbi.warehouse_name
+        AND wo.delete_flag = 0
+        AND wbi.comp_id = wo.comp_id
+        and wo.goods_name = wpsi.goods_name
+        and wo.in_type = '货转'
+        ) AS cargoWeight,
+        (
+        SELECT
+        ifnull(sum( wo.transfer_out_weight ),0)
+        FROM
+        warehousing_order wo
+        WHERE
+        wo.warehouse_name = wbi.warehouse_name
+        AND wo.delete_flag = 0
+        AND wbi.comp_id = wo.comp_id
+        and wo.goods_name = wpsi.goods_name
+        and wo.redeem_flag = '赎'
+        ) AS redemptionWeight
         FROM
-        	warehouse_base_info wbi
-        	LEFT JOIN warehouse_position_info wpi ON wpi.base_id = wbi.id
-        	AND wpi.delete_flag = 0
-        	LEFT JOIN warehouse_position_storage_info wpsi ON wpsi.position_id = wpi.id
-        	AND wpsi.delete_flag = 0
+        warehouse_base_info wbi
+        LEFT JOIN warehouse_position_info wpi ON wpi.base_id = wbi.id
+        AND wpi.delete_flag = 0
+        LEFT JOIN warehouse_position_storage_info wpsi ON wpsi.position_id = wpi.id
+        AND wpsi.delete_flag = 0
         WHERE
-        	wpsi.id IS NOT NULL
+        wpsi.id IS NOT NULL
         <if test="compId != null and compId != ''">
             AND wbi.comp_id= #{compId}
         </if>
@@ -623,7 +647,7 @@
             AND wbi.warehouse_name= #{warehouseName}
         </if>
         GROUP BY
-        	wpsi.goods_name
+        wpsi.goods_name
 
     </select>
 

+ 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