forked from I3-YF/i3plus-mes-pcn-yfai
Merge branch 'uat-temp-wj-chongqingdaqu-dev' into uat-temp-wj-chongqingdaqu-dev-bak
commit
d61f098384
@ -0,0 +1,7 @@
|
||||
package cn.estsh.i3plus.ext.mes.pcn.api.base;
|
||||
|
||||
import cn.estsh.i3plus.pojo.mes.bean.MesPartPackageType;
|
||||
|
||||
public interface IMesPartPackageTypeService {
|
||||
MesPartPackageType getMesPartPackageType(String organizeCode, String packageTypeCode);
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.base;
|
||||
|
||||
import cn.estsh.i3plus.ext.mes.pcn.api.base.IMesPartPackageTypeService;
|
||||
import cn.estsh.i3plus.pojo.base.bean.DdlPackBean;
|
||||
import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack;
|
||||
import cn.estsh.i3plus.pojo.mes.bean.MesPartPackageType;
|
||||
import cn.estsh.i3plus.pojo.mes.repository.IMesPartPackageTypeRepository;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author jason
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class MesPartPackageTypeServiceImpl implements IMesPartPackageTypeService {
|
||||
@Autowired
|
||||
private IMesPartPackageTypeRepository partPackageTypeRDao;
|
||||
|
||||
@Override
|
||||
public MesPartPackageType getMesPartPackageType(String organizeCode, String packageTypeCode) {
|
||||
DdlPackBean packBean = DdlPackBean.getDdlPackBean(organizeCode);
|
||||
DdlPreparedPack.getStringEqualPack(packageTypeCode, "packageTypeCode", packBean);
|
||||
return partPackageTypeRDao.getByProperty(packBean);
|
||||
}
|
||||
}
|
@ -0,0 +1,67 @@
|
||||
package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.numberrule;
|
||||
|
||||
import cn.estsh.i3plus.ext.mes.pcn.apiservice.util.MesPcnException;
|
||||
import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords;
|
||||
import cn.estsh.i3plus.mes.pcn.api.iservice.busi.INumberRulePackAttributeStrategyService;
|
||||
import cn.estsh.i3plus.platform.common.tool.TimeTool;
|
||||
import cn.estsh.i3plus.pojo.base.bean.DdlPackBean;
|
||||
import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack;
|
||||
import cn.estsh.i3plus.pojo.mes.bean.MesCustomerPart;
|
||||
import cn.estsh.i3plus.pojo.mes.model.GenSerialNoModel;
|
||||
import cn.estsh.i3plus.pojo.mes.repository.MesCustomerPartRepository;
|
||||
import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
public class XiaoPengNumberRule2StrategyService implements INumberRulePackAttributeStrategyService {
|
||||
|
||||
@Autowired
|
||||
private MesCustomerPartRepository customerPartRepository;
|
||||
|
||||
@Override
|
||||
public GenSerialNoModel execute(GenSerialNoModel genSerialNoModel) {
|
||||
|
||||
Map<String, Object> dataMap = genSerialNoModel.getDataMap();
|
||||
MesCustomerPart customerPart = (!CollectionUtils.isEmpty(dataMap) && dataMap.containsKey(MesCustomerPart.class.getSimpleName())) ?
|
||||
(MesCustomerPart)dataMap.get(MesCustomerPart.class.getSimpleName()) : getMesCustomerPart(genSerialNoModel.getOrganizeCode(), genSerialNoModel.getPartNo());
|
||||
if (null != customerPart) {
|
||||
genSerialNoModel.setCustPartNo(customerPart.getCustPartNo());
|
||||
}else {
|
||||
MesPcnException.throwMesBusiException("请检查客户零件信息,零件[%s]客户零件关系未维护", genSerialNoModel.getPartNo());
|
||||
}
|
||||
|
||||
//年月日缩写
|
||||
Date date = new Date();
|
||||
genSerialNoModel.setYear(getYearShort(date));
|
||||
genSerialNoModel.setMonth(getMonthShort(date));
|
||||
genSerialNoModel.setDay(getDayShort(date));
|
||||
return genSerialNoModel;
|
||||
}
|
||||
|
||||
private String getYearShort(Date date) {
|
||||
return MesExtEnumUtil.YEAR_SHORT2.valueOfDescription(Integer.parseInt(TimeTool.getYear(date)));
|
||||
}
|
||||
|
||||
private String getMonthShort(Date date) {
|
||||
return MesExtEnumUtil.MONTH_SHORT2.valueOfDescription(Integer.parseInt(TimeTool.getMonth(date)));
|
||||
}
|
||||
|
||||
private String getDayShort(Date date) {
|
||||
return MesExtEnumUtil.DAY_SHORT2.valueOfDescription(Integer.parseInt(TimeTool.getDay(date)));
|
||||
}
|
||||
|
||||
private MesCustomerPart getMesCustomerPart(String orgaizeCode, String partNo) {
|
||||
if (StringUtils.isEmpty(orgaizeCode) || StringUtils.isEmpty(partNo)) return null;
|
||||
DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean(orgaizeCode);
|
||||
DdlPreparedPack.getStringEqualPack(partNo, MesPcnExtConstWords.ERP_PART_NO, ddlPackBean);
|
||||
MesCustomerPart customerPart = customerPartRepository.getByProperty(ddlPackBean);
|
||||
return customerPart;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,164 @@
|
||||
package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.print.sortshipping.strategy;
|
||||
|
||||
import cn.estsh.i3plus.ext.mes.pcn.api.base.IMesPartPackageTypeService;
|
||||
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesPartShippingGroupService;
|
||||
import cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.print.IPrintTemplateStrategyService;
|
||||
import cn.estsh.i3plus.pojo.base.bean.DdlPackBean;
|
||||
import cn.estsh.i3plus.pojo.base.enumutil.ResourceEnumUtil;
|
||||
import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack;
|
||||
import cn.estsh.i3plus.pojo.mes.bean.MesPart;
|
||||
import cn.estsh.i3plus.pojo.mes.bean.MesPartPackageType;
|
||||
import cn.estsh.i3plus.pojo.mes.bean.MesPartShippingGroup;
|
||||
import cn.estsh.i3plus.pojo.mes.bean.edi.cd.MesCimVolvoJisRackId;
|
||||
import cn.estsh.i3plus.pojo.mes.bean.edi.cd.MesCimVolvoJisRackIdDetail;
|
||||
import cn.estsh.i3plus.pojo.mes.bean.shipping.MesShippingOrderManagement;
|
||||
import cn.estsh.i3plus.pojo.mes.bean.shipping.MesShippingOrderManagementDetail;
|
||||
import cn.estsh.i3plus.pojo.mes.model.ChengDuVolvoShippingPrintModel;
|
||||
import cn.estsh.i3plus.pojo.mes.repository.MesPartRepository;
|
||||
import cn.estsh.i3plus.pojo.mes.repository.MesShippingOrderManagementDetailRepository;
|
||||
import cn.estsh.i3plus.pojo.mes.repository.edi.cd.MesCimVolvoJisRackIdDetailRepository;
|
||||
import cn.estsh.i3plus.pojo.mes.repository.edi.cd.MesCimVolvoJisRackIdRepository;
|
||||
import cn.estsh.impp.framework.boot.auth.AuthUtil;
|
||||
import cn.estsh.impp.framework.boot.util.ResultBean;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description : 成都volvo发运单打印策略
|
||||
* @Reference :
|
||||
* @Author : jason.niu
|
||||
* @CreateDate : 2025/03/20 16:43
|
||||
* @Modify:
|
||||
**/
|
||||
@Component
|
||||
@Slf4j
|
||||
public class ChengDuVolvoShippingPrintStrategyService implements IPrintTemplateStrategyService {
|
||||
@Autowired
|
||||
private MesShippingOrderManagementDetailRepository shippingOrderDetailRDao;
|
||||
@Autowired
|
||||
private MesCimVolvoJisRackIdRepository rackIdRDao;
|
||||
@Autowired
|
||||
private MesCimVolvoJisRackIdDetailRepository rackIdDetailRDao;
|
||||
@Autowired
|
||||
private MesPartRepository partRDao;
|
||||
@Autowired
|
||||
private IMesPartShippingGroupService shippingGroupService;
|
||||
@Autowired
|
||||
private IMesPartPackageTypeService partPackageTypeService;
|
||||
|
||||
@Override
|
||||
public ResultBean execute(MesShippingOrderManagement bean, List<MesShippingOrderManagement> shippingOrderManagementList) {
|
||||
List<ChengDuVolvoShippingPrintModel> modelList = new ArrayList<>();
|
||||
for (MesShippingOrderManagement loadingList : shippingOrderManagementList) {
|
||||
ChengDuVolvoShippingPrintModel model = getPrintData(loadingList);
|
||||
if (model != null) {
|
||||
modelList.add(model);
|
||||
}
|
||||
}
|
||||
return ResultBean.success("装车单打印成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode()).setResultList(modelList);
|
||||
}
|
||||
|
||||
private ChengDuVolvoShippingPrintModel getPrintData(MesShippingOrderManagement shippingOrder) {
|
||||
final String organizeCode = AuthUtil.getOrganize().getOrganizeCode();
|
||||
final String userName = AuthUtil.getSessionUser().getUserName();
|
||||
|
||||
ChengDuVolvoShippingPrintModel model = new ChengDuVolvoShippingPrintModel();
|
||||
DdlPackBean shippingDetailPackBean = DdlPackBean.getDdlPackBean(organizeCode);
|
||||
DdlPreparedPack.getNumEqualPack(shippingOrder.getId(), "pid", shippingDetailPackBean);
|
||||
List<MesShippingOrderManagementDetail> shippingDetails = shippingOrderDetailRDao.findByHqlWhere(shippingDetailPackBean);
|
||||
if (CollectionUtils.isEmpty(shippingDetails)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
List<String> partNos = new ArrayList<>();
|
||||
List<Long> rackDetailIdList = new ArrayList<>();
|
||||
for (MesShippingOrderManagementDetail shippingDetail : shippingDetails) {
|
||||
if (shippingDetail.getSourceId() != null) {
|
||||
rackDetailIdList.add(shippingDetail.getSourceId());
|
||||
}
|
||||
if (!partNos.contains(shippingDetail.getPartNo())) {
|
||||
partNos.add(shippingDetail.getPartNo());
|
||||
}
|
||||
}
|
||||
DdlPackBean rackDetailPackBean = DdlPackBean.getDdlPackBean(organizeCode);
|
||||
DdlPreparedPack.getInPackList(rackDetailIdList, "id", rackDetailPackBean);
|
||||
List<MesCimVolvoJisRackIdDetail> rackIdDetails = rackIdDetailRDao.findByHqlWhere(rackDetailPackBean);
|
||||
if (CollectionUtils.isEmpty(rackIdDetails)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
List<Long> rackIdList = new ArrayList<>();
|
||||
for (MesCimVolvoJisRackIdDetail rackIdDetail : rackIdDetails) {
|
||||
if (rackIdDetail.getJisRackIdFid() != null && !rackIdList.contains(rackIdDetail.getJisRackIdFid())) {
|
||||
rackIdList.add(rackIdDetail.getJisRackIdFid());
|
||||
}
|
||||
}
|
||||
DdlPackBean rackPackBean = DdlPackBean.getDdlPackBean(organizeCode);
|
||||
DdlPreparedPack.getInPackList(rackIdList, "id", rackPackBean);
|
||||
List<MesCimVolvoJisRackId> rackIds = rackIdRDao.findByHqlWhere(rackPackBean);
|
||||
if (CollectionUtils.isEmpty(rackIds)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// 净重
|
||||
double totalNetWeight = 0.0;
|
||||
// 净重单位
|
||||
String netWom = "";
|
||||
// 包装重量
|
||||
double packageWeight = 0.0;
|
||||
// 包装重量单位
|
||||
String tmpGwUom = "";
|
||||
DdlPackBean partPackBean = DdlPackBean.getDdlPackBean(organizeCode);
|
||||
DdlPreparedPack.getInPackList(partNos, "partNo", rackPackBean);
|
||||
List<MesPart> parts = partRDao.findByHqlWhere(partPackBean);
|
||||
if (!CollectionUtils.isEmpty(parts)) {
|
||||
for (MesPart mesPart : parts) {
|
||||
if (mesPart.getNetWeight() != null) {
|
||||
totalNetWeight += mesPart.getNetWeight();
|
||||
}
|
||||
netWom = mesPart.getWeightUom();
|
||||
}
|
||||
}
|
||||
MesPartShippingGroup shippingGroup = shippingGroupService.getMesPartShippingGroup(organizeCode, shippingOrder.getShippingGroupCode());
|
||||
if (shippingGroup != null && !StringUtils.isEmpty(shippingGroup.getPackageTypeCode()) && (shippingGroup.getPackageTypeCode().startsWith("P") || shippingGroup.getPackageTypeCode().startsWith("p"))) {
|
||||
MesPartPackageType partPackageType = partPackageTypeService.getMesPartPackageType(organizeCode, shippingGroup.getPackageTypeCode());
|
||||
if (partPackageType != null) {
|
||||
packageWeight = partPackageType.getNetWeight() != null ? partPackageType.getNetWeight() : 0;
|
||||
tmpGwUom = partPackageType.getWeightUom();
|
||||
}
|
||||
}
|
||||
|
||||
MesCimVolvoJisRackId rackId = rackIds.get(0);
|
||||
model.setRecelver(rackId.getShipToId());
|
||||
model.setDock(rackId.getIdForPlaceOfDischarge());
|
||||
model.setAdviceNoteNo(rackId.getAsnNo());
|
||||
model.setAdviceNoteBarCode(rackId.getAsnNo());
|
||||
model.setSupplierAddress(StringUtils.isEmpty(rackId.getShipFrom()) ? rackId.getShipFromId() : rackId.getShipFrom());
|
||||
model.setNetWeight(String.format("%.2f", totalNetWeight));
|
||||
model.setNWUom(netWom);
|
||||
model.setGrossWeight(String.format("%.2f", totalNetWeight + packageWeight));
|
||||
model.setGWUom(tmpGwUom);
|
||||
model.setRackId(rackId.getJisRackId());
|
||||
model.setRackBarCode(rackId.getJisRackId());
|
||||
model.setFirstPreNo(rackId.getFirstSequenceNumber());
|
||||
model.setFirstPreBarCode(rackId.getFirstSequenceNumber());
|
||||
model.setLastPreNo(rackId.getLastSequenceNumber());
|
||||
model.setLastPreBarCode(rackId.getLastSequenceNumber());
|
||||
model.setSupplierID(rackId.getSellerId());
|
||||
model.setSupplierBarCode(rackId.getSellerId());
|
||||
model.setCountryOfOrigin("CN");
|
||||
model.setNoofCars(rackDetailIdList.size());
|
||||
model.setDescription(rackId.getRackReference());
|
||||
model.setPackageId(rackId.getJisRackId());
|
||||
model.setPackageBarCode(rackId.getJisRackId());
|
||||
model.setProcess("LDJIS");
|
||||
|
||||
return model;
|
||||
}
|
||||
}
|
@ -0,0 +1,169 @@
|
||||
package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.print.strategy;
|
||||
|
||||
import cn.estsh.i3plus.ext.mes.pcn.api.base.IMesCustomerPartService;
|
||||
import cn.estsh.i3plus.ext.mes.pcn.api.base.IMesPartService;
|
||||
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesPrintedSnLogService;
|
||||
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesWorkOrderService;
|
||||
import cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.print.IPrintTemplateStrategyService;
|
||||
import cn.estsh.i3plus.ext.mes.pcn.apiservice.util.MesPcnException;
|
||||
import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesProduceSnPrintDataModel;
|
||||
import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesProduceSnPrintModel;
|
||||
import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords;
|
||||
import cn.estsh.i3plus.mes.pcn.api.iservice.busi.ISyncFuncService;
|
||||
import cn.estsh.i3plus.mes.pcn.util.DateUtil;
|
||||
import cn.estsh.i3plus.platform.common.convert.ConvertBean;
|
||||
import cn.estsh.i3plus.platform.common.tool.TimeTool;
|
||||
import cn.estsh.i3plus.pojo.base.codemaker.SnowflakeIdMaker;
|
||||
import cn.estsh.i3plus.pojo.mes.bean.*;
|
||||
import cn.estsh.i3plus.pojo.mes.bean.edi.cd.MesCimVolvoJisRackId;
|
||||
import cn.estsh.i3plus.pojo.mes.bean.edi.cd.MesCimVolvoJisRackIdDetail;
|
||||
import cn.estsh.i3plus.pojo.mes.bean.shipping.MesCustSortInfo;
|
||||
import cn.estsh.i3plus.pojo.mes.model.GenSerialNoModel;
|
||||
import cn.estsh.i3plus.pojo.mes.model.StationRequestBean;
|
||||
import cn.estsh.i3plus.pojo.mes.model.StepResult;
|
||||
import cn.estsh.i3plus.pojo.mes.repository.MesCustSoftInfoRepository;
|
||||
import cn.estsh.i3plus.pojo.mes.repository.edi.cd.MesCimVolvoJisRackIdDetailRepository;
|
||||
import cn.estsh.i3plus.pojo.mes.repository.edi.cd.MesCimVolvoJisRackIdRepository;
|
||||
import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @Description : 成都volvo零件标签打印
|
||||
* @Reference :
|
||||
* @Author : jason.niu
|
||||
* @CreateDate : 2025/03/20 16:43
|
||||
* @Modify:
|
||||
**/
|
||||
@Component
|
||||
@Slf4j
|
||||
public class ChengDuVolvoPartPrintStrategy implements IPrintTemplateStrategyService {
|
||||
@Autowired
|
||||
private ISyncFuncService syncFuncService;
|
||||
|
||||
@Autowired
|
||||
private SnowflakeIdMaker snowflakeIdMaker;
|
||||
|
||||
@Autowired
|
||||
private IMesPartService mesPartService;
|
||||
|
||||
@Autowired
|
||||
private IMesPrintedSnLogService mesPrintedSnLogService;
|
||||
|
||||
@Autowired
|
||||
private IMesCustomerPartService mesCustomerPartService;
|
||||
@Autowired
|
||||
private IMesWorkOrderService mesWorkOrderService;
|
||||
@Autowired
|
||||
private MesCustSoftInfoRepository custSoftInfoRDao;
|
||||
@Autowired
|
||||
private MesCimVolvoJisRackIdDetailRepository rackIdDetailRDao;
|
||||
@Autowired
|
||||
private MesCimVolvoJisRackIdRepository volvoJisRackIdRDao;
|
||||
|
||||
@Override
|
||||
public MesProduceSnPrintModel execute(GenSerialNoModel genSerialNoModel, MesProduceSnPrintModel mesProduceSnPrintModel, MesNumberRule numberRule, StepResult stepResult, StationRequestBean reqBean, Boolean isStep) {
|
||||
String organizeCode = mesProduceSnPrintModel.getOrganizeCode();
|
||||
//物料信息
|
||||
MesPart mesPart = mesPartService.getMesPartByPartNo(mesProduceSnPrintModel.getPartNo(), organizeCode);
|
||||
MesCustomerPart customerPart = (!Objects.isNull(genSerialNoModel) && !CollectionUtils.isEmpty(genSerialNoModel.getDataMap()) && genSerialNoModel.getDataMap().containsKey(MesCustomerPart.class.getSimpleName())) ? (MesCustomerPart) genSerialNoModel.getDataMap().get(MesCustomerPart.class.getSimpleName()) : mesCustomerPartService.getMesCustomerPart(organizeCode,mesProduceSnPrintModel.getPartNo());
|
||||
if (!isStep){
|
||||
MesPcnException.throwBusiException("成都volvo零件标签打印只支持工位端打印!");
|
||||
}
|
||||
|
||||
MesProduceSn mesProduceSn = mesProduceSnPrintModel.getMesProduceSnList().get(0);
|
||||
//封装打印信息
|
||||
MesProduceSnPrintDataModel printDataModel = getModel(mesProduceSn, customerPart);
|
||||
mesProduceSnPrintModel.getMesProduceSnPrintDataModelList().clear();
|
||||
Map<String, Object> printTemplateData = new HashMap<>(getPrintContextMap(mesProduceSn, customerPart));
|
||||
List<Map<String, Object>> printDataMapList = new ArrayList<>();
|
||||
printDataMapList.add(printTemplateData);
|
||||
mesProduceSnPrintModel.getPrintContextList().add(packResultMap(mesProduceSnPrintModel, printDataMapList));
|
||||
|
||||
//保存打印记录
|
||||
mesProduceSnPrintModel.getMesPrintedSnLogList().add(mesPrintedSnLogService.getMesCustomPrintedSnLog(mesProduceSnPrintModel.getUserName(), organizeCode, printDataModel, printTemplateData));
|
||||
return mesProduceSnPrintModel;
|
||||
}
|
||||
|
||||
private MesProduceSn generateMesProduceSn(MesPart mesPart, String sn, String userName, Double qty) {
|
||||
MesProduceSn mesProduceSn = new MesProduceSn();
|
||||
mesProduceSn.setSerialNumber(snowflakeIdMaker.nextId() + "");
|
||||
mesProduceSn.setProductSn(sn);
|
||||
mesProduceSn.setCustSn(sn);
|
||||
mesProduceSn.setPartNo(mesPart.getPartNo());
|
||||
mesProduceSn.setPartName(mesPart.getPartName());
|
||||
mesProduceSn.setProcessLabelTemplate(mesPart.getProcessLabelTemplate());
|
||||
mesProduceSn.setCustLabelTemplate(mesPart.getCustLabelTemplate());
|
||||
mesProduceSn.setProdLabelTemplate(mesPart.getProductLabelTemplate());
|
||||
mesProduceSn.setQty(qty);
|
||||
mesProduceSn.setSnStatus(MesExtEnumUtil.PRODUCE_SN_STATUS.CREATE.getValue());
|
||||
mesProduceSn.setQcStatus(MesExtEnumUtil.PRODUCE_QC_STATUS.QUALIFIED.getValue());
|
||||
mesProduceSn.setLotNo(TimeTool.getToday());
|
||||
mesProduceSn.setPrintCount(MesPcnExtConstWords.ONE);
|
||||
mesProduceSn.setPrintStatus(MesExtEnumUtil.PRINT_STATUS.PRINTED.getValue());
|
||||
mesProduceSn.setOrganizeCode(mesPart.getOrganizeCode());
|
||||
ConvertBean.serviceModelInitialize(mesProduceSn, userName);
|
||||
return mesProduceSn;
|
||||
}
|
||||
|
||||
private MesProduceSnPrintDataModel getModel(MesProduceSn produceSn, MesCustomerPart customerPart) {
|
||||
MesProduceSnPrintDataModel mesProduceSnPrintDataModel = new MesProduceSnPrintDataModel();
|
||||
mesProduceSnPrintDataModel.setPartNo(produceSn.getPartNo());
|
||||
mesProduceSnPrintDataModel.setPartName(produceSn.getPartName());
|
||||
if (!Objects.isNull(customerPart)) {
|
||||
mesProduceSnPrintDataModel.setCustPartNo(customerPart.getCustPartNo());
|
||||
}
|
||||
mesProduceSnPrintDataModel.setBarcode(produceSn.getProductSn());
|
||||
mesProduceSnPrintDataModel.setPrintDate(TimeTool.getNowTime(true));
|
||||
mesProduceSnPrintDataModel.setUserName(produceSn.getCreateUser());
|
||||
mesProduceSnPrintDataModel.setProductDate(TimeTool.parseStringFormat(produceSn.getLotNo(), DateUtil.SHORT_FORMAT, "yyyy/MM/dd"));
|
||||
return mesProduceSnPrintDataModel;
|
||||
}
|
||||
|
||||
private Map<String, Object> getPrintContextMap(MesProduceSn produceSn, MesCustomerPart customerPart) {
|
||||
MesWorkOrder workOrder = mesWorkOrderService.getWorkOrderNoByCustSn(produceSn.getOrganizeCode(), produceSn.getProductSn());
|
||||
if (workOrder == null || StringUtils.isEmpty(workOrder.getWorkOrderSource())) {
|
||||
MesPcnException.throwBusiException("客户条码[%s]对应的工单信息不存在!", produceSn.getProductSn());
|
||||
}
|
||||
|
||||
MesCustSortInfo custSoftInfo = custSoftInfoRDao.getById(Long.parseLong(workOrder.getWorkOrderSource()));
|
||||
if (custSoftInfo == null) {
|
||||
MesPcnException.throwBusiException("工单[%s]无法匹配客户排序信息!", workOrder.getWorkOrderNo());
|
||||
}
|
||||
MesCimVolvoJisRackIdDetail rackIdDetail = rackIdDetailRDao.getById(custSoftInfo.getSourceId());
|
||||
if (rackIdDetail == null) {
|
||||
MesPcnException.throwBusiException("工单[%s]客户排序信息无法匹配RackIdDetail!", workOrder.getWorkOrderNo());
|
||||
}
|
||||
MesCimVolvoJisRackId rackId = volvoJisRackIdRDao.getById(rackIdDetail.getJisRackIdFid());
|
||||
if (rackId == null) {
|
||||
MesPcnException.throwBusiException("工单[%s]客户排序信息无法匹配RackId!", workOrder.getWorkOrderNo());
|
||||
}
|
||||
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
result.put(MesPcnExtConstWords.VOLVO_CONSIGNMENT_REFERENCE, rackId.getConsignmentReference());
|
||||
result.put(MesPcnExtConstWords.PRODUCT_DATE, TimeTool.getNowTime("yyyyMMdd HH:mm"));
|
||||
result.put(MesPcnExtConstWords.VOLVO_FYON, rackIdDetail.getFyon());
|
||||
result.put(MesPcnExtConstWords.VOLVO_SEQUENCENUMBER, rackIdDetail.getSequenceNumber());
|
||||
result.put(MesPcnExtConstWords.VOLVO_RACKID, rackId.getJisRackId());
|
||||
result.put(MesPcnExtConstWords.VOLVO_POSITION, rackIdDetail.getPosition());
|
||||
result.put(MesPcnExtConstWords.CUST_PART_NO, custSoftInfo.getCustPartNo());
|
||||
result.put(MesPcnExtConstWords.PRINT_BAR_CODE, produceSn.getProductSn());
|
||||
result.put(MesPcnExtConstWords.PRINT_DATE, TimeTool.getNowTime(true));
|
||||
result.put(MesPcnExtConstWords.USER_NAME, produceSn.getCreateUser());
|
||||
return result;
|
||||
}
|
||||
|
||||
private Map<String, Object> packResultMap(MesProduceSnPrintModel printModel, List<Map<String, Object>> printTemplateDateList) {
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
resultMap.put(MesPcnExtConstWords.LABEL_TEMPLATE, printModel.getMesLabelTemplate());
|
||||
resultMap.put(MesPcnExtConstWords.TEMPLATE_DATA, printTemplateDateList);
|
||||
resultMap.put(MesPcnExtConstWords.TEMPLATE_CODE, printModel.getMesLabelTemplate().getTemplateCode());
|
||||
resultMap.put(MesPcnExtConstWords.PRINTER, printModel.getPrinter());
|
||||
return resultMap;
|
||||
}
|
||||
}
|
@ -0,0 +1,84 @@
|
||||
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.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.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 cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil;
|
||||
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;
|
||||
|
||||
/**
|
||||
* @Description : 扫描可回用包装条码工步
|
||||
* @Reference :
|
||||
* @Author : wangjie
|
||||
* @CreateDate 2024/9/11 13:53
|
||||
* @Modify:
|
||||
**/
|
||||
@Slf4j
|
||||
@Service("mesRecyclablePackageScanStepService")
|
||||
public class MesRecyclablePackageScanStepService extends BaseStepService {
|
||||
|
||||
@Autowired
|
||||
private IMesProductionProcessContextStepService productionProcessContextStepService;
|
||||
|
||||
@Autowired
|
||||
private IMesProductionDispatchContextStepService productionDispatchContextStepService;
|
||||
|
||||
@Autowired
|
||||
private IMesProductionCustomContextStepService productionCustomContextStepService;
|
||||
|
||||
@Override
|
||||
public StepResult execute(StationRequestBean reqBean) {
|
||||
|
||||
StationResultBean resultBean = new StationResultBean();
|
||||
|
||||
StepResult stepResult = StepResult.getSuccessComplete();
|
||||
|
||||
//获取上下文信息
|
||||
MesProductionProcessContext productionProcessContext = productionProcessContextStepService.dispatchCurCellEquipment(reqBean);
|
||||
|
||||
//当前工序已存在读取待验证的可回用包装条码信息
|
||||
if (productionDispatchContextStepService.checkScanRecyclablePackageIsExistContext(reqBean)) return stepResult;
|
||||
|
||||
//存储生产过程上下文对象
|
||||
productionProcessContextStepService.dispatchProductionProcessContext(reqBean, productionProcessContext);
|
||||
|
||||
if (StringUtils.isEmpty(reqBean.getScanInfo())) stepSendGuideAndThrowEx(reqBean, resultBean.writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.PROCESS.getValue()), "请扫描可回用包装条码!");
|
||||
|
||||
doHandleScanRecyclablePackageContext(reqBean, stepResult, reqBean.getScanInfo());
|
||||
|
||||
return stepSuccessCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.SCAN.getValue()).scanInfo(reqBean.getScanInfo()), stepResult, stepResult.getMsg());
|
||||
}
|
||||
|
||||
//封装可回用包装条码信息 (扫描)
|
||||
private List<MesEquipVariableCollectContext> doHandleScanRecyclablePackageContext(StationRequestBean reqBean, StepResult stepResult, String scanInfo) {
|
||||
|
||||
List<MesEquipVariableCollectContext> equipVariableCollectContextList = new ArrayList<>();
|
||||
|
||||
equipVariableCollectContextList.add(new MesEquipVariableCollectContext(reqBean.getOrganizeCode(), scanInfo, MesExtEnumUtil.CELL_MESSAGE_SOURCE.SCAN.getValue()));
|
||||
|
||||
//保存设备当前一轮工序的待验证的可回用包装条码信息
|
||||
productionDispatchContextStepService.dispatchScanRecyclablePackageContext(reqBean, equipVariableCollectContextList);
|
||||
|
||||
//发送工步内容
|
||||
productionCustomContextStepService.sendStepContextMessage(reqBean, scanInfo, MesExtEnumUtil.CELL_MESSAGE_SOURCE.SCAN);
|
||||
|
||||
stepResult.msg(String.format("当前扫描信息可回用包装条码[%s]!", scanInfo));
|
||||
|
||||
return equipVariableCollectContextList;
|
||||
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue