瀏覽代碼

审批系统修改

liujiankang 6 年之前
父節點
當前提交
09ff5eb047

+ 10 - 0
watero-rst-core/src/main/java/com.iamberry.rst.core/approval/ApprovalApplyPickItem.java

@@ -31,6 +31,8 @@ public class ApprovalApplyPickItem implements Serializable{
     private String itemProductUnit;
     //箱数/套数
     private Integer itemProductBoxNumber;
+    //生产审批订单项id
+    private Integer productionItemId;
     //创建时间
     @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
     @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
@@ -156,4 +158,12 @@ public class ApprovalApplyPickItem implements Serializable{
     public void setItemExternalModel(String itemExternalModel) {
         this.itemExternalModel = itemExternalModel;
     }
+
+    public Integer getProductionItemId() {
+        return productionItemId;
+    }
+
+    public void setProductionItemId(Integer productionItemId) {
+        this.productionItemId = productionItemId;
+    }
 }

+ 9 - 0
watero-rst-core/src/main/java/com.iamberry.rst.core/approval/ApprovalProductionItem.java

@@ -22,6 +22,7 @@ public class ApprovalProductionItem implements Serializable{
     private Integer itemActualStorage;//实际入库数量
     private Integer itemShouldStorage;//应入库数量
     private Integer itemLackNumber;//缺少数量
+    private Integer itemCanpickNumber;//可提货数量
     private Date itemCreateTime;
     private Date itemUpdateTime;
 
@@ -154,4 +155,12 @@ public class ApprovalProductionItem implements Serializable{
     public void setItemExternalModel(String itemExternalModel) {
         this.itemExternalModel = itemExternalModel;
     }
+
+    public Integer getItemCanpickNumber() {
+        return itemCanpickNumber;
+    }
+
+    public void setItemCanpickNumber(Integer itemCanpickNumber) {
+        this.itemCanpickNumber = itemCanpickNumber;
+    }
 }

+ 11 - 2
watero-rst-service/src/main/java/com/iamberry/rst/service/approval/ApplyPickServiceImpl.java

@@ -112,8 +112,8 @@ public class ApplyPickServiceImpl  implements ApplyPickService {
             List<ApprovalProductionItem> approvalProductionItemList = approvalProductionMapper.getApprovalProductionItemList(approvalProductionItem);
             approvalProductionItem = approvalProductionItemList.get(0);
 
-            if(approvalApplyPickItem.getItemProductNum() > approvalProductionItem.getItemProductNum() ){
-                throw new RuntimeException(approvalProductionItem.getItemProductName()+"("+ approvalProductionItem.getItemColorName() +")"+"的提货数量不能大于"+approvalProductionItem.getItemProductNum());
+            if(approvalApplyPickItem.getItemProductNum() > approvalProductionItem.getItemCanpickNumber() ){
+                throw new RuntimeException(approvalProductionItem.getItemProductName()+"("+ approvalProductionItem.getItemColorName() +")"+"的提货数量不能大于可提货数量"+approvalProductionItem.getItemProductNum());
             }
             approvalApplyPickItem.setProductId(approvalProductionItem.getProductId());
             approvalApplyPickItem.setItemProductName(approvalProductionItem.getItemProductName());
@@ -123,6 +123,15 @@ public class ApplyPickServiceImpl  implements ApplyPickService {
             approvalApplyPickItem.setItemProductUnit(approvalProductionItem.getItemProductUnit());
             approvalApplyPickItem.setItemProductBoxNumber(approvalProductionItem.getItemProductBoxNumber());
             approvalApplyPickItem.setItemExternalModel(approvalProductionItem.getItemExternalModel());
+            approvalApplyPickItem.setProductionItemId(approvalProductionItem.getItemId());
+
+            //修改生产审批项可提货数量
+            ApprovalProductionItem  productionItem = new ApprovalProductionItem();
+            productionItem.setItemId(approvalApplyPickItem.getItemId());
+            productionItem.setItemCanpickNumber(approvalProductionItem.getItemCanpickNumber()-approvalApplyPickItem.getItemProductNum());
+            if(approvalOrderMapper.updateProductionItem(productionItem) < 1){
+                throw new RuntimeException("修改生产审批项可提货数量失败----itemId="+approvalApplyPickItem.getItemId());
+            }
         }
         flag = applyPickItemMapper.saveList(approvalApplyPick.getListApplyPickItem());
         if(flag < 1){

+ 20 - 0
watero-rst-service/src/main/java/com/iamberry/rst/service/approval/ApprovalOrderServiceImpl.java

@@ -275,6 +275,7 @@ public class ApprovalOrderServiceImpl implements ApprovalOrderService {
             /*productionItem.setItemShouldStorage(productionItem.getItemLackNumber());*/
             productionItem.setItemLackNumber(productionItem.getItemLackNumber() - jsonRecords.getInt("actualStorage"));
             productionItem.setItemActualStorage(productionItem.getItemActualStorage()+jsonRecords.getInt("actualStorage"));
+            productionItem.setItemCanpickNumber(productionItem.getItemActualStorage()+jsonRecords.getInt("actualStorage"));
             if(approvalOrderMapper.updateProductionItem(productionItem) < 1){
                 return new ResponseJson(200, "修改审批产品项失败", 500);
             }
@@ -702,6 +703,25 @@ public class ApprovalOrderServiceImpl implements ApprovalOrderService {
                     rj.setResultMsg("添加流程信息记录失败!");
                     return  rj;
                 }
+                //如果是提货订单则需要返回可提货数量
+                if (ainfo.getApprovalType() == 2) {
+                    //修改生产审批项的可提货数量
+                    ApprovalInfo approval = new ApprovalInfo();
+                    approval.setApprovalId(ainfo.getApprovalId());
+                    List<ApprovalInfo> listApprovalInfo =  approvalOrderMapper.listApprovalInfo(approval);
+                    for(ApprovalApplyPickItem item : listApprovalInfo.get(0).getApprovalApplyPick().getListApplyPickItem()){
+                        //查询生产审批id
+                        ApprovalProductionItem productionItem = approvalOrderMapper.getProductionItem(item.getProductionItemId());
+                        ApprovalProductionItem productItem = new ApprovalProductionItem();
+                        productItem.setItemId(item.getProductionItemId());
+                        productItem.setItemCanpickNumber(productionItem.getItemCanpickNumber()+item.getItemProductNum());
+                        if(approvalOrderMapper.updateProductionItem(productItem) < 1){
+                            rj = ResponseJson.getFAILURE();
+                            rj.setResultMsg("返回生产审批可提货数量失败!");
+                            return  rj;
+                        }
+                    }
+                }
                 //调用第三方revokeTask接口执行撤销
                 approvalTaskService.revokeTask(approvalInfo.getActivitiId(),"业务员撤销审核");
                 break;

+ 17 - 6
watero-rst-service/src/main/java/com/iamberry/rst/service/approval/mapper/applyPickItemMapper.xml

@@ -14,6 +14,7 @@
         <result    column="item_product_box_number"    property="itemProductBoxNumber" />
         <result    column="item_create_time"    property="itemCreateTime" />
         <result    column="item_update_time"    property="itemUpdateTime" />
+        <result    column="production_item_id"    property="productionItemId" />
     </resultMap>
     <sql    id="Base_List" >
         t.apply_item_id,
@@ -27,7 +28,8 @@
         t.item_product_unit,
         t.item_product_box_number,
         t.item_create_time,
-        t.item_update_time
+        t.item_update_time,
+        t.production_item_id
     </sql>
     <select id="getApprovalApplyPickItemList" resultMap="BaseResultMap" parameterType="ApprovalApplyPickItem" >
         select
@@ -64,6 +66,9 @@
             <if test="itemProductBoxNumber != null ">
                 AND t.item_product_box_number = #{itemProductBoxNumber}
             </if >
+            <if test="productionItemId != null ">
+                AND t.production_item_id = #{productionItemId}
+            </if >
         </where>
     </select>
     <select id="getApprovalApplyPickItemById" resultMap="BaseResultMap" parameterType="Integer" >
@@ -85,7 +90,8 @@
         item_brand_name,
         item_product_model,
         item_product_unit,
-        item_product_box_number
+        item_product_box_number,
+        production_item_id
         )
         values
         (
@@ -98,7 +104,8 @@
         #{itemBrandName},
         #{itemProductModel},
         #{itemProductUnit},
-        #{itemProductBoxNumber}
+        #{itemProductBoxNumber},
+        #{productionItemId}
         )
     </insert>
     <update id="update" parameterType="ApprovalApplyPickItem" >
@@ -133,7 +140,7 @@
                 item_product_unit = #{itemProductUnit},
             </if >
             <if test="itemProductBoxNumber != null ">
-                item_product_box_number = #{itemProductBoxNumber},
+                item_product_box_number = #{itemProductBoxNumber}
             </if >
         </set >
         where apply_item_id= #{applyItemId}
@@ -156,7 +163,9 @@
         item_brand_name,
         item_product_model,
         item_product_unit,
-        item_product_box_number
+        item_product_box_number,
+        item_external_model,
+        production_item_id
         )
         values
         <foreach collection="list" item="node" index="index" separator="," open="" close="">
@@ -170,7 +179,9 @@
             #{node.itemBrandName},
             #{node.itemProductModel},
             #{node.itemProductUnit},
-            #{node.itemProductBoxNumber}
+            #{node.itemProductBoxNumber},
+            #{node.itemExternalModel},
+            #{node.productionItemId}
             )
         </foreach >
     </insert>

+ 2 - 1
watero-rst-service/src/main/java/com/iamberry/rst/service/approval/mapper/applyPickMapper.xml

@@ -83,7 +83,8 @@
         <result    column="item_product_box_number"    property="itemProductBoxNumber" />
         <result    column="item_create_time"    property="itemCreateTime" />
         <result    column="item_update_time"    property="itemUpdateTime" />
-        <result    column="item_external_model"    property="itemExternalModel " />
+        <result    column="item_external_model"    property="itemExternalModel" />
+        <result    column="production_item_id"    property="productionItemId" />
     </resultMap>
     <resultMap  id="approvalInfoMap" type="ApprovalInfo" >
         <result    column="approval_id"    property="approvalId" />

+ 14 - 8
watero-rst-service/src/main/java/com/iamberry/rst/service/approval/mapper/approvalOrderMapper.xml

@@ -172,7 +172,8 @@
     item_actual_storage,
     item_lack_number,
     item_create_time,
-    item_external_model
+    item_external_model,
+    item_canpick_number
     )
     VALUES
     <foreach collection="list" item="item" separator=",">
@@ -180,7 +181,7 @@
       #{item.productionId},#{item.productId},#{item.itemProductName},#{item.itemColorName},
       #{item.itemProductNum},#{item.itemBrandName},#{item.itemProductModel},#{item.itemProductUnit}
       ,#{item.itemProductBoxNumber},#{item.itemShouldStorage},#{item.itemActualStorage},#{item.itemLackNumber},NOW(),#{item.itemExternalModel}
-      )
+      ,#{item.itemCanpickNumber})
     </foreach>
   </insert>
 
@@ -359,7 +360,7 @@
         AND ai.approval_status in (2,6)
       </if>
       <if test="selectState != null and selectState != '' and selectState == 4">
-        AND ai.approval_status  = 7
+        AND ai.approval_status  in (7,10)
       </if>
       <if test="selectState != null and selectState != '' and selectState == 5">
         AND ai.approval_status in (1,4)
@@ -437,7 +438,8 @@
     api.item_lack_number itemLackNumber,
     api.item_create_time itemCreateTime,
     api.item_update_time itemUpdateTime,
-    api.item_external_model  itemExternalModel
+    api.item_external_model  itemExternalModel,
+    api.item_canpick_number  itemCanpickNumber
     from tb_rst_approval_production_item api
     where
         api.production_id = #{productionId}
@@ -554,11 +556,14 @@
   <update id="updateProductionItem" parameterType="ApprovalProductionItem">
     update tb_rst_approval_production_item
     <set >
-      <if test="itemActualStorage != null" >
+      <if test="itemActualStorage != null and itemActualStorage != ''" >
         item_actual_storage = #{itemActualStorage},
       </if>
-      <if test="itemLackNumber != null" >
-        item_lack_number = #{itemLackNumber}
+      <if test="itemLackNumber != null and itemLackNumber != ''" >
+        item_lack_number = #{itemLackNumber},
+      </if>
+      <if test="itemCanpickNumber != null and itemCanpickNumber != ''" >
+        item_canpick_number = #{itemCanpickNumber}
       </if>
     </set>
     WHERE
@@ -609,7 +614,8 @@
     api.item_lack_number itemLackNumber,
     api.item_create_time itemCreateTime,
     api.item_update_time itemUpdateTime,
-    api.item_external_model  itemExternalModel
+    api.item_external_model  itemExternalModel,
+    api.item_canpick_number  itemCanpickNumber
     from tb_rst_approval_production_item api
     where
     api.item_id = #{itemId}

+ 5 - 1
watero-rst-service/src/main/java/com/iamberry/rst/service/approval/mapper/approvalProductionMapper.xml

@@ -20,6 +20,8 @@
         <result    column="production_create_time"    property="productionCreateTime" />
         <result    column="production_update_time"    property="productionUpdateTime" />
         <result    column="contract_name"    property="contractName" />
+        <result    column="contact_address"    property="contactAddress" />
+        <result    column="inspection_time"    property="inspectionTime" />
     </resultMap>
     <sql    id="Base_List" >
         t.production_id,
@@ -39,7 +41,9 @@
         t.production_remark,
         t.production_create_time,
         t.production_update_time,
-        t.contract_name
+        t.contract_name,
+        t.contact_address,
+        t.inspection_time
     </sql>
     <select id="getApprovalProductionList" resultMap="BaseResultMap" parameterType="ApprovalProduction" >
         select

+ 29 - 0
watero-rst-web/src/main/java/com/iamberry/rst/controllers/approval/ApplyPickController.java

@@ -269,6 +269,35 @@ public class ApplyPickController {
             rj.setResultMsg("修改审批信息状态为发货失败!");
             return  rj;
         }
+
+        //查询生产审批项可提货数量,并修改可提货数量
+        ApprovalInfo appinfo = approvalOrderService.getApprovalInfoById(aap.getProductionApprovalId());
+        Integer canpickNumber = 0;//可提货数量
+        for(ApprovalProductionItem item : appinfo.getApprovalProduction().getListProductionItem()){
+            canpickNumber += item.getItemCanpickNumber();
+        }
+        ApprovalInfo info = new ApprovalInfo();
+        info.setApprovalId(aap.getProductionApprovalId());
+        if(canpickNumber > 0){
+            //修改关联生产审批信息状态为已完成部分提货
+
+            info.setApprovalStatusDetails("已完成部分提货");
+            info.setApprovalStatus(11);
+            if(approvalOrderService.updateApprovalInfo(info) < 1){
+                rj = ResponseJson.getFAILURE();
+                rj.setResultMsg("修改关联审批信息状态为已完成部分提货失败!");
+                return  rj;
+            }
+        }else{
+            //修改关联生产审批信息状态为已完成提货
+            info.setApprovalStatusDetails("已完成提货");
+            info.setApprovalStatus(10);
+            if(approvalOrderService.updateApprovalInfo(info) < 1){
+                rj = ResponseJson.getFAILURE();
+                rj.setResultMsg("修改关联审批信息状态为已完成提货失败!");
+                return  rj;
+            }
+        }
         return rj;
     }
 }

+ 39 - 0
watero-rst-web/src/main/java/com/iamberry/rst/controllers/approval/ApprovalController.java

@@ -18,6 +18,10 @@ import com.iamberry.wechat.tools.ResponseJson;
 import com.iamberry.wechat.tools.ResultInfo;
 import net.sf.json.JSONArray;
 import net.sf.json.JSONObject;
+import org.activiti.bpmn.model.*;
+import org.activiti.bpmn.model.Process;
+import org.activiti.engine.RepositoryService;
+import org.activiti.engine.repository.Deployment;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -53,6 +57,8 @@ public class ApprovalController {
     private ApplyPickService applyPickService;
     @Autowired
     private ApprovalProductionService approvalProductionService;
+    @Autowired
+    private RepositoryService repositoryService;
     @SuppressWarnings("restriction")
     private BASE64Decoder decoder = new BASE64Decoder();
     /**
@@ -105,6 +111,7 @@ public class ApprovalController {
             approvalProductionItem.setItemShouldStorage(orderItem.getInt("itemProductNum"));
             approvalProductionItem.setItemActualStorage(0);
             approvalProductionItem.setItemLackNumber(orderItem.getInt("itemProductNum"));
+            approvalProductionItem.setItemCanpickNumber(0);
             if (orderItem.containsKey("itemExternalModel")) {
                 approvalProductionItem.setItemExternalModel(orderItem.getString("itemExternalModel"));
             }
@@ -652,4 +659,36 @@ public class ApprovalController {
         }
         return rj;
     }
+    /*@ResponseBody
+    @RequestMapping(value = "/deploymentPrecessDefinition")
+    public void deploymentPrecessDefinition(){
+        getBpmnModel();
+        repositoryService.deleteDeployment("310008",true);
+        repositoryService.deleteDeployment("427508",true);
+        repositoryService.deleteDeployment("427501",true);
+        repositoryService.deleteDeployment("422501",true);
+        *//*Deployment deployment = repositoryService.createDeployment()
+                .key("GenerationApproval")
+                .name("提交审批流程")
+                .addClasspathResource("RST.bpmn")
+                .deploy();
+        Deployment deployment = repositoryService.createDeployment()
+                .key("ApplicationForDelivery")
+                .name("提交提货订单审批流程")
+                .addClasspathResource("pickRst.bpmn")
+                .deploy();*//*
+        //获取审批任务id
+        Map<String, Object> taskinfo = approvalTaskService.salesmanSubmitApply(1);
+        String[] split = (String[])taskinfo.get("users");
+        for (String name : split){
+            System.out.println(name);
+        }
+        Map<String, Object> taskinfo2 = approvalTaskService.salesmanSubmitApply(2);
+        String[] split2 = (String[])taskinfo2.get("users");
+        for (String name : split2){
+            System.out.println(name);
+        }
+
+
+    }*/
 }

+ 1 - 1
watero-rst-web/src/main/java/com/iamberry/rst/controllers/approval/adminApprovalController.java

@@ -37,7 +37,7 @@ import java.util.*;
  */
 
 @Controller
-@RequestMapping("/approval")
+/*@RequestMapping("/approval")*/
 /*@RequestMapping("/wechat/approval")*/
 public class adminApprovalController {
     @Autowired

文件差異過大導致無法顯示
+ 76 - 0
watero-rst-web/src/main/resources/RST.bpmn


文件差異過大導致無法顯示
+ 61 - 0
watero-rst-web/src/main/resources/pickRst.bpmn