Merge remote-tracking branch 'origin/dev-wuhan-temp' into dev-wuhan-temp

master
臧学普 6 months ago
commit 34f8cb319f

@ -3,10 +3,12 @@ package cn.estsh.i3plus.ext.mes.pcn.api.base;
import cn.estsh.i3plus.pojo.base.bean.ListPager;
import cn.estsh.i3plus.pojo.base.common.Pager;
import cn.estsh.i3plus.pojo.mes.bean.MesProdShiftRecord;
import cn.estsh.i3plus.pojo.mes.bean.MesShift;
import io.swagger.annotations.ApiOperation;
import java.util.List;
import java.util.Map;
/**
* @Description: 线
@ -23,4 +25,7 @@ public interface IMesShiftService {
@ApiOperation(value = "查询产线与班次的对应关系")
public List<MesShift> queryMesShift(String organizeCode, String workCenterCode);
@ApiOperation(value = "获取当前班次时间日期")
Map<String,String> getShiftTimeMap(MesProdShiftRecord record);
}

@ -1,9 +1,10 @@
package cn.estsh.i3plus.ext.mes.pcn.apiservice.controller.busi;
import cn.estsh.i3plus.ext.mes.pcn.api.base.IMesProdShiftRecordService;
import cn.estsh.i3plus.ext.mes.pcn.api.base.IMesShiftService;
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.pojo.constant.MesCommonConstant;
import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords;
import cn.estsh.i3plus.mes.pcn.util.StationKvBeanUtil;
import cn.estsh.i3plus.pojo.base.bean.ListPager;
import cn.estsh.i3plus.pojo.base.common.Pager;
@ -18,12 +19,12 @@ import cn.estsh.impp.framework.boot.util.ResultBean;
import cn.estsh.impp.framework.boot.util.ValidatorBean;
import com.google.common.base.Objects;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* @Description:
@ -39,6 +40,10 @@ public class MesProdShiftRecordController {
@Autowired
private IMesProductionCustomContextStepService productionCustomContextStepService;
@Autowired
private IMesShiftService mesShiftService;
@GetMapping("/query-pager")
@ApiOperation(value = "查询开关班记录")
public ResultBean queryMesProdShiftRecordByPager(MesProdShiftRecord mesProdShiftRecord, Pager pager) {
@ -121,12 +126,18 @@ public class MesProdShiftRecordController {
//封装展示组件班组班次内容
private List<StationKvBean> getProdShiftData(MesProdShiftRecord record) {
return StationKvBeanUtil.addStationKvBeanList(new ArrayList<>(),
List<StationKvBean> stationKvBeans = StationKvBeanUtil.addStationKvBeanList(new ArrayList<>(),
new StationKvBean("shiftGroup", "班组", record.getShiftGroup()),
new StationKvBean("shiftGroupName", "班组名称", record.getShiftGroup()),
new StationKvBean("shiftCode", "班次", record.getShiftCode()),
new StationKvBean("shiftName", "班次名称", record.getShiftName()))
;
new StationKvBean("shiftName", "班次名称", record.getShiftName()));
//班次开始时间 ,班次结束时间
Map<String, String> shiftTimeMap = mesShiftService.getShiftTimeMap(record);
if (!java.util.Objects.isNull(shiftTimeMap)) {
StationKvBeanUtil.addStationKvBeanList(stationKvBeans,
new StationKvBean(MesPcnExtConstWords.START_TIME,"开始时间",shiftTimeMap.get(MesPcnExtConstWords.START_TIME)),
new StationKvBean(MesPcnExtConstWords.END_TIME,"结束时间",shiftTimeMap.get(MesPcnExtConstWords.END_TIME)));
}
return stationKvBeans;
}
}

@ -1,19 +1,29 @@
package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.base;
import cn.estsh.i3plus.ext.mes.pcn.api.base.IMesShiftService;
import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords;
import cn.estsh.i3plus.mes.pcn.util.DateUtil;
import cn.estsh.i3plus.platform.common.tool.TimeTool;
import cn.estsh.i3plus.pojo.base.bean.DdlPackBean;
import cn.estsh.i3plus.pojo.base.bean.ListPager;
import cn.estsh.i3plus.pojo.base.common.Pager;
import cn.estsh.i3plus.pojo.base.common.PagerHelper;
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack;
import cn.estsh.i3plus.pojo.mes.bean.MesProdShiftRecord;
import cn.estsh.i3plus.pojo.mes.bean.MesShift;
import cn.estsh.i3plus.pojo.mes.repository.MesShiftRepository;
import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
/**
@ -49,4 +59,31 @@ public class MesShiftServiceImpl implements IMesShiftService {
DdlPreparedPack.getStringEqualPack(workCenterCode, "workCenterCode", packBean);
return mesShiftRepository.findByHqlWhere(packBean);
}
@Override
public Map<String, String> getShiftTimeMap(MesProdShiftRecord record) {
List<MesShift> shiftList = queryMesShift(record.getOrganizeCode(), record.getWorkCenterCode());
if (CollectionUtils.isEmpty(shiftList)) {
return null;
}
Optional<MesShift> shiftOptional = shiftList.stream().filter(t -> t.getShiftCode().equals(record.getShiftCode())).findFirst();
if (!shiftOptional.isPresent()) {
return null;
}
if (StringUtils.isEmpty(shiftOptional.get().getStartTime()) || StringUtils.isEmpty(shiftOptional.get().getEndTime()) || StringUtils.isEmpty(record.getStartTime())) {
return null;
}
String startData = TimeTool.parseStringFormat(record.getStartTime(), DateUtil.BASE_FORMAT, DateUtil.SHORT_FORMAT);
//白班
String startTime = startData + " " + shiftOptional.get().getStartTime();
String endTime = startData + " " + shiftOptional.get().getEndTime();
//晚班
if (MesExtEnumUtil.SHIFT_CODE.SHIFT_CODE_20.getValue().equals(record.getShiftCode())) {
endTime = TimeTool.getToday(DateUtil.addDays(record.getStartTime(), 1)) + " " + shiftOptional.get().getEndTime();
}
Map<String, String> shiftTimeMap = new HashMap<>(2);
shiftTimeMap.put(MesPcnExtConstWords.START_TIME, startTime);
shiftTimeMap.put(MesPcnExtConstWords.END_TIME, endTime);
return shiftTimeMap;
}
}

@ -3,6 +3,7 @@ package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.busi;
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesBoxingErrorProofingService;
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesConfigService;
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProduceSnExtService;
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProductionRecordService;
import cn.estsh.i3plus.ext.mes.pcn.apiservice.util.MesPcnException;
import cn.estsh.i3plus.ext.mes.pcn.pojo.constant.MesCommonConstant;
import cn.estsh.i3plus.platform.common.convert.ConvertBean;
@ -26,10 +27,7 @@ import org.springframework.stereotype.Service;
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.Objects;
import java.util.*;
import java.util.stream.Collectors;
/**
@ -70,6 +68,9 @@ public class MesBoxingErrorProofingService implements IMesBoxingErrorProofingSer
@Autowired
private IMesProduceSnExtService mesProduceSnExtService;
@Autowired
private IMesProductionRecordService mesProductionRecordService;
@Override
public ListPager<MesPackageDetail> queryMesPackageDetailByPager(MesPackage mesPackage, Pager pager) {
@ -82,6 +83,8 @@ public class MesBoxingErrorProofingService implements IMesBoxingErrorProofingSer
@Override
public MesPackage doScan(MesPackageDetail mesPackageDetail) {
//获取包装定义
MesPackingDefine packingDefine = getMesPackingDefine(mesPackageDetail);
//扫描的是包装
if (mesPackageDetail.getIsScanPackageBoolean()) {
checkNotNull(mesPackageDetail);
@ -92,8 +95,6 @@ public class MesBoxingErrorProofingService implements IMesBoxingErrorProofingSer
MesPart mesPart;
Double qty;
String packageOneCode = "";
//获取包装定义
MesPackingDefine packingDefine = getMesPackingDefine(mesPackageDetail);
//WMS打印的条码信息
MesPackageSn mesPackageSn = getMesPackageSn(mesPackageDetail.getOrganizeCode(), mesPackageDetail.getPackageNo());
if(!Objects.isNull(mesPackageSn)){
@ -103,7 +104,7 @@ public class MesBoxingErrorProofingService implements IMesBoxingErrorProofingSer
}else{
//解析获取信息保存
if (StringUtils.isEmpty(packingDefine.getSplitChar())) {
MesPcnException.throwMesBusiException("箱类别代号【%s】分隔符不能为空", packingDefine.getPackCode());
MesPcnException.throwMesBusiException("箱类别代号【%s】分隔符不能为空,请检查数据!", packingDefine.getPackCode());
}
String[] split = mesPackageDetail.getPackageNo().split("\\" + packingDefine.getSplitChar());
//获取序列号
@ -122,16 +123,16 @@ public class MesBoxingErrorProofingService implements IMesBoxingErrorProofingSer
checkNotNull(mesPackageDetail);
//校验过程条码是否存在
if (StringUtils.isEmpty(mesPackageDetail.getSerialNumber())) {
MesPcnException.throwMesBusiException("过程条码不允许为空");
MesPcnException.throwMesBusiException("过程条码不允许为空,请检查数据!");
}
//校验包装条码信息
MesPackage mesPackage = getMesPackageAndCheck(mesPackageDetail.getPackageNo(), mesPackageDetail.getOrganizeCode());
//校验是否已关闭
if (CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue() == mesPackage.getIsSealed()) {
MesPcnException.throwMesBusiException("箱条码已封箱,不允许扫描零件条码");
MesPcnException.throwMesBusiException("箱条码已封箱,不允许扫描零件条码,请检查数据!");
}
//校验条码规则
MesPart mesPart = getMesPart(mesPackageDetail, mesPackage);
MesPart mesPart = getMesPart(mesPackageDetail, mesPackage, packingDefine);
//包装规格明细
MesPackageDetail saveMesPackageDetail = getPackageDetail(mesPackageDetail, mesPart);
if (mesPackageDetail.getIsMemoryBoolean()) {
@ -152,7 +153,7 @@ public class MesBoxingErrorProofingService implements IMesBoxingErrorProofingSer
MesPackage mesPackage = getMesPackageAndCheck(packageDetail.getPackageNo(), packageDetail.getOrganizeCode());
//校验是否已关闭
if (CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue() == mesPackage.getIsSealed()) {
MesPcnException.throwMesBusiException("箱条码已封箱,不允许扫描零件条码");
MesPcnException.throwMesBusiException("箱条码已封箱,不允许扫描零件条码,请检查数据!");
}
//去掉重复零件条码
List<MesPackageDetail> saveMesPackageDetailList = new ArrayList<>();
@ -171,26 +172,26 @@ public class MesBoxingErrorProofingService implements IMesBoxingErrorProofingSer
public ResultBean updateMesPackage(MesPackage mesPackage) {
String userName = mesPackage.getModifyUser();
if (Objects.isNull(CommonEnumUtil.TRUE_OR_FALSE.valueOfDescription(mesPackage.getIsSealed()))) {
MesPcnException.throwMesBusiException("是否封箱不能为空");
MesPcnException.throwMesBusiException("是否封箱不能为空,请检查数据!");
}
//查询包装条码信息
MesPackage mesPackageDb = getMesPackageAndCheck(mesPackage.getPackageNo(), mesPackage.getOrganizeCode());
if (CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue() == mesPackage.getIsSealed()) {
if (CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue() == mesPackageDb.getIsSealed()) {
MesPcnException.throwMesBusiException("箱条码【%s】状态为已关箱请勿重复操作", mesPackage.getPackageNo());
MesPcnException.throwMesBusiException("箱条码【%s】状态为已关箱请勿重复操作,请检查数据!", mesPackage.getPackageNo());
}
//校验是否存在包装明细
DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean(mesPackage.getOrganizeCode());
DdlPreparedPack.getStringEqualPack(mesPackage.getPackageNo(), "packageNo", ddlPackBean);
if (!mesPackageDetailRDao.isExitByHql(ddlPackBean)) {
MesPcnException.throwMesBusiException("箱条码【%s】下不存在零件条码不允许关箱", mesPackage.getPackageNo());
MesPcnException.throwMesBusiException("箱条码【%s】下不存在零件条码不允许关箱,请检查数据!", mesPackage.getPackageNo());
}
//关箱
updateMesPackage(mesPackageDb, mesPackage.getModifyUser(), 0d, true);
return ResultBean.success("关箱成功");
} else {
if (CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue() == mesPackageDb.getIsSealed()) {
MesPcnException.throwMesBusiException("箱条码【%s】状态不为已关箱不需要拆箱", mesPackage.getPackageNo());
MesPcnException.throwMesBusiException("箱条码【%s】状态不为已关箱不需要拆箱,请检查数据!", mesPackage.getPackageNo());
}
//拆箱
unboxing(mesPackage, userName, mesPackageDb);
@ -203,17 +204,17 @@ public class MesBoxingErrorProofingService implements IMesBoxingErrorProofingSer
//查询包装条码信息
MesPackage mesPackageDb = getMesPackageAndCheck(mesPackageDetail.getPackageNo(), mesPackageDetail.getOrganizeCode());
if (CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue() == mesPackageDb.getIsSealed()) {
MesPcnException.throwMesBusiException("箱条码【%s】不为已关箱状态不允许操作替换条码", mesPackageDetail.getPackageNo());
MesPcnException.throwMesBusiException("箱条码【%s】不为已关箱状态不允许操作替换条码,请检查数据!", mesPackageDetail.getPackageNo());
}
//校验是否重复扫描
List<MesPackageDetail> mesPackageDetails = getMesPackageDetailList(mesPackageDetail);
//校验条码是否符合规则
MesPart mesPart = getMesPart(mesPackageDetail, mesPackageDb);
MesPart mesPart = getMesPart(mesPackageDetail, mesPackageDb, null);
boolean exist = false;
for (MesPackageDetail packageDetail : mesPackageDetails) {
//替换条码是否已经存在
if (packageDetail.getSerialNumber().equals(mesPackageDetail.getSerialNumber())) {
MesPcnException.throwMesBusiException("零件条码【%s】已存在存在", mesPackageDetail.getSerialNumber());
MesPcnException.throwMesBusiException("零件条码【%s】已存在存在,请检查数据!", mesPackageDetail.getSerialNumber());
}
//替换条码
if (packageDetail.getSerialNumber().equals(mesPackageDetail.getOldSerialNumber())) {
@ -226,7 +227,7 @@ public class MesBoxingErrorProofingService implements IMesBoxingErrorProofingSer
}
}
if(!exist){
MesPcnException.throwMesBusiException("原零件条码【%s】不存在", mesPackageDetail.getOldSerialNumber());
MesPcnException.throwMesBusiException("原零件条码【%s】不存在,请检查数据!", mesPackageDetail.getOldSerialNumber());
}
mesPackageDetailRDao.saveAll(mesPackageDetails);
}
@ -238,7 +239,7 @@ public class MesBoxingErrorProofingService implements IMesBoxingErrorProofingSer
DdlPreparedPack.getInPackArray(serialNumberList, "serialNumber", ddlPackBean);
List<MesPackageDetail> mesPackageDetails = mesPackageDetailRDao.findByHqlWhere(ddlPackBean);
if (CollectionUtils.isEmpty(mesPackageDetails)) {
MesPcnException.throwMesBusiException("零件条码【%s】不存在", mesPackageDetail.getOldSerialNumber());
MesPcnException.throwMesBusiException("零件条码【%s】不存在,请检查数据!", mesPackageDetail.getOldSerialNumber());
}
return mesPackageDetails;
}
@ -247,11 +248,11 @@ public class MesBoxingErrorProofingService implements IMesBoxingErrorProofingSer
public void unLock(String organizeCode, String pwd) {
String cfgValue = configService.getCfgValue(organizeCode, MesCommonConstant.BOXING_ERROR_PROOFING_PWD);
if (!Objects.equals(cfgValue, pwd)) {
MesPcnException.throwMesBusiException("解锁失败密码错误");
MesPcnException.throwMesBusiException("解锁失败密码错误,请检查数据!");
}
}
private MesPart getMesPart(MesPackageDetail mesPackageDetail, MesPackage mesPackage) {
private MesPart getMesPart(MesPackageDetail mesPackageDetail, MesPackage mesPackage, MesPackingDefine packingDefine) {
//校验是否重复扫描
checkSerialNumber(mesPackageDetail);
//获取包装定义明细
@ -259,7 +260,7 @@ public class MesBoxingErrorProofingService implements IMesBoxingErrorProofingSer
//校验是否包含
String partNo = getPartNo(mesPackageDetail, mesPackage, defineDetails);
//校验条码信息
checkSnStatus(mesPackageDetail);
checkSn(mesPackageDetail, packingDefine);
//物料信息
return getPart(mesPackageDetail.getOrganizeCode(), partNo);
}
@ -269,7 +270,7 @@ public class MesBoxingErrorProofingService implements IMesBoxingErrorProofingSer
DdlPreparedPack.getStringEqualPack(mesPackageDetail.getPackageNo(), "packageNo", ddlPackBean);
DdlPreparedPack.getStringEqualPack(mesPackageDetail.getSerialNumber(), "serialNumber", ddlPackBean);
if (mesPackageDetailRDao.isExitByHql(ddlPackBean)) {
MesPcnException.throwMesBusiException("零件条码【%s】已存在该箱不允许重复扫描", mesPackageDetail.getSerialNumber());
MesPcnException.throwMesBusiException("零件条码【%s】已存在该箱不允许重复扫描,请检查数据!", mesPackageDetail.getSerialNumber());
}
}
@ -278,7 +279,7 @@ public class MesBoxingErrorProofingService implements IMesBoxingErrorProofingSer
DdlPreparedPack.getStringEqualPack(packCode, "packCode", ddlPackBean);
List<MesPackingDefineDetails> defineDetails = mesPackingDefineDetailsRDao.findByHqlWhere(ddlPackBean);
if (CollectionUtils.isEmpty(defineDetails)) {
MesPcnException.throwMesBusiException("箱类别代号【%s】包装定义明细未维护", packCode);
MesPcnException.throwMesBusiException("箱类别代号【%s】包装定义明细未维护,请检查数据!", packCode);
}
return defineDetails;
}
@ -302,7 +303,7 @@ public class MesBoxingErrorProofingService implements IMesBoxingErrorProofingSer
private MesPackage getMesPackageAndCheck(String packageNo, String organizeCode) {
MesPackage mesPackageDb = getMesPackage(organizeCode, packageNo);
if (Objects.isNull(mesPackageDb)) {
MesPcnException.throwMesBusiException("箱条码【%s】信息不存在", packageNo);
MesPcnException.throwMesBusiException("箱条码【%s】信息不存在,请检查数据!", packageNo);
}
return mesPackageDb;
}
@ -367,12 +368,28 @@ public class MesBoxingErrorProofingService implements IMesBoxingErrorProofingSer
return saveMesPackageDetail;
}
private void checkSnStatus(MesPackageDetail mesPackageDetail) {
private void checkSn(MesPackageDetail mesPackageDetail, MesPackingDefine packingDefine) {
List<MesProduceSn> produceSnList = mesProduceSnExtService.getProduceSnList(mesPackageDetail.getOrganizeCode(), mesPackageDetail.getSerialNumber());
if (!CollectionUtils.isEmpty(produceSnList)) {
MesProduceSn nextMesProduceSn = produceSnList.stream().sorted(Comparator.comparing(MesProduceSn::getCreateDatetime).reversed()).collect(Collectors.toList()).iterator().next();
if (!MesExtEnumUtil.PRODUCE_SN_STATUS.checkAllowBoxingErrorProofing(nextMesProduceSn.getSnStatus()) || !MesExtEnumUtil.PRODUCE_QC_STATUS.checkAllowBoxingErrorProofing(nextMesProduceSn.getQcStatus())) {
MesPcnException.throwMesBusiException("条码【%s】状态【%s】质量状态【%s】不允许操作装箱防错", mesPackageDetail.getSerialNumber(), MesExtEnumUtil.PRODUCE_SN_STATUS.valueOfDescription(nextMesProduceSn.getSnStatus()), MesExtEnumUtil.PRODUCE_QC_STATUS.valueOfDescription(nextMesProduceSn.getQcStatus()));
MesPcnException.throwMesBusiException("条码【%s】状态【%s】质量状态【%s】不允许操作装箱防错请检查数据", mesPackageDetail.getSerialNumber(), MesExtEnumUtil.PRODUCE_SN_STATUS.valueOfDescription(nextMesProduceSn.getSnStatus()), MesExtEnumUtil.PRODUCE_QC_STATUS.valueOfDescription(nextMesProduceSn.getQcStatus()));
}
}
//查询加工记录
List<MesProductionRecord> productionRecordList = mesProductionRecordService.findProductionRecordList(mesPackageDetail.getOrganizeCode(), mesPackageDetail.getSerialNumber());
//工艺校验
if(!Objects.isNull(packingDefine) && !Objects.isNull(packingDefine.getCheckCraftFlag()) && CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue() == packingDefine.getCheckCraftFlag()){
if(CollectionUtils.isEmpty(productionRecordList)){
MesPcnException.throwMesBusiException("条码【%s】校验装箱防错对应工艺失败加工记录信息不存在请检查数据", mesPackageDetail.getSerialNumber());
}
if(StringUtils.isEmpty(packingDefine.getCraft())){
MesPcnException.throwMesBusiException("条码【%s】校验装箱防错对应工艺为空请检查数据", mesPackageDetail.getSerialNumber());
}
//校验条码是否经过该工艺
Optional<MesProductionRecord> productionRecordOptional = productionRecordList.stream().filter(t -> !StringUtils.isEmpty(t.getCraftCode()) && packingDefine.getCraft().equals(t.getCraftCode())).findFirst();
if(!productionRecordOptional.isPresent()){
MesPcnException.throwMesBusiException("条码【%s】校验装箱防错对应工艺【%s】失败请检查数据", mesPackageDetail.getSerialNumber(),packingDefine.getCraft());
}
}
}
@ -383,7 +400,7 @@ public class MesBoxingErrorProofingService implements IMesBoxingErrorProofingSer
for (MesPackingDefineDetails defineDetail : defineDetails) {
//条码规则为空
if (StringUtils.isEmpty(defineDetail.getPackageBarcodeRule())) {
MesPcnException.throwMesBusiException("箱类别代号【%s】零件号【%s】条码规则未维护", mesPackage.getPackageSn(), defineDetail.getPartNo());
MesPcnException.throwMesBusiException("箱类别代号【%s】零件号【%s】条码规则未维护,请检查数据!", mesPackage.getPackageSn(), defineDetail.getPartNo());
}
packageBarcodeRule = defineDetail.getPackageBarcodeRule().replace("*", "");
//包含箱条码
@ -393,24 +410,24 @@ public class MesBoxingErrorProofingService implements IMesBoxingErrorProofingSer
}
}
if (Objects.isNull(partNo)) {
MesPcnException.throwMesBusiException("零件条码【%s】未匹配到符合条码规则的数据", mesPackageDetail.getSerialNumber());
MesPcnException.throwMesBusiException("零件条码【%s】未匹配到符合条码规则的数据,请检查数据!", mesPackageDetail.getSerialNumber());
}
return partNo;
}
private void checkNotNull(MesPackageDetail mesPackageDetail) {
if (StringUtils.isEmpty(mesPackageDetail.getPackageNo())) {
MesPcnException.throwMesBusiException("包装编码不能为空");
MesPcnException.throwMesBusiException("包装编码不能为空,请检查数据!");
}
if (StringUtils.isEmpty(mesPackageDetail.getScanType())) {
MesPcnException.throwMesBusiException("客户条码规则不能为空");
MesPcnException.throwMesBusiException("客户条码规则不能为空,请检查数据!");
}
}
private void checkSerial(MesPackingDefine packingDefine, String[] split) {
if (StringUtils.isEmpty(packingDefine.getSerialIdIndex()) || packingDefine.getSerialIdIndex() > split.length
|| StringUtils.isEmpty(split[packingDefine.getSerialIdIndex() - 1])) {
MesPcnException.throwMesBusiException("序列号所在位置不存在");
MesPcnException.throwMesBusiException("序列号所在位置不存在,请检查数据!");
}
String serialNo = split[packingDefine.getSerialIdIndex() - 1];
}
@ -418,18 +435,18 @@ public class MesBoxingErrorProofingService implements IMesBoxingErrorProofingSer
private void checkOrganizeCode(MesPackageDetail mesPackageDetail, MesPackingDefine packingDefine, String[] split) {
if (StringUtils.isEmpty(packingDefine.getOrganizeIndex()) || packingDefine.getOrganizeIndex() > split.length
|| StringUtils.isEmpty(split[packingDefine.getOrganizeIndex() - 1])) {
MesPcnException.throwMesBusiException("工厂所在位置不存在");
MesPcnException.throwMesBusiException("工厂所在位置不存在,请检查数据!");
}
String organizeCode = split[packingDefine.getOrganizeIndex() - 1];
if (!Objects.equals(organizeCode, mesPackageDetail.getOrganizeCode())) {
MesPcnException.throwMesBusiException("箱条码工厂【%s】和当前工厂【%s】不匹配", organizeCode, mesPackageDetail.getOrganizeCode());
MesPcnException.throwMesBusiException("箱条码工厂【%s】和当前工厂【%s】不匹配,请检查数据!", organizeCode, mesPackageDetail.getOrganizeCode());
}
}
private MesPart getMesPart(MesPackageDetail mesPackageDetail, MesPackingDefine packingDefine, String[] split) {
if (StringUtils.isEmpty(packingDefine.getPartNoIndex()) || packingDefine.getPartNoIndex() > split.length
|| StringUtils.isEmpty(split[packingDefine.getPartNoIndex() - 1])) {
MesPcnException.throwMesBusiException("物料号所在位置不存在");
MesPcnException.throwMesBusiException("物料号所在位置不存在,请检查数据!");
}
return getPart(mesPackageDetail.getOrganizeCode(), split[packingDefine.getPartNoIndex() - 1]);
}
@ -439,7 +456,7 @@ public class MesBoxingErrorProofingService implements IMesBoxingErrorProofingSer
DdlPreparedPack.getStringEqualPack(partNo, "partNo", packBean);
MesPart mesPart = partRDao.getByProperty(packBean);
if (Objects.isNull(mesPart)) {
MesPcnException.throwMesBusiException("物料【%s】信息不存在", partNo);
MesPcnException.throwMesBusiException("物料【%s】信息不存在,请检查数据!", partNo);
}
return mesPart;
}
@ -447,11 +464,11 @@ public class MesBoxingErrorProofingService implements IMesBoxingErrorProofingSer
private Double getQty(MesPackingDefine packingDefine, String[] split) {
if (StringUtils.isEmpty(packingDefine.getQtyIndex()) || packingDefine.getQtyIndex() > split.length
|| StringUtils.isEmpty(split[packingDefine.getQtyIndex() - 1])) {
MesPcnException.throwMesBusiException("数量所在位置不存在");
MesPcnException.throwMesBusiException("数量所在位置不存在,请检查数据!");
}
//校验是否数字
if (!CheckTool.isNumber(split[packingDefine.getQtyIndex() - 1])) {
MesPcnException.throwMesBusiException("数量所在位置不为数字类型");
MesPcnException.throwMesBusiException("数量所在位置不为数字类型,请检查数据!");
}
return Double.parseDouble(split[packingDefine.getQtyIndex() - 1]);
}
@ -490,7 +507,7 @@ public class MesBoxingErrorProofingService implements IMesBoxingErrorProofingSer
DdlPreparedPack.getStringEqualPack(mesPackageDetail.getScanType(), "scanType", packBean);
MesPackingDefine packingDefine = mesPackingDefineRDao.getByProperty(packBean);
if (Objects.isNull(packingDefine)) {
MesPcnException.throwFlowException("客户条码规则在包装定义界面未维护");
MesPcnException.throwFlowException("客户条码规则在包装定义界面未维护,请检查数据!");
}
return packingDefine;
}

@ -1,6 +1,7 @@
package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.station;
import cn.estsh.i3plus.ext.mes.pcn.api.base.IMesProdShiftRecordService;
import cn.estsh.i3plus.ext.mes.pcn.api.base.IMesShiftService;
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;
@ -32,10 +33,7 @@ import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.StringJoiner;
import java.util.*;
/**
* @Description :
@ -63,6 +61,9 @@ public class MesProductionNoSortModuleService extends BaseModuleService {
@Autowired
private MesFileRepository mesFileRepository;
@Autowired
private IMesShiftService mesShiftService;
@Override
public void init(StationRequestBean reqBean) {
// 获取工单信息
@ -82,7 +83,6 @@ public class MesProductionNoSortModuleService extends BaseModuleService {
this.sendMessage(reqBean, new StationResultBean().writeDbLog(), "请先开班!", MesPcnEnumUtil.STATION_BUSI_TYPE.MESSAGE, MesPcnEnumUtil.STATION_DATA_TYPE.TEXT);
MesPcnException.throwBusiException("请先开班!");
}
// 发送班次班组和工单
StationResultBean resultBean = getStationResultBean(reqBean, moduleContentContext, prodShiftDataContext);
this.sendMessage(reqBean, resultBean);
@ -108,7 +108,6 @@ public class MesProductionNoSortModuleService extends BaseModuleService {
((IStepService) SpringContextsUtil.getBean("mesEquipByPassReadStepService")).executeInState(reqBean);
}
private List<StationKvBean> getShiftRecordStationKvBeans(StationRequestBean reqBean) {
// 获取班次信息 redis
List<StationKvBean> prodShiftDataContext = productionCustomContextStepService.getProdShiftDataContext(reqBean.getOrganizeCode(), reqBean.getWorkCenterCode());
@ -208,11 +207,18 @@ public class MesProductionNoSortModuleService extends BaseModuleService {
//封装展示组件班组班次内容
private List<StationKvBean> getProdShiftData(MesProdShiftRecord record) {
return StationKvBeanUtil.addStationKvBeanList(new ArrayList<>(),
List<StationKvBean> stationKvBeans = StationKvBeanUtil.addStationKvBeanList(new ArrayList<>(),
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()));
//班次开始时间 ,班次结束时间
Map<String, String> shiftTimeMap = mesShiftService.getShiftTimeMap(record);
if (!java.util.Objects.isNull(shiftTimeMap)) {
StationKvBeanUtil.addStationKvBeanList(stationKvBeans,
new StationKvBean(MesPcnExtConstWords.START_TIME,"开始时间",shiftTimeMap.get(MesPcnExtConstWords.START_TIME)),
new StationKvBean(MesPcnExtConstWords.END_TIME,"结束时间",shiftTimeMap.get(MesPcnExtConstWords.END_TIME)));
}
return stationKvBeans;
}
}

Loading…
Cancel
Save