修复上料问题

uat-temp-nht-2506120000-jialiao
jason 4 weeks ago
parent 42ef11c53c
commit 13ea542a77

@ -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;

@ -14,6 +14,9 @@ import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.Map;
/**
*
*/
@Slf4j
@Component
public class MesContainerBindCooperationPartService extends MesAbstractContainerBindDispatchService {

@ -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 {

Loading…
Cancel
Save