forked from I3-YF/i3plus-mes-pcn-yfai
Merge branch 'uat-temp-wj-chongqingdaqu-prod-temp-rfid' into uat-temp-wj-chongqingdaqu-dev
commit
ae9582d18d
@ -1,18 +1,36 @@
|
||||
package cn.estsh.i3plus.ext.mes.pcn.api.busi;
|
||||
|
||||
import cn.estsh.i3plus.pojo.mes.bean.MesProdRouteOptParam;
|
||||
import cn.estsh.i3plus.pojo.mes.bean.seres.MesCimSeresJisRfid;
|
||||
import cn.estsh.i3plus.pojo.mes.bean.shipping.MesShippingOrderManagement;
|
||||
import cn.estsh.i3plus.pojo.mes.bean.shipping.MesShippingOrderManagementDetail;
|
||||
import cn.estsh.i3plus.pojo.mes.bean.shipping.MesShippingQueue;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
public interface IMesShippingQueueService {
|
||||
|
||||
@ApiOperation("根据零件发运组代码查询创建时间正序创建状态的一条发运队列")
|
||||
MesShippingQueue getShippingQueue(String organizeCode, String shippingGroupCode);
|
||||
|
||||
@ApiOperation("根据发运代码查询创建时间正序创建状态的一条发运队列")
|
||||
MesShippingQueue getShippingQueueByCode(String organizeCode, String shippingCode);
|
||||
|
||||
@ApiOperation("根据ID修改发运队列")
|
||||
void saveShippingQueue(String organizeCode, Long id, String[] propertyName, Object[] propertyValue);
|
||||
|
||||
@ApiOperation("根据VIN查询赛力斯RFID信息")
|
||||
MesCimSeresJisRfid getCimSeresJisRfid(String organizeCode, String vin);
|
||||
|
||||
@ApiOperation("根据发运代码查询发运主表")
|
||||
MesShippingOrderManagement getShipping(String organizeCode, String shippingCode);
|
||||
|
||||
@ApiOperation("根据发运主表ID查询发运明细表")
|
||||
MesShippingOrderManagementDetail getShippingDetail(String organizeCode, Long pid);
|
||||
|
||||
@ApiOperation("解析rfidSn")
|
||||
String getRfidSn(Optional<Map<String, MesProdRouteOptParam>> stepParamMap, String rfid);
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,28 @@
|
||||
package cn.estsh.i3plus.ext.mes.pcn.api.job;
|
||||
|
||||
import cn.estsh.i3plus.pojo.mes.bean.MesWorkOrder;
|
||||
import cn.estsh.i3plus.pojo.mes.bean.MesWorkOrderCalcQtyRecord;
|
||||
import cn.estsh.impp.framework.boot.exception.ImppBusiException;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface IMesWorkOrderCalcQtyRestoreDispatchService {
|
||||
|
||||
@ApiOperation(value = "查询生产工单计数记录表")
|
||||
List<MesWorkOrderCalcQtyRecord> getWorkOrderCalcQtyRecordList(String organizeCode, Integer qty);
|
||||
|
||||
@ApiOperation(value = "查询工单")
|
||||
@Transactional(propagation = Propagation.NOT_SUPPORTED)
|
||||
MesWorkOrder getWorkOrderDb(String organizeCode, Long workOrderId);
|
||||
|
||||
@ApiOperation(value = "补录生产工单计数JOB修改数据")
|
||||
@Transactional(propagation = Propagation.REQUIRES_NEW, noRollbackFor = {ImppBusiException.class, Exception.class})
|
||||
void doRestoreWorkOrderCalcQty(String organizeCode, MesWorkOrder workOrder, List<MesWorkOrderCalcQtyRecord> value);
|
||||
|
||||
@ApiOperation(value = "修改记录状态")
|
||||
void saveWorkOrderCalcQtyRecord(String organizeCode, List<Long> idList, Integer dealStatus, String remark);
|
||||
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package cn.estsh.i3plus.ext.mes.pcn.api.job;
|
||||
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public interface IMesWorkOrderCalcQtyRestoreService {
|
||||
|
||||
@ApiOperation(value = "补录离线生产工单数据JOB")
|
||||
void doRestoreWorkOrderCalcQty(Map<String, String> paramMap);
|
||||
|
||||
}
|
@ -0,0 +1,77 @@
|
||||
package cn.estsh.i3plus.ext.mes.pcn.apiservice.schedulejob;
|
||||
|
||||
|
||||
import cn.estsh.i3plus.ext.mes.pcn.api.job.IMesWorkOrderCalcQtyRestoreService;
|
||||
import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords;
|
||||
import cn.estsh.impp.framework.boot.init.ApplicationProperties;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.quartz.DisallowConcurrentExecution;
|
||||
import org.quartz.JobExecutionContext;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StopWatch;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author wangjie
|
||||
* @Description 生产工单计数补录JOB
|
||||
* @version 1.0
|
||||
* @date 2021/2/2 16:44
|
||||
**/
|
||||
@Slf4j
|
||||
@DisallowConcurrentExecution
|
||||
@Component
|
||||
@ApiOperation("补录生产工单计数JOB")
|
||||
public class MesWorkOrderCalcQtyRestoreJob extends BaseMesScheduleJob {
|
||||
|
||||
public MesWorkOrderCalcQtyRestoreJob() {
|
||||
super(MesWorkOrderCalcQtyRestoreJob.class, "补录生产工单计数JOB");
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private IMesWorkOrderCalcQtyRestoreService workOrderCalcQtyRestoreService;
|
||||
|
||||
@Override
|
||||
public void executeMesJob(JobExecutionContext context, ApplicationProperties applicationProperties) {
|
||||
|
||||
String jobParam = this.getJobParam();
|
||||
if (StringUtils.isEmpty(jobParam)) {
|
||||
log.info("--- 异常 --- 补录生产工单计数JOB --- 参数为空 ---");
|
||||
return;
|
||||
}
|
||||
|
||||
Map<String, String> paramMap = JSONObject.parseObject(jobParam, Map.class);
|
||||
|
||||
if (CollectionUtils.isEmpty(paramMap) || !paramMap.containsKey(MesPcnExtConstWords.ORGANIZE_CODE)) {
|
||||
log.info("--- 异常 --- 补录生产工单计数JOB --- 参数未配置:工厂代码[organizeCode] ---");
|
||||
return;
|
||||
}
|
||||
|
||||
StopWatch stopWatch = new StopWatch();
|
||||
|
||||
try {
|
||||
|
||||
stopWatch.start();
|
||||
|
||||
workOrderCalcQtyRestoreService.doRestoreWorkOrderCalcQty(paramMap);
|
||||
|
||||
} catch (Exception e) {
|
||||
|
||||
log.info("--- 异常 --- 补录生产工单计数JOB --- ERROR --- {} ---", e.toString());
|
||||
|
||||
} finally {
|
||||
|
||||
stopWatch.stop();
|
||||
|
||||
log.info("补录生产工单计数JOB --- END --- 耗时: {} ms ---", stopWatch.getTotalTimeMillis());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,188 @@
|
||||
package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.job;
|
||||
|
||||
import cn.estsh.i3plus.ext.mes.pcn.api.job.IMesWorkOrderCalcQtyRestoreDispatchService;
|
||||
import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords;
|
||||
import cn.estsh.i3plus.platform.common.tool.MathOperation;
|
||||
import cn.estsh.i3plus.pojo.base.bean.DdlPackBean;
|
||||
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
|
||||
import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack;
|
||||
import cn.estsh.i3plus.pojo.mes.bean.MesWorkOrder;
|
||||
import cn.estsh.i3plus.pojo.mes.bean.MesWorkOrderCalcQtyRecord;
|
||||
import cn.estsh.i3plus.pojo.mes.repository.MesWorkOrderCalcQtyRecordRepository;
|
||||
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;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class MesWorkOrderCalcQtyRestoreDispatchService implements IMesWorkOrderCalcQtyRestoreDispatchService {
|
||||
|
||||
@Autowired
|
||||
private MesWorkOrderCalcQtyRecordRepository workOrderCalcQtyRecordRepository;
|
||||
|
||||
@Autowired
|
||||
private MesWorkOrderRepository workOrderRepository;
|
||||
|
||||
@Override
|
||||
public List<MesWorkOrderCalcQtyRecord> getWorkOrderCalcQtyRecordList(String organizeCode, Integer qty) {
|
||||
DdlPackBean packBean = DdlPackBean.getDdlPackBean(organizeCode);
|
||||
DdlPreparedPack.getNumEqualPack(MesExtEnumUtil.MES_LOG_DEAL_STATUS.UNDEAL.getValue(), MesPcnExtConstWords.DEAL_STATUS, packBean);
|
||||
DdlPreparedPack.getOrderByPack(new Object[]{CommonEnumUtil.ASC_OR_DESC.ASC.getValue()}, new String[]{MesPcnExtConstWords.CREATE_DATE_TIME}, packBean);
|
||||
return workOrderCalcQtyRecordRepository.findByHqlTopWhere(packBean, qty);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MesWorkOrder getWorkOrderDb(String organizeCode, Long workOrderId) {
|
||||
return workOrderRepository.getByProperty(
|
||||
new String[]{MesPcnExtConstWords.ORGANIZE_CODE, MesPcnExtConstWords.IS_DELETED, MesPcnExtConstWords.IS_VALID, MesPcnExtConstWords.ID},
|
||||
new Object[]{organizeCode, CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), workOrderId});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doRestoreWorkOrderCalcQty(String organizeCode, MesWorkOrder workOrder, List<MesWorkOrderCalcQtyRecord> workOrderCalcQtyRecordList) {
|
||||
|
||||
//搜集记录ID集合
|
||||
List<Long> idList = workOrderCalcQtyRecordList.stream().filter(o -> null != o).map(MesWorkOrderCalcQtyRecord::getId).collect(Collectors.toList());
|
||||
if (null == workOrder) {
|
||||
//修改记录状态
|
||||
saveWorkOrderCalcQtyRecord(organizeCode, idList, MesExtEnumUtil.MES_LOG_DEAL_STATUS.DEAL_FAILURE.getValue(), "工单信息不存在");
|
||||
log.info("补录生产工单计数JOB --- 补录: {} --- ID: {} --- END --- {} {} --- MesWorkOrderCalcQtyRecord: {} ---",
|
||||
workOrderCalcQtyRecordList.get(0).getWorkOrderNo(), workOrderCalcQtyRecordList.get(0).getId(), MesExtEnumUtil.MES_LOG_DEAL_STATUS.DEAL_FAILURE.getDescription(), "工单信息不存在", idList.toString());
|
||||
return;
|
||||
}
|
||||
|
||||
//计数
|
||||
Double completeQty = !StringUtils.isEmpty(workOrder.getCompleteQty()) ? workOrder.getCompleteQty() : new Double(MesPcnExtConstWords.ZERO);
|
||||
Double suspiciousPartQty = !StringUtils.isEmpty(workOrder.getSuspiciousPartQty()) ? workOrder.getSuspiciousPartQty() : new Double(MesPcnExtConstWords.ZERO);
|
||||
Double scrapPartQty = !StringUtils.isEmpty(workOrder.getScrapPartQty()) ? workOrder.getScrapPartQty() : new Double(MesPcnExtConstWords.ZERO);
|
||||
for (MesWorkOrderCalcQtyRecord workOrderCalcQtyRecord : workOrderCalcQtyRecordList) {
|
||||
if (null == workOrderCalcQtyRecord) continue;
|
||||
if (!StringUtils.isEmpty(workOrderCalcQtyRecord.getCompleteQty())) completeQty = MathOperation.add(completeQty, workOrderCalcQtyRecord.getCompleteQty());
|
||||
if (!StringUtils.isEmpty(workOrderCalcQtyRecord.getSuspiciousPartQty())) suspiciousPartQty = MathOperation.add(suspiciousPartQty, workOrderCalcQtyRecord.getSuspiciousPartQty());
|
||||
if (!StringUtils.isEmpty(workOrderCalcQtyRecord.getScrapPartQty())) scrapPartQty = MathOperation.add(scrapPartQty, workOrderCalcQtyRecord.getScrapPartQty());
|
||||
}
|
||||
|
||||
//未完成数
|
||||
Double unCompleteQty = !StringUtils.isEmpty(workOrder.getUnCompleteQty()) ? workOrder.getUnCompleteQty() : workOrder.getQty();
|
||||
unCompleteQty = MathOperation.compareTo(unCompleteQty, new Double(MesPcnExtConstWords.ZERO)) <= MesPcnExtConstWords.ZERO ? new Double(MesPcnExtConstWords.ZERO) : MathOperation.sub(workOrder.getQty(), completeQty);
|
||||
if (MathOperation.compareTo(unCompleteQty, new Double(MesPcnExtConstWords.ZERO)) < MesPcnExtConstWords.ZERO) unCompleteQty = new Double(MesPcnExtConstWords.ZERO);
|
||||
|
||||
//状态
|
||||
Integer workOrderStatus = workOrder.getWorkOrderStatus();
|
||||
if (workOrderStatus.compareTo(MesExtEnumUtil.ORDER_STATUS.RELEASE.getValue()) == MesPcnExtConstWords.ZERO || workOrderStatus.compareTo(MesExtEnumUtil.ORDER_STATUS.PROCESS.getValue()) == MesPcnExtConstWords.ZERO) {
|
||||
if (MathOperation.compareTo(completeQty, workOrder.getQty()) >= MesPcnExtConstWords.ZERO) workOrderStatus = MesExtEnumUtil.ORDER_STATUS.COMPLETE.getValue();
|
||||
else workOrderStatus = MesExtEnumUtil.ORDER_STATUS.PROCESS.getValue();
|
||||
}
|
||||
|
||||
//添加修改属性
|
||||
Map<String, Object> propertyMap = new HashMap<>();
|
||||
Map<String, Object> conditionMap = new HashMap<>();
|
||||
conditionMap.put(MesPcnExtConstWords.ID, workOrder.getId());
|
||||
conditionMap.put(MesPcnExtConstWords.ORGANIZE_CODE, organizeCode);
|
||||
conditionMap.put(MesPcnExtConstWords.IS_DELETED, CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue());
|
||||
conditionMap.put(MesPcnExtConstWords.IS_VALID, CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue());
|
||||
if (MathOperation.compareTo(workOrder.getCompleteQty(), completeQty) != MesPcnExtConstWords.ZERO) {
|
||||
propertyMap.put(MesPcnExtConstWords.COMPLETE_QTY, completeQty);
|
||||
conditionMap.put(MesPcnExtConstWords.COMPLETE_QTY, workOrder.getCompleteQty());
|
||||
}
|
||||
if (MathOperation.compareTo(workOrder.getSuspiciousPartQty(), suspiciousPartQty) != MesPcnExtConstWords.ZERO) {
|
||||
propertyMap.put(MesPcnExtConstWords.SUSPICIOUS_PART_QTY, suspiciousPartQty);
|
||||
conditionMap.put(MesPcnExtConstWords.SUSPICIOUS_PART_QTY, workOrder.getSuspiciousPartQty());
|
||||
}
|
||||
if (MathOperation.compareTo(workOrder.getScrapPartQty(), scrapPartQty) != MesPcnExtConstWords.ZERO) {
|
||||
propertyMap.put(MesPcnExtConstWords.SCRAP_PART_QTY, scrapPartQty);
|
||||
conditionMap.put(MesPcnExtConstWords.SCRAP_PART_QTY, workOrder.getScrapPartQty());
|
||||
}
|
||||
if (MathOperation.compareTo(workOrder.getUnCompleteQty(), unCompleteQty) != MesPcnExtConstWords.ZERO) {
|
||||
propertyMap.put(MesPcnExtConstWords.UN_COMPLETE_QTY, unCompleteQty);
|
||||
conditionMap.put(MesPcnExtConstWords.UN_COMPLETE_QTY, workOrder.getUnCompleteQty());
|
||||
}
|
||||
if (workOrder.getWorkOrderStatus().compareTo(workOrderStatus) != MesPcnExtConstWords.ZERO) {
|
||||
propertyMap.put(MesPcnExtConstWords.WORK_ORDER_STATUS, workOrderStatus);
|
||||
conditionMap.put(MesPcnExtConstWords.WORK_ORDER_STATUS, workOrder.getWorkOrderStatus());
|
||||
}
|
||||
|
||||
//当前没有任何修改
|
||||
if (CollectionUtils.isEmpty(propertyMap)) {
|
||||
//修改记录状态
|
||||
saveWorkOrderCalcQtyRecord(organizeCode, idList, MesExtEnumUtil.MES_LOG_DEAL_STATUS.DEAL_SUCCESS.getValue(), "工单信息无变更");
|
||||
log.info("补录生产工单计数JOB --- 补录: {} --- ID: {} --- END --- {} {} --- MesWorkOrderCalcQtyRecord: {} ---",
|
||||
workOrder.getWorkOrderNo(), workOrder.getId(), MesExtEnumUtil.MES_LOG_DEAL_STATUS.DEAL_SUCCESS.getDescription(), "工单信息无变更", idList.toString());
|
||||
return;
|
||||
}
|
||||
|
||||
//添加常规字段判断是否需要修改
|
||||
if (workOrder.getSystemSyncStatus().compareTo(CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue()) != 0) {
|
||||
propertyMap.put(MesPcnExtConstWords.SYSTEM_SYNC_STATUS, CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue());
|
||||
conditionMap.put(MesPcnExtConstWords.SYSTEM_SYNC_STATUS, workOrder.getSystemSyncStatus());
|
||||
}
|
||||
|
||||
if (!workOrder.getSystemSyncDatetime().equals(MesPcnExtConstWords.EMPTY)) propertyMap.put(MesPcnExtConstWords.SYSTEM_SYNC_DATE_TIME, MesPcnExtConstWords.EMPTY);
|
||||
|
||||
String userInfo = workOrderCalcQtyRecordList.get(workOrderCalcQtyRecordList.size() - MesPcnExtConstWords.ONE).getCreateUser();
|
||||
if (!workOrder.getModifyUser().equals(userInfo)) propertyMap.put(MesPcnExtConstWords.MODIFY_USER, userInfo);
|
||||
|
||||
propertyMap.put(MesPcnExtConstWords.MODIFY_DATE_TIME, (new SimpleDateFormat(MesPcnExtConstWords.DATE_FORMAT_SSS)).format(new Date()));
|
||||
conditionMap.put(MesPcnExtConstWords.MODIFY_DATE_TIME, workOrder.getModifyDatetime());
|
||||
|
||||
//修改值
|
||||
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 ++;
|
||||
}
|
||||
|
||||
//修改条件
|
||||
String[] conditionName = new String[conditionMap.size()];
|
||||
Object[] conditionValue = new Object[conditionMap.size()];
|
||||
|
||||
index = 0;
|
||||
for (Map.Entry<String, Object> innerEntry : conditionMap.entrySet()) {
|
||||
if (null == innerEntry) continue;
|
||||
conditionName[index] = innerEntry.getKey();
|
||||
conditionValue[index] = innerEntry.getValue();
|
||||
index ++;
|
||||
}
|
||||
|
||||
//当工单修改成功后, 再修改记录状态
|
||||
if (workOrderRepository.updateByPropertiesNoSync(conditionName, conditionValue, propertyName, propertyValue) == 1) {
|
||||
//修改记录状态
|
||||
saveWorkOrderCalcQtyRecord(organizeCode, idList, MesExtEnumUtil.MES_LOG_DEAL_STATUS.DEAL_SUCCESS.getValue(), "工单信息已变更成功");
|
||||
|
||||
log.info("补录生产工单计数JOB --- 补录: {} --- ID: {} --- END --- conditionMap: {} --- propertyMap: {} --- {} {} --- MesWorkOrderCalcQtyRecord: {} ---",
|
||||
workOrder.getWorkOrderNo(), workOrder.getId(), JSONObject.toJSONString(conditionMap), JSONObject.toJSONString(propertyMap),
|
||||
MesExtEnumUtil.MES_LOG_DEAL_STATUS.DEAL_SUCCESS.getDescription(), "工单信息已变更成功", idList.toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//修改记录状态
|
||||
@Override
|
||||
public void saveWorkOrderCalcQtyRecord(String organizeCode, List<Long> idList, Integer dealStatus, String remark) {
|
||||
String[] propertyName = new String[]{MesPcnExtConstWords.DEAL_STATUS, MesPcnExtConstWords.MODIFY_USER,
|
||||
MesPcnExtConstWords.MODIFY_DATE_TIME, MesPcnExtConstWords.SYSTEM_SYNC_STATUS, MesPcnExtConstWords.REMARK};
|
||||
Object[] propertyValue = new Object[]{dealStatus, MesPcnExtConstWords.JOB,
|
||||
(new SimpleDateFormat(MesPcnExtConstWords.DATE_FORMAT_SSS)).format(new Date()), CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), remark};
|
||||
DdlPackBean packBean = DdlPackBean.getDdlPackBean(organizeCode);
|
||||
DdlPreparedPack.getInPackList(idList, MesPcnExtConstWords.ID, packBean);
|
||||
workOrderCalcQtyRecordRepository.updateByPropertiesNoSync(propertyName, propertyValue, packBean);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,65 @@
|
||||
package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.job;
|
||||
|
||||
import cn.estsh.i3plus.ext.mes.pcn.api.job.IMesWorkOrderCalcQtyRestoreDispatchService;
|
||||
import cn.estsh.i3plus.ext.mes.pcn.api.job.IMesWorkOrderCalcQtyRestoreService;
|
||||
import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords;
|
||||
import cn.estsh.i3plus.pojo.mes.bean.MesWorkOrder;
|
||||
import cn.estsh.i3plus.pojo.mes.bean.MesWorkOrderCalcQtyRecord;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class MesWorkOrderCalcQtyRestoreService implements IMesWorkOrderCalcQtyRestoreService {
|
||||
|
||||
@Autowired
|
||||
private IMesWorkOrderCalcQtyRestoreDispatchService workOrderCalcQtyRestoreDispatchService;
|
||||
|
||||
@Override
|
||||
public void doRestoreWorkOrderCalcQty(Map<String, String> paramMap) {
|
||||
|
||||
//参数 工厂
|
||||
String organizeCode = paramMap.get(MesPcnExtConstWords.ORGANIZE_CODE);
|
||||
|
||||
//参数 处理数据量
|
||||
Integer qty = paramMap.containsKey(MesPcnExtConstWords.QTY) ? Integer.valueOf(paramMap.get(MesPcnExtConstWords.QTY)) : MesPcnExtConstWords.ONE_HUNDRED;
|
||||
|
||||
//生产工单计数记录表
|
||||
List<MesWorkOrderCalcQtyRecord> workOrderCalcQtyRecordList = workOrderCalcQtyRestoreDispatchService.getWorkOrderCalcQtyRecordList(organizeCode, qty);
|
||||
|
||||
Map<String, List<MesWorkOrderCalcQtyRecord>> workOrderNoMap = CollectionUtils.isEmpty(workOrderCalcQtyRecordList) ? null :
|
||||
workOrderCalcQtyRecordList.stream().filter(o -> null != o).collect(Collectors.groupingBy(MesWorkOrderCalcQtyRecord::getWorkOrderNo));
|
||||
|
||||
log.info("补录生产工单计数JOB --- 查询到未补录完成的记录 {} 条 --- 生产工单包含: {} ---",
|
||||
CollectionUtils.isEmpty(workOrderCalcQtyRecordList) ? "[]" : workOrderCalcQtyRecordList.size(),
|
||||
CollectionUtils.isEmpty(workOrderNoMap) ? "[]" : workOrderNoMap.keySet().toString());
|
||||
|
||||
if (CollectionUtils.isEmpty(workOrderNoMap)) return;
|
||||
|
||||
for (Map.Entry<String, List<MesWorkOrderCalcQtyRecord>> entry : workOrderNoMap.entrySet()) {
|
||||
|
||||
if (null == entry) continue;
|
||||
|
||||
//查询工单, 无事务查询
|
||||
MesWorkOrder workOrder = workOrderCalcQtyRestoreDispatchService.getWorkOrderDb(organizeCode, entry.getValue().get(0).getPid());
|
||||
|
||||
if (null == workOrder) log.info("补录生产工单计数JOB --- 补录: {} --- ID: {} --- START --- 信息不存在 ---", entry.getKey(), entry.getValue().get(0).getPid());
|
||||
else log.info("补录生产工单计数JOB --- 补录: {} --- ID: {} --- START ---", entry.getKey(), entry.getValue().get(0).getPid());
|
||||
|
||||
try {
|
||||
workOrderCalcQtyRestoreDispatchService.doRestoreWorkOrderCalcQty(organizeCode, workOrder, entry.getValue());
|
||||
} catch (Exception e) {
|
||||
log.info("补录生产工单计数JOB --- 补录: {} --- ID: {} --- EXCEPTION: {} ---", entry.getKey(), entry.getValue().get(0).getPid(), e.toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.station.function;
|
||||
|
||||
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProductionProcessContextStepService;
|
||||
import cn.estsh.i3plus.mes.pcn.serviceimpl.fsm.BaseSwsService;
|
||||
import cn.estsh.i3plus.mes.pcn.serviceimpl.fsm.IShippingDispatchService;
|
||||
import cn.estsh.i3plus.mes.pcn.serviceimpl.fsm.function.IFsmModuleFunctionService;
|
||||
import cn.estsh.i3plus.platform.common.util.MesPcnConstWords;
|
||||
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
|
||||
import cn.estsh.i3plus.pojo.base.enumutil.MesPcnEnumUtil;
|
||||
import cn.estsh.i3plus.pojo.mes.model.ButtonDynamicModel;
|
||||
import cn.estsh.i3plus.pojo.mes.model.StationRequestBean;
|
||||
import cn.estsh.i3plus.pojo.mes.model.StationResultBean;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* @Description : 工位参数按钮事件接口实现【发运RFID切换生产模式】
|
||||
**/
|
||||
@Service
|
||||
public class MesFunctionChooseShippingRfidRouteModeService extends BaseSwsService implements IFsmModuleFunctionService {
|
||||
|
||||
@Autowired
|
||||
private IMesProductionProcessContextStepService productionProcessContextStepService;
|
||||
|
||||
@Autowired
|
||||
private IShippingDispatchService shippingDispatchService;
|
||||
|
||||
@Override
|
||||
public Boolean doFunction(StationRequestBean reqBean, StationResultBean resultBean, ButtonDynamicModel buttonDynamicModel) {
|
||||
|
||||
//获取发运RFID生产模式
|
||||
String routeMode = productionProcessContextStepService.getShippingRfidRouteModeContext(reqBean);
|
||||
|
||||
//判断是否人工模式
|
||||
Boolean isManualMode = !StringUtils.isEmpty(routeMode) && routeMode.equals(CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValueStr());
|
||||
|
||||
//处理切换发运RFID生产模式的标志
|
||||
productionProcessContextStepService.disPatchChooseShippingRfidRouteMode(reqBean);
|
||||
|
||||
this.sendMessage(reqBean, resultBean.writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.PICK.getValue()).scanInfo(buttonDynamicModel.getFunctionValue()),
|
||||
String.format("生产线[%s]工位[%s]%s:[%s],请等待验证!", reqBean.getWorkCenterCode(), reqBean.getWorkCellCode(), buttonDynamicModel.getButtonName(), isManualMode ? "人工 -> 自动" : "自动 -> 人工"),
|
||||
MesPcnEnumUtil.STATION_BUSI_TYPE.MESSAGE, MesPcnEnumUtil.STATION_DATA_TYPE.TEXT);
|
||||
|
||||
reqBean.setClientInfo(shippingDispatchService.getActorClientInfo(reqBean));
|
||||
reqBean.setInterfaceType(MesPcnConstWords.SHIPPING);
|
||||
reqBean.setBusiType(MesPcnEnumUtil.ACTOR_RECEIVE_STRATEGY.WS_CMD_DO_SCAN.getCode());
|
||||
reqBean.setForceJumpProcess(true);
|
||||
shippingDispatchService.sendScanQueueNextExec(reqBean);
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,89 @@
|
||||
package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.step;
|
||||
|
||||
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.apiservice.serviceimpl.step.method.MesWorkOrderCheckCompleteQtyStepService;
|
||||
import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProductionPartContext;
|
||||
import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProductionProcessContext;
|
||||
import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProductionPsInContext;
|
||||
import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords;
|
||||
import cn.estsh.i3plus.mes.pcn.serviceimpl.fsm.BaseStepService;
|
||||
import cn.estsh.i3plus.mes.pcn.serviceimpl.fsm.IStepService;
|
||||
import cn.estsh.i3plus.pojo.mes.model.StationRequestBean;
|
||||
import cn.estsh.i3plus.pojo.mes.model.StationResultBean;
|
||||
import cn.estsh.i3plus.pojo.mes.model.StepResult;
|
||||
import cn.estsh.impp.framework.boot.util.SpringContextsUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.StringJoiner;
|
||||
|
||||
/**
|
||||
* @Description : 验证加工单数量后保存加工结果工步
|
||||
* @Author : wangjie
|
||||
**/
|
||||
@Slf4j
|
||||
@Service("mesProductionDataSaveBeforeLockOrderStepService")
|
||||
public class MesProductionDataSaveBeforeLockOrderStepService extends BaseStepService {
|
||||
|
||||
@Autowired
|
||||
private IMesProductionProcessContextStepService productionProcessContextStepService;
|
||||
|
||||
@Autowired
|
||||
private IMesProductionDispatchContextStepService productionDispatchContextStepService;
|
||||
|
||||
@Autowired
|
||||
private MesWorkOrderCheckCompleteQtyStepService workOrderCheckCompleteQtyStepService;
|
||||
|
||||
@Override
|
||||
public StepResult execute(StationRequestBean reqBean) {
|
||||
|
||||
StationResultBean resultBean = new StationResultBean();
|
||||
|
||||
StepResult stepResult = StepResult.getSuccessComplete();
|
||||
|
||||
//获取上下文信息: 处理加工不可用规则
|
||||
MesProductionProcessContext productionProcessContext = productionProcessContextStepService.dispatchProdRuleIgnoreCfgContext(reqBean);
|
||||
|
||||
//配置错误 抛出异常
|
||||
if (!productionProcessContext.getSuccess()) stepExpSendMsgAndThrowEx(reqBean, resultBean.writeDbLog(), productionProcessContext.getMessage());
|
||||
|
||||
//存储生产过程上下文对象
|
||||
productionProcessContextStepService.dispatchProductionProcessContext(reqBean, productionProcessContext);
|
||||
|
||||
//获取上下文产出零件数据信息集合
|
||||
List<MesProductionPartContext> productionPartContextList = productionDispatchContextStepService.getProductionPartContext(reqBean);
|
||||
|
||||
//获取上下文进料零件条码信息集合
|
||||
List<MesProductionPsInContext> productionPsInContextList = productionDispatchContextStepService.getProductionPsInContext(reqBean);
|
||||
|
||||
synchronized (new StringJoiner(MesPcnExtConstWords.COLON).add(reqBean.getOrganizeCode()).add(reqBean.getWorkCenterCode()).add(MesPcnExtConstWords.WORK_ORDER_COMPLETE_CONTEXT).toString().intern()) {
|
||||
|
||||
//验证加工单完成数量
|
||||
workOrderCheckCompleteQtyStepService.dispatchWorkOrderCompleteQtyContext(
|
||||
reqBean, resultBean, stepResult, productionProcessContext, productionPartContextList, productionPsInContextList);
|
||||
|
||||
//匹配失败需要清除本次扫描/读取信息
|
||||
if (!stepResult.isCompleted() && workOrderCheckCompleteQtyStepService.doBusiCheckToDelete(reqBean, stepResult, productionPartContextList, productionPsInContextList))
|
||||
return stepResult.nextTriggerEvent(MesPcnExtConstWords.NEXT_TRIGGER_EVENT_PART_NO);
|
||||
|
||||
//非排序线 保存加工结果工步 execute 方法 使用的是 新事务
|
||||
stepResult = ((IStepService) SpringContextsUtil.getBean("mesProductionDataSaveStepService")).execute(reqBean);
|
||||
|
||||
//保存加工结果事务提交之后, 保存工单计数
|
||||
if (stepResult.isCompleted() && !StringUtils.isEmpty(stepResult.getStepAfterState())) {
|
||||
IStepService stepService = ((IStepService) SpringContextsUtil.getBean(stepResult.getStepAfterState()));
|
||||
stepResult.stepAfterState(null);
|
||||
stepService.executeStepAfterExecute(reqBean, stepResult);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return stepResult;
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,135 @@
|
||||
package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.step;
|
||||
|
||||
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProductionCustomContextStepService;
|
||||
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.api.busi.IMesShippingQueueService;
|
||||
import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesEquipVariableCollectContext;
|
||||
import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProductionProcessContext;
|
||||
import cn.estsh.i3plus.mes.pcn.serviceimpl.fsm.BaseStepService;
|
||||
import cn.estsh.i3plus.mes.pcn.serviceimpl.fsm.IStepService;
|
||||
import cn.estsh.i3plus.pojo.base.enumutil.MesPcnEnumUtil;
|
||||
import cn.estsh.i3plus.pojo.mes.bean.MesProdRouteOptParam;
|
||||
import cn.estsh.i3plus.pojo.mes.bean.seres.MesCimSeresJisRfid;
|
||||
import cn.estsh.i3plus.pojo.mes.bean.shipping.MesShippingOrderManagement;
|
||||
import cn.estsh.i3plus.pojo.mes.bean.shipping.MesShippingOrderManagementDetail;
|
||||
import cn.estsh.i3plus.pojo.mes.bean.shipping.MesShippingQueue;
|
||||
import cn.estsh.i3plus.pojo.mes.model.StationKvBean;
|
||||
import cn.estsh.i3plus.pojo.mes.model.StationRequestBean;
|
||||
import cn.estsh.i3plus.pojo.mes.model.StationResultBean;
|
||||
import cn.estsh.i3plus.pojo.mes.model.StepResult;
|
||||
import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil;
|
||||
import cn.estsh.impp.framework.boot.util.SpringContextsUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @Description : 发运队列工位人工扫描发运单号工步
|
||||
* @Author : wangjie
|
||||
**/
|
||||
@Slf4j
|
||||
@Service("mesShippingCodeScanStepService")
|
||||
public class MesShippingCodeScanStepService extends BaseStepService {
|
||||
|
||||
@Autowired
|
||||
private IMesProductionProcessContextStepService productionProcessContextStepService;
|
||||
|
||||
@Autowired
|
||||
private IMesProductionDispatchContextStepService productionDispatchContextStepService;
|
||||
|
||||
@Autowired
|
||||
private IMesProductionCustomContextStepService productionCustomContextStepService;
|
||||
|
||||
@Autowired
|
||||
private IMesShippingQueueService shippingQueueService;
|
||||
|
||||
@Override
|
||||
public StepResult execute(StationRequestBean reqBean) {
|
||||
|
||||
StationResultBean resultBean = new StationResultBean();
|
||||
|
||||
StepResult stepResult;
|
||||
|
||||
//获取上下文信息
|
||||
MesProductionProcessContext productionProcessContext = productionProcessContextStepService.dispatchCurCellEquipment(reqBean);
|
||||
|
||||
//配置错误 抛出异常
|
||||
if (!productionProcessContext.getSuccess()) stepExpSendMsgAndThrowEx(reqBean, resultBean.writeDbLog(), productionProcessContext.getMessage());
|
||||
|
||||
//存储生产过程上下文对象
|
||||
productionProcessContextStepService.dispatchProductionProcessContext(reqBean, productionProcessContext);
|
||||
|
||||
//扫描信息置空
|
||||
String scanInfo = reqBean.resetScanInfo(reqBean.getScanInfo());
|
||||
|
||||
//验证发运组信息是否有效
|
||||
List<StationKvBean> resultList = null;
|
||||
|
||||
if (StringUtils.isEmpty(scanInfo)) stepSendGuideAndThrowEx(reqBean, resultBean.writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.PROCESS.getValue()), "[人工模式]请扫描发运单号!");
|
||||
|
||||
//发送工步内容
|
||||
productionCustomContextStepService.sendStepContextMessage(reqBean, scanInfo, MesExtEnumUtil.CELL_MESSAGE_SOURCE.SCAN);
|
||||
|
||||
//根据发运代码查询创建时间正序创建状态的一条发运队列
|
||||
MesShippingQueue shippingQueue = shippingQueueService.getShippingQueueByCode(reqBean.getOrganizeCode(), scanInfo);
|
||||
String vinCode = (null == shippingQueue || StringUtils.isEmpty(shippingQueue.getVin())) ? null : shippingQueue.getVin();
|
||||
if (StringUtils.isEmpty(vinCode)) {
|
||||
MesShippingOrderManagement shipping = shippingQueueService.getShipping(reqBean.getOrganizeCode(), scanInfo);
|
||||
MesShippingOrderManagementDetail shippingDetail = null == shipping ? null : shippingQueueService.getShippingDetail(reqBean.getOrganizeCode(), shipping.getId());
|
||||
vinCode = null == shippingDetail ? null : shippingDetail.getVin();
|
||||
}
|
||||
|
||||
if (StringUtils.isEmpty(vinCode)) {
|
||||
this.sendMessage(reqBean, new StationResultBean().writeDbLog().scanInfo(scanInfo), String.format("当前扫描信息发运单号[%s]信息无效!", scanInfo), MesPcnEnumUtil.STATION_BUSI_TYPE.MESSAGE, MesPcnEnumUtil.STATION_DATA_TYPE.EXP_TEXT);
|
||||
stepSendGuideAndThrowEx(reqBean, resultBean.writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.PROCESS.getValue()), "[人工模式]请扫描发运单号!");
|
||||
}
|
||||
|
||||
//根据VIN查询赛力斯RFID信息
|
||||
MesCimSeresJisRfid cimSeresJisRfid = shippingQueueService.getCimSeresJisRfid(reqBean.getOrganizeCode(), vinCode);
|
||||
if (null == cimSeresJisRfid || StringUtils.isEmpty(cimSeresJisRfid.getRfid())) {
|
||||
this.sendMessage(reqBean, new StationResultBean().writeDbLog().scanInfo(scanInfo), String.format("当前扫描信息发运单号[%s]信息关联的VIN[%s]未查询到有效的赛力斯RFID信息!", scanInfo, vinCode), MesPcnEnumUtil.STATION_BUSI_TYPE.MESSAGE, MesPcnEnumUtil.STATION_DATA_TYPE.EXP_TEXT);
|
||||
stepSendGuideAndThrowEx(reqBean, resultBean.writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.PROCESS.getValue()), "[人工模式]请扫描发运单号!");
|
||||
}
|
||||
|
||||
//获取工步参数
|
||||
Optional<Map<String, MesProdRouteOptParam>> stepParamMap = getStepParams(reqBean);
|
||||
//解析rfidSn
|
||||
String rfidSn = shippingQueueService.getRfidSn(stepParamMap, cimSeresJisRfid.getRfid());
|
||||
if (StringUtils.isEmpty(rfidSn)) {
|
||||
this.sendMessage(reqBean, new StationResultBean().writeDbLog().scanInfo(scanInfo), String.format("当前扫描信息发运单号[%s]信息关联的VIN[%s]查询到的赛力斯RFID[%s]解析错误!", scanInfo, vinCode, cimSeresJisRfid.getRfid()), MesPcnEnumUtil.STATION_BUSI_TYPE.MESSAGE, MesPcnEnumUtil.STATION_DATA_TYPE.EXP_TEXT);
|
||||
stepSendGuideAndThrowEx(reqBean, resultBean.writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.PROCESS.getValue()), "[人工模式]请扫描发运单号!");
|
||||
}
|
||||
|
||||
List<MesEquipVariableCollectContext> equipVariableCollectContextList = new ArrayList<>();
|
||||
equipVariableCollectContextList.add(new MesEquipVariableCollectContext(reqBean.getOrganizeCode(), rfidSn, MesExtEnumUtil.CELL_MESSAGE_SOURCE.READ.getValue()));
|
||||
//保存上下文扫/读信息:主条码
|
||||
productionDispatchContextStepService.dispatchScanProductSnContext(reqBean, equipVariableCollectContextList);
|
||||
|
||||
//主条码验证工步 【非排序】
|
||||
stepResult = ((IStepService) SpringContextsUtil.getBean("mesProductSnCheckStepService")).executeInState(reqBean);
|
||||
|
||||
if (!stepResult.isCompleted()) {
|
||||
this.sendMessage(reqBean, new StationResultBean().writeDbLog().scanInfo(scanInfo), String.format("当前扫描信息发运单号[%s]信息关联的VIN[%s]查询到的赛力斯RFID[%s]验证错误!", scanInfo, vinCode, cimSeresJisRfid.getRfid()), MesPcnEnumUtil.STATION_BUSI_TYPE.MESSAGE, MesPcnEnumUtil.STATION_DATA_TYPE.EXP_TEXT);
|
||||
stepSendGuideAndThrowEx(reqBean, resultBean.writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.PROCESS.getValue()), "[人工模式]请扫描发运单号!");
|
||||
}
|
||||
|
||||
//保存上下文发运队列信息
|
||||
if (null != shippingQueue) {
|
||||
//保存上下文发运队列信息
|
||||
shippingQueue.setPidStr(cimSeresJisRfid.getId().toString());
|
||||
shippingQueue.setRfidSn(rfidSn);
|
||||
productionDispatchContextStepService.dispatchShippingQueueContext(reqBean, shippingQueue);
|
||||
}
|
||||
|
||||
return stepSuccessCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(), stepResult, String.format("当前扫描信息发运单号[%s]VIN[%s]已匹配到赛力斯RFID信息[%s]!", scanInfo, vinCode, cimSeresJisRfid.getRfid()));
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.step;
|
||||
|
||||
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProductionProcessContextStepService;
|
||||
import cn.estsh.i3plus.mes.pcn.serviceimpl.fsm.BaseStepService;
|
||||
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
|
||||
import cn.estsh.i3plus.pojo.mes.model.StationRequestBean;
|
||||
import cn.estsh.i3plus.pojo.mes.model.StepResult;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* @Description : 验证发运队列生产模式工步
|
||||
* @Author : wangjie
|
||||
**/
|
||||
@Slf4j
|
||||
@Service("mesShippingRfidRouteModeCheckStepService")
|
||||
public class MesShippingRfidRouteModeCheckStepService extends BaseStepService {
|
||||
|
||||
@Autowired
|
||||
private IMesProductionProcessContextStepService productionProcessContextStepService;
|
||||
|
||||
@Override
|
||||
public StepResult execute(StationRequestBean reqBean) {
|
||||
|
||||
StepResult stepResult = StepResult.getSuccessComplete();
|
||||
|
||||
//获取发运RFID生产模式
|
||||
String routeMode = productionProcessContextStepService.getShippingRfidRouteModeContext(reqBean);
|
||||
|
||||
//判断是否人工模式
|
||||
Boolean isManualMode = !StringUtils.isEmpty(routeMode) && routeMode.equals(CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValueStr());
|
||||
if (isManualMode) stepResult.isCompleted(false);
|
||||
|
||||
return stepResult;
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.step;
|
||||
|
||||
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProductionProcessContextStepService;
|
||||
import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProductionProcessContext;
|
||||
import cn.estsh.i3plus.mes.pcn.serviceimpl.fsm.BaseStepService;
|
||||
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
|
||||
import cn.estsh.i3plus.pojo.base.enumutil.MesPcnEnumUtil;
|
||||
import cn.estsh.i3plus.pojo.mes.model.StationRequestBean;
|
||||
import cn.estsh.i3plus.pojo.mes.model.StationResultBean;
|
||||
import cn.estsh.i3plus.pojo.mes.model.StepResult;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* @Description : 加载发运队列生产模式工步
|
||||
* @Author : wangjie
|
||||
**/
|
||||
@Slf4j
|
||||
@Service("mesShippingRfidRouteModeLoadStepService")
|
||||
public class MesShippingRfidRouteModeLoadStepService extends BaseStepService {
|
||||
|
||||
@Autowired
|
||||
private IMesProductionProcessContextStepService productionProcessContextStepService;
|
||||
|
||||
@Override
|
||||
public StepResult execute(StationRequestBean reqBean) {
|
||||
|
||||
StationResultBean resultBean = new StationResultBean();
|
||||
|
||||
StepResult stepResult = StepResult.getSuccessComplete();
|
||||
|
||||
//获取上下文信息
|
||||
MesProductionProcessContext productionProcessContext = productionProcessContextStepService.dispatchCurCellEquipment(reqBean);
|
||||
|
||||
//配置错误 抛出异常
|
||||
if (!productionProcessContext.getSuccess()) stepExpSendMsgAndThrowEx(reqBean, resultBean.writeDbLog(), productionProcessContext.getMessage());
|
||||
|
||||
//存储生产过程上下文对象
|
||||
productionProcessContextStepService.dispatchProductionProcessContext(reqBean, productionProcessContext);
|
||||
|
||||
//处理发运RFID生产模式
|
||||
String routeMode = productionProcessContextStepService.disPatchShippingRfidRouteModeContext(reqBean);
|
||||
|
||||
//判断是否人工模式
|
||||
Boolean isManualMode = !StringUtils.isEmpty(routeMode) && routeMode.equals(CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValueStr());
|
||||
if (isManualMode) resultBean.writeDbLog();
|
||||
|
||||
return stepDynamicsCompleteAndSendMsgReturn(reqBean, resultBean, stepResult, isManualMode ? false : true,
|
||||
MesPcnEnumUtil.STATION_BUSI_TYPE.RUNNING_INFO, MesPcnEnumUtil.STATION_DATA_TYPE.TEXT, String.format("当前生产模式是否人工模式[%s]!", isManualMode));
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
package cn.estsh.i3plus.ext.mes.pcn.pojo.context;
|
||||
|
||||
import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import lombok.Data;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 生产过程上下文对象-加工单完成数
|
||||
*/
|
||||
@Data
|
||||
public class MesWorkOrderCompleteQtyContext implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -1602007855074296100L;
|
||||
|
||||
@ApiParam("生产工单号")
|
||||
private String workOrderNo;
|
||||
|
||||
@ApiParam("工单数量")
|
||||
private Double qty;
|
||||
|
||||
@ApiParam("完成数量")
|
||||
private Double completeQty;
|
||||
|
||||
public MesWorkOrderCompleteQtyContext(String workOrderNo, Double qty, Double completeQty) {
|
||||
this.workOrderNo = workOrderNo;
|
||||
this.qty = qty;
|
||||
this.completeQty = StringUtils.isEmpty(completeQty) ? new Double(MesPcnExtConstWords.ZERO) : completeQty;
|
||||
}
|
||||
|
||||
public MesWorkOrderCompleteQtyContext overrideCompleteQty(Double completeQty) {
|
||||
this.completeQty = completeQty;
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue