Your Name лет назад: 2
Родитель
Сommit
2b26847432

+ 7 - 6
java110-db/src/main/resources/mapper/store/AllocationStorehouseApplyV1ServiceDaoImplMapper.xml

@@ -85,16 +85,17 @@
         <if test="state !=null and state != ''">
             , t.state= #{state}
         </if>
-        <if test="storeId !=null and storeId != ''">
-            , t.store_id= #{storeId}
-        </if>
-        <if test="communityId !=null and communityId != ''">
-            , t.community_id= #{communityId}
-        </if>
+
         where 1=1
         <if test="applyId !=null and applyId != ''">
             and t.apply_id= #{applyId}
         </if>
+        <if test="communityId !=null and communityId != ''">
+            and t.community_id= #{communityId}
+        </if>
+        <if test="storeId !=null and storeId != ''">
+            and t.store_id= #{storeId}
+        </if>
 
     </update>
 

+ 36 - 2
service-store/src/main/java/com/java110/store/cmd/resourceStore/AllocationStoreEnterCmd.java

@@ -3,24 +3,29 @@ package com.java110.store.cmd.resourceStore;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.java110.core.annotation.Java110Cmd;
+import com.java110.core.context.CmdContextUtils;
 import com.java110.core.context.ICmdDataFlowContext;
 import com.java110.core.event.cmd.Cmd;
 import com.java110.core.event.cmd.CmdEvent;
 import com.java110.core.factory.GenerateCodeFactory;
 import com.java110.dto.purchase.AllocationStorehouseApplyDto;
 import com.java110.dto.purchase.AllocationStorehouseDto;
+import com.java110.dto.purchase.PurchaseApplyDto;
 import com.java110.dto.resource.ResourceStoreDto;
 import com.java110.dto.resource.ResourceStoreTimesDto;
 import com.java110.dto.store.StorehouseDto;
 import com.java110.intf.common.IAllocationStorehouseUserInnerServiceSMO;
+import com.java110.intf.common.IOaWorkflowActivitiInnerServiceSMO;
 import com.java110.intf.store.*;
 import com.java110.po.purchase.AllocationStorehouseApplyPo;
+import com.java110.po.purchase.PurchaseApplyPo;
 import com.java110.po.purchase.ResourceStorePo;
 import com.java110.po.resource.ResourceStoreTimesPo;
 import com.java110.store.bmo.allocation.IAllocationBMO;
 import com.java110.utils.exception.CmdException;
 import com.java110.utils.util.Assert;
 import com.java110.utils.util.BeanConvertUtil;
+import com.java110.vo.ResultVo;
 import org.springframework.beans.factory.annotation.Autowired;
 
 import java.text.ParseException;
@@ -35,6 +40,7 @@ public class AllocationStoreEnterCmd extends Cmd {
     @Autowired
     private IAllocationStorehouseApplyInnerServiceSMO allocationStorehouseApplyInnerServiceSMOImpl;
 
+
     @Autowired
     private IResourceStoreTimesV1InnerServiceSMO resourceStoreTimesV1InnerServiceSMOImpl;
 
@@ -59,6 +65,9 @@ public class AllocationStoreEnterCmd extends Cmd {
     @Autowired
     private IAllocationBMO allocationBMOImpl;
 
+    @Autowired
+    private IOaWorkflowActivitiInnerServiceSMO oaWorkflowUserInnerServiceSMOImpl;
+
     @Override
     public void validate(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException, ParseException {
         Assert.hasKeyAndValue(reqJson, "applyId", "订单ID为空");
@@ -107,8 +116,6 @@ public class AllocationStoreEnterCmd extends Cmd {
     @Override
     public void doCmd(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException, ParseException {
 
-
-
         JSONArray resourceStores = reqJson.getJSONArray("resourceStores");
         JSONObject resourceStore = null;
         int quantity = 0;
@@ -123,6 +130,33 @@ public class AllocationStoreEnterCmd extends Cmd {
             //todo 每条记录调拨
             allocationBMOImpl.doToAllocationStorehouse(allocationStorehouseDtos.get(0), quantity);
         }
+
+        //
+        String applyId = reqJson.getString("applyId");
+        AllocationStorehouseApplyPo allocationStorehouseApplyPo = new AllocationStorehouseApplyPo();
+        allocationStorehouseApplyPo.setApplyId(applyId);
+        //todo 如果包含taskId 流程提交下去
+        if (reqJson.containsKey("taskId")) {
+            reqJson.put("auditCode", "1100");
+            reqJson.put("auditMessage", "入库成功");
+            reqJson.put("id", reqJson.getString("applyId"));
+            reqJson.put("storeId", CmdContextUtils.getStoreId(context));
+            reqJson.put("nextUserId", reqJson.getString("staffId"));
+            boolean isLastTask = oaWorkflowUserInnerServiceSMOImpl.completeTask(reqJson);
+            if (isLastTask) {
+                allocationStorehouseApplyPo.setState(AllocationStorehouseApplyDto.STATE_END);
+            } else {
+                allocationStorehouseApplyPo.setState(AllocationStorehouseApplyDto.STATE_DEALING);
+            }
+        } else {
+            allocationStorehouseApplyPo.setState(AllocationStorehouseApplyDto.STATE_DEALING);
+        }
+        allocationStorehouseApplyPo.setStatusCd("0");
+        allocationStorehouseApplyV1InnerServiceSMOImpl.updateAllocationStorehouseApply(allocationStorehouseApplyPo);
+
+
+
+        context.setResponseEntity(ResultVo.createResponseEntity(ResultVo.CODE_OK, "采购申请成功"));
     }
 
 }

+ 25 - 0
service-store/src/main/java/com/java110/store/cmd/resourceStore/SaveAllocationStorehouseCmd.java

@@ -89,6 +89,9 @@ public class SaveAllocationStorehouseCmd extends Cmd {
     @Autowired
     private IAllocationBMO allocationBMOImpl;
 
+    @Autowired
+    private IOaWorkflowActivitiInnerServiceSMO oaWorkflowUserInnerServiceSMOImpl;
+
     @Override
     public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException {
         Assert.hasKeyAndValue(reqJson, "remark", "请求报文中未包含申请信息");
@@ -314,6 +317,28 @@ public class SaveAllocationStorehouseCmd extends Cmd {
             //todo 每条记录调拨
             allocationBMOImpl.doToAllocationStorehouse(tmpAllocationStorehouseDto, allocationStock);
         }
+
+        String applyId = allocationStorehouseApplyPo.getApplyId();
+        AllocationStorehouseApplyPo tmpAllocationStorehouseApplyPo = new AllocationStorehouseApplyPo();
+        tmpAllocationStorehouseApplyPo.setApplyId(applyId);
+        //todo 如果包含taskId 流程提交下去
+        if (reqJson.containsKey("taskId")) {
+            reqJson.put("auditCode", "1100");
+            reqJson.put("auditMessage", "入库成功");
+            reqJson.put("id", reqJson.getString("applyId"));
+            reqJson.put("storeId", reqJson.getString("storeId"));
+            reqJson.put("nextUserId", reqJson.getString("staffId"));
+            boolean isLastTask = oaWorkflowUserInnerServiceSMOImpl.completeTask(reqJson);
+            if (isLastTask) {
+                tmpAllocationStorehouseApplyPo.setState(AllocationStorehouseApplyDto.STATE_END);
+            } else {
+                tmpAllocationStorehouseApplyPo.setState(AllocationStorehouseApplyDto.STATE_DEALING);
+            }
+        } else {
+            tmpAllocationStorehouseApplyPo.setState(AllocationStorehouseApplyDto.STATE_DEALING);
+        }
+        tmpAllocationStorehouseApplyPo.setStatusCd("0");
+        allocationStorehouseApplyV1InnerServiceSMOImpl.updateAllocationStorehouseApply(tmpAllocationStorehouseApplyPo);
     }
 
     /**