Merge remote-tracking branch 'origin/uat-temp-nht-2506120000-jialiao' into mes-uat-changshu0609-temp-wj-250616-xisu-merge-nht

mes-uat-changshu0609-temp-wj-250616-xisu
王杰 4 weeks ago
commit 6846c57bbc

@ -75,13 +75,13 @@ public class MesContainerSnStationServiceImpl implements IMesContainerSnStationS
Query countQuery = entityManager.createNativeQuery(countQueryHql.append(hql).toString());
packContainerSnStation(mesContainerSnStation.getOrganizeCode(), mesContainerSnStation, countQuery);
//本次查询满足条件的总数
int count = countQuery.getResultList().size();
int count = Integer.parseInt(String.valueOf(countQuery.getSingleResult()));
if (count <= 0) {
return new ListPager<>(new ArrayList<>(), pager);
}
StringBuilder dataQueryHql = new StringBuilder();
dataQueryHql.append("select DISTINCT mss.top_container_sn as containerSn, mss.station as station, mss.seq as seq");
dataQueryHql.append("select DISTINCT mss.top_container_sn as containerSn, mss.station as station, mss.seq as seq, mss.id as id");
Query dataQuery = entityManager.createNativeQuery(dataQueryHql.append(hql).toString());
packContainerSnStation(mesContainerSnStation.getOrganizeCode(), mesContainerSnStation, dataQuery);
@ -97,6 +97,7 @@ public class MesContainerSnStationServiceImpl implements IMesContainerSnStationS
snStation.setContainerSn(StringUtils.isEmpty(cells[0]) ? "" : cells[0].toString());
snStation.setStation(StringUtils.isEmpty(cells[1]) ? "" : cells[1].toString());
snStation.setSeq(StringUtils.isEmpty(cells[2]) ? 0 : Integer.parseInt(cells[2].toString()));
snStation.setId(StringUtils.isEmpty(cells[3]) ? 0 : Long.parseLong(cells[3].toString()));
modelList.add(snStation);
}

@ -344,11 +344,17 @@ public class MesContainerSnBindServiceImpl implements IMesContainerSnBindService
new String[]{MesPcnExtConstWords.ORGANIZE_CODE, MesPcnExtConstWords.IS_DELETED, MesPcnExtConstWords.IS_VALID, "containerSn"},
new Object[]{organizeCode, CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), containerSn.getContainerSn()});
}
for (MesContainerPackageDetail packageDetail : packageDetails) {
if (Objects.equals(packageDetail.getBarCode(), model.getBarCode())) {
MesPcnException.throwMesBusiException("容器条码【%s】与条码【%s】已绑定请检查数据", containerSn.getContainerSn(), model.getBarCode());
}
MesContainerPackageDetail barcodePackageDetail = containerPackageDetailRDao.getByProperty(new String[]{MesPcnExtConstWords.ORGANIZE_CODE, MesPcnExtConstWords.IS_DELETED, MesPcnExtConstWords.IS_VALID, "barCode"},
new Object[]{organizeCode, CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), model.getBarCode()});
if (barcodePackageDetail != null) {
MesPcnException.throwMesBusiException("条码【%s】已被容器【%s】绑定请检查数据", model.getBarCode(), barcodePackageDetail.getContainerSn());
}
// for (MesContainerPackageDetail packageDetail : packageDetails) {
// if (Objects.equals(packageDetail.getBarCode(), model.getBarCode())) {
// MesPcnException.throwMesBusiException("容器条码【%s】与条码【%s】已绑定请检查数据", containerSn.getContainerSn(), model.getBarCode());
// }
// }
List<MesContainerPackageDetail> oldPackageDetails = new ArrayList<>();
getBottomPackageDetails(organizeCode, containerSn.getContainerSn(), oldPackageDetails);
@ -357,17 +363,15 @@ public class MesContainerSnBindServiceImpl implements IMesContainerSnBindService
MesContainerSn childContainerSn = containerSnService.getContainerSn(organizeCode, model.getBarCode());
if (childContainerSn != null) {
if (!Objects.equals(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue(), containerType.getIsAllowRecursion())) {
MesPcnException.throwBusiException("扫描的容器条码:%s不允许绑定容器", containerSn.getContainerSn());
MesPcnException.throwBusiException("容器条码【%s】不能绑定容器请重新扫描", containerSn.getContainerSn());
}
bottomPackageDetails = checkContainerBarcode(organizeCode, model.getBarCode(), oldPackageDetails);
} else {
if (Objects.equals(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue(), containerType.getIsAllowRecursion())) {
MesPcnException.throwBusiException("容器条码【%s】不能零件条码请重新扫描", containerSn.getContainerSn());
}
bottomPackageDetails = new ArrayList<>();
}
// MesContainerSnBindModel containerResult = packageContainerSnService.packageContain(organizeCode, model.getUserName(), model.getContainerSn(), model.getBarCode());
// if (containerResult != null) {
// return containerResult;
// }
String barcode = model.getBarCode();
if (!CollectionUtils.isEmpty(bottomPackageDetails)) {
barcode = bottomPackageDetails.get(0).getBarCode();
@ -523,6 +527,11 @@ public class MesContainerSnBindServiceImpl implements IMesContainerSnBindService
if (!Objects.equals(containerPackage.getPackageStatus(), MesExtEnumUtil.CONTAINER_PACKAGE_STATUS.STATUS_20.getValue())) {
MesPcnException.throwMesBusiException("容器条码【%s】未关箱不能执行开箱操作", containerSn.getContainerSn());
}
MesContainerPackageDetail packageDetail = containerPackageDetailRDao.getByProperty(new String[]{MesPcnExtConstWords.ORGANIZE_CODE, MesPcnExtConstWords.IS_DELETED, MesPcnExtConstWords.IS_VALID, "barCode"},
new Object[]{model.getOrganizeCode(), CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), containerSn.getContainerSn()});
if (packageDetail != null) {
MesPcnException.throwMesBusiException("容器条码【%s】已被容器【%s】绑定请先解绑再执行开箱操作", containerSn.getContainerSn(), packageDetail.getContainerSn());
}
containerPackage.setPackageStatus(MesExtEnumUtil.CONTAINER_PACKAGE_STATUS.STATUS_10.getValue());
ConvertBean.serviceModelUpdate(containerPackage, model.getUserName());
@ -551,7 +560,7 @@ public class MesContainerSnBindServiceImpl implements IMesContainerSnBindService
MesPcnException.throwMesBusiException("容器条码【%s】或容器类型代码【%s】未维护与零件关系请检查数据", containerSn.getContainerSn(), containerSn.getContainerTypeCode());
}
if (!StringUtils.isEmpty(selectPartNo) && !Objects.equals(selectPartNo, model.getPartNo())) {
MesPcnException.throwMesBusiException("条码【%s】的零件号【%s】与选择的零件不匹配请检查数据", barCode, produceSn.getPartNo());
MesPcnException.throwMesBusiException("条码【%s】的零件号【%s】与选择的零件不匹配请检查数据", barCode, model.getPartNo());
}
return model;

@ -7,16 +7,23 @@ import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords;
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
import cn.estsh.i3plus.pojo.mes.bean.MesContainerSnPart;
import cn.estsh.i3plus.pojo.mes.bean.MesContainerTypePart;
import cn.estsh.i3plus.pojo.mes.bean.MesRawSnWeightRecord;
import cn.estsh.i3plus.pojo.mes.repository.MesContainerSnPartRepository;
import cn.estsh.i3plus.pojo.mes.repository.MesContainerTypePartRepository;
import cn.estsh.i3plus.pojo.mes.repository.MesRawSnWeightRecordRepository;
import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil;
import org.springframework.beans.factory.annotation.Autowired;
/**
* @author jason
*/
public class MesAbstractContainerBindDispatchService implements IMesContainerBindDispatchService {
@Autowired
protected MesContainerSnPartRepository containerSnPartRDao;
@Autowired
protected MesContainerTypePartRepository containerTypePartRDao;
@Autowired
protected MesRawSnWeightRecordRepository rawSnWeightRecordRDao;
protected MesAbstractContainerBindDispatchService(MesExtEnumUtil.CONTAINER_TYPE containerType, MesExtEnumUtil.CONTAINER_PART_MATCH_TYPE matchType) {
ContainerBindManager.INSTANCE.register(containerType, matchType, this);
@ -55,4 +62,17 @@ public class MesAbstractContainerBindDispatchService implements IMesContainerBin
}
return model;
}
protected Double getRawSnWeightQty(String organizeCode, String barcode) {
MesRawSnWeightRecord weightRecord = rawSnWeightRecordRDao.getByProperty(
new String[]{MesPcnExtConstWords.ORGANIZE_CODE, MesPcnExtConstWords.IS_DELETED, MesPcnExtConstWords.IS_VALID, "barCode"},
new Object[]{organizeCode, CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), barcode});
if (weightRecord == null) {
MesPcnException.throwMesBusiException("调配器条码【%s】不存在于原料重量记录表请检查数据", barcode);
}
if (weightRecord.getNetWeight() == null) {
MesPcnException.throwMesBusiException("调配器条码【%s】在原料重量记录表中的数量不能为空请检查数据", barcode);
}
return weightRecord.getNetWeight();
}
}

@ -13,7 +13,11 @@ import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
/**
*
*/
@Slf4j
@Component
public class MesContainerBindCooperationPartService extends MesAbstractContainerBindDispatchService {
@ -37,6 +41,10 @@ public class MesContainerBindCooperationPartService extends MesAbstractContainer
}
result.put(MesPcnExtConstWords.DATA_TYPE, MesExtEnumUtil.CONTAINER_BARCODE_DATA_TYPE.STATUS_10.getValue());
if (Objects.equals(model.getContainerType(), MesExtEnumUtil.CONTAINER_TYPE.CONTAINER_TYPE_50.getValue())) {
Double netWeight = getRawSnWeightQty(organizeCode, barcode);
result.put(MesPcnExtConstWords.QTY, netWeight);
}
return result;
}
}

@ -10,12 +10,16 @@ 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.StringUtils;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
// YFWHU|YFNSC901C241223042722|C901|401007574AAABN|9.0|EA|C901|20241223|
/**
*
* YFWHU|YFNSC901C241223042722|C901|401007574AAABN|9.0|EA|C901|20241223|
*/
@Slf4j
@Component
public class MesContainerBindPackageSnService extends MesAbstractContainerBindDispatchService {
@ -56,8 +60,16 @@ public class MesContainerBindPackageSnService extends MesAbstractContainerBindDi
!Objects.equals(produceSn.getQcStatus(), MesExtEnumUtil.PRODUCE_QC_STATUS.SUSPICIOUS_TO_QUALIFIED.getValue())) {
MesPcnException.throwMesBusiException("扫描条码【%s】的质量状态必须为“合格”或“可疑转正常”, 请检查数据!", barcode);
}
result.put(MesPcnExtConstWords.DATA_TYPE, MesExtEnumUtil.CONTAINER_BARCODE_DATA_TYPE.STATUS_10.getValue());
String barQty = splitBarcode[4];
if (StringUtils.isEmpty(barQty)) {
MesPcnException.throwMesBusiException("自制件箱码【%s】的数量为空, 请检查数据!", barcode);
}
try {
result.put(MesPcnExtConstWords.QTY, Double.valueOf(barQty));
} catch (NumberFormatException e) {
MesPcnException.throwMesBusiException("自制件箱码【%s】的数量【%s】格式错误, 请检查数据!", barcode, barQty);
}
result.put(MesPcnExtConstWords.DATA_TYPE, MesExtEnumUtil.CONTAINER_BARCODE_DATA_TYPE.STATUS_20.getValue());
return result;
}

@ -16,6 +16,9 @@ import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
/**
*
*/
@Slf4j
@Component
public class MesContainerBindProductSnService extends MesAbstractContainerBindDispatchService {
@ -49,6 +52,10 @@ public class MesContainerBindProductSnService extends MesAbstractContainerBindDi
}
result.put(MesPcnExtConstWords.DATA_TYPE, MesExtEnumUtil.CONTAINER_BARCODE_DATA_TYPE.STATUS_10.getValue());
if (Objects.equals(model.getContainerType(), MesExtEnumUtil.CONTAINER_TYPE.CONTAINER_TYPE_50.getValue())) {
Double netWeight = getRawSnWeightQty(organizeCode, barcode);
result.put(MesPcnExtConstWords.QTY, netWeight);
}
return result;
}
}

Loading…
Cancel
Save