生产开模统计job逻辑修改

tags/yfai-pcn-ext-v1.0
jun 1 year ago
parent 1ce8b4b480
commit b4f7aad050

@ -1,5 +1,7 @@
package cn.estsh.i3plus.ext.mes.pcn.api.busi; package cn.estsh.i3plus.ext.mes.pcn.api.busi;
import io.swagger.annotations.ApiOperation;
/** /**
* @Description : * @Description :
* @Reference : * @Reference :
@ -9,5 +11,6 @@ package cn.estsh.i3plus.ext.mes.pcn.api.busi;
**/ **/
public interface IMesProdMouldStatisticsService { public interface IMesProdMouldStatisticsService {
@ApiOperation("汇总生产开模统计")
void doSumMesProdMouldStatistics(String organizeCode, Integer pageSize, String userName); void doSumMesProdMouldStatistics(String organizeCode, Integer pageSize, String userName);
} }

@ -56,7 +56,7 @@ public class MesProdMouldStatisticsDaoImpl implements IMesProdMouldStatisticsDao
query.setParameter("organizeCode", organizeCode); query.setParameter("organizeCode", organizeCode);
query.setParameter("isValid", CommonEnumUtil.VALID); query.setParameter("isValid", CommonEnumUtil.VALID);
query.setParameter("isDeleted", CommonEnumUtil.FALSE); query.setParameter("isDeleted", CommonEnumUtil.FALSE);
query.setParameter("ids", idList); query.setParameter("idList", idList);
query.setParameter("moduleStatisticsStatus", CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()); query.setParameter("moduleStatisticsStatus", CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue());
query.setParameter("modifyUser", userName); query.setParameter("modifyUser", userName);
if (updateSyncStatus) { if (updateSyncStatus) {

@ -62,17 +62,11 @@ public class MesProdMouldStatisticsServiceImpl implements IMesProdMouldStatistic
return; return;
} }
Map<String, List<MesProdMouldRecord>> undStatisticsMesProdMouldRecordMap = undStatisticsMesProdMouldRecordList.stream().collect(Collectors.groupingBy(MesProdMouldRecord::getEquipmentCode)); Map<String, List<MesProdMouldRecord>> undStatisticsMesProdMouldRecordMap = undStatisticsMesProdMouldRecordList.stream().collect(Collectors.groupingBy(MesProdMouldRecord::getEquipmentCode));
//查询加工记录表
Map<Long, List<MesProductionRecord>> productionRecordMap = getProductionRecordMap(organizeCode, undStatisticsMesProdMouldRecordList.stream().map(MesProdMouldRecord::getId).collect(Collectors.toList()));
//数据处理 //数据处理
List<MesProductionRecord> mesProductionRecordList = new ArrayList<>();
for (MesMouldMappingCfg mesMouldMappingCfg : getMesMouldMappingCfgs(organizeCode, new ArrayList<>(undStatisticsMesProdMouldRecordMap.keySet()))) { for (MesMouldMappingCfg mesMouldMappingCfg : getMesMouldMappingCfgs(organizeCode, new ArrayList<>(undStatisticsMesProdMouldRecordMap.keySet()))) {
List<MesProdMouldRecord> mesProdMouldRecords = undStatisticsMesProdMouldRecordMap.get(mesMouldMappingCfg.getEquipmentCode()); List<MesProdMouldRecord> mesProdMouldRecords = undStatisticsMesProdMouldRecordMap.get(mesMouldMappingCfg.getEquipmentCode());
//更新开模记录数据 //更新开模记录数据
mesProdMouldRecords.forEach(mesProdMouldRecord -> { mesProdMouldRecords.forEach(mesProdMouldRecord -> {
if (!Objects.isNull(productionRecordMap) && productionRecordMap.containsKey(mesProdMouldRecord.getId())) {
mesProductionRecordList.addAll(productionRecordMap.get(mesProdMouldRecord.getId()));
}
mesProdMouldRecord.setAssetNum(mesMouldMappingCfg.getAssetNum()); mesProdMouldRecord.setAssetNum(mesMouldMappingCfg.getAssetNum());
mesProdMouldRecord.setMeterName(mesMouldMappingCfg.getMeterName()); mesProdMouldRecord.setMeterName(mesMouldMappingCfg.getMeterName());
mesProdMouldRecord.setSystemSyncStatus(CommonEnumUtil.FALSE); mesProdMouldRecord.setSystemSyncStatus(CommonEnumUtil.FALSE);
@ -83,6 +77,13 @@ public class MesProdMouldStatisticsServiceImpl implements IMesProdMouldStatistic
saveMesProdMouldStatistics(organizeCode, userName, mesMouldMappingCfg, mesProdMouldRecords); saveMesProdMouldStatistics(organizeCode, userName, mesMouldMappingCfg, mesProdMouldRecords);
} }
//更新加工记录表状态 //更新加工记录表状态
updateMesProductionRecord(organizeCode, userName, undStatisticsMesProdMouldRecordList.stream().map(MesProdMouldRecord::getId).collect(Collectors.toList()));
}
private void updateMesProductionRecord(String organizeCode, String userName, List<Long> idList) {
//查询加工记录表
List<MesProductionRecord> mesProductionRecordList = getProductionRecordList(organizeCode, idList);
//更新加工记录表状态
if (!CollectionUtils.isEmpty(mesProductionRecordList)) { if (!CollectionUtils.isEmpty(mesProductionRecordList)) {
List<Long> noUpdateSyncStatusId = mesProductionRecordList.stream().filter(t -> MesExtEnumUtil.REPORT_STATUS.REPORT_STATUS_10.getValue() == t.getReportStatus()).map(MesProductionRecord::getId).collect(Collectors.toList()); List<Long> noUpdateSyncStatusId = mesProductionRecordList.stream().filter(t -> MesExtEnumUtil.REPORT_STATUS.REPORT_STATUS_10.getValue() == t.getReportStatus()).map(MesProductionRecord::getId).collect(Collectors.toList());
List<Long> updateSyncStatusId = mesProductionRecordList.stream().filter(t -> MesExtEnumUtil.REPORT_STATUS.REPORT_STATUS_10.getValue() != t.getReportStatus()).map(MesProductionRecord::getId).collect(Collectors.toList()); List<Long> updateSyncStatusId = mesProductionRecordList.stream().filter(t -> MesExtEnumUtil.REPORT_STATUS.REPORT_STATUS_10.getValue() != t.getReportStatus()).map(MesProductionRecord::getId).collect(Collectors.toList());
@ -132,17 +133,12 @@ public class MesProdMouldStatisticsServiceImpl implements IMesProdMouldStatistic
private List<MesMouldMappingCfg> getMesMouldMappingCfgs(String organizeCode, List<String> equipmentCodeList) { private List<MesMouldMappingCfg> getMesMouldMappingCfgs(String organizeCode, List<String> equipmentCodeList) {
DdlPackBean packBean = DdlPackBean.getDdlPackBean(organizeCode); DdlPackBean packBean = DdlPackBean.getDdlPackBean(organizeCode);
DdlPreparedPack.getInPackList(equipmentCodeList, "equipmentCode", packBean); DdlPreparedPack.getInPackList(equipmentCodeList, "equipmentCode", packBean);
List<MesMouldMappingCfg> mesMouldMappingCfgs = mesMouldMappingCfgRDao.findByHqlWhere(packBean); return mesMouldMappingCfgRDao.findByHqlWhere(packBean);
return mesMouldMappingCfgs;
} }
private Map<Long, List<MesProductionRecord>> getProductionRecordMap(String organizeCode, List<Long> idList) { private List<MesProductionRecord> getProductionRecordList(String organizeCode, List<Long> idList) {
DdlPackBean packBean = DdlPackBean.getDdlPackBean(organizeCode); DdlPackBean packBean = DdlPackBean.getDdlPackBean(organizeCode);
DdlPreparedPack.getInPackList(idList, "mouldRecordId", packBean); DdlPreparedPack.getInPackList(idList, "mouldRecordId", packBean);
List<MesProductionRecord> productionRecordList = mesProductionRecordRDao.findByHqlWhere(packBean); return mesProductionRecordRDao.findByHqlWhere(packBean);
if (!CollectionUtils.isEmpty(productionRecordList)) {
return productionRecordList.stream().collect(Collectors.groupingBy(MesProductionRecord::getMouldRecordId));
}
return null;
} }
} }

Loading…
Cancel
Save