|
@@ -2,6 +2,8 @@ package com.rongwei.bscommon.sys.service.impl;
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
import com.rongwei.bscommon.sys.service.*;
|
|
import com.rongwei.bscommon.sys.service.*;
|
|
import com.rongwei.bscommon.sys.utils.ZhcxCommon;
|
|
import com.rongwei.bscommon.sys.utils.ZhcxCommon;
|
|
import com.rongwei.bsentity.domain.ZhcxOutsideInspectionItpDo;
|
|
import com.rongwei.bsentity.domain.ZhcxOutsideInspectionItpDo;
|
|
@@ -51,6 +53,9 @@ public class ZhcxOutsideInspectionItpServiceImpl extends ServiceImpl<ZhcxOutside
|
|
@Autowired
|
|
@Autowired
|
|
private ZhcxCommon zhcxCommon;
|
|
private ZhcxCommon zhcxCommon;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private ZhcxOutsideInspectionItpDao dao;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 拆单
|
|
* 拆单
|
|
*
|
|
*
|
|
@@ -87,17 +92,11 @@ public class ZhcxOutsideInspectionItpServiceImpl extends ServiceImpl<ZhcxOutside
|
|
for(int m = 0, n = structurNames.length; m < n; m++) {
|
|
for(int m = 0, n = structurNames.length; m < n; m++) {
|
|
for(String inspectionContent : inspectionContents) {
|
|
for(String inspectionContent : inspectionContents) {
|
|
count++;
|
|
count++;
|
|
- SysSerialVo sysSerialVo = new SysSerialVo();
|
|
|
|
- sysSerialVo.setRuleTemplateStr("W@{date:yyyyMMdd}@{serialNumber:#0000}");
|
|
|
|
- sysSerialVo.setModulecode("ZHCX_OUTSIDE_INSPECTION_ITP_CODE");
|
|
|
|
- sysSerialVo.setIfautomaticreset("y");
|
|
|
|
- sysSerialVo.setResetrule("date:yyyyMMdd");
|
|
|
|
- sysSerialVo.setInitValue(0L);
|
|
|
|
- String code = serialNumberService.getCodeByTemplate(sysSerialVo);
|
|
|
|
|
|
+
|
|
if(count == 0) { //第一个做修改
|
|
if(count == 0) { //第一个做修改
|
|
itpDo.setStructurename(structurNames[m]);
|
|
itpDo.setStructurename(structurNames[m]);
|
|
itpDo.setInspectioncontent(inspectionContent);
|
|
itpDo.setInspectioncontent(inspectionContent);
|
|
- itpDo.setInspectioncode(code);
|
|
|
|
|
|
+ itpDo.setInspectioncode(genCode());
|
|
// itpDo.setStructureid(structureIds[m]);
|
|
// itpDo.setStructureid(structureIds[m]);
|
|
updateList.add(itpDo);
|
|
updateList.add(itpDo);
|
|
continue;
|
|
continue;
|
|
@@ -108,7 +107,7 @@ public class ZhcxOutsideInspectionItpServiceImpl extends ServiceImpl<ZhcxOutside
|
|
entity.setStructurename(structurNames[m]);
|
|
entity.setStructurename(structurNames[m]);
|
|
entity.setInspectioncontent(inspectionContent);
|
|
entity.setInspectioncontent(inspectionContent);
|
|
entity.setId(SecurityUtil.getUUID());
|
|
entity.setId(SecurityUtil.getUUID());
|
|
- entity.setInspectioncode(code);
|
|
|
|
|
|
+ entity.setInspectioncode(genCode());
|
|
// entity.setStructureid(structureIds[m]);
|
|
// entity.setStructureid(structureIds[m]);
|
|
insertList.add(entity);
|
|
insertList.add(entity);
|
|
newItpIdList.add(entity.getId());
|
|
newItpIdList.add(entity.getId());
|
|
@@ -116,22 +115,14 @@ public class ZhcxOutsideInspectionItpServiceImpl extends ServiceImpl<ZhcxOutside
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- //钢结构
|
|
|
|
- if("10".equals(itpDo.getInspectiontype())) {
|
|
|
|
- itpNdtResultService.copyByItpId(id, newItpIdList);
|
|
|
|
- }
|
|
|
|
- String[] array = {"10", "20", "30"};
|
|
|
|
- List<String> qcTypeList = Arrays.asList(array);
|
|
|
|
- if(qcTypeList.contains(itpDo.getInspectiontype())) {
|
|
|
|
- qcItemResultService.copyByItpId(id, newItpIdList);
|
|
|
|
- }
|
|
|
|
|
|
+ insertChildren(itpDo, newItpIdList);
|
|
|
|
|
|
updateBatchById(updateList);
|
|
updateBatchById(updateList);
|
|
saveBatch(insertList);
|
|
saveBatch(insertList);
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public String OperInspectionStatus(OperOutsideInspectionVo vo) {
|
|
|
|
|
|
+ public String operInspectionStatus(OperOutsideInspectionVo vo) {
|
|
/* 10: 取消 20: 拒收 30: 派单 40: 转派 50: 接收 60: 有条件接收 */
|
|
/* 10: 取消 20: 拒收 30: 派单 40: 转派 50: 接收 60: 有条件接收 */
|
|
String operType = vo.getOperType();
|
|
String operType = vo.getOperType();
|
|
log.info("执行OperInspectionStatus函数的"+operType+"操作, itpId="+vo.getItpId());
|
|
log.info("执行OperInspectionStatus函数的"+operType+"操作, itpId="+vo.getItpId());
|
|
@@ -231,4 +222,141 @@ public class ZhcxOutsideInspectionItpServiceImpl extends ServiceImpl<ZhcxOutside
|
|
return "";
|
|
return "";
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 再次报验
|
|
|
|
+ * 1、报验结论拒收,报验次数+1,修改报验单号
|
|
|
|
+ * 2、清空派单信息
|
|
|
|
+ *
|
|
|
|
+ * @param id
|
|
|
|
+ */
|
|
|
|
+ @Override
|
|
|
|
+ public void reInspection(String id) {
|
|
|
|
+ ZhcxOutsideInspectionItpDo itpDo = getById(id);
|
|
|
|
+
|
|
|
|
+ //拒收,报验次数加+1
|
|
|
|
+ Map<String, String> map = new HashMap<>();
|
|
|
|
+ map.put("id", id);
|
|
|
|
+ dao.updateInspectionCount(map);
|
|
|
|
+
|
|
|
|
+ LambdaQueryWrapper<ZhcxOutsideInspectionItpSupervisionDispatchDo> dispatchLambdaQueryWrapper = Wrappers.lambdaQuery();
|
|
|
|
+ dispatchLambdaQueryWrapper.eq(ZhcxOutsideInspectionItpSupervisionDispatchDo::getItpid, id);
|
|
|
|
+ ZhcxOutsideInspectionItpSupervisionDispatchDo dispatchServiceOne = dispatchService.getOne(dispatchLambdaQueryWrapper);
|
|
|
|
+
|
|
|
|
+ List<String> inspectionCodes = new ArrayList<>(Arrays.asList(itpDo.getInspectioncode().split("-")));;
|
|
|
|
+
|
|
|
|
+ ZhcxOutsideInspectionItpDo entity = new ZhcxOutsideInspectionItpDo();
|
|
|
|
+ BeanUtil.copyProperties(itpDo, entity);
|
|
|
|
+
|
|
|
|
+ //报验状态:取消状态
|
|
|
|
+ if("30".equals(dispatchServiceOne.getDispatchstatus())) {
|
|
|
|
+ if(inspectionCodes.size() == 1) {
|
|
|
|
+ inspectionCodes.add("C1");
|
|
|
|
+ entity.setSourceid(itpDo.getId());
|
|
|
|
+ entity.setSourcecode(itpDo.getInspectioncode());
|
|
|
|
+ } else {
|
|
|
|
+ boolean flag = false;
|
|
|
|
+ for(int m = 0, n = inspectionCodes.size(); m < n; m++) {
|
|
|
|
+ if(inspectionCodes.get(m).startsWith("C")) {
|
|
|
|
+ Integer c = Integer.valueOf(inspectionCodes.get(m).replace("C", ""));
|
|
|
|
+ c += 1;
|
|
|
|
+ inspectionCodes.set(m, "C" + c);
|
|
|
|
+ flag = true;
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if(!flag) {
|
|
|
|
+ inspectionCodes.add("C1");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //报验结论:拒收状态
|
|
|
|
+ if("20".equals(dispatchServiceOne.getInspectionconclusion())) {
|
|
|
|
+ if(inspectionCodes.size() == 1) {
|
|
|
|
+ inspectionCodes.add("R1");
|
|
|
|
+ entity.setSourceid(itpDo.getId());
|
|
|
|
+ entity.setSourcecode(itpDo.getInspectioncode());
|
|
|
|
+ } else {
|
|
|
|
+ boolean flag = false;
|
|
|
|
+ for(int m = 0, n = inspectionCodes.size(); m < n; m++) {
|
|
|
|
+ if(inspectionCodes.get(m).startsWith("R")) {
|
|
|
|
+ Integer c = Integer.valueOf(inspectionCodes.get(m).replace("C", ""));
|
|
|
|
+ c += 1;
|
|
|
|
+ inspectionCodes.set(m, "R" + c);
|
|
|
|
+ flag = true;
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if(!flag) {
|
|
|
|
+ inspectionCodes.add("R1");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //新的报验单
|
|
|
|
+ entity.setId(SecurityUtil.getUUID());
|
|
|
|
+ entity.setInspectioncode(StringUtils.join(inspectionCodes, "-"));
|
|
|
|
+ save(entity);
|
|
|
|
+
|
|
|
|
+ //指派单
|
|
|
|
+ ZhcxOutsideInspectionItpSupervisionDispatchDo dispatchEntity = new ZhcxOutsideInspectionItpSupervisionDispatchDo();
|
|
|
|
+ BeanUtil.copyProperties(dispatchServiceOne, dispatchEntity);
|
|
|
|
+ dispatchEntity.setId(SecurityUtil.getUUID());
|
|
|
|
+ dispatchEntity.setItpid(entity.getId());
|
|
|
|
+ dispatchService.save(dispatchEntity);
|
|
|
|
+
|
|
|
|
+ //报验单明细
|
|
|
|
+ List<String> newItpIdList = new ArrayList<>();
|
|
|
|
+ newItpIdList.add(entity.getId());
|
|
|
|
+ insertChildren(itpDo, newItpIdList);
|
|
|
|
+
|
|
|
|
+ //以前报验单弃用
|
|
|
|
+ ZhcxOutsideInspectionItpDo itpDoTemp = new ZhcxOutsideInspectionItpDo();
|
|
|
|
+ itpDoTemp.setId(id);
|
|
|
|
+ itpDoTemp.setLifecycle("99");
|
|
|
|
+ updateById(itpDoTemp);
|
|
|
|
+
|
|
|
|
+ //更新
|
|
|
|
+ dispatchService.reInspection(dispatchServiceOne.getId());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 生成单号
|
|
|
|
+ *
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ private String genCode() {
|
|
|
|
+ SysSerialVo sysSerialVo = new SysSerialVo();
|
|
|
|
+ sysSerialVo.setRuleTemplateStr("W@{date:yyyyMMdd}@{serialNumber:#0000}");
|
|
|
|
+ sysSerialVo.setModulecode("ZHCX_OUTSIDE_INSPECTION_ITP_CODE");
|
|
|
|
+ sysSerialVo.setIfautomaticreset("y");
|
|
|
|
+ sysSerialVo.setResetrule("date:yyyyMMdd");
|
|
|
|
+ sysSerialVo.setInitValue(0L);
|
|
|
|
+ return serialNumberService.getCodeByTemplate(sysSerialVo);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 保存子表
|
|
|
|
+ *
|
|
|
|
+ * @param itpDo
|
|
|
|
+ * @param newItpIdList
|
|
|
|
+ */
|
|
|
|
+ private void insertChildren(ZhcxOutsideInspectionItpDo itpDo, List<String> newItpIdList) {
|
|
|
|
+ if(ObjectUtil.isEmpty(newItpIdList)) {
|
|
|
|
+ return ;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //钢结构
|
|
|
|
+ if("10".equals(itpDo.getInspectiontype())) {
|
|
|
|
+ itpNdtResultService.copyByItpId(itpDo.getId(), newItpIdList);
|
|
|
|
+ }
|
|
|
|
+ String[] array = {"10", "20", "30"};
|
|
|
|
+ List<String> qcTypeList = Arrays.asList(array);
|
|
|
|
+ if(qcTypeList.contains(itpDo.getInspectiontype())) {
|
|
|
|
+ qcItemResultService.copyByItpId(itpDo.getId(), newItpIdList);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|