|
|
|
@ -18,7 +18,10 @@ import cn.estsh.i3plus.pojo.base.common.Pager;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.enumutil.MesPcnEnumUtil;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.*;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.MesQueueOrder;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.MesQueueOrderPush;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.MesStateMachineStatus;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.MesWorkCenter;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.model.AttrBean;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.model.StationKvBean;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.model.StationRequestBean;
|
|
|
|
@ -34,6 +37,7 @@ import org.springframework.util.CollectionUtils;
|
|
|
|
|
import org.springframework.util.StringUtils;
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.Comparator;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
@ -149,27 +153,29 @@ public class MesProductionSortModuleService extends BaseModuleService {
|
|
|
|
|
List<MesQueueOrderModel> queueOrderModelList = null;
|
|
|
|
|
for (String partProdGroupCode : partProdGroupCodeList) {
|
|
|
|
|
Pager pager = new Pager();
|
|
|
|
|
pager.setStartRow(1);
|
|
|
|
|
pager.setCurrentPage(1);
|
|
|
|
|
pager.setPageSize(50);
|
|
|
|
|
pager.setStartRow(MesPcnExtConstWords.ONE);
|
|
|
|
|
pager.setCurrentPage(MesPcnExtConstWords.ONE);
|
|
|
|
|
pager.setPageSize(MesPcnExtConstWords.FIFTY);
|
|
|
|
|
DdlPackBean packBean = DdlPackBean.getDdlPackBean(reqBean.getOrganizeCode());
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(reqBean.getWorkCenterCode(), MesPcnExtConstWords.WORK_CENTER_CODE, packBean);
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(reqBean.getWorkCellCode(), MesPcnExtConstWords.WORK_CELL_CODE, packBean);
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(partProdGroupCode, MesPcnExtConstWords.PART_PROD_GROUP_CODE, packBean);
|
|
|
|
|
packBean.setOrderByStr(" order by productSeq desc ");
|
|
|
|
|
DdlPreparedPack.getOrderByPack(new Object[]{CommonEnumUtil.ASC_OR_DESC.DESC.getValue()}, new String[]{MesPcnExtConstWords.PRODUCT_SEQ}, packBean);
|
|
|
|
|
List<MesQueueOrder> queueOrderList = queueOrderRepository.findByHqlWherePage(packBean, pager);
|
|
|
|
|
|
|
|
|
|
if (!CollectionUtils.isEmpty(queueOrderList)) {
|
|
|
|
|
Boolean isComplete = false;
|
|
|
|
|
Integer index = MesPcnExtConstWords.ONE;
|
|
|
|
|
for (MesQueueOrder mesQueueOrder : queueOrderList) {
|
|
|
|
|
MesQueueOrderModel queueOrderModel = new MesQueueOrderModel();
|
|
|
|
|
BeanUtils.copyProperties(mesQueueOrder, queueOrderModel);
|
|
|
|
|
|
|
|
|
|
//默认绿色【完成状态或关闭状态】
|
|
|
|
|
String color = MesExtEnumUtil.COLOR.GREEN.getValue();
|
|
|
|
|
if (queueOrderModel.getStatus() == MesExtEnumUtil.QUEUE_ORDER_STATUS.FINISH.getValue()) isComplete = true;
|
|
|
|
|
else if (!isComplete) color = MesExtEnumUtil.COLOR.WHITE.getValue();
|
|
|
|
|
//创建状态标白色
|
|
|
|
|
if (queueOrderModel.getStatus() == MesExtEnumUtil.QUEUE_ORDER_STATUS.CREATE.getValue()) color = MesExtEnumUtil.COLOR.WHITE.getValue();
|
|
|
|
|
//跳号标黄色
|
|
|
|
|
if (index < queueOrderList.size() && checkJumpNumber(queueOrderList.get(index).getWorkOrderSeq(), mesQueueOrder.getWorkOrderSeq())) color = MesExtEnumUtil.COLOR.YELLOW.getValue();
|
|
|
|
|
|
|
|
|
|
queueOrderModel.setColor(color);
|
|
|
|
|
|
|
|
|
|
if (CollectionUtils.isEmpty(queueOrderModelList)) queueOrderModelList = new ArrayList<>();
|
|
|
|
@ -210,24 +216,75 @@ public class MesProductionSortModuleService extends BaseModuleService {
|
|
|
|
|
|
|
|
|
|
//查询推单队列
|
|
|
|
|
private List<MesQueueOrderModel> queryQueueOrderPush(StationRequestBean reqBean) {
|
|
|
|
|
//处理排序线推单上下文, 返回推送工位类型对应的配置信息 【来源工位】
|
|
|
|
|
List<MesQueueOrderPushCellCfg> queueOrderPushCellCfgList = productionProcessContextStepService.dispatchQueueOrderPushCellCfgContext(reqBean, MesExtEnumUtil.QUEUE_ORDER_CELL_PUSH_TYPE.TARGET.getValue());
|
|
|
|
|
List<MesQueueOrderPush> queueOrderPushList =
|
|
|
|
|
//处理排序线推单上下文, 返回推送工位类型对应的配置信息 【来源工位】;
|
|
|
|
|
//再根据配置查询生产队列工位推送信息 : 根据生产线代码,推送来源代码集合查询创建状态的生产队列工位推送信息【创建时间正序】
|
|
|
|
|
List<MesQueueOrderPush> queueOrderPushList = queueOrderPushService.getQueueOrderPushList(reqBean.getOrganizeCode(),
|
|
|
|
|
productionProcessContextStepService.dispatchQueueOrderPushCellCfgContext(reqBean, MesExtEnumUtil.QUEUE_ORDER_CELL_PUSH_TYPE.TARGET.getValue()));
|
|
|
|
|
|
|
|
|
|
//列表做多展示50条队列; 超过49条,进行截取
|
|
|
|
|
if (!CollectionUtils.isEmpty(queueOrderPushList) && queueOrderPushList.size() > MesPcnExtConstWords.FORTY_NINE) queueOrderPushList = queueOrderPushList.subList(MesPcnExtConstWords.ZERO, MesPcnExtConstWords.FORTY_NINE);
|
|
|
|
|
|
|
|
|
|
//查询最多50条当前工位修改时间最新的队列记录
|
|
|
|
|
DdlPackBean packBean = DdlPackBean.getDdlPackBean(reqBean.getOrganizeCode());
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(reqBean.getWorkCenterCode(), MesPcnExtConstWords.WORK_CENTER_CODE, packBean);
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(reqBean.getWorkCellCode(), MesPcnExtConstWords.WORK_CELL_CODE, packBean);
|
|
|
|
|
DdlPreparedPack.getOrderByPack(new Object[]{CommonEnumUtil.ASC_OR_DESC.DESC.getValue()}, new String[]{MesPcnExtConstWords.MODIFY_DATE_TIME}, packBean);
|
|
|
|
|
Integer topNum = CollectionUtils.isEmpty(queueOrderPushList) ? MesPcnExtConstWords.FIFTY : (MesPcnExtConstWords.FIFTY - queueOrderPushList.size());
|
|
|
|
|
List<MesQueueOrder> queueOrderList = queueOrderRepository.findByHqlTopWhere(packBean, topNum);
|
|
|
|
|
|
|
|
|
|
if (CollectionUtils.isEmpty(queueOrderPushList) && CollectionUtils.isEmpty(queueOrderList)) return null;
|
|
|
|
|
|
|
|
|
|
//推送队列根据创建时间倒序
|
|
|
|
|
if (!CollectionUtils.isEmpty(queueOrderPushList)) queueOrderPushList = queueOrderPushList.stream().filter(o -> null != o).sorted(Comparator.comparing(MesQueueOrderPush::getCreateDatetime).reversed()).collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
List<MesQueueOrderModel> queueOrderModelList = new ArrayList<>();
|
|
|
|
|
if (!CollectionUtils.isEmpty(queueOrderPushList)) {
|
|
|
|
|
for (MesQueueOrderPush queueOrderPush : queueOrderPushList) {
|
|
|
|
|
if (null == queueOrderPush) continue;
|
|
|
|
|
MesQueueOrderModel queueOrderModel = new MesQueueOrderModel();
|
|
|
|
|
BeanUtils.copyProperties(queueOrderPush, queueOrderModel);
|
|
|
|
|
queueOrderModel.setWorkCellCode(reqBean.getWorkCellCode());
|
|
|
|
|
queueOrderModel.setStatus(MesExtEnumUtil.QUEUE_ORDER_STATUS.CREATE.getValue());
|
|
|
|
|
queueOrderModelList.add(queueOrderModel);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (!CollectionUtils.isEmpty(queueOrderList)) {
|
|
|
|
|
for (MesQueueOrder queueOrder : queueOrderList) {
|
|
|
|
|
if (null == queueOrder) continue;
|
|
|
|
|
MesQueueOrderModel queueOrderModel = new MesQueueOrderModel();
|
|
|
|
|
BeanUtils.copyProperties(queueOrder, queueOrderModel);
|
|
|
|
|
queueOrderModelList.add(queueOrderModel);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Integer index = MesPcnExtConstWords.ONE;
|
|
|
|
|
for (MesQueueOrderModel queueOrderModel : queueOrderModelList) {
|
|
|
|
|
if (null == queueOrderModel) continue;
|
|
|
|
|
//默认绿色【完成状态】
|
|
|
|
|
String color = MesExtEnumUtil.COLOR.GREEN.getValue();
|
|
|
|
|
if (queueOrderModel.getStatus() == MesExtEnumUtil.QUEUE_ORDER_STATUS.CREATE.getValue()) color = MesExtEnumUtil.COLOR.WHITE.getValue();
|
|
|
|
|
//跳号标黄色
|
|
|
|
|
if (index < queueOrderList.size() && checkJumpNumber(queueOrderModelList.get(index).getWorkOrderSeq(), queueOrderModel.getWorkOrderSeq())) color = MesExtEnumUtil.COLOR.YELLOW.getValue();
|
|
|
|
|
queueOrderModel.setColor(color);
|
|
|
|
|
index ++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return queueOrderModelList;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//标黄是跳号的工单, 不是跳过的工单
|
|
|
|
|
private boolean checkJumpNumber(String nextWorkOrderSeq, String currentWorkOrderSeq) {
|
|
|
|
|
if (StringUtils.isEmpty(nextWorkOrderSeq) || StringUtils.isEmpty(currentWorkOrderSeq) || !CheckTool.isNumber(nextWorkOrderSeq) || !CheckTool.isNumber(currentWorkOrderSeq)) return false;
|
|
|
|
|
return Integer.parseInt(currentWorkOrderSeq) != Integer.parseInt(nextWorkOrderSeq) + MesPcnExtConstWords.ONE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//查询当前工位完成状态最新的一笔队列记录
|
|
|
|
|
private MesQueueOrder getNewQueueOrder(StationRequestBean reqBean) {
|
|
|
|
|
DdlPackBean packBean = DdlPackBean.getDdlPackBean(reqBean.getOrganizeCode());
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(reqBean.getWorkCenterCode(), MesPcnExtConstWords.WORK_CENTER_CODE, packBean);
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(reqBean.getWorkCellCode(), MesPcnExtConstWords.WORK_CELL_CODE, packBean);
|
|
|
|
|
DdlPreparedPack.getNumEqualPack(MesExtEnumUtil.QUEUE_ORDER_STATUS.FINISH.getValue(), MesPcnExtConstWords.STATUS, packBean);
|
|
|
|
|
packBean.setOrderByStr(" order by modifyDatetime desc ");
|
|
|
|
|
DdlPreparedPack.getOrderByPack(new Object[]{CommonEnumUtil.ASC_OR_DESC.DESC.getValue()}, new String[]{MesPcnExtConstWords.MODIFY_DATE_TIME}, packBean);
|
|
|
|
|
return queueOrderRepository.getByProperty(packBean);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|