zhangyuewww 2 年之前
父节点
当前提交
fab45d0f01

+ 13 - 1
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/entity/ContractManagementInfo.java

@@ -47,7 +47,7 @@ public class ContractManagementInfo extends BaseModel<ContractManagementInfo> {
      */
     private String contractNo;
     /**
-     * 合同类型(1销售2采购)
+     * 合同类型(1销售2采购3收购)
      */
     private String contractType;
     /**
@@ -74,6 +74,18 @@ public class ContractManagementInfo extends BaseModel<ContractManagementInfo> {
      * 运输方式
      */
     private String shippingType;
+    /**
+     * 交易主体
+     */
+    private String transactionSubject;
+    /**
+     * 中转公司
+     */
+    private String transitCompany;
+    /**
+     * 结算单价
+     */
+    private Double settlementPrice;
     /**
      * 结算方式
      */

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

@@ -476,6 +476,16 @@ public class WeighingManagement extends BaseModel<WeighingManagement> {
      */
     @TableField(exist = false)
     private Double settleMoney;
+    /**
+     * 已完成量(吨)
+     */
+    @TableField(exist = false)
+    private Double completedQuantity;
+    /**
+     * 重量(吨)
+     */
+    @TableField(exist = false)
+    private Float weight;
     @Override
     protected Serializable pkVal() {
         return this.id;

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

@@ -316,6 +316,34 @@ public class ContractManagementInfoServiceImpl extends ServiceImpl<ContractManag
                     workflowService.activateInstance(contractManagementInfo.getWorkflowId(), contractManagementInfo.getId());
                 }
 
+            }
+            //收购合同
+            else if("3".equals(contractManagementInfo.getContractType())){
+                boolean isStartWorkflow = StringUtils.isBlank(contractManagementInfo.getWorkflowId());
+                // 不是退回的单子
+                if (isStartWorkflow) {
+                    Workflow workflow = workflowService
+                            .findLatestWorkflowByBusinessCodeByApp(contractManagementInfo.getCompId(), "SHOU-CONTRACT-APPROVE");
+                    // 没配置审核流程,直接结束并处理信息
+                    if (workflow == null) {
+                        throw new YException(YExceptionEnum.PURCHASE_ORDER_ERROR);
+                    }
+                    // 开启审核流
+                    else {
+
+                        // 设置状态 已提交审核
+                        contractManagementInfo.setWorkflowId(workflow.getId());
+                        this.updateById(contractManagementInfo);
+                        workflowService.startInstance(workflow.getId(), contractManagementInfo.getId());
+                    }
+                }
+                // 退回的单子 再启用
+                else {
+
+                    this.updateById(contractManagementInfo);
+                    workflowService.activateInstance(contractManagementInfo.getWorkflowId(), contractManagementInfo.getId());
+                }
+
             }
             //代收合同
             else {
@@ -386,6 +414,20 @@ public class ContractManagementInfoServiceImpl extends ServiceImpl<ContractManag
                 warehouseBaseInfo.setOtherPersonPhone(contractManagementInfo.getPersonPhone());
                 warehouseBaseInfoService.updateById(warehouseBaseInfo);
             }
+            //收购任务重量随合同重量变化
+            if("3".equals(contractManagementInfo.getContractType())){
+                //一个收购合同只能选一次
+                InOutWarehouseTask inOutWarehouseTask=inOutWarehouseTaskService.selectOne(new EntityWrapper<InOutWarehouseTask>()
+                        .eq("comp_id", contractManagementInfo.getCompId())
+                        .eq("contract_no", contractManagementInfo.getContractNo())
+                        .eq("delete_flag", "0")
+                        .eq("task_type_key", "3")
+                        .orderBy("update_date", false));
+                if (inOutWarehouseTask!=null){
+                    inOutWarehouseTask.setWeight(contractManagementInfo.getWeight());
+                    inOutWarehouseTaskService.updateById(inOutWarehouseTask);
+                }
+            }
             // 根据类型进入审核
 //            if ("1".equals(contractManagementInfo.getGoodsType())) {
 //                if ("1".equals(contractManagementInfo.getContractType())) {

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

@@ -1486,6 +1486,33 @@ public class WarehouseBaseInfoServiceImpl extends ServiceImpl<WarehouseBaseInfoM
             cacheComponent.putRaw(Const.ADMIN_CONTRACTINFO+compId+flag,JSONObject.toJSONString(temp),60*60*24);
             return temp;
         }
+        //收购合同
+        else if (flag == 9) {
+            List<ContractManagementInfo> contractManagementInfoList = contractManagementInfoService.selectList(new EntityWrapper<ContractManagementInfo>()
+                    .eq("comp_id", compId)
+                    .eq("contract_type", "3")
+                    .eq("status_flag", "1")
+                    .eq("delete_flag", "0")
+                    .orderBy("update_date", false));
+            for (ContractManagementInfo contractManagementInfo : contractManagementInfoList) {
+                //一个收购合同只能选一次
+                InOutWarehouseTask inOutWarehouseTask=iInOutWarehouseTaskService.selectOne(new EntityWrapper<InOutWarehouseTask>()
+                        .eq("comp_id", contractManagementInfo.getCompId())
+                        .eq("contract_no", contractManagementInfo.getContractNo())
+                        .eq("delete_flag", "0")
+                        .eq("task_type_key", "3")
+                        .orderBy("update_date", false));
+                if (inOutWarehouseTask==null){
+                    ContractGoodsInfo contractGoodsInfo = contractGoodsInfoService.selectOne(new EntityWrapper<ContractGoodsInfo>()
+                            .eq("contract_id", contractManagementInfo.getId()));
+                    contractManagementInfo.setGoodsName(contractGoodsInfo.getGoodsName());
+                    contractManagementInfo.setGoodsNameKey(contractGoodsInfo.getGoodsNameKey());
+                    temp.add(contractManagementInfo);
+                }
+            }
+            cacheComponent.putRaw(Const.ADMIN_CONTRACTINFO+compId+flag,JSONObject.toJSONString(temp),60*60*24);
+            return temp;
+        }
         //查采购、销售合同编号,以及移库任务编号
         else {
             List<ContractManagementInfo> contractManagementInfoList = contractManagementInfoService.selectList(new EntityWrapper<ContractManagementInfo>()

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

@@ -161,6 +161,13 @@ public class WeighingManagementServiceImpl extends ServiceImpl<WeighingManagemen
                         weighingManagement1.setQualityInspectionManagement(qualityInspectionManagement);
                         WarehouseInOutInfo warehouseInOutInfo=warehouseInOutInfoService.selectById(qualityInspectionManagement.getWarehouseInOutId());
                         if (warehouseInOutInfo!=null){
+                            InOutWarehouseTask inOutWarehouseTask=inOutWarehouseTaskService.selectOne(new EntityWrapper<InOutWarehouseTask>()
+                                    .eq("in_out_task_no",warehouseInOutInfo.getInOutTaskNo())
+                                    .eq("comp_id",weighingManagement1.getCompId()));
+                            if (inOutWarehouseTask!=null){
+                                weighingManagement1.setCompletedQuantity(inOutWarehouseTask.getCompletedQuantity());
+                                weighingManagement1.setWeight(inOutWarehouseTask.getWeight());
+                            }
                             weighingManagement1.setTranCarNo(warehouseInOutInfo.getTranCarNo());
                             WarehouseInOutDetail warehouseInOutDetail=warehouseInOutDetailService.selectOne(new EntityWrapper<WarehouseInOutDetail>()
                                     .eq("info_id", warehouseInOutInfo.getId()));