Przeglądaj źródła

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

ccjgmwz 3 lat temu
rodzic
commit
b344817f01

+ 9 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/controller/WarehouseBaseInfoController.java

@@ -129,5 +129,14 @@ public class WarehouseBaseInfoController {
     public List<ContractManagementInfo> selectContractNoList(String compId,Integer flag) {
         return warehouseBaseInfoService.selectContractNoList(compId,flag);
     }
+    /**
+     * 查出库时的成本
+     * @param contractNo,carNo
+     * @return
+     */
+    @GetMapping("/selectCost")
+    public Float selectCost(String contractNo,String carNo) {
+        return warehouseBaseInfoService.selectCost(contractNo,carNo);
+    }
 }
 

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

@@ -155,6 +155,10 @@ public class WarehouseInOutInfo extends BaseModel<WarehouseInOutInfo> {
      * 车牌号
      */
     private String carNo;
+    /**
+     * 成本
+     */
+    private Float weightedCost;
     /**
      * 箱号
      */

+ 7 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/IWarehouseBaseInfoService.java

@@ -90,4 +90,11 @@ public interface IWarehouseBaseInfoService extends IService<WarehouseBaseInfo> {
      * @return
      */
     List<WarehouseBaseInfo> selectWarehouseSelf(String compId,String personCharge);
+    /**
+     * 查出库时的成本
+     *
+     * @param contractNo
+     * @param carNo
+     */
+    Float selectCost(String contractNo,String carNo);
 }

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

@@ -111,6 +111,7 @@ public class IdentityAuthenticationInfoServiceImpl extends ServiceImpl<IdentityA
         }
         IdentityAuthenticationInfo identityAuthenticationInfo1 = this.selectOne(new EntityWrapper<IdentityAuthenticationInfo>()
                 .eq("customer_phone", identityAuthenticationInfo.getCustomerPhone())
+                .eq("customer_type_flag", identityAuthenticationInfo2.getCustomerTypeFlag())
                 .eq("delete_flag", "0"));
         //查询手机号存在,将其覆盖
         if (identityAuthenticationInfo1 != null) {
@@ -151,6 +152,7 @@ public class IdentityAuthenticationInfoServiceImpl extends ServiceImpl<IdentityA
         List<IdentityAuthenticationInfo> identityAuthenticationInfoList =
                 this.selectList(new EntityWrapper<IdentityAuthenticationInfo>()
                         .eq(IdentityAuthenticationInfo.QueryFiles.CUSTOMER_PHONE, identityAuthenticationInfo.getCustomerPhone())
+                        .eq("customer_type_flag", identityAuthenticationInfo.getCustomerTypeFlag())
                         .eq(IdentityAuthenticationInfo.QueryFiles.DELETE_FLAG, NumberConstant.CONSTANT0));
         //同一手机号再次被认证
         if (identityAuthenticationInfoList.size() > 0) {

+ 113 - 47
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/WarehouseBaseInfoServiceImpl.java

@@ -798,53 +798,53 @@ public class WarehouseBaseInfoServiceImpl extends ServiceImpl<WarehouseBaseInfoM
                 if (!CollectionUtils.isEmpty(tranCarInfoList)){
                     contractManagementInfo.setTranCarInfoList(tranCarInfoList);
                 }
-                //移库编号成本
-                if ("移库出库".equals(inOutWarehouseTask.getInOutType())) {
-                    //自动创建的临时库移库,成本为对应的合同单价
-                    ContractManagementInfo contractManagementInfo1 = contractManagementInfoService.selectOne(new EntityWrapper<ContractManagementInfo>()
-                            .eq("comp_id", inOutWarehouseTask.getCompId())
-                            .eq("contract_no", inOutWarehouseTask.getWarehouseName()));
-                    if (contractManagementInfo1 != null) {
-                        contractManagementInfo.setUnitContractPrice(contractManagementInfo1.getUnitContractPrice());
-                    }
-                    //其他类型移库,一个运输阶段成本加权,多个成本为空
-                    TranTaskInfo tranTaskInfo=tranTaskInfoService.selectOne(new EntityWrapper<TranTaskInfo>()
-                            .eq("comp_id", inOutWarehouseTask.getCompId())
-                            .eq("contract_no", inOutWarehouseTask.getMoveTaskNo()));
-                    if (tranTaskInfo!=null){
-                        List<TranProcessInfo> tranProcessInfoList=tranProcessInfoService.selectList(new EntityWrapper<TranProcessInfo>()
-                        .eq("info_id",tranTaskInfo.getId()));
-                        //只有一个汽运的运输阶段
-                        if (tranProcessInfoList.size()==1&&tranProcessInfoList.get(0).getTranTypeKey()=="1"){
-                            //成本为所选车辆出库时所在库的加权成本
-                            WarehouseBaseInfo warehouseBaseInfo=warehouseBaseInfoService.selectOne(new EntityWrapper<WarehouseBaseInfo>()
-                                    .eq("comp_id", inOutWarehouseTask.getCompId())
-                                    .eq("warehouse_name", inOutWarehouseTask.getWarehouseName()));
-                            if (warehouseBaseInfo!=null){
-                                CostManagementInfo costManagementInfo=costManagementInfoService.selectOne(new EntityWrapper<CostManagementInfo>()
-                                        .eq("warehouse_id", warehouseBaseInfo.getId()));
-                                if (costManagementInfo!=null){
-                                    contractManagementInfo.setUnitContractPrice(Double.valueOf(String.valueOf(costManagementInfo.getCost())));
-                                }
-                            }
-                        }
-                        else{
-                            contractManagementInfo.setUnitContractPrice(null);
-                        }
-                    }
-                }
-                else if ("退库".equals(inOutWarehouseTask.getInOutType())) {
-                    //自动创建的临时库退库,成本为对应的合同单价
-                    ContractManagementInfo contractManagementInfo1 = contractManagementInfoService.selectOne(new EntityWrapper<ContractManagementInfo>()
-                            .eq("comp_id", inOutWarehouseTask.getCompId())
-                            .eq("contract_no", inOutWarehouseTask.getWarehouseName()));
-                    if (contractManagementInfo1 != null) {
-                        contractManagementInfo.setUnitContractPrice(contractManagementInfo1.getUnitContractPrice());
-                    }
-                }
-                else{
-                    contractManagementInfo.setUnitContractPrice(null);
-                }
+//                //移库编号成本
+//                if ("移库出库".equals(inOutWarehouseTask.getInOutType())) {
+//                    //自动创建的临时库移库,成本为对应的合同单价
+//                    ContractManagementInfo contractManagementInfo1 = contractManagementInfoService.selectOne(new EntityWrapper<ContractManagementInfo>()
+//                            .eq("comp_id", inOutWarehouseTask.getCompId())
+//                            .eq("contract_no", inOutWarehouseTask.getWarehouseName()));
+//                    if (contractManagementInfo1 != null) {
+//                        contractManagementInfo.setUnitContractPrice(contractManagementInfo1.getUnitContractPrice());
+//                    }
+//                    //其他类型移库,一个运输阶段成本加权,多个成本为空
+//                    TranTaskInfo tranTaskInfo=tranTaskInfoService.selectOne(new EntityWrapper<TranTaskInfo>()
+//                            .eq("comp_id", inOutWarehouseTask.getCompId())
+//                            .eq("contract_no", inOutWarehouseTask.getMoveTaskNo()));
+//                    if (tranTaskInfo!=null){
+//                        List<TranProcessInfo> tranProcessInfoList=tranProcessInfoService.selectList(new EntityWrapper<TranProcessInfo>()
+//                        .eq("info_id",tranTaskInfo.getId()));
+//                        //只有一个汽运的运输阶段
+//                        if (tranProcessInfoList.size()==1&&tranProcessInfoList.get(0).getTranTypeKey()=="1"){
+//                            //成本为所选车辆出库时所在库的加权成本
+//                            WarehouseBaseInfo warehouseBaseInfo=warehouseBaseInfoService.selectOne(new EntityWrapper<WarehouseBaseInfo>()
+//                                    .eq("comp_id", inOutWarehouseTask.getCompId())
+//                                    .eq("warehouse_name", inOutWarehouseTask.getWarehouseName()));
+//                            if (warehouseBaseInfo!=null){
+//                                CostManagementInfo costManagementInfo=costManagementInfoService.selectOne(new EntityWrapper<CostManagementInfo>()
+//                                        .eq("warehouse_id", warehouseBaseInfo.getId()));
+//                                if (costManagementInfo!=null){
+//                                    contractManagementInfo.setUnitContractPrice(Double.valueOf(String.valueOf(costManagementInfo.getCost())));
+//                                }
+//                            }
+//                        }
+//                        else{
+//                            contractManagementInfo.setUnitContractPrice(null);
+//                        }
+//                    }
+//                }
+//                else if ("退库".equals(inOutWarehouseTask.getInOutType())) {
+//                    //自动创建的临时库退库,成本为对应的合同单价
+//                    ContractManagementInfo contractManagementInfo1 = contractManagementInfoService.selectOne(new EntityWrapper<ContractManagementInfo>()
+//                            .eq("comp_id", inOutWarehouseTask.getCompId())
+//                            .eq("contract_no", inOutWarehouseTask.getWarehouseName()));
+//                    if (contractManagementInfo1 != null) {
+//                        contractManagementInfo.setUnitContractPrice(contractManagementInfo1.getUnitContractPrice());
+//                    }
+//                }
+//                else{
+//                    contractManagementInfo.setUnitContractPrice(null);
+//                }
                 contractManagementInfo.setContractNo(inOutWarehouseTask.getMoveTaskNo());
                 contractManagementInfo.setContractPrice(inOutWarehouseTask.getUnitPrice());
                 contractManagementInfo.setInOutType("移库入库");
@@ -1033,4 +1033,70 @@ public class WarehouseBaseInfoServiceImpl extends ServiceImpl<WarehouseBaseInfoM
         }
         return warehouseBaseInfoList;
     }
+
+    @Override
+    public Float selectCost(String contractNo, String carNo) {
+        Float cost=0f;
+        String compId = "";
+        if (compId == null || compId.isEmpty()) {
+            compId = AuthSecurityUtils.getStaffById(AuthSecurityUtils.getCurrentUserId()).getCompId();
+        }
+        //采购合同
+        ContractManagementInfo contractManagementInfo = contractManagementInfoService.selectOne(new EntityWrapper<ContractManagementInfo>()
+                .eq("comp_id", compId)
+                .eq("delete_flag", "0")
+                .eq("contract_no", contractNo)
+                .eq("contract_type", "2")
+                .eq("status_flag", "1")
+                .eq("deliver_type", "2"));
+        if (contractManagementInfo!=null){
+            cost=Float.valueOf(String.valueOf(contractManagementInfo.getUnitContractPrice()));
+        }
+        //移库任务编号
+       InOutWarehouseTask inOutWarehouseTask = iInOutWarehouseTaskService.selectOne(new EntityWrapper<InOutWarehouseTask>()
+                .eq("comp_id", compId)
+                 .eq("move_task_no", contractNo)
+                .eq("delete_flag", "0")
+                .eq("task_type_key", "3")
+                .eq("in_out_flag", "1"));
+        if (inOutWarehouseTask!=null){
+            if("移库出库".equals(inOutWarehouseTask.getInOutType())) {
+                //自动创建的临时库移库,成本为对应的合同单价
+                ContractManagementInfo contractManagementInfo1 = contractManagementInfoService.selectOne(new EntityWrapper<ContractManagementInfo>()
+                        .eq("comp_id", inOutWarehouseTask.getCompId())
+                        .eq("contract_no", inOutWarehouseTask.getWarehouseName()));
+                if (contractManagementInfo1 != null) {
+                    cost = Float.valueOf(String.valueOf(contractManagementInfo1.getUnitContractPrice()));
+                }
+                //其他类型移库,一个运输阶段成本加权,多个成本为空
+                TranTaskInfo tranTaskInfo = tranTaskInfoService.selectOne(new EntityWrapper<TranTaskInfo>()
+                        .eq("comp_id", inOutWarehouseTask.getCompId())
+                        .eq("contract_no", inOutWarehouseTask.getMoveTaskNo()));
+                if (tranTaskInfo != null) {
+                    List<TranProcessInfo> tranProcessInfoList = tranProcessInfoService.selectList(new EntityWrapper<TranProcessInfo>()
+                            .eq("info_id", tranTaskInfo.getId()));
+                    //只有一个汽运的运输阶段
+                    if (tranProcessInfoList.size() == 1 && tranProcessInfoList.get(0).getTranTypeKey() == "1") {
+                        //成本为所选车辆出库时所在库的加权成本
+                        WarehouseInOutInfo warehouseInOutInfo = warehouseInOutInfoService.selectOne(new EntityWrapper<WarehouseInOutInfo>()
+                                .eq("car_no", carNo).eq("comp_id", compId)
+                                .eq("contract_no", contractNo));
+                        if (warehouseInOutInfo != null) {
+                            cost = warehouseInOutInfo.getWeightedCost();
+                        }
+                    }
+                }
+            }
+            else if ("退库".equals(inOutWarehouseTask.getInOutType())) {
+                //自动创建的临时库退库,成本为对应的合同单价
+                ContractManagementInfo contractManagementInfo1 = contractManagementInfoService.selectOne(new EntityWrapper<ContractManagementInfo>()
+                        .eq("comp_id", inOutWarehouseTask.getCompId())
+                        .eq("contract_no", inOutWarehouseTask.getWarehouseName()));
+                if (contractManagementInfo1 != null) {
+                    cost=Float.valueOf(String.valueOf(contractManagementInfo1.getUnitContractPrice()));
+                }
+            }
+        }
+        return cost;
+    }
 }

+ 32 - 5
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/WarehouseInOutInfoServiceImpl.java

@@ -309,8 +309,8 @@ public class WarehouseInOutInfoServiceImpl extends ServiceImpl<WarehouseInOutInf
                         weightedDetails.setCostBefore(weightedDetailsList.get(0).getCostBefore());
                     }
                     // 计算新加权成本
-                    Float newCost = 0f;
-                    if ("干粮".equals(warehouseInOutInfo.getTaskType())) {
+                    float newCost = 0f;
+                    if ("干粮".equals(warehouseInOutInfo.getType())) {
                         newCost = ((warehouseInOutInfo.getCost() + warehouseInOutInfo.getFreight()) * warehouseInOutInfo.getNetWeight() + original * weightedDetails.getCostBefore()) / (warehouseInOutInfo.getNetWeight() + original);
 
                     } else {
@@ -382,6 +382,13 @@ public class WarehouseInOutInfoServiceImpl extends ServiceImpl<WarehouseInOutInf
                         else {
                             throw new YException(YExceptionEnum.POSITION_NO_ERROR);
                         }
+                        //出库时打入成本
+                        CostManagementInfo costManagementInfo = costManagementInfoService.selectOne(new EntityWrapper<CostManagementInfo>().eq("warehouse_id", warehouseInOutInfo.getBaseId())
+                                .eq("goods_name_key", warehouseInOutInfo.getGoodsNameKey()));
+                        if (costManagementInfo!=null){
+                            warehouseInOutInfo.setWeightedCost(costManagementInfo.getCost());
+                            warehouseInOutInfoService.updateById(warehouseInOutInfo);
+                        }
                     }
                     //仓库不存在
                     else {
@@ -391,6 +398,13 @@ public class WarehouseInOutInfoServiceImpl extends ServiceImpl<WarehouseInOutInf
                 //临时库出库
                 else if ("1".equals(warehouseInOutInfo.getInOutFlag()) && "2".equals(warehouseBaseInfo.getWarehouseType())) {
                     if (warehouseBaseInfo != null) {
+                        //出库时打入成本
+                        CostManagementInfo costManagementInfo = costManagementInfoService.selectOne(new EntityWrapper<CostManagementInfo>().eq("warehouse_id", warehouseInOutInfo.getBaseId())
+                                .eq("goods_name_key", warehouseInOutInfo.getGoodsNameKey()));
+                        if (costManagementInfo!=null){
+                            warehouseInOutInfo.setWeightedCost(costManagementInfo.getCost());
+                            warehouseInOutInfoService.updateById(warehouseInOutInfo);
+                        }
                         //定义入库
                         String inNetWeight = "";
                         // 查询入库量
@@ -510,7 +524,7 @@ public class WarehouseInOutInfoServiceImpl extends ServiceImpl<WarehouseInOutInf
                         }
                         // 计算新加权成本
                         Float newCost = 0f;
-                        if ("干粮".equals(warehouseInOutInfo.getTaskType())) {
+                        if ("干粮".equals(warehouseInOutInfo.getType())) {
                             newCost = ((warehouseInOutInfo.getCost() + warehouseInOutInfo.getFreight()) * warehouseInOutInfo.getNetWeight() + original * weightedDetails.getCostBefore()) / (warehouseInOutInfo.getNetWeight() + original);
 
                         } else {
@@ -518,7 +532,6 @@ public class WarehouseInOutInfoServiceImpl extends ServiceImpl<WarehouseInOutInf
 
                         }
                         weightedDetails.setCostAfter(newCost);
-
                         weightedDetailsService.insert(weightedDetails);
                         // 修改成本信息表
                         CostManagementInfo costManagementInfo = costManagementInfoService.selectOne(new EntityWrapper<CostManagementInfo>().eq("warehouse_id", weightedDetails.getWarehouseId())
@@ -821,6 +834,13 @@ public class WarehouseInOutInfoServiceImpl extends ServiceImpl<WarehouseInOutInf
                             workflowService.activateInstance(salesDeliveryReport.getWorkflowId(), salesDeliveryReport.getId());
                         }
                     } else {
+                        //出库时打入成本
+                        CostManagementInfo costManagementInfo = costManagementInfoService.selectOne(new EntityWrapper<CostManagementInfo>().eq("warehouse_id", warehouseInOutInfo.getBaseId())
+                                .eq("goods_name_key", warehouseInOutInfo.getGoodsNameKey()));
+                        if (costManagementInfo!=null){
+                            warehouseInOutInfo.setWeightedCost(costManagementInfo.getCost());
+                            warehouseInOutInfoService.updateById(warehouseInOutInfo);
+                        }
                         //现货销售统计
                         StockSaleReceiptReport stockSaleReceiptReport = new StockSaleReceiptReport();
                         stockSaleReceiptReport.setId(IdGenerator.generateUUID());
@@ -951,7 +971,7 @@ public class WarehouseInOutInfoServiceImpl extends ServiceImpl<WarehouseInOutInf
                         }
                         // 计算新加权成本
                         Float newCost = 0f;
-                        if ("干粮".equals(warehouseInOutInfo.getTaskType())) {
+                        if ("干粮".equals(warehouseInOutInfo.getType())) {
                             newCost = ((warehouseInOutInfo.getCost() + warehouseInOutInfo.getFreight()) * warehouseInOutInfo.getNetWeight() + original * weightedDetails.getCostBefore()) / (warehouseInOutInfo.getNetWeight() + original);
 
                         } else {
@@ -1290,6 +1310,13 @@ public class WarehouseInOutInfoServiceImpl extends ServiceImpl<WarehouseInOutInf
                                 stockSaleReceiptReport.setReturnFlag("1");
                             }
                         }
+                        //出库时打入成本
+                        CostManagementInfo costManagementInfo = costManagementInfoService.selectOne(new EntityWrapper<CostManagementInfo>().eq("warehouse_id", warehouseInOutInfo.getBaseId())
+                                .eq("goods_name_key", warehouseInOutInfo.getGoodsNameKey()));
+                        if (costManagementInfo!=null){
+                            warehouseInOutInfo.setWeightedCost(costManagementInfo.getCost());
+                            warehouseInOutInfoService.updateById(warehouseInOutInfo);
+                        }
                         stockSaleReceiptReportService.insert(stockSaleReceiptReport);
                         boolean isStartWorkflow = org.apache.commons.lang3.StringUtils.isBlank(stockSaleReceiptReport.getWorkflowId());
                         // 不是退回的单子