瀏覽代碼

成本分配列表增加操作

huxy 2 年之前
父節點
當前提交
c58aac37a3

+ 76 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/costLossReview/controller/SyCostLossReviewController.java

@@ -228,6 +228,27 @@ public class SyCostLossReviewController extends JeecgController<SyOrderData, ISy
     }
 
 
+    @AutoLog(value = "成本损失列表-提交")
+    @ApiOperation(value="成本损失列表-提交", notes="成本损失列表-提交")
+    @PostMapping(value = "/submit")
+    public Result<?> submit(@RequestBody CostAllocationReview costAllocationReview,
+                            @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
+                            @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
+                            HttpServletRequest req){
+        Result<String> result = new Result<String>();
+        if(oConvertUtils.isEmpty(costAllocationReview.getPlanNum())){
+            result.setSuccess(false);
+            result.setMessage("取消提交失败,未获取到计划号!");
+            result.setResult("取消提交失败,未获取到计划号!");
+            return result;
+        }
+        syCostLossReviewService.submit(costAllocationReview);
+        result.setSuccess(true);
+        result.setMessage(costAllocationReview.getCurrentState()+"成功!");
+        result.setResult(costAllocationReview.getPlanNum());
+        return Result.OK("成功提交");
+    }
+
     /**
      * 面损表列表取消提交
      * @param costAllocationReview
@@ -285,6 +306,31 @@ public class SyCostLossReviewController extends JeecgController<SyOrderData, ISy
 
     }
 
+    /**
+     * 成本审批历史查询
+     * @param code
+     * @return
+     */
+    @GetMapping(value = "/querySyCostApprovalHistory")
+    public Result<List<SyApprovalHistory>> querySyCostApprovalHistory(String code){
+
+        Result<List<SyApprovalHistory>> result = new Result<List<SyApprovalHistory>>();
+
+        if(oConvertUtils.isEmpty(code)){
+            result.setSuccess(false);
+            result.setMessage("计划号不能为空!");
+            return result;
+        }
+        List<SyApprovalHistory> list = syCostLossReviewMapper.querySyCostApprovalHistory(code);
+
+        result.setMessage("查询成功!");
+        result.setSuccess(true);
+        result.setResult(list);
+
+        return result;
+
+    }
+
 
     /**
      * 查询是否有指派人
@@ -316,4 +362,34 @@ public class SyCostLossReviewController extends JeecgController<SyOrderData, ISy
 
     }
 
+    /**
+     * 成本查询是否有指派人
+     * @param code
+     * @return
+     */
+    @GetMapping(value = "/querySyCostApprovalAssignedBy")
+    public Result<String> querySyCostApprovalAssignedBy(String code) {
+
+        Result<String> result = new Result<String>();
+
+        if (oConvertUtils.isEmpty(code)) {
+            result.setSuccess(false);
+            result.setMessage("计划号不能为空!");
+            return result;
+        }
+        String name = syCostLossReviewMapper.querySyApprovalAssignedBy2(code);
+        if (oConvertUtils.isNotEmpty(name)) {
+            result.setMessage("查询成功!");
+            result.setSuccess(true);
+            result.setResult(name);
+        } else {
+            result.setMessage("查询成功!");
+            result.setSuccess(true);
+            result.setResult("");
+        }
+
+        return result;
+
+    }
+
 }

+ 1 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/costLossReview/entity/CostAllocationReview.java

@@ -24,6 +24,7 @@ public class CostAllocationReview {
     private String approvalDate;
     //审批人
     private String approvalMan;
+    /*保存、提交、已指派、返单、完成*/
     private String status;
     /**款号*/
     @ApiModelProperty(value = "款号")

+ 20 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/costLossReview/mapper/SyCostLossReviewMapper.java

@@ -4,6 +4,7 @@ import com.baomidou.dynamic.datasource.annotation.DS;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import org.apache.ibatis.annotations.Param;
+import org.jeecg.modules.cost.entity.SyCostJson;
 import org.jeecg.modules.documents.costLossReview.entity.CostAllocationReview;
 import org.jeecg.modules.documents.costLossReview.entity.FabricLossReview;
 import org.jeecg.modules.documents.costLossReview.entity.SyApprovalHistory;
@@ -91,4 +92,23 @@ public interface SyCostLossReviewMapper extends BaseMapper<SyCostLossReview> {
     String querySyApprovalAssignedBy(@Param("code") String code);
 
     public void addhi(@Param("map") Map<String,Object> map);
+
+
+
+
+    public int submit(@Param("code") String code,@Param("stuta") String stuta);
+
+    int addSyCostApprovalHistory(@Param("syApprovalHistory")SyApprovalHistory syApprovalHistory);
+    //通过计划号查询审批历史
+    List<SyApprovalHistory> querySyCostApprovalHistory(@Param("code") String code);
+
+    SyCostJson getSyCostJson(@Param("planNum")String planNum);
+
+    String querySyApprovalAssignedBy2(@Param("code") String code);
+
+    public int rejectionDateUpdate2(@Param("code") String code,@Param("stuta") String stuta,@Param("rejectionDate") String rejectionDate,@Param("rejectBy") String rejectBy);
+
+    public int submitDateUpdate2(@Param("code") String code,@Param("stuta") String stuta,@Param("submitDate") String submitDate,@Param("submitBy") String submitBy);
+
+    public int firstApproveDateUpdate2(@Param("code") String code,@Param("stuta") String stuta,@Param("firstApproveDate") String firstApproveDate,@Param("firstApproveBy") String firstApproveBy);
 }

+ 59 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/costLossReview/mapper/xml/SyCostLossReviewMapper.xml

@@ -517,4 +517,63 @@ select count(*) from(
         where plan_no = #{code} and stuta = '指派'
 
     </select>
+
+
+
+    <select id="querySyApprovalAssignedBy2" resultType="String">
+        select assigned_by as assignedBy from sy_cost_approval_history
+        where plan_no = #{code} and stuta = '指派'
+
+    </select>
+
+    <insert id="addSyCostApprovalHistory">
+    insert into sy_cost_approval_history(id,stuta,plan_no,processed_by,processing_time,processing_opinion,assigned_by)
+    values(#{syApprovalHistory.id},#{syApprovalHistory.stuta},#{syApprovalHistory.planNo},#{syApprovalHistory.processedBy},#{syApprovalHistory.processingTime},
+    #{syApprovalHistory.processingOpinion},#{syApprovalHistory.assignedBy})
+    </insert>
+
+
+    <select id="getSyCostJson" resultType="org.jeecg.modules.cost.entity.SyCostJson" >
+        select * from sy_cost_json
+        where plan_Num=#{planNum}
+    </select>
+
+
+    <update id="submit" >
+        update sy_cost_json set status=#{stuta}
+        where plan_num=#{code }
+    </update>
+
+    <!--   成本表列表修改第一次驳回日期-->
+    <update id="rejectionDateUpdate2">
+
+        update sy_cost_json
+        set status = #{stuta},reject_date = #{rejectionDate},reject_by = #{rejectBy}
+        where plan_num = #{code}
+    </update>
+
+    <!--    成本表列表修改第一次审批日期-->
+    <update id="firstApproveDateUpdate2">
+
+        update sy_cost_json
+        set status = #{stuta},first_approve_date = #{firstApproveDate}, first_approve_by= #{firstApproveBy}
+        where plan_num = #{code}
+    </update>
+
+    <!--    成本表列表修改第一次提交日期-->
+    <update id="submitDateUpdate2">
+
+        update sy_cost_json
+        set status = #{stuta},submit_date = #{submitDate}, submit_by= #{submitBy}
+        where plan_num = #{code}
+    </update>
+
+
+    <select id="querySyCostApprovalHistory" resultType="org.jeecg.modules.documents.costLossReview.entity.SyApprovalHistory">
+
+     select id,case when stuta = '指派' then concat(stuta,'(',assigned_by,')') else stuta end as stuta,plan_no as planNo,processed_by as processedBy,processing_time as processingTime,
+     processing_opinion as processingOpinion from sy_cost_approval_history
+     where plan_no = #{code} order by processing_time
+
+    </select>
 </mapper>

+ 3 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/costLossReview/service/ISyCostLossReviewService.java

@@ -3,6 +3,7 @@ package org.jeecg.modules.documents.costLossReview.service;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.IService;
+import org.apache.ibatis.annotations.Param;
 import org.jeecg.modules.documents.costLossReview.entity.CostAllocationReview;
 import org.jeecg.modules.documents.costLossReview.entity.FabricLossReview;
 import org.jeecg.modules.documents.costLossReview.entity.SyApprovalHistory;
@@ -47,4 +48,6 @@ public interface ISyCostLossReviewService extends IService<SyCostLossReview> {
       */
      public int addSyApprovalHistory(SyApprovalHistory syApprovalHistory);
 
+     public int submit(CostAllocationReview costAllocationReview);
+
 }

+ 94 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/costLossReview/service/impl/SyCostLossReviewServiceImpl.java

@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.jeecg.common.exception.JeecgBootException;
+import org.jeecg.modules.cost.entity.SyCostJson;
 import org.jeecg.modules.documents.costLossReview.entity.CostAllocationReview;
 import org.jeecg.modules.documents.costLossReview.entity.FabricLossReview;
 import org.jeecg.modules.documents.costLossReview.entity.SyApprovalHistory;
@@ -184,4 +185,97 @@ public class SyCostLossReviewServiceImpl extends ServiceImpl<SyCostLossReviewMap
         }
         return 0;
     }
+
+    /**
+     * 成本新增审批历史
+     * @param syApprovalHistory
+     * @return
+     */
+    public int addSyCostApprovalHistory(SyApprovalHistory syApprovalHistory) {
+
+        //设置ID
+        syApprovalHistory.setId(oConvertUtils.id());
+
+        int i = syCostLossReviewMapper.addSyCostApprovalHistory(syApprovalHistory);
+
+        if(i>0){
+            return i;
+        }
+        return 0;
+    }
+
+    @Override
+    public int submit(CostAllocationReview costAllocationReview) {
+        String code=costAllocationReview.getPlanNum();
+        String stuta=costAllocationReview.getStatus();
+        String currentState=costAllocationReview.getCurrentState();
+        SyApprovalHistory syApprovalHistory=costAllocationReview.getSyApprovalHistory();
+        SyCostJson syCostJson=syCostLossReviewMapper.getSyCostJson(costAllocationReview.getPlanNum());
+        int i = 0;
+        //判断状态是否为提交状态状态,如果是才可以取消提交
+        if(currentState.equals("取消提交")){
+            if(stuta.equals("提交")){
+                i = syCostLossReviewMapper.submit(code,"保存");
+                this.addSyCostApprovalHistory(syApprovalHistory);
+            }else{
+                throw new JeecgBootException("取消提交失败,只允许'提交'状态下才能取消提交!");
+            }
+        }
+        if(currentState.equals("提交")){
+            //查询面损表是否含有第一次提交日期
+            if(oConvertUtils.isEmpty(syCostJson.getSubmitDate())){
+                i = syCostLossReviewMapper.submitDateUpdate2(code,"提交",syApprovalHistory.getProcessingTime(),syApprovalHistory.getProcessedBy());
+                this.addSyCostApprovalHistory(syApprovalHistory);
+            }else {
+                i = syCostLossReviewMapper.submit(code, "提交");
+                this.addSyCostApprovalHistory(syApprovalHistory);
+            }
+
+            //查询面损审批历史是否有指派,如果有提交状态改成已指派
+            String name = syCostLossReviewMapper.querySyApprovalAssignedBy(code);
+            String name2 = syCostLossReviewMapper.querySyApprovalAssignedBy2(code);
+            if(oConvertUtils.isNotEmpty(name)||oConvertUtils.isNotEmpty(name2)){
+                syApprovalHistory.setStuta("指派");
+                syApprovalHistory.setAssignedBy(name);
+                if(name2==null){
+                    this.addSyCostApprovalHistory(syApprovalHistory);
+                }
+                i = syCostLossReviewMapper.submit(code, "已指派");
+            }
+        }
+        if(currentState.equals("指派")){
+            i = syCostLossReviewMapper.submit(code,"已指派");
+            this.addSyCostApprovalHistory(syApprovalHistory);
+        }
+        if(currentState.equals("审批通过")){
+            //查询面损表是否含有第一次审批日期
+            if(oConvertUtils.isEmpty(syCostJson.getFirstApproveDate())){
+                i = syCostLossReviewMapper.firstApproveDateUpdate2(code,"完成",syApprovalHistory.getProcessingTime(),syApprovalHistory.getProcessedBy());
+                this.addSyCostApprovalHistory(syApprovalHistory);
+            }else {
+                i = syCostLossReviewMapper.submit(code, "完成");
+                this.addSyCostApprovalHistory(syApprovalHistory);
+            }
+        }
+        if(currentState.equals("驳回")){
+            //查询面损表是否含有第一次驳回日期
+            if(oConvertUtils.isEmpty(syCostJson.getRejectDate())){
+                i = syCostLossReviewMapper.rejectionDateUpdate2(code,"返单",syApprovalHistory.getProcessingTime(),syApprovalHistory.getProcessedBy());
+                this.addSyCostApprovalHistory(syApprovalHistory);
+            }else {
+                i = syCostLossReviewMapper.submit(code, "返单");
+                this.addSyCostApprovalHistory(syApprovalHistory);
+            }
+        }
+        if(currentState.equals("撤销审批")){
+            i = syCostLossReviewMapper.submit(code,"保存");
+            this.addSyCostApprovalHistory(syApprovalHistory);
+        }
+
+        if(i>0){
+            return 1;
+        }
+        syCostLossReviewMapper.submit(costAllocationReview.getCurrentState(),costAllocationReview.getPlanNum());
+        return 0;
+    }
 }

+ 29 - 22
jeecg-boot-module-system/src/main/java/org/jeecg/modules/splfi/service/impl/SyPackingListFabricServiceImpl.java

@@ -1197,6 +1197,7 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 		String pushsno005=org.jeecg.modules.system.util.oConvertUtils.addOne(redisUtil.get("pushsno005").toString());
 		String pushsno006=org.jeecg.modules.system.util.oConvertUtils.addOne(redisUtil.get("pushsno006").toString());
 		String pushsno007=org.jeecg.modules.system.util.oConvertUtils.addOne(pushsno001);
+		boolean ycIsPush=true;
 		if (main!=null){
 			Map<String, Order> mapSort=new HashMap<>();
 			String date2 = main.getLatestDateOfShipment2().substring(0,10);//装柜日期
@@ -1314,6 +1315,7 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 			JSONArray mapItems6=new JSONArray();
 			JSONArray mapItems7=new JSONArray();
 
+
 			Map<String,Object> orderData=null;
 
 			if(main.getSupplierCode()!=null){
@@ -1493,11 +1495,15 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 						moDetailsIds.add(item.getOmpoIdItem());//同一个id只会进来一次
 						Map<String,Object> mapStr1=syPackingListFabricMapper.getOM_MOMain(item.getOmpoIdItem(),item.getInventoryCode());//供应商编码,存货编码
 						//System.out.println("mapStr1\n"+mapStr1);
-						if(mapStr1==null) {
-							throw new JeecgBootException(mapt.get("account")+"账套,委外订单子表行id"+item.getOmpoIdItem()+"未找到对应的染厂物料");
-						}else if(!mapStr1.containsKey("isosid")||mapStr1.get("isosid")==null){
-							throw new JeecgBootException(mapt.get("account")+"账套,委外订单子表行id"+mapStr1.get("MODetailsID")+"的isosid为空");
-						}else{
+						if(mapStr1==null||!mapStr1.containsKey("isosid")||mapStr1.get("isosid")==null) {
+							ycIsPush=false;
+						}
+//						if(mapStr1==null) {
+//							throw new JeecgBootException(mapt.get("account")+"账套,委外订单子表行id"+item.getOmpoIdItem()+"未找到对应的染厂物料");
+//						}else if(!mapStr1.containsKey("isosid")||mapStr1.get("isosid")==null){
+//							throw new JeecgBootException(mapt.get("account")+"账套,委外订单子表行id"+mapStr1.get("MODetailsID")+"的isosid为空");
+//						}
+						else{
 							JSONObject mapItem7=new JSONObject();
 							getcFree(mapItem7,mapStr1);
 							mapItem7.put("POAUTOIDCOL","MODetailsID");//订单明细ID对应字段名(固定MOMaterialsID) MOMaterialsID
@@ -1507,23 +1513,24 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 							mapItem7.put("CBATCH",item.getDyelotNumber());//批号
 							mapItem7.put("CDEFINE26",item.getKaoClothWeight());
 							mapItems7.add(mapItem7);
+							String cSOCode=syPackingListFabricMapper.getSO_SOMain(mapStr1.get("isosid").toString());
+							map7.put("CWHCODE",mapStr1.get("cVenDefine2"));
+							map2.put("CWHCODE",mapStr1.get("cVenDefine2"));//仓库编码
+							map7.put("CVENCODE",mapStr1.get("cVenCode"));
+							map7.put("cOrderCode",cSOCode);
+							for (Map<String,Object> stringObjectMap : orderDataItem3){
+								JSONObject mapItem2=new JSONObject();
+								getcFree(mapItem2,stringObjectMap);
+								mapItem2.put("ALLCAUTOIDCOL","MOMaterialsID");//订单明细ID对应字段名(固定MOMaterialsID) MOMaterialsID
+								mapItem2.put("AUTOID_ALL",stringObjectMap.get("MOMaterialsID"));//关联明细ID
+								mapItem2.put("CINVCODE",stringObjectMap.get("cInvCode"));//存货编码(如果来源单据是委外订单,此字段需要传该订单的子件编码)
+								mapItem2.put("IQUANTITY",item.getAfterHeavy());//数量
+								mapItem2.put("CBATCH",item.getDyelotNumber());//批号
+								mapItem2.put("CBATCHPROPERTY2",item.getWidth());//门幅
+								mapItems2.add(mapItem2);
+							}
 						}
-						String cSOCode=syPackingListFabricMapper.getSO_SOMain(mapStr1.get("isosid").toString());
-						map7.put("CWHCODE",mapStr1.get("cVenDefine2"));
-						map2.put("CWHCODE",mapStr1.get("cVenDefine2"));//仓库编码
-						map7.put("CVENCODE",mapStr1.get("cVenCode"));
-						map7.put("cOrderCode",cSOCode);
-						for (Map<String,Object> stringObjectMap : orderDataItem3){
-							JSONObject mapItem2=new JSONObject();
-							getcFree(mapItem2,stringObjectMap);
-							mapItem2.put("ALLCAUTOIDCOL","MOMaterialsID");//订单明细ID对应字段名(固定MOMaterialsID) MOMaterialsID
-							mapItem2.put("AUTOID_ALL",stringObjectMap.get("MOMaterialsID"));//关联明细ID
-							mapItem2.put("CINVCODE",stringObjectMap.get("cInvCode"));//存货编码(如果来源单据是委外订单,此字段需要传该订单的子件编码)
-							mapItem2.put("IQUANTITY",item.getAfterHeavy());//数量
-							mapItem2.put("CBATCH",item.getDyelotNumber());//批号
-							mapItem2.put("CBATCHPROPERTY2",item.getWidth());//门幅
-							mapItems2.add(mapItem2);
-						}
+
 					}
 
 					mapItem5.put("POAUTOIDCOL","Autoid");//明细ID对应字段名(关联单据类型为采购订单传ID,委外订单传MODetailsID,入库单为Autoid)
@@ -1727,7 +1734,7 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 		}
 		String isSucceed=null;
 		//try{
-			if(mapList2!=null&&mapList2.size()>0&&main.getIsSucceed()!=null&&main.getIsSucceed().indexOf("-7-")>0){//印花
+			if(mapList2!=null&&mapList2.size()>0&&main.getIsSucceed()!=null&&main.getIsSucceed().indexOf("-7-")>0&&ycIsPush){//印花
 				JSONArray resturn2 = InterfaceConnUtils.doPost(mapList2,"materialout_import");//材料出库单
 				isSucceed=result(main,resturn2,"材料出库单",((Map) mapList2.get(0)).get("CACCID").toString(),"2");//材料出库单
 				redisUtil.set("pushsno006", pushsno006);//材料出库单