44424 PCN:工单判可疑的码,扫描工单检验通过后,在扫描装配件工步时扫描判可疑码,工单标记为可疑

uat-temp-wj-250208-44424
王杰 3 months ago
parent b46e6a6a8a
commit 3b391c1019

@ -17,6 +17,7 @@ import cn.estsh.i3plus.pojo.mes.model.StationResultBean;
import cn.estsh.i3plus.pojo.mes.model.StepResult;
import cn.estsh.i3plus.pojo.mes.repository.MesWorkOrderRepository;
import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -26,7 +27,9 @@ import org.springframework.util.StringUtils;
import javax.persistence.EntityManager;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @Description :
@ -89,42 +92,68 @@ public class MesWorkOrderSaveSortStepService extends BaseStepService {
private void doHandleWorkOrderData(StationRequestBean reqBean, StationResultBean resultBean, List<MesProductionPartContext> productionPartContextList, MesWorkCell workCell) {
//获取上下文加工结果
String productResult = productionDispatchContextStepService.getProductResultContext(reqBean);
Map<String, Object> propertyMap;
for (MesProductionPartContext productionPartContext : productionPartContextList) {
if (null == productionPartContext || StringUtils.isEmpty(productionPartContext.getForeignKey())) continue;
//判断是否末道工位
Boolean isEndWorkCell = (!StringUtils.isEmpty(workCell.getIsEndWorkCell()) && workCell.getIsEndWorkCell().compareTo(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()) == 0) ? true : false;
if (!isEndWorkCell && productionPartContext.getWorkOrderStatus().compareTo(MesExtEnumUtil.ORDER_STATUS.PROCESS.getValue()) == 0) continue;
if (!isEndWorkCell) {
workOrderRepository.updateByPropertiesNoSync(
new String[]{MesPcnExtConstWords.ID, MesPcnExtConstWords.ORGANIZE_CODE},
new Object[]{productionPartContext.getId(), reqBean.getOrganizeCode()},
new String[]{MesPcnExtConstWords.MODIFY_USER, MesPcnExtConstWords.MODIFY_DATE_TIME,
MesPcnExtConstWords.SYSTEM_SYNC_STATUS, MesPcnExtConstWords.SYSTEM_SYNC_DATE_TIME,
MesPcnExtConstWords.WORK_ORDER_STATUS, MesPcnExtConstWords.START_TIME, MesPcnExtConstWords.ONLINE_TIME},
new Object[]{reqBean.getUserInfo(), (new SimpleDateFormat(MesPcnExtConstWords.DATE_FORMAT_SSS)).format(new Date()),
CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), MesPcnExtConstWords.EMPTY,
MesExtEnumUtil.ORDER_STATUS.PROCESS.getValue(), productionPartContext.getOnlineTime(), productionPartContext.getOnlineTime()});
} else {
productionPartContext.setOfflineTime(TimeTool.getNowTime(true));
workOrderRepository.updateByPropertiesNoSync(
new String[]{MesPcnExtConstWords.ID, MesPcnExtConstWords.ORGANIZE_CODE},
new Object[]{productionPartContext.getId(), reqBean.getOrganizeCode()},
new String[]{MesPcnExtConstWords.MODIFY_USER, MesPcnExtConstWords.MODIFY_DATE_TIME,
MesPcnExtConstWords.SYSTEM_SYNC_STATUS, MesPcnExtConstWords.SYSTEM_SYNC_DATE_TIME,
MesPcnExtConstWords.WORK_ORDER_STATUS, MesPcnExtConstWords.COMPLETE_QTY, MesPcnExtConstWords.UN_COMPLETE_QTY,
MesPcnExtConstWords.START_TIME, MesPcnExtConstWords.ONLINE_TIME, MesPcnExtConstWords.END_TIME, MesPcnExtConstWords.OFFLINE_TIME},
new Object[]{reqBean.getUserInfo(), (new SimpleDateFormat(MesPcnExtConstWords.DATE_FORMAT_SSS)).format(new Date()),
CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), MesPcnExtConstWords.EMPTY,
MesExtEnumUtil.ORDER_STATUS.COMPLETE.getValue(), new Double(1), new Double(0),
productionPartContext.getOnlineTime(), productionPartContext.getOnlineTime(), productionPartContext.getOfflineTime(), productionPartContext.getOfflineTime()});
propertyMap = new HashMap<>();
//质量非合格
if (!StringUtils.isEmpty(productResult) && !productResult.equals(MesExtEnumUtil.PRODUCE_QC_STATUS.QUALIFIED.getValue() + MesPcnExtConstWords.EMPTY)) {
propertyMap.put(MesPcnExtConstWords.QC_STATUS, Integer.valueOf(productResult));
}
log.info("工厂{}生产线{}工位{}:FSM STATE DISPATCHER --- DO STEP --- {} EXEC --- ORDER:{} --- UPDATE:[{}:{}]",
reqBean.getOrganizeCode(), reqBean.getWorkCenterCode(), reqBean.getWorkCellCode(),
StringUtil.toLowerCaseFirst(this.getClass().getSimpleName()), productionPartContext.getWorkOrderNo(), MesPcnExtConstWords.WORK_ORDER_STATUS, !isEndWorkCell ? MesExtEnumUtil.ORDER_STATUS.PROCESS.getValue() : MesExtEnumUtil.ORDER_STATUS.COMPLETE.getValue());
//末工位 或者 非加工中
if (isEndWorkCell || productionPartContext.getWorkOrderStatus().compareTo(MesExtEnumUtil.ORDER_STATUS.PROCESS.getValue()) != 0) {
if (!isEndWorkCell) {
propertyMap.put(MesPcnExtConstWords.WORK_ORDER_STATUS, MesExtEnumUtil.ORDER_STATUS.PROCESS.getValue());
propertyMap.put(MesPcnExtConstWords.START_TIME, productionPartContext.getOnlineTime());
propertyMap.put(MesPcnExtConstWords.ONLINE_TIME, productionPartContext.getOnlineTime());
} else {
productionPartContext.setOfflineTime(TimeTool.getNowTime(true));
propertyMap.put(MesPcnExtConstWords.WORK_ORDER_STATUS, MesExtEnumUtil.ORDER_STATUS.COMPLETE.getValue());
propertyMap.put(MesPcnExtConstWords.START_TIME, productionPartContext.getOnlineTime());
propertyMap.put(MesPcnExtConstWords.ONLINE_TIME, productionPartContext.getOnlineTime());
propertyMap.put(MesPcnExtConstWords.END_TIME, productionPartContext.getOfflineTime());
propertyMap.put(MesPcnExtConstWords.OFFLINE_TIME, productionPartContext.getOfflineTime());
propertyMap.put(MesPcnExtConstWords.COMPLETE_QTY, new Double(1));
propertyMap.put(MesPcnExtConstWords.UN_COMPLETE_QTY, new Double(0));
}
}
//当存在修改字段的情况下进行修改工单信息
if (!CollectionUtils.isEmpty(propertyMap) && propertyMap.size() > 0) {
propertyMap.put(MesPcnExtConstWords.MODIFY_USER, reqBean.getUserInfo());
propertyMap.put(MesPcnExtConstWords.MODIFY_DATE_TIME, (new SimpleDateFormat(MesPcnExtConstWords.DATE_FORMAT_SSS)).format(new Date()));
propertyMap.put(MesPcnExtConstWords.SYSTEM_SYNC_STATUS, CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue());
propertyMap.put(MesPcnExtConstWords.SYSTEM_SYNC_DATE_TIME, MesPcnExtConstWords.EMPTY);
String[] propertyName = new String[propertyMap.size()];
Object[] propertyValue = new Object[propertyMap.size()];
Integer index = 0;
for (Map.Entry<String, Object> innerEntry : propertyMap.entrySet()) {
if (null == innerEntry) continue;
propertyName[index] = innerEntry.getKey();
propertyValue[index] = innerEntry.getValue();
index ++;
}
workOrderRepository.updateByPropertiesNoSync(new String[]{MesPcnExtConstWords.ID, MesPcnExtConstWords.ORGANIZE_CODE}, new Object[]{productionPartContext.getId(), reqBean.getOrganizeCode()}, propertyName, propertyValue);
log.info("工厂{}生产线{}工位{}:FSM STATE DISPATCHER --- DO STEP --- {} EXEC --- ORDER:{} --- UPDATE:{}",
reqBean.getOrganizeCode(), reqBean.getWorkCenterCode(), reqBean.getWorkCellCode(),
StringUtil.toLowerCaseFirst(this.getClass().getSimpleName()), productionPartContext.getWorkOrderNo(), JSONObject.toJSONString(propertyMap));
}
}
}

Loading…
Cancel
Save