报工问题修改

tags/yfai-pcn-ext-v1.0
微笑着面对明天 12 months ago
parent d32640909e
commit 77b8304de0

@ -19,15 +19,15 @@ public interface IMesInputDefectRecordService {
@ApiOperation(value = "查询页面信息")
public MesPartInspectionViewModel queryPartInspection(MesPartInspectionInputModel model, String org);
MesPartInspectionViewModel queryPartInspection(MesPartInspectionInputModel model, String org);
@ApiOperation(value = "零件类型缺陷类型对应关系信息")
public List<MesPartTypeDefect> queryPartTypeDefect(String serialNumber, String defectLocation, boolean flg, Integer frontBack, String org);
List<MesPartTypeDefect> queryPartTypeDefect(String serialNumber, String defectLocation, boolean flg, Integer frontBack, String org);
@ApiOperation(value = "完成质检")
public void savePartInspection(MesPartInspectionInputModel model, String org);
void savePartInspection(MesPartInspectionInputModel model, String org);
@ApiOperation(value = "可疑品录入")
public void saveSusPartInspection(MesPartInspectionInputModel model, String org);
void saveSusPartInspection(MesPartInspectionInputModel model, String org);
}

@ -34,8 +34,6 @@ public class MqttConfig {
@Value("${mqtt.clearSession}")
public boolean clearSession;
@Value("${mqtt.topic}")
public String topic;
@Value("${mqtt.topic.list}")
private String topicList;

@ -5,6 +5,7 @@ import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesEquipmentLogExtService;
import cn.estsh.i3plus.ext.mes.pcn.apiservice.schedulejob.MesReportNoSortJob;
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesWorkOrderService;
import cn.estsh.i3plus.ext.mes.pcn.apiservice.schedulejob.MesReportWorkByPreDayJob;
import cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.test.TestService;
import cn.estsh.i3plus.ext.mes.pcn.pojo.constant.MesCommonConstant;
import cn.estsh.i3plus.platform.common.convert.ConvertBean;
import cn.estsh.i3plus.pojo.base.bean.DdlPackBean;
@ -50,6 +51,9 @@ public class TestController {
@Autowired
private IMesConfigService configService;
@Autowired
private TestService testService;
@GetMapping("/equipment/log/query")
@ApiOperation(value = "查询设备交互")
public ResultBean queryReworkTaskByPager(String organizeCode, Integer equipId) {
@ -123,4 +127,11 @@ public class TestController {
mesReportWorkByPreDayJob.executeMesJob(null, null);
}
@GetMapping("/testInsert")
@ApiOperation(value = "批量")
public void testInsert() {
testService.insertList();
}
}

@ -89,6 +89,9 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService
@Autowired
private IMesProduceSnExtService produceSnExtService;
@Autowired
private MesProductVersionRepository productVersionRepository;
@Override
public MesPartInspectionViewModel queryPartInspection(MesPartInspectionInputModel inputModel, String org) {
@ -821,8 +824,25 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService
partInspectionRepository.save(partInspection);
//
String source = configService.getCfgValue(org, "LGORT");
//移库
MesMove move = createMove(model, configService.getCfgValue(org, "LGORT"), configService.getCfgValue(org, "UMLGO"), org);
String partNo = model.getPartNo();
// 查询生产版本
String workCenterCode = model.getWorkCenterCode();
String productVersion = model.getProductVersion();
if (!StringUtils.isEmpty(productVersion)) {
DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean();
DdlPreparedPack.getStringEqualPack(partNo, "partNo", ddlPackBean);
DdlPreparedPack.getStringEqualPack(workCenterCode, "workCenterCode", ddlPackBean);
DdlPreparedPack.getStringEqualPack(productVersion, "productVersion", ddlPackBean);
MesProductVersion version = productVersionRepository.getByProperty(ddlPackBean);
if (version != null) {
source = version.getShipInventoryPoint();
}
}
MesMove move = createMove(model, source, configService.getCfgValue(org, "UMLGO"), org);
moveRepository.save(move);
}
}

@ -95,6 +95,9 @@ public class MesNcProcessingService implements IMesNcProcessingService {
private MesOrgRepository mesOrgRDao;
@Autowired
private MesProductVersionRepository productVersionRepository;
@Autowired
private IMesProduceSnExtService produceSnExtService;
@Override
public ListPager<MesPartInspection> queryPartInspectionByPager(MesPartInspection partInspection, Pager pager) {
@ -327,6 +330,19 @@ public class MesNcProcessingService implements IMesNcProcessingService {
private void saveDate(MesNcProcessingInputModel model, MesPartSap part, Integer type, MesDefectType person, String org,String areaCode, boolean
isOrder) {
String source = configService.getCfgValue(org, "LGORT");
if (!StringUtils.isEmpty(model.getProductVersion())) {
DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean();
DdlPreparedPack.getStringEqualPack(model.getPart().getPartNo(), "partNo", ddlPackBean);
DdlPreparedPack.getStringEqualPack(model.getPartInspection().getWorkCenterCode(), "workCenterCode", ddlPackBean);
DdlPreparedPack.getStringEqualPack(model.getProductVersion(), "productVersion", ddlPackBean);
MesProductVersion version = productVersionRepository.getByProperty(ddlPackBean);
if (version != null) {
source = version.getShipInventoryPoint();
}
}
if (type == MesExtEnumUtil.NC_TYPE.NORMAL.getValue()) {
//更新条码质量状态
@ -417,13 +433,14 @@ public class MesNcProcessingService implements IMesNcProcessingService {
ConvertBean.serviceModelUpdate(sn, model.getPartInspection().getModifyUser());
partInspectionRepository.save(model.getPartInspection());
if (isOrder) {
MesMove move = createMove(model, configService.getCfgValue(org, "UMLGO"), configService.getCfgValue(org, "SCRAP"), org,MesExtEnumUtil.MOVE_TYPE.SCRAP_MOVE);
MesMove move = createMove(model, source, configService.getCfgValue(org, "SCRAP"), org,MesExtEnumUtil.MOVE_TYPE.SCRAP_MOVE);
moveRepository.save(move);
}
} else {
//移库 转报废 根据责任方库区对应关系的主数据选择哪个责任方就移动到哪个库区8000移至8002/8003
MesMove move = createMove(model, configService.getCfgValue(org, "UMLGO"), areaCode, org, MesExtEnumUtil.MOVE_TYPE.SCRAP_MOVE);
// MesMove move = createMove(model, configService.getCfgValue(org, "UMLGO"), configService.getCfgValue(org, "SCRAP"), org);
moveRepository.save(move);
}
} else if (type == MesExtEnumUtil.NC_TYPE.RELEASE.getValue()) {

@ -57,6 +57,7 @@ public class MesWorkCellScanMonitorLogServiceImpl implements IMesWorkCellScanMon
for (Long mouldRecordId : mouldRecordIdList) {
DdlPackBean recordPackBean = DdlPackBean.getDdlPackBean(organizeCode);
DdlPreparedPack.getNumEqualPack(mouldRecordId, "mouldRecordId", recordPackBean);
List<MesProductionRecord> recordList = productionRecordRao.findByHqlWhere(recordPackBean);
//需要补录如下字段
DdlPackBean monitorLogPackBean = DdlPackBean.getDdlPackBean(organizeCode);
@ -73,7 +74,6 @@ public class MesWorkCellScanMonitorLogServiceImpl implements IMesWorkCellScanMon
new Object[]{workOrderNoStr, serialNoStr, productSnStr, custSnStr, partNoStr, partNameStr, TimeTool.getNowTime(true), "JOB", MesExtEnumUtil.MES_LOG_DEAL_STATUS.DEAL_SUCCESS.getValue(), newTimes}, monitorLogPackBean);
} else {
if (newTimes > times) {
monitorLogRao.updateByProperties(new String[]{"modifyDatetime", "modifyUser", "times"}, new Object[]{TimeTool.getNowTime(true), "JOB", newTimes}, monitorLogPackBean);
} else {
monitorLogRao.updateByProperties(new String[]{"modifyDatetime", "modifyUser", "times", "dealStatus"}, new Object[]{TimeTool.getNowTime(true), "JOB", newTimes, MesExtEnumUtil.MES_LOG_DEAL_STATUS.DEAL_FAILURE.getValue()}, monitorLogPackBean);

@ -554,8 +554,15 @@ public class MesWorkOrderService implements IMesWorkOrderService {
//保存数据
List<MesProductOffLine> mesProductOffLineList = new ArrayList<>();
MesProductOffLine newMesProductOffLine;
for (MesBom mesBom : mesBoms) {
// 排除重复的数据
Map<MesBom, List<MesBom>> map = mesBoms.stream().collect(Collectors.groupingBy(mesBom -> {
MesBom bom = new MesBom();
bom.setPartNo(mesBom.getPartNo());
bom.setItemPartNo(mesBom.getItemPartNo());
return bom;
}));
for (Map.Entry<MesBom, List<MesBom>> entry : map.entrySet()) {
MesBom mesBom = entry.getValue().get(0);
newMesProductOffLine = new MesProductOffLine();
newMesProductOffLine.setReportPartNo(oldMesWorkOrder.getPartNo());
newMesProductOffLine.setReportPartNameRdd(oldMesWorkOrder.getPartName());
@ -580,7 +587,6 @@ public class MesWorkOrderService implements IMesWorkOrderService {
ConvertBean.serviceModelInitialize(newMesProductOffLine, userName);
mesProductOffLineList.add(newMesProductOffLine);
}
mesProductOffLineRDao.saveAll(mesProductOffLineList);
// 同步工单信息给加工记录、条码信息
DdlPackBean snDdlPackBean = DdlPackBean.getDdlPackBean();
@ -678,6 +684,7 @@ public class MesWorkOrderService implements IMesWorkOrderService {
DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean(organizeCode);
DdlPreparedPack.getStringEqualPack(productionRecord.getPartNo(), "partNo", ddlPackBean);
DdlPreparedPack.getStringEqualPack(productionRecord.getWorkCenterCode(), "workCenterCode", ddlPackBean);
if (!StringUtils.isEmpty(productionRecord.getWorkOrderNo())) {
DdlPreparedPack.getStringEqualPack(productionRecord.getWorkOrderNo(), "workOrderNo", ddlPackBean);
@ -687,7 +694,9 @@ public class MesWorkOrderService implements IMesWorkOrderService {
// 新增班次逻辑
//DdlPreparedPack.
List<MesWorkOrder> oldMesWorkOrders = workOrderRepository.findByHqlWhere(ddlPackBean);
if (!CollectionUtils.isEmpty(oldMesWorkOrders)) {
oldMesWorkOrders = oldMesWorkOrders.stream().filter(mesWorkOrder -> !Objects.equals(MesExtEnumUtil.ORDER_TYPE_IDENTIFICATION.P.getValue(), mesWorkOrder.getOrderFlag())).collect(Collectors.toList());
}
return oldMesWorkOrders;
}
@ -748,14 +757,7 @@ public class MesWorkOrderService implements IMesWorkOrderService {
if(!CollectionUtils.isEmpty(mesProductionRecordList)) {
Map<String, List<MesProductionRecord>> map = mesProductionRecordList.stream().collect(Collectors.groupingBy(MesProductionRecord::getPartNo));
map.forEach((k, v) -> {
DdlPackBean packBean = DdlPackBean.getDdlPackBean();
DdlPreparedPack.getStringEqualPack(k, "partNo", packBean);
// 排除掉试制造件
MesPartSap part = partSapRepository.getByProperty(packBean);
if (part != null && !Objects.equals(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue(), part.getIsTestPiece())) {
recordList.add(v.get(0));
}
LOGGER.info("sap物料中不存在该物料号【{}】, 或者是试制件,不进行报工");
});
}
@ -791,7 +793,6 @@ public class MesWorkOrderService implements IMesWorkOrderService {
if (part != null && !Objects.equals(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue(), part.getIsTestPiece())) {
recordList.add(v.get(0));
}
LOGGER.info("sap物料中不存在该物料号【{}】, 或者是试制件,不进行报工");
});
}
return recordList;

@ -67,7 +67,7 @@ public class MesEquipmentLogExtService implements IMesEquipmentLogExtService {
DdlPreparedPack.getNumEqualPack(equipId, MesPcnExtConstWords.EQUIP_ID, packBean);
DdlPreparedPack.getNumEqualPack(equipVariableId, MesPcnExtConstWords.EQUIP_VARIABLE_ID, packBean);
equipmentLogRepository.updateByProperties(new String[]{"equipVariableValue",MesPcnExtConstWords.EQUIP_VARIABLE_STATUS}, new Object[]{value, MesExtEnumUtil.EQUIP_VARIABLE_NEED_NEW_VALUE.TRUE.getValue()}, packBean);
equipmentLogRepository.updateByProperties(new String[]{"equipVariableValue",MesPcnExtConstWords.EQUIP_VARIABLE_STATUS}, new Object[]{value, MesExtEnumUtil.EQUIP_VARIABLE_NEED_NEW_VALUE.TRUE.getEquipVariableStatus()}, packBean);
}
@Override
public Boolean checkEquipQuality(Integer quality) {

@ -203,7 +203,7 @@ public class MesProductionNoSortModuleService extends BaseModuleService {
return StationKvBeanUtil.addStationKvBeanList(new ArrayList<>(),
new StationKvBean("shiftGroup", "班组", record.getShiftGroup()),
new StationKvBean("shiftGroupName", "班组名称", record.getShiftGroup()),
new StationKvBean("shiftGroupName", "班组名称", record.getShiftGroupName()),
new StationKvBean("shiftCode", "班次", record.getShiftCode()),
new StationKvBean("shiftName", "班次名称", record.getShiftName()))
;

@ -5,6 +5,7 @@ import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesInputDefectRecordService;
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesNcProcessingService;
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProductionDispatchContextStepService;
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProductionProcessContextStepService;
import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProductionPartContext;
import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProductionPsOutContext;
import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesNcProcessingInputModel;
import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesPartInspectionInputModel;
@ -28,6 +29,7 @@ import com.google.common.base.Objects;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import java.util.Arrays;
@ -35,6 +37,7 @@ import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors;
/**
* @Description :
@ -76,8 +79,11 @@ public class MesProductResultErrorHandleStepService extends BaseStepService {
}
// 获取条码列表
List<MesProductionPsOutContext> mesProduceSns = mesProductionDispatchContextStepService.getProductionPsOutContext(reqBean);
List<MesProductionPartContext> productionPartContexts = mesProductionDispatchContextStepService.getProductionPartContext(reqBean);
// 保存加工异常记录(NC判断记录)
saveProductResultException(reqBean, mesProduceSns, result);
saveProductResultException(reqBean, mesProduceSns,productionPartContexts, result);
return execSuccessCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.PROCESS.getValue()), stepResult, "加工异常处理成功");
@ -90,9 +96,14 @@ public class MesProductResultErrorHandleStepService extends BaseStepService {
* @param reqBean
* @param mesProduceSns
*/
private void saveProductResultException(StationRequestBean reqBean, List<MesProductionPsOutContext> mesProduceSns, String result) {
private void saveProductResultException(StationRequestBean reqBean, List<MesProductionPsOutContext> mesProduceSns, List<MesProductionPartContext> productionPartContexts, String result) {
String defectTypeCode = MesEnumUtil.DEFECT_TYPE_CODE.DETERMIND.getValue();
mesProduceSns.forEach(mesProduceSn -> {
String productVersion = null;
List<MesProductionPartContext> mesProductionPartContextList = productionPartContexts.stream().filter(mesProductionPartContext -> Objects.equal(mesProduceSn.getForeignKey(),mesProductionPartContext.getForeignKey())).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(mesProductionPartContextList)) {
productVersion = mesProductionPartContextList.get(0).getProductVersion();
}
MesNcProcessingInputModel model = new MesNcProcessingInputModel();
MesDefectType mesDefectType = new MesDefectType();
mesDefectType.setBackDefect(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue());
@ -135,6 +146,7 @@ public class MesProductResultErrorHandleStepService extends BaseStepService {
mesPartInspectionDetail.setDefectTypeName(mesDefectType.getDefectTypeName());
model.setPartInspection(partInspection);
model.setType(partInspection.getSourceType());
model.setProductVersion(productVersion);
if (Objects.equal(MesExtEnumUtil.EQUIP_VARIABLE_CFG_CATEGORY.PRODUCT_SCRAP.getValue(), result)) {
model.setType(MesExtEnumUtil.NC_TYPE.SCRAP.getValue());
@ -156,6 +168,8 @@ public class MesProductResultErrorHandleStepService extends BaseStepService {
inspectModel.setWorkCenterCode(mesProduceSn.getWorkCenterCode());
inspectModel.setPartInspection(partInspection);
inspectModel.setShiftCode(mesProduceSn.getShiftCode());
inspectModel.setProductVersion(productVersion);
inputDefectRecordService.saveSusPartInspection(inspectModel, reqBean.getOrganizeCode());
}
});

@ -0,0 +1,6 @@
package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.test;
public interface TestService {
void insertList();
}

@ -0,0 +1,100 @@
package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.test;
import cn.estsh.i3plus.platform.common.convert.ConvertBean;
import cn.estsh.i3plus.pojo.base.codemaker.SnowflakeIdMaker;
import cn.estsh.i3plus.pojo.mes.bean.MesEquipmentLogDetail;
import cn.estsh.i3plus.pojo.mes.repository.MesEquipmentLogDetailRepository;
import cn.estsh.i3plus.pojo.mes.repository.MesEquipmentLogRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.logging.Logger;
@Service
public class TestServiceImpl implements TestService{
@Autowired
private MesEquipmentLogRepository equipmentLogRepository;
@Autowired
private MesEquipmentLogDetailRepository equipmentLogDetailRepository;
@Autowired
private SnowflakeIdMaker snowflakeIdMaker;
private static ExecutorService executorService = new ThreadPoolExecutor(1, 10,
0L, TimeUnit.MILLISECONDS,
new LinkedBlockingQueue<>(200), r -> {
Thread thread = new Thread(r);
thread.setName("executorService--"+r.hashCode());
return thread;
},new ThreadPoolExecutor.DiscardPolicy());
private static ExecutorService executorService2 = new ThreadPoolExecutor(1, 10,
0L, TimeUnit.MILLISECONDS,
new LinkedBlockingQueue<>(200), r -> {
Thread thread = new Thread(r);
thread.setName("executorService--"+r.hashCode());
return thread;
},new ThreadPoolExecutor.DiscardPolicy());
public void insertList() {
executorService = new ThreadPoolExecutor(1, 10,
0L, TimeUnit.MILLISECONDS,
new LinkedBlockingQueue<>(200), r -> {
Thread thread = new Thread(r);
thread.setName("executorService--"+r.hashCode());
return thread;
},new ThreadPoolExecutor.DiscardPolicy());
executorService2 = new ThreadPoolExecutor(1, 10,
0L, TimeUnit.MILLISECONDS,
new LinkedBlockingQueue<>(200), r -> {
Thread thread = new Thread(r);
thread.setName("executorService--"+r.hashCode());
return thread;
},new ThreadPoolExecutor.DiscardPolicy());
List<MesEquipmentLogDetail> list = new ArrayList<>();
for (int i= 1; i< 10; i ++) {
executorService.execute(new Runnable() {
@Override
public void run() {
for (int j = 1; j < 500; j++) {
executorService2.execute(new Runnable() {
@Override
public void run() {
MesEquipmentLogDetail equipmentLogDetail = new MesEquipmentLogDetail();
ConvertBean.serviceModelInitialize(equipmentLogDetail, "test");
equipmentLogDetail.setId(snowflakeIdMaker.nextId());
equipmentLogDetail.setEquipVariableId(123123l);
equipmentLogDetail.setEquipVariableName("aaa");
equipmentLogDetail.setReadWriteFlag(1);
equipmentLogDetail.setDataType("40");
equipmentLogDetail.setEquipId(7);
equipmentLogDetail.setEquipmentCode("Foaming5#");
list.add(equipmentLogDetail);
/* try {
Thread.sleep(50);
} catch (InterruptedException e) {
e.printStackTrace();
}*/
}
});
}
}
});
try {
Thread.sleep(10000);
} catch (InterruptedException e) {
e.printStackTrace();
}
equipmentLogDetailRepository.saveAll(list);
}
}
}

@ -45,6 +45,9 @@ public class MesProductionPartContext implements Serializable {
@ApiParam("完成数量【不能用于业务计算】")
private Double completeQty;
@ApiParam("生产版本")
private String productVersion;
@ApiParam("设备代码")
private String equipmentCode;

@ -38,6 +38,9 @@ public class MesNcProcessingInputModel {
@ApiParam("物料")
private MesPartSap part;
@ApiParam("版本号")
private String productVersion;
@ApiParam("NC-零件检测详情")
private List<MesPartInspectionDetail> partInspectionDetailList;

@ -49,6 +49,8 @@ public class MesPartInspectionInputModel {
@ApiParam("是否返工单完成单据")
private boolean transferFlg = false;
@ApiParam("版本号")
private String productVersion;
@ApiParam("NC-零件检测-单据")
private MesPartInspection partInspection;

Loading…
Cancel
Save