From b775bd00e11cfd575b067f6394684849a0796479 Mon Sep 17 00:00:00 2001
From: k94314517 <8417338+k94314517@user.noreply.gitee.com>
Date: 星期四, 14 九月 2023 17:45:25 +0800
Subject: [PATCH] 111
---
server/src/main/java/doumeemes/service/ext/impl/WorkorderExtServiceImpl.java | 178 +++++++++++++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 161 insertions(+), 17 deletions(-)
diff --git a/server/src/main/java/doumeemes/service/ext/impl/WorkorderExtServiceImpl.java b/server/src/main/java/doumeemes/service/ext/impl/WorkorderExtServiceImpl.java
index b5e1a8a..f094941 100644
--- a/server/src/main/java/doumeemes/service/ext/impl/WorkorderExtServiceImpl.java
+++ b/server/src/main/java/doumeemes/service/ext/impl/WorkorderExtServiceImpl.java
@@ -407,12 +407,13 @@
tModle.setUrgent(w.getUrgent());
tModle.setUpdateTime(w.getUpdateTime());
tModle.setRemark(w.getRemark());
- tModle.setQualifiedNum(0);
- tModle.setUnqualifiedNum(0);
+ tModle.setQualifiedNum(w.getQualifiedNum());
+ tModle.setUnqualifiedNum(w.getUnqualifiedNum());
tModle.setProUserId(w.getProUserId());
tModle.setProUserName(w.getProUserName());
tModle.setProUserName(w.getProUserName());
tModle.setCreateUser(w.getCreateUser());
+ tModle.setCreateUserName(w.getCreateUserName());
if(w.getProUserId()!=null){
//鏌ヨ鐝粍淇℃伅
QueryCompanyUserExtDTO queryCompanyUserExtDTO = new QueryCompanyUserExtDTO();
@@ -449,13 +450,17 @@
//浜у嚭鏃ユ湡
tModle.setProduceDate(r.getCreateTime());
}
- if(Constants.equalsInteger(r.getDoneType(),Constants.ZERO)){
+// if(Constants.equalsInteger(r.getDoneType(),Constants.ZERO)){
//濡傛灉鏄悎鏍间骇鍑�
- tModle.setQualifiedNum(tModle.getQualifiedNum()+Constants.formatBigdecimal(r.getNum()).intValue());
- }else{
+// tModle.setQualifiedNum(tModle.getQualifiedNum()+Constants.formatBigdecimal(r.getNum()).intValue());
+// }else{
//濡傛灉鏄笉鑹搧
- tModle.setUnqualifiedNum(tModle.getUnqualifiedNum()+Constants.formatBigdecimal(r.getNum()).intValue());
- }
+// tModle.setUnqualifiedNum(tModle.getUnqualifiedNum()+Constants.formatBigdecimal(r.getNum()).intValue());
+// }
+ //濡傛灉鏄悎鏍间骇鍑�
+ tModle.setQualifiedNum(tModle.getQualifiedNum());
+ //濡傛灉鏄笉鑹搧
+ tModle.setUnqualifiedNum(tModle.getUnqualifiedNum());
}
}
}
@@ -755,7 +760,7 @@
* @param param
*/
@Override
- @Async
+// @Async
public void statisticNum(Workorder param){
if(param.getPlanId()== null){
if(param.getId()== null){
@@ -806,12 +811,14 @@
}
if(Constants.equalsInteger(order.getStatus(),Constants.WORKORDER_STATUS.create)
||Constants.equalsInteger(order.getStatus(),Constants.WORKORDER_STATUS.material)
+ ||Constants.equalsInteger(order.getStatus(),Constants.WORKORDER_STATUS.producing)
||Constants.equalsInteger(order.getStatus(),Constants.WORKORDER_STATUS.check)
||Constants.equalsInteger(order.getStatus(),Constants.WORKORDER_STATUS.done)){
//缁熻宸插垎閰嶆湭鎶ュ伐鏁伴噺
distributeNoDoneNum += Constants.formatIntegerNum(order.getPlanNum());
}
if(Constants.equalsInteger(order.getStatus(),Constants.WORKORDER_STATUS.baogong)
+ ||Constants.equalsInteger(order.getStatus(),Constants.WORKORDER_STATUS.producing)
|| Constants.equalsInteger(order.getStatus(),Constants.WORKORDER_STATUS.instock)){
doneNum += Constants.formatIntegerNum(order.getUnqualifiedNum()) + Constants.formatIntegerNum(order.getQualifiedNum());
int tNum =Constants.formatIntegerNum(order.getUnqualifiedNum()) + Constants.formatIntegerNum(order.getQualifiedNum());
@@ -828,14 +835,10 @@
&& item.getOmodel()!=null
&& (Constants.equalsInteger(item.getOmodel().getStatus() ,Constants.WORKORDER_STATUS.baogong)
||Constants.equalsInteger(item.getOmodel().getStatus() ,Constants.WORKORDER_STATUS.instock))){
- //濡傛灉鏄骇鍑�
- if(Constants.equalsInteger(item.getDoneType(),Constants.ZERO)){
- //濡傛灉鏄悎鏍间骇鍑猴紝绱鏁伴噺
- qulifiedNum += Constants.formatBigdecimal(item.getNum()).intValue();
- }else{
- //濡傛灉鏄笉鑹骇鍑猴紝绱鏁伴噺
- unqulifiedNum += Constants.formatBigdecimal(item.getNum()).intValue();
- }
+ //濡傛灉鏄悎鏍间骇鍑猴紝绱鏁伴噺
+ qulifiedNum += Constants.formatBigdecimal(BigDecimal.valueOf(item.getQualifiedNum())).intValue();
+ //濡傛灉鏄笉鑹骇鍑猴紝绱鏁伴噺
+ unqulifiedNum += Constants.formatBigdecimal(BigDecimal.valueOf(item.getUnqualifiedNum())).intValue();
}
}
}
@@ -858,7 +861,7 @@
if(!Objects.isNull(plan.getWorkPlansId())){
//鏇存柊涓昏鍗曟暟鎹俊鎭�
if(plansMapper.selectCount(new QueryWrapper<Plans>()
- .in("STATUS",0,1,4)
+ .in("STATUS",0,1,4,5)
.eq("DELETED",Constants.ZERO)
.ne("id",p.getId())
.eq("WORK_PLANS_ID",plan.getWorkPlansId()))<=Constants.ZERO){
@@ -895,6 +898,147 @@
}
+
+
+ @Override
+ @Async
+ public void statisticNumAsync(Workorder param){
+ if(param.getPlanId()== null){
+ if(param.getId()== null){
+ return;
+ }
+ Workorder wModel = new Workorder();
+ wModel.setDeleted(Constants.ZERO);
+ wModel.setId(param.getId());
+ wModel = workorderExtMapper.selectOne(wModel);
+ if(wModel== null){
+ return;
+ }
+ param.setPlanId(wModel.getPlanId());
+ }
+ Plans plan = plansExtMapper.selectById(param.getPlanId());
+ if(plan == null){
+ return;
+ }
+ JSONObject json = new JSONObject();
+ QueryWorkorderExtDTO qw = new QueryWorkorderExtDTO();
+ qw.setPlanId(param.getPlanId());
+ qw.setDeleted(Constants.ZERO);
+ //鏌ヨ鍏ㄩ儴宸ュ崟鏁版嵁
+ List<WorkorderExtListVO> orderList = workorderExtMapper.selectList(qw);
+ //宸插畬宸ユ暟閲�
+ int doneNum=0;
+ //宸插垎閰嶆暟閲�
+ //宸叉姤宸ュ伐鍗曪紙鍖呮嫭宸ュ崟鐘舵�侊細宸叉姤宸ャ�佸凡鍏ュ簱锛夌殑瀹屽伐鏁伴噺锛堝寘鎷細鍚堟牸銆佷笉鑹�佹姤搴燂級
+ //+鏈姤宸ュ伐鍗曪紙鍖呮嫭宸ュ崟鐘舵�侊細宸插垱寤恒�佸凡澶囨枡銆佸凡妫�楠屻�佸凡瀹屽伐锛夌殑宸插垎閰嶆暟閲�
+ int distributNum=0;
+ //宸插垎閰嶆湭鎶ュ伐鏁伴噺=鏈姤宸ュ伐鍗曪紙宸ュ崟鐘舵�侊細宸插垱寤恒�佸凡澶囨枡銆佸凡妫�楠屻�佸凡瀹屽伐锛夌殑璁″垝鐢熶骇鏁伴噺涔嬪拰锛�
+ int distributeNoDoneNum=0;
+ //鍚堟牸鏁伴噺=宸叉姤宸ュ伐鍗曪紙宸ュ崟鐘舵�侊細宸叉姤宸ャ�佸凡鍏ュ簱锛変骇鍑轰负鍚堟牸鐨勬暟閲忎箣鍜岋紱
+ int qulifiedNum=0;
+ //涓嶈壇鏁伴噺=宸叉姤宸ュ伐鍗曪紙宸ュ崟鐘舵�侊細宸叉姤宸ャ�佸凡鍏ュ簱锛変骇鍑轰负涓嶈壇鐨勬暟閲忎箣鍜岋紱
+ int unqulifiedNum =0;
+ int allOrderNum =0;
+ if(orderList!=null && orderList.size()>0){
+ QueryWorkorderRecordExtDTO rw = new QueryWorkorderRecordExtDTO();
+ rw.setPlanId(param.getPlanId());
+ rw.setDeleted(Constants.ZERO);
+ //鏌ヨ鍏ㄩ儴宸ュ崟浜у嚭鍜屾姇鏂欐暟鎹�
+ List<WorkorderRecordExtListVO> allRecordList = workorderRecordExtMapper.selectListNew(rw);
+ for(WorkorderExtListVO order : orderList){
+ if(Constants.equalsInteger(order.getStatus(),Constants.WORKORDER_STATUS.cancel)){
+ //鍙栨秷鐨勫伐鍗曚笉绱鏁伴噺
+ continue;
+ }
+ if(Constants.equalsInteger(order.getStatus(),Constants.WORKORDER_STATUS.create)
+ ||Constants.equalsInteger(order.getStatus(),Constants.WORKORDER_STATUS.material)
+ ||Constants.equalsInteger(order.getStatus(),Constants.WORKORDER_STATUS.producing)
+ ||Constants.equalsInteger(order.getStatus(),Constants.WORKORDER_STATUS.check)
+ ||Constants.equalsInteger(order.getStatus(),Constants.WORKORDER_STATUS.done)){
+ //缁熻宸插垎閰嶆湭鎶ュ伐鏁伴噺
+ distributeNoDoneNum += Constants.formatIntegerNum(order.getPlanNum());
+ }
+ if(Constants.equalsInteger(order.getStatus(),Constants.WORKORDER_STATUS.baogong)
+ ||Constants.equalsInteger(order.getStatus(),Constants.WORKORDER_STATUS.producing)
+ || Constants.equalsInteger(order.getStatus(),Constants.WORKORDER_STATUS.instock)){
+ doneNum += Constants.formatIntegerNum(order.getUnqualifiedNum()) + Constants.formatIntegerNum(order.getQualifiedNum());
+ int tNum =Constants.formatIntegerNum(order.getUnqualifiedNum()) + Constants.formatIntegerNum(order.getQualifiedNum());
+ distributNum += tNum;
+ allOrderNum += tNum;
+ }else {
+ distributNum += Constants.formatIntegerNum(order.getPlanNum());
+ }
+
+ List<WorkorderRecordExtListVO> rList = getRecordListById(order.getId(),allRecordList);
+ if(rList!=null){
+ for(WorkorderRecordExtListVO item : rList){
+ if(Constants.equalsInteger(item.getType(),Constants.WORKORDER_RECORD_TYPE.produce)
+ && item.getOmodel()!=null
+ && (Constants.equalsInteger(item.getOmodel().getStatus() ,Constants.WORKORDER_STATUS.baogong)
+ ||Constants.equalsInteger(item.getOmodel().getStatus() ,Constants.WORKORDER_STATUS.instock))){
+ //濡傛灉鏄悎鏍间骇鍑猴紝绱鏁伴噺
+ qulifiedNum += Constants.formatBigdecimal(BigDecimal.valueOf(item.getQualifiedNum())).intValue();
+ //濡傛灉鏄笉鑹骇鍑猴紝绱鏁伴噺
+ unqulifiedNum += Constants.formatBigdecimal(BigDecimal.valueOf(item.getUnqualifiedNum())).intValue();
+ }
+ }
+ }
+ }
+ }
+ json.put(Constants.STATISTIC.distributeNoDone,distributeNoDoneNum);
+ json.put(Constants.STATISTIC.done,doneNum);
+ json.put(Constants.STATISTIC.distribute,distributNum);
+ json.put(Constants.STATISTIC.qulified,qulifiedNum);
+ json.put(Constants.STATISTIC.unqulified,unqulifiedNum);
+
+ UpdateWrapper updateWrapper = new UpdateWrapper();
+ Plans p = new Plans();
+ p.setId(param.getPlanId());
+ p.setStatisticInfo(json.toJSONString());
+ p.setUpdateTime(DateUtil.getCurrentDate());
+ if( Constants.formatIntegerNum(plan.getNum()) <= allOrderNum){
+ //濡傛灉婊¤冻璁″垝宸插畬宸ワ紝鏇存柊璁″垝鐘舵��
+ p.setStatus(Constants.PLAN_STATUS.done);
+ if(!Objects.isNull(plan.getWorkPlansId())){
+ //鏇存柊涓昏鍗曟暟鎹俊鎭�
+ if(plansMapper.selectCount(new QueryWrapper<Plans>()
+ .in("STATUS",0,1,4,5)
+ .eq("DELETED",Constants.ZERO)
+ .ne("id",p.getId())
+ .eq("WORK_PLANS_ID",plan.getWorkPlansId()))<=Constants.ZERO){
+ WorkPlans workPlans = workPlansExtMapper.selectById(plan.getWorkPlansId());
+ if(!Objects.isNull(workPlans)){
+ workPlans.setStatus(Constants.WORKPLANHISTORY_TYPE.done);
+ workPlans.setUpdateTime(new Date());
+ workPlansExtMapper.updateById(workPlans);
+ planHistoryExtMapper.insert(initPlanHistoryByModel(workPlans,null,Constants.WORKPLANHISTORY_TYPE.done));
+ }
+ };
+ }
+ //
+ plan.getWorkPlansId();
+
+ updateWrapper.set("STATUS",p.getStatus());
+ if(Constants.equalsInteger(plan.getStatus(),Constants.PLAN_STATUS.distribute)){
+ //濡傛灉宸插垎閰�
+ planHistoryExtMapper.insertBatch(Arrays.asList(PlansExtServiceImpl.initHistoryByModel(plan,null,Constants.PLANHISTORY_TYPE.done)));
+ }
+// planHistoryService.create(PlansExtServiceImpl.initHistoryByModel(plan,null,Constants.PLANHISTORY_TYPE.done));
+ }
+ //鏇存柊缁熻淇℃伅
+// plansExtMapper.updateById(p);
+ updateWrapper.eq("ID",param.getPlanId());
+ updateWrapper.set("STATISTIC_INFO",json.toJSONString());
+ updateWrapper.set("UPDATE_TIME",DateUtil.getCurrentDate());
+ plansExtMapper.update(null,updateWrapper);
+// Workorder order = new Workorder();
+// order.setUpdateTime(DateUtil.getCurrentDate());
+// //宸插叧闂�
+// order.setId(param.getId());
+// workorderExtMapper.updateById(order);
+
+ }
+
/**
* 妫�娴嬫暟鎹湁鏁堟��
* @param param
--
Gitblit v1.9.3