|
|
|
@ -5,6 +5,7 @@ import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProductionCustomContextStepServi
|
|
|
|
|
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.IMesWorkOrderExtService;
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.pcn.apiservice.util.MesPcnException;
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProdShiftContext;
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProductionPartContext;
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProductionProcessContext;
|
|
|
|
@ -74,16 +75,15 @@ public class MesProductionNoSortModuleService extends BaseModuleService {
|
|
|
|
|
//获取上下文信息
|
|
|
|
|
MesProductionProcessContext productionProcessContext = productionProcessContextStepService.getEquipmentVariableList(reqBean, MesExtEnumUtil.EQUIP_VARIABLE_TYPE.PRODUCTION.getValue());
|
|
|
|
|
MesWorkCell mesWorkCell = productionProcessContext.getWorkCell();
|
|
|
|
|
/**
|
|
|
|
|
* 获取班次信息,先查询缓存,缓存没有在查询数据库
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
//获取班次信息,先查询缓存,缓存没有在查询数据库
|
|
|
|
|
List<StationKvBean> prodShiftDataContext = getShiftRecordStationKvBeans(reqBean);
|
|
|
|
|
|
|
|
|
|
MesProdShiftContext mesProdShiftKvBean = productionCustomContextStepService.getMesProdShiftKvBean(reqBean.getOrganizeCode(), reqBean.getWorkCenterCode());
|
|
|
|
|
|
|
|
|
|
if (CollectionUtils.isEmpty(prodShiftDataContext)) {
|
|
|
|
|
this.sendMessage(reqBean, new StationResultBean().writeDbLog(), "请先开班", MesPcnEnumUtil.STATION_BUSI_TYPE.MESSAGE, MesPcnEnumUtil.STATION_DATA_TYPE.TEXT);
|
|
|
|
|
throw ImppExceptionBuilder.newInstance().setSystemID(CommonEnumUtil.SOFT_TYPE.MES_PCN.getCode()).setErrorCode("NO_SHOW_MSG").build();
|
|
|
|
|
MesPcnException.throwBusiException("请先开班");
|
|
|
|
|
}
|
|
|
|
|
// 发送班次班组和工单
|
|
|
|
|
StationResultBean resultBean = getStationResultBean(reqBean, moduleContentContext, prodShiftDataContext);
|
|
|
|
@ -92,8 +92,8 @@ public class MesProductionNoSortModuleService extends BaseModuleService {
|
|
|
|
|
// 整合班次加工数量
|
|
|
|
|
List<StationKvBean> productionStatisticsContext = productionCustomContextStepService.getProductionStatisticsContext(reqBean);
|
|
|
|
|
if (CollectionUtils.isEmpty(productionStatisticsContext)) {
|
|
|
|
|
productionStatisticsContext = StationKvBeanUtil.addStationKvBeanList(new ArrayList<>(), new StationKvBean(new StringJoiner(MesPcnExtConstWords.AND).add(mesProdShiftKvBean.getShiftGroup()).add(mesProdShiftKvBean.getShiftCode()).toString(), "加工数", "0"),
|
|
|
|
|
new StationKvBean("color", "颜色", MesExtEnumUtil.COLOR.BLACK.getValue()));
|
|
|
|
|
productionStatisticsContext = StationKvBeanUtil.addStationKvBeanList(new ArrayList<>(), new StationKvBean(new StringJoiner(MesPcnExtConstWords.AND).add(mesProdShiftKvBean.getShiftGroup()).add(mesProdShiftKvBean.getShiftCode()).toString(), "加工数", MesPcnExtConstWords.ZERO_STR),
|
|
|
|
|
new StationKvBean(MesPcnExtConstWords.COLOR, "颜色", MesExtEnumUtil.COLOR.BLACK.getValue()));
|
|
|
|
|
}
|
|
|
|
|
StationResultBean shiftCountBean = getStationResultBean(reqBean, productionStatisticsContext,mesWorkCell, mesProdShiftKvBean);
|
|
|
|
|
this.sendMessage(reqBean, shiftCountBean);
|
|
|
|
@ -137,14 +137,6 @@ public class MesProductionNoSortModuleService extends BaseModuleService {
|
|
|
|
|
return resultBean;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private List<AttrBean> packDataAttrList() {
|
|
|
|
|
List<AttrBean> attrBeanList = new ArrayList<>();
|
|
|
|
|
PojoAttrUtil.loadPojoAttrs(attrBeanList, "index", "序号",true);
|
|
|
|
|
PojoAttrUtil.loadPojoAttrs(attrBeanList, "custPartNo", "客户零件号", true);
|
|
|
|
|
PojoAttrUtil.loadPojoAttrs(attrBeanList, "orderNo", "工单号", true);
|
|
|
|
|
|
|
|
|
|
return attrBeanList;
|
|
|
|
|
}
|
|
|
|
|
private StationResultBean getStationResultBean(StationRequestBean reqBean, List<StationKvBean> productionStatisticsContext, MesWorkCell mesWorkCell, MesProdShiftContext mesProdShiftKvBean) {
|
|
|
|
|
StationResultBean resultBean = new StationResultBean();
|
|
|
|
|
resultBean.setBusiType(MesPcnEnumUtil.STATION_BUSI_TYPE.MODULE_CUSTOM_CONTENT.getValue());
|
|
|
|
@ -158,7 +150,7 @@ public class MesProductionNoSortModuleService extends BaseModuleService {
|
|
|
|
|
if (!StringUtils.isEmpty(mesWorkCell.getFileId())) {
|
|
|
|
|
DdlPackBean packBean = DdlPackBean.getDdlPackBean();
|
|
|
|
|
|
|
|
|
|
DdlPreparedPack.getNumEqualPack(Long.parseLong(mesWorkCell.getFileId()), "id", packBean);
|
|
|
|
|
DdlPreparedPack.getNumEqualPack(Long.parseLong(mesWorkCell.getFileId()), MesPcnExtConstWords.ID, packBean);
|
|
|
|
|
MesFile mesFile = mesFileRepository.getByProperty(packBean);
|
|
|
|
|
if (mesFile != null) {
|
|
|
|
|
url = mesFile.getFileUrl();
|
|
|
|
@ -169,15 +161,15 @@ public class MesProductionNoSortModuleService extends BaseModuleService {
|
|
|
|
|
List<MesWorkOrder> workOrderList = workOrderExtService.getWorkOrderListByShiftCode(reqBean.getOrganizeCode(), mesWorkCell.getWorkCenterCode(), mesProdShiftKvBean.getShiftCode());
|
|
|
|
|
if (CollectionUtils.isEmpty(workOrderList)) {
|
|
|
|
|
StationKvBeanUtil.addStationKvBeanList(orderQtyKvBeans, new ArrayList<>(),
|
|
|
|
|
new StationKvBean(MesPcnExtConstWords.QTY, "工单计划数", 0 + ""),
|
|
|
|
|
new StationKvBean(MesPcnExtConstWords.COMPLATED_QTY, "工单完成数", 0 + ""));
|
|
|
|
|
new StationKvBean(MesPcnExtConstWords.QTY, "工单计划数", MesPcnExtConstWords.ZERO_STR),
|
|
|
|
|
new StationKvBean(MesPcnExtConstWords.COMPLATED_QTY, "工单完成数", MesPcnExtConstWords.ZERO_STR));
|
|
|
|
|
} else {
|
|
|
|
|
double qty = workOrderList.stream().map(MesWorkOrder::getQty).reduce((a, b) -> a + b).get();
|
|
|
|
|
double complateQty = workOrderList.stream().map(MesWorkOrder::getCompleteQty).reduce((a, b) -> a + b).get();
|
|
|
|
|
Double qty = workOrderList.stream().map(MesWorkOrder::getQty).reduce((a, b) -> a + b).get();
|
|
|
|
|
Double complateQty = workOrderList.stream().map(MesWorkOrder::getCompleteQty).reduce((a, b) -> a + b).get();
|
|
|
|
|
|
|
|
|
|
StationKvBeanUtil.addStationKvBeanList(orderQtyKvBeans, new ArrayList<>(),
|
|
|
|
|
new StationKvBean(MesPcnExtConstWords.QTY, "工单计划数", qty + ""),
|
|
|
|
|
new StationKvBean(MesPcnExtConstWords.COMPLATED_QTY, "工单完成数", complateQty + ""));
|
|
|
|
|
new StationKvBean(MesPcnExtConstWords.QTY, "工单计划数", qty.toString()),
|
|
|
|
|
new StationKvBean(MesPcnExtConstWords.COMPLATED_QTY, "工单完成数", complateQty.toString()));
|
|
|
|
|
}
|
|
|
|
|
if (!CollectionUtils.isEmpty(productionPartContextList)) {
|
|
|
|
|
|
|
|
|
@ -186,11 +178,11 @@ public class MesProductionNoSortModuleService extends BaseModuleService {
|
|
|
|
|
resultBean.setResultList(orderQtyKvBeans);
|
|
|
|
|
} else if (Objects.equal(MesExtEnumUtil.WORK_FILE_TYPE.PROD_VIDEO.getValue(), mesWorkCell.getIsShowMsg())) {
|
|
|
|
|
dataType = MesPcnEnumUtil.STATION_DATA_TYPE.VIDEO.getValue();
|
|
|
|
|
reqJson.put("url", url);
|
|
|
|
|
reqJson.put(MesPcnExtConstWords.URL, url);
|
|
|
|
|
resultBean.setResultObj(reqJson);
|
|
|
|
|
} else if (Objects.equal(MesExtEnumUtil.WORK_FILE_TYPE.WORK_CELL_PICTURE.getValue(), mesWorkCell.getIsShowMsg())) {
|
|
|
|
|
dataType = MesPcnEnumUtil.STATION_DATA_TYPE.IMAGE.getValue();
|
|
|
|
|
reqJson.put("url", url);
|
|
|
|
|
reqJson.put(MesPcnExtConstWords.URL, url);
|
|
|
|
|
resultBean.setResultObj(reqJson);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -205,19 +197,20 @@ public class MesProductionNoSortModuleService extends BaseModuleService {
|
|
|
|
|
|
|
|
|
|
return resultBean;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public boolean execStateModule(StationRequestBean reqBean, List<MesStateMachineStatus> states, Map<String, String> wcpcMap) {
|
|
|
|
|
init(reqBean);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//封装展示组件班组班次内容
|
|
|
|
|
private List<StationKvBean> getProdShiftData(MesProdShiftRecord record) {
|
|
|
|
|
|
|
|
|
|
return StationKvBeanUtil.addStationKvBeanList(new ArrayList<>(),
|
|
|
|
|
new StationKvBean("shiftGroup", "班组", record.getShiftGroup()),
|
|
|
|
|
new StationKvBean("shiftGroupName", "班组名称", record.getShiftGroupName()),
|
|
|
|
|
new StationKvBean("shiftCode", "班次", record.getShiftCode()),
|
|
|
|
|
new StationKvBean("shiftName", "班次名称", record.getShiftName()))
|
|
|
|
|
;
|
|
|
|
|
new StationKvBean(MesPcnExtConstWords.SHIFT_GROUP, "班组", record.getShiftGroup()),
|
|
|
|
|
new StationKvBean(MesPcnExtConstWords.SHIFT_GROUP_NAME, "班组名称", record.getShiftGroupName()),
|
|
|
|
|
new StationKvBean(MesPcnExtConstWords.SHIFT_CODE, "班次", record.getShiftCode()),
|
|
|
|
|
new StationKvBean(MesPcnExtConstWords.SHIFT_NAME, "班次名称", record.getShiftName()));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|