|
@@ -14,12 +14,14 @@ import com.rongwei.bsentity.vo.OperOutsideInspectionVo;
|
|
|
import com.rongwei.bsentity.vo.SupervisionVo;
|
|
|
import com.rongwei.commonservice.serial.service.SysSerialNumberService;
|
|
|
import com.rongwei.rwadmincommon.system.domain.SysUserDo;
|
|
|
+import com.rongwei.rwadmincommon.system.service.SysGeneralCRUDService;
|
|
|
import com.rongwei.rwadmincommon.system.vo.SysUserVo;
|
|
|
import com.rongwei.rwcommon.base.R;
|
|
|
import com.rongwei.rwcommon.utils.SecurityUtil;
|
|
|
import com.rongwei.rwcommon.utils.StringUtils;
|
|
|
+import com.rongwei.rwcommon.vo.generalsql.MasterSlaveUpdateVo;
|
|
|
import com.rongwei.rwcommonentity.commonservers.vo.SysSerialVo;
|
|
|
-import lombok.extern.java.Log;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
@@ -34,7 +36,7 @@ import java.util.*;
|
|
|
* @since 2023-12-26
|
|
|
*/
|
|
|
@Service
|
|
|
-@Log
|
|
|
+@Slf4j
|
|
|
public class ZhcxOutsideInspectionItpServiceImpl extends ServiceImpl<ZhcxOutsideInspectionItpDao, ZhcxOutsideInspectionItpDo> implements ZhcxOutsideInspectionItpService {
|
|
|
|
|
|
@Autowired
|
|
@@ -58,6 +60,9 @@ public class ZhcxOutsideInspectionItpServiceImpl extends ServiceImpl<ZhcxOutside
|
|
|
@Autowired
|
|
|
private ZhcxOutsideInspectionItpDao dao;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private SysGeneralCRUDService sysGeneralCRUDService;
|
|
|
+
|
|
|
/**
|
|
|
* 拆单
|
|
|
*
|
|
@@ -264,35 +269,89 @@ public class ZhcxOutsideInspectionItpServiceImpl extends ServiceImpl<ZhcxOutside
|
|
|
|
|
|
/**
|
|
|
* 再次报验
|
|
|
- * 1、报验结论拒收,报验次数+1,修改报验单号
|
|
|
- * 2、清空派单信息
|
|
|
+ * 1、复制一份作为历史记录
|
|
|
+ * 2、保存最新数据
|
|
|
+ * 3、更新报验次数
|
|
|
+ * 4、清空派单数据
|
|
|
*
|
|
|
* @param id
|
|
|
*/
|
|
|
@Override
|
|
|
- public void reInspection(String id) {
|
|
|
+ public void reInspection(String id, MasterSlaveUpdateVo masterSlaveUpdate) {
|
|
|
ZhcxOutsideInspectionItpDo itpDo = getById(id);
|
|
|
|
|
|
+ LambdaQueryWrapper<ZhcxOutsideInspectionItpSupervisionDispatchDo> dispatchLambdaQueryWrapper = Wrappers.lambdaQuery();
|
|
|
+ dispatchLambdaQueryWrapper.eq(ZhcxOutsideInspectionItpSupervisionDispatchDo::getItpid, id);
|
|
|
+ ZhcxOutsideInspectionItpSupervisionDispatchDo dispatchDo = dispatchService.getOne(dispatchLambdaQueryWrapper);
|
|
|
+
|
|
|
+ //保存历史
|
|
|
+ saveHistory(itpDo, dispatchDo);
|
|
|
+
|
|
|
+ //新的报验单号
|
|
|
+ String newCode = genNewCode(itpDo, dispatchDo);
|
|
|
+ masterSlaveUpdate.getMasterUpdate().getUpdatecolumns().put("INSPECTIONCODE", newCode);
|
|
|
+ masterSlaveUpdate.getMasterUpdate().getUpdatecolumns().put("INSPECTIONSTATUS", "20");
|
|
|
+
|
|
|
+ //报验次数需要累计
|
|
|
+ masterSlaveUpdate.getMasterUpdate().getUpdatecolumns().remove("INSPECTIONCOUNT");
|
|
|
+ try {
|
|
|
+ sysGeneralCRUDService.generalMsUpdate(masterSlaveUpdate);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("保存失败: {}", e);
|
|
|
+ }
|
|
|
+
|
|
|
//拒收,报验次数加+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);
|
|
|
+ //更新
|
|
|
+ dispatchService.reInspection(dispatchDo.getId());
|
|
|
+ }
|
|
|
|
|
|
- List<String> inspectionCodes = new ArrayList<>(Arrays.asList(itpDo.getInspectioncode().split("-")));;
|
|
|
+ /**
|
|
|
+ * 保存
|
|
|
+ *
|
|
|
+ * @param itpDo
|
|
|
+ * @param dispatchDo
|
|
|
+ */
|
|
|
+ private void saveHistory(ZhcxOutsideInspectionItpDo itpDo, ZhcxOutsideInspectionItpSupervisionDispatchDo dispatchDo) {
|
|
|
|
|
|
+ //保存报验单
|
|
|
ZhcxOutsideInspectionItpDo entity = new ZhcxOutsideInspectionItpDo();
|
|
|
BeanUtil.copyProperties(itpDo, entity);
|
|
|
+ //新的报验单
|
|
|
+ entity.setId(SecurityUtil.getUUID());
|
|
|
+ entity.setLifecycle("99");
|
|
|
+ save(entity);
|
|
|
+
|
|
|
+ //保存指派单
|
|
|
+ ZhcxOutsideInspectionItpSupervisionDispatchDo dispatchEntity = new ZhcxOutsideInspectionItpSupervisionDispatchDo();
|
|
|
+ BeanUtil.copyProperties(dispatchDo, dispatchEntity);
|
|
|
+ dispatchEntity.setId(SecurityUtil.getUUID());
|
|
|
+ dispatchEntity.setItpid(entity.getId());
|
|
|
+ dispatchService.save(dispatchEntity);
|
|
|
+
|
|
|
+ //报验单明细
|
|
|
+ List<String> newItpIdList = new ArrayList<>();
|
|
|
+ newItpIdList.add(entity.getId());
|
|
|
+ insertChildren(itpDo, newItpIdList);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 生成新的单号
|
|
|
+ *
|
|
|
+ * @param itpDo
|
|
|
+ * @param dispatchDo
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private String genNewCode(ZhcxOutsideInspectionItpDo itpDo, ZhcxOutsideInspectionItpSupervisionDispatchDo dispatchDo) {
|
|
|
+ List<String> inspectionCodes = new ArrayList<>(Arrays.asList(itpDo.getInspectioncode().split("-")));;
|
|
|
|
|
|
//报验状态:取消状态
|
|
|
- if("30".equals(dispatchServiceOne.getDispatchstatus())) {
|
|
|
+ if("30".equals(dispatchDo.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++) {
|
|
@@ -312,16 +371,14 @@ public class ZhcxOutsideInspectionItpServiceImpl extends ServiceImpl<ZhcxOutside
|
|
|
}
|
|
|
|
|
|
//报验结论:拒收状态
|
|
|
- if("20".equals(dispatchServiceOne.getInspectionconclusion())) {
|
|
|
+ if("20".equals(dispatchDo.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", ""));
|
|
|
+ Integer c = Integer.valueOf(inspectionCodes.get(m).replace("R", ""));
|
|
|
c += 1;
|
|
|
inspectionCodes.set(m, "R" + c);
|
|
|
flag = true;
|
|
@@ -335,31 +392,7 @@ public class ZhcxOutsideInspectionItpServiceImpl extends ServiceImpl<ZhcxOutside
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- //新的报验单
|
|
|
- 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 StringUtils.join(inspectionCodes, "-");
|
|
|
}
|
|
|
|
|
|
/**
|