|
|
|
|
@ -343,8 +343,30 @@ public class InspectionTaskServiceImpl extends BaseServiceImpl<InspectionTaskMap |
|
|
|
|
public R fill(InspectionTaskDetailVO detailVO) { |
|
|
|
|
// 更新 Task
|
|
|
|
|
updateById(detailVO); |
|
|
|
|
|
|
|
|
|
for (WorkPlanItemVO wpItemVO : detailVO.getWpItemList()) { |
|
|
|
|
|
|
|
|
|
WorkPlanItem wpItemDB = wpItemService.getById(wpItemVO.getId()); |
|
|
|
|
WorkPlan wpi = workPlanMapper.selectById(wpItemDB.getWpId()); |
|
|
|
|
if(null != wpi){ |
|
|
|
|
WorkOrder order = workOrderMapper.selectById(wpi.getWoId()); |
|
|
|
|
if(null != order){ |
|
|
|
|
YieldOrder yieldOrder = yieldOrderMapper.selectById(order.getYoId()); |
|
|
|
|
String[] arr = new String[]{"YH","CASTH","YB","YC","SAST","CISS","EK"}; |
|
|
|
|
String[] chrr = new String[]{"董以青","王跃伟","刘旭","张琼琼","张楠","朱辉","高博","宁亚美","党哲","左帅通","赵亚丽"}; |
|
|
|
|
for (String s : arr) { |
|
|
|
|
if (s == yieldOrder.getProductIdent()){ |
|
|
|
|
for (String s1 : chrr) { |
|
|
|
|
if (s1 == AuthUtil.getNickName()){ |
|
|
|
|
// throw new BusinessException("当前用户无当前等级检验资质!");
|
|
|
|
|
return R.fail("当前用户无当前等级检验资质!"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (InspectionTaskConst.CHECK_RESULT_TODO.equals(wpItemDB.getCheckResult()) && |
|
|
|
|
!InspectionTaskConst.CHECK_RESULT_TODO.equals(wpItemVO.getCheckResult())) { // 数据库中是待检测的,新传入数据不是待检测的。
|
|
|
|
|
// copy from VO
|
|
|
|
|
@ -362,8 +384,6 @@ public class InspectionTaskServiceImpl extends BaseServiceImpl<InspectionTaskMap |
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(null != wpItemVO.getWpItemDetailList() && wpItemVO.getWpItemDetailList().size() > 0){ |
|
|
|
|
QueryWrapper<WorkPlanItemDetail> qw = new QueryWrapper<>(); |
|
|
|
|
qw.eq("WORK_PLAN_ITEM_ID", wpItemDB.getId()); |
|
|
|
|
@ -1319,12 +1339,20 @@ public class InspectionTaskServiceImpl extends BaseServiceImpl<InspectionTaskMap |
|
|
|
|
@Override |
|
|
|
|
public InspectionTask refreshStatusAndQty(Long id) { |
|
|
|
|
InspectionTask task = getById(id); |
|
|
|
|
WorkPlan wp = workPlanMapper.selectById(task.getWpId()); |
|
|
|
|
WorkOrder wo = workOrderMapper.selectById(wp.getWoId()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (null == task) { |
|
|
|
|
throw new IllegalArgumentException("error id!"); |
|
|
|
|
} |
|
|
|
|
List<WorkPlanItem> itemList = wpItemService.listByTaskId(id); |
|
|
|
|
StatusCountMap map = new StatusCountMap(); |
|
|
|
|
int sumCheckQ = 0, sumTestQty = 0, sumLossQty = 0; |
|
|
|
|
for (WorkPlanItem item : itemList) { |
|
|
|
|
sumCheckQ += item.getCheckQty(); |
|
|
|
|
sumTestQty += item.getTestQty(); |
|
|
|
|
sumLossQty += item.getLossQty(); |
|
|
|
|
map.add1(item.getCheckResult()); |
|
|
|
|
} |
|
|
|
|
int countToDo = map.get(InspectionTaskConst.CHECK_RESULT_TODO); |
|
|
|
|
@ -1344,6 +1372,12 @@ public class InspectionTaskServiceImpl extends BaseServiceImpl<InspectionTaskMap |
|
|
|
|
if (countToDo == 0) { // 未检验为0
|
|
|
|
|
if (countOK == itemList.size()) { // 全部item 合格
|
|
|
|
|
checkResult = InspectionTaskConst.CHECK_RESULT_OK; |
|
|
|
|
|
|
|
|
|
task.setCheckUserId(AuthUtil.getUserId()); |
|
|
|
|
task.setCheckDate(LocalDateTime.now()); |
|
|
|
|
// this.computeOrderQty(wp, task, wo, sumCheckQ, sumTestQty, sumLossQty, 0);
|
|
|
|
|
// this.qualified(wp, wc, wo);
|
|
|
|
|
|
|
|
|
|
} else if (countNA == itemList.size()) { // 全部item NA
|
|
|
|
|
checkResult = InspectionTaskConst.CHECK_RESULT_NA; |
|
|
|
|
} else if (countNO >= 0 && countNO <= itemList.size()) { // 不合格
|
|
|
|
|
|