日志记录修改

main
BKGY_MYT 3 weeks ago
parent d9548802b5
commit 2bff90935a

@ -129,7 +129,7 @@ public interface SubService {
List<PmThickAddvBt> getPmThickAddvBt();
void SaveData(SlabInfoDO p, List<PmPdSlab> pmPdSlabDOList, List<PmPdPlateCut> pmPdPlateCutDOList, List<PmPdBlockPos> pmPdBlockPosDOList, List<PmPdContSum> pmPdContSumDOList, List<PmSmallPltPos> pmSmallPltPosDOList, List<PmCmdSlab> pmCmdSlabDOList, List<PmCmdLargePlt> pmCmdLargePltDOList, List<PmCmdCont> pmCmdContDOList, List<PmCmdSmallPlt> pmCmdSmallPltDOList, List<PmSubHis> plistpmSubHisDO, List<PmSubOrd> plistpmSubOrdDO, List<PmPdRecDTO> pmPdRecDTOList, Long organizationId);
String SaveData(SlabInfoDO p, List<PmPdSlab> pmPdSlabDOList, List<PmPdPlateCut> pmPdPlateCutDOList, List<PmPdBlockPos> pmPdBlockPosDOList, List<PmPdContSum> pmPdContSumDOList, List<PmSmallPltPos> pmSmallPltPosDOList, List<PmCmdSlab> pmCmdSlabDOList, List<PmCmdLargePlt> pmCmdLargePltDOList, List<PmCmdCont> pmCmdContDOList, List<PmCmdSmallPlt> pmCmdSmallPltDOList, List<PmSubHis> plistpmSubHisDO, List<PmSubOrd> plistpmSubOrdDO, List<PmPdRecDTO> pmPdRecDTOList, Long organizationId);
void saveSubLog(String slabNo, long subMode, String subRslt, String subLog, Long organizationId);

@ -7,6 +7,8 @@ import com.xisc.pm.api.dto.*;
import com.xisc.pm.api.dto.ctevent.ProContBoardEndDTO;
import com.xisc.pm.api.dto.model.*;
import com.xisc.pm.app.service.PmPdRecService;
import com.xisc.pm.app.service.strategy.PdMatTypeStrategyFactory;
import com.xisc.pm.app.service.strategy.pdmattype.PdMatTypeStrategy;
import com.xisc.pm.domain.entity.*;
import com.xisc.pm.domain.repository.*;
import com.xisc.pm.domain.vo.MatStatusModifyVO;
@ -17,10 +19,12 @@ import com.xisc.pm.infra.client.QdOrderClient;
import com.xisc.pm.infra.constant.Constants;
import com.xisc.pm.infra.constant.CtEventConstants;
import com.xisc.pm.infra.constant.PmPlateConstants;
import com.xisc.pm.infra.enums.PdEventType;
import com.xisc.pm.infra.enums.PdProdFlag;
import com.xisc.pm.infra.mapper.SubMapper;
import com.xisc.pm.app.service.SubService;
import com.xisc.pm.infra.util.BeanUtils;
import io.choerodon.core.exception.CommonException;
import io.choerodon.core.oauth.CustomUserDetails;
import io.choerodon.core.oauth.DetailsHelper;
import org.apache.commons.lang3.math.NumberUtils;
@ -54,6 +58,63 @@ public class SubServiceImpl implements SubService {
@Autowired
private QdOrderClient qdOrderClient;
@Autowired
private SubMapper subMapper;
@Autowired
private PmPdSlabRepository pmPdSlabRepository;
@Autowired
private PmCmdSlabRepository pmCmdSlabRepository;
@Autowired
private PmCmdLargePltRepository pmCmdLargePltRepository;
@Autowired
private PmPdContSumRepository pmPdContSumRepository;
@Autowired
private PmPdBlockPosRepository pmPdBlockPosRepository;
@Autowired
private PmPdPlateCutRepository pmPdPlateCutRepository;
@Autowired
private PmSmallPltPosRepository pmSmallPltPosRepository;
@Autowired
private PmCmdSmallPltRepository pmCmdSmallPltRepository;
@Autowired
private PmCmdContRepository pmCmdContRepository;
@Autowired
private PmSubHisRepository pmSubHisRepository;
@Autowired
private PmSubOrdRepository pmSubOrdRepository;
@Autowired
private PmPdSlabInfoRepository pmPdSlabInfoRepository;
@Autowired
private MmEventClient mmEventClient;
@Autowired
private RedisHelper redisHelper;
@Autowired
private PmPdRecService pmPdRecService;
@Autowired
private PmProContRepository pmProContRepository;
@Autowired
private PmSubLogRepository pmSubLogRepository;
@Autowired
protected EventClient eventClient;
// @Autowired
// private TransactionService transactionService;
@ -4134,65 +4195,13 @@ public class SubServiceImpl implements SubService {
// batchInsertPmCmdCont(pmCmdContDOList);
// System.out.println("PmCmdCont 命令参数 保存成功");
SaveData(p,pmPdSlabDOList, pmPdPlateCutDOList, pmPdBlockPosDOList, pmPdContSumDOList, pmSmallPltPosDOList, pmCmdSlabDOList, pmCmdLargePltDOList, pmCmdContDOList, pmCmdSmallPltDOList,plistpmSubHisDO,plistpmSubOrdDO,pmPdRecs,organizationId);
String strSubLog = SaveData(p,pmPdSlabDOList, pmPdPlateCutDOList, pmPdBlockPosDOList, pmPdContSumDOList, pmSmallPltPosDOList, pmCmdSlabDOList, pmCmdLargePltDOList, pmCmdContDOList, pmCmdSmallPltDOList,plistpmSubHisDO,plistpmSubOrdDO,pmPdRecs,organizationId);
subLog.setSubDate(now);
subLog.setSubLog(subLog.getSubLog() + strSubLog);
pmSubLogRepository.insertSelective(subLog);
}
@Autowired
private SubMapper subMapper;
@Autowired
private PmPdSlabRepository pmPdSlabRepository;
@Autowired
private PmCmdSlabRepository pmCmdSlabRepository;
@Autowired
private PmCmdLargePltRepository pmCmdLargePltRepository;
@Autowired
private PmPdContSumRepository pmPdContSumRepository;
@Autowired
private PmPdBlockPosRepository pmPdBlockPosRepository;
@Autowired
private PmPdPlateCutRepository pmPdPlateCutRepository;
@Autowired
private PmSmallPltPosRepository pmSmallPltPosRepository;
@Autowired
private PmCmdSmallPltRepository pmCmdSmallPltRepository;
@Autowired
private PmCmdContRepository pmCmdContRepository;
@Autowired
private PmSubHisRepository pmSubHisRepository;
@Autowired
private PmSubOrdRepository pmSubOrdRepository;
@Autowired
private PmPdSlabInfoRepository pmPdSlabInfoRepository;
@Autowired
private MmEventClient mmEventClient;
@Autowired
private RedisHelper redisHelper;
@Autowired
private PmPdRecService pmPdRecService;
@Autowired
private PmProContRepository pmProContRepository;
@Autowired
private PmSubLogRepository pmSubLogRepository;
@Autowired
protected EventClient eventClient;
// 获取板坯信息
@Override
@ -4541,114 +4550,132 @@ public class SubServiceImpl implements SubService {
@Override
@Transactional(rollbackFor = Exception.class)
public void SaveData(SlabInfoDO p, List<PmPdSlab> pmPdSlabDOList, List<PmPdPlateCut> pmPdPlateCutDOList, List<PmPdBlockPos> pmPdBlockPosDOList, List<PmPdContSum> pmPdContSumDOList, List<PmSmallPltPos> pmSmallPltPosDOList, List<PmCmdSlab> pmCmdSlabDOList, List<PmCmdLargePlt> pmCmdLargePltDOList, List<PmCmdCont> pmCmdContDOList, List<PmCmdSmallPlt> pmCmdSmallPltDOList, List<PmSubHis> plistpmSubHisDO, List<PmSubOrd> plistpmSubOrdDO, List<PmPdRecDTO> pmPdRecDTOList, Long organizationId) {
public String SaveData(SlabInfoDO p, List<PmPdSlab> pmPdSlabDOList, List<PmPdPlateCut> pmPdPlateCutDOList, List<PmPdBlockPos> pmPdBlockPosDOList, List<PmPdContSum> pmPdContSumDOList, List<PmSmallPltPos> pmSmallPltPosDOList, List<PmCmdSlab> pmCmdSlabDOList, List<PmCmdLargePlt> pmCmdLargePltDOList, List<PmCmdCont> pmCmdContDOList, List<PmCmdSmallPlt> pmCmdSmallPltDOList, List<PmSubHis> plistpmSubHisDO, List<PmSubOrd> plistpmSubOrdDO, List<PmPdRecDTO> pmPdRecDTOList, Long organizationId) {
String strSubLog = "";
//抛合同事件
String bizId = pmPdRecDTOList.get(0).getKeyvalue1();
String key = String.format(PmPlateConstants.YIELD_EXEC_LOCK_KEY, organizationId.toString(), bizId);
if (redisHelper.hasKey(key)) {
throw new CommonException("pm.pm_pro_cont_043", bizId);
}
// //抛合同事件
// String bizId = pmPdRecDTOList.get(0).getKeyvalue1();
// String key = String.format(PmPlateConstants.YIELD_EXEC_LOCK_KEY, organizationId.toString(), bizId);
// if (redisHelper.hasKey(key)) {
// throw new CommonException("pm.pm_pro_cont_043", bizId);
// }
//
// PdMatTypeStrategy pdMatTypeStrategy = PdMatTypeStrategyFactory.matchStrategy("S");
// try {
// // 抛合同组板事件
// pmPdRecService.createEvent(organizationId, pmPdRecDTOList
// , PdEventType.HP04, Constants.SYSTEM_PD_CODE, pdMatTypeStrategy.pdProgram());
// redisHelper.strSet(key, "1", 30L, TimeUnit.SECONDS);
// // 抛组板履历事件
// List<PmPdRecDTO> pmPdRecs = new ArrayList<>();
// CustomUserDetails userDetails = DetailsHelper.getUserDetails();
// for (PmPdContSum contSum : pmPdContSumDOList) {
// PmPdRecDTO pmPdRecDTO = new PmPdRecDTO();
// pmPdRecDTO.setOrderNo(contSum.getOrderNo());
// pmPdRecDTO.setEventMaker(userDetails == null ? "" : userDetails.getUserId().toString());
// pmPdRecDTO.setMscLineNo(pmPdRecDTOList.get(0).getMscLineNo());
// pmPdRecDTO.setKeyvalue1(bizId);
// pmPdRecDTO.setKeyvalue1Desc(PmPdRecDTO.DESC_VIRTUAL_SLAB_NO);
// pmPdRecDTO.setMatNo(bizId);
// pmPdRecDTO.setQty(contSum.getOrderPlateNum());
// pmPdRecs.add(pmPdRecDTO);
// }
// pmPdRecService.createEvent(organizationId, pmPdRecs, PdEventType.HP10,
// Constants.SYSTEM_PD_CODE, "余材板坯组板");
// System.out.println("抛合同组板事件 执行成功");
// // 抛合同
//
//
// } finally {
// // 抛合同组板释放事件
// pmPdRecService.createEvent(organizationId, pmPdRecDTOList
// , PdEventType.HP05, Constants.SYSTEM_PD_CODE, pdMatTypeStrategy.pdProgram());
// redisHelper.delKey(key);
// }
PdMatTypeStrategy pdMatTypeStrategy = PdMatTypeStrategyFactory.matchStrategy("S");
try {
// 抛合同组板事件
pmPdRecService.createEvent(organizationId, pmPdRecDTOList
, PdEventType.HP04, Constants.SYSTEM_PD_CODE, pdMatTypeStrategy.pdProgram());
redisHelper.strSet(key, "1", 30L, TimeUnit.SECONDS);
// 抛组板履历事件
List<PmPdRecDTO> pmPdRecs = new ArrayList<>();
CustomUserDetails userDetails = DetailsHelper.getUserDetails();
for (PmPdContSum contSum : pmPdContSumDOList) {
PmPdRecDTO pmPdRecDTO = new PmPdRecDTO();
pmPdRecDTO.setOrderNo(contSum.getOrderNo());
pmPdRecDTO.setEventMaker(userDetails == null ? "" : userDetails.getUserId().toString());
pmPdRecDTO.setMscLineNo(pmPdRecDTOList.get(0).getMscLineNo());
pmPdRecDTO.setKeyvalue1(bizId);
pmPdRecDTO.setKeyvalue1Desc(PmPdRecDTO.DESC_VIRTUAL_SLAB_NO);
pmPdRecDTO.setMatNo(bizId);
pmPdRecDTO.setQty(contSum.getOrderPlateNum());
pmPdRecs.add(pmPdRecDTO);
}
pmPdRecService.createEvent(organizationId, pmPdRecs, PdEventType.HP10,
Constants.SYSTEM_PD_CODE, "余材板坯组板");
System.out.println("抛合同组板事件 执行成功");
strSubLog = "-----抛合同组板事件 执行成功";
// 抛合同
} finally {
// 抛合同组板释放事件
pmPdRecService.createEvent(organizationId, pmPdRecDTOList
, PdEventType.HP05, Constants.SYSTEM_PD_CODE, pdMatTypeStrategy.pdProgram());
redisHelper.delKey(key);
}
if (plistpmSubHisDO.size() > 0) {
pmSubHisRepository.batchInsertSelective(plistpmSubHisDO);
System.out.println("pmSubHis表 保存成功");
strSubLog += "-----pmSubHis表 保存成功";
}
if (plistpmSubOrdDO.size() > 0) {
pmSubOrdRepository.batchInsertSelective(plistpmSubOrdDO);
System.out.println("pmSubOrd表 保存成功");
strSubLog += "-----pmSubOrd表 保存成功";
}
////
// if (pmPdSlabDOList.size() > 0) {
// pmPdSlabRepository.batchInsertSelective(pmPdSlabDOList);
// System.out.println("PmPdSlab表 保存成功");
// }
// if (pmPdPlateCutDOList.size() > 0) {
// pmPdPlateCutRepository.batchInsertSelective(pmPdPlateCutDOList);
// System.out.println("PmPdPlateCut 大板粗切位置 保存成功");
// }
// if (pmPdBlockPosDOList.size() > 0) {
// pmPdBlockPosRepository.batchInsertSelective(pmPdBlockPosDOList);
// System.out.println("PmPdBlockPos 组合子板位置表 保存成功");
// }
// if (pmPdContSumDOList.size() > 0) {
// pmPdContSumRepository.batchInsertSelective(pmPdContSumDOList);
// System.out.println("PmPdContSum 合同总量表 保存成功");
// }
// if (pmSmallPltPosDOList.size() > 0) {
// pmSmallPltPosRepository.batchInsertSelective(pmSmallPltPosDOList);
// System.out.println("PmSmallPltPos 命令小板位置表 保存成功");
// }
// if (pmCmdSlabDOList.size() > 0) {
// pmCmdSlabRepository.batchInsertSelective(pmCmdSlabDOList);
// System.out.println("PmCmdSlab 保存成功");
// }
// if (pmCmdLargePltDOList.size() > 0) {
// pmCmdLargePltRepository.batchInsertSelective(pmCmdLargePltDOList);
// System.out.println("pmCmdLargePltDO 命令大板 保存成功");
// }
// if (pmCmdContDOList.size() > 0) {
// pmCmdContRepository.batchInsertSelective(pmCmdContDOList);
// System.out.println("PmCmdCont 命令参数 保存成功");
// }
// if (pmCmdSmallPltDOList.size() > 0) {
// pmCmdSmallPltRepository.batchInsertSelective(pmCmdSmallPltDOList);
// System.out.println("PmCmdSmallPlt 命令小板表 保存成功");
// }
//
// // 调用mm接口
// // 查询MM_SLAB 信息获取板坯信息
// PmPdSlabSplitDTO pmPdSlabSplitDTO = pmPdSlabRepository.selectMmSlabBySlabId(p.getSlabId(), p.getTenantId());
// // 查询板坯信息表。第一次查询可能无值
// PmPdSlabInfo pmPdSlabInfo = pmPdSlabInfoRepository.selectBySlabNo(p.getSlabNo(), p.getTenantId());
//
// pmPdSlabInfo = buildPmPdSlabInfo(pmPdSlabSplitDTO, p.getSlabNo(), p.getMscLineNo(), p.getTenantId());
// pmPdSlabInfoRepository.insertSelective(pmPdSlabInfo);
// System.out.println("pmPdSlabInfo表 保存成功");
//
// // 轧钢模块“在制品材料管理封锁事件接口"
// callMatStatusModify(pmPdSlabInfo);
// System.out.println("mm模块接口 调用成功");
// System.out.println("程序执行完成!");
//
// //抛合同
// zbCtEventRec(organizationId, pmPdSlabDOList, pmCmdLargePltDOList, pmCmdSlabDOList, pmSmallPltPosDOList);
// System.out.println("抛合同事件完成");
if (pmPdSlabDOList.size() > 0) {
pmPdSlabRepository.batchInsertSelective(pmPdSlabDOList);
System.out.println("PmPdSlab表 保存成功");
strSubLog += "-----PmPdSlab表 保存成功";
}
if (pmPdPlateCutDOList.size() > 0) {
pmPdPlateCutRepository.batchInsertSelective(pmPdPlateCutDOList);
System.out.println("PmPdPlateCut 大板粗切位置 保存成功");
strSubLog += "-----PmPdPlateCut 大板粗切位置 保存成功";
}
if (pmPdBlockPosDOList.size() > 0) {
pmPdBlockPosRepository.batchInsertSelective(pmPdBlockPosDOList);
System.out.println("PmPdBlockPos 组合子板位置表 保存成功");
strSubLog += "-----PmPdBlockPos 组合子板位置表 保存成功";
}
if (pmPdContSumDOList.size() > 0) {
pmPdContSumRepository.batchInsertSelective(pmPdContSumDOList);
System.out.println("PmPdContSum 合同总量表 保存成功");
strSubLog += "-----PmPdContSum 合同总量表 保存成功";
}
if (pmSmallPltPosDOList.size() > 0) {
pmSmallPltPosRepository.batchInsertSelective(pmSmallPltPosDOList);
System.out.println("PmSmallPltPos 命令小板位置表 保存成功");
strSubLog += "-----PmSmallPltPos 命令小板位置表 保存成功";
}
if (pmCmdSlabDOList.size() > 0) {
pmCmdSlabRepository.batchInsertSelective(pmCmdSlabDOList);
System.out.println("PmCmdSlab 保存成功");
strSubLog += "-----PmCmdSlab 保存成功";
}
if (pmCmdLargePltDOList.size() > 0) {
pmCmdLargePltRepository.batchInsertSelective(pmCmdLargePltDOList);
System.out.println("pmCmdLargePltDO 命令大板 保存成功");
strSubLog += "-----pmCmdLargePltDO 命令大板 保存成功";
}
if (pmCmdContDOList.size() > 0) {
pmCmdContRepository.batchInsertSelective(pmCmdContDOList);
System.out.println("PmCmdCont 命令参数 保存成功");
strSubLog += "-----PmCmdCont 命令参数 保存成功";
}
if (pmCmdSmallPltDOList.size() > 0) {
pmCmdSmallPltRepository.batchInsertSelective(pmCmdSmallPltDOList);
System.out.println("PmCmdSmallPlt 命令小板表 保存成功");
strSubLog += "-----PmCmdSmallPlt 命令小板表 保存成功";
}
// 调用mm接口
// 查询MM_SLAB 信息获取板坯信息
PmPdSlabSplitDTO pmPdSlabSplitDTO = pmPdSlabRepository.selectMmSlabBySlabId(p.getSlabId(), p.getTenantId());
// 查询板坯信息表。第一次查询可能无值
PmPdSlabInfo pmPdSlabInfo = pmPdSlabInfoRepository.selectBySlabNo(p.getSlabNo(), p.getTenantId());
pmPdSlabInfo = buildPmPdSlabInfo(pmPdSlabSplitDTO, p.getSlabNo(), p.getMscLineNo(), p.getTenantId());
pmPdSlabInfoRepository.insertSelective(pmPdSlabInfo);
System.out.println("pmPdSlabInfo表 保存成功");
strSubLog += "-----pmPdSlabInfo表 保存成功";
// 轧钢模块“在制品材料管理封锁事件接口"
callMatStatusModify(pmPdSlabInfo);
System.out.println("mm模块接口 调用成功");
strSubLog += "-----mm模块接口 调用成功";
//抛合同
zbCtEventRec(organizationId, pmPdSlabDOList, pmCmdLargePltDOList, pmCmdSlabDOList, pmSmallPltPosDOList);
System.out.println("抛合同事件完成");
System.out.println("程序执行完成!");
strSubLog += "-----抛合同事件完成 -----程序执行完成!";
return strSubLog;
//

Loading…
Cancel
Save