|
|
@ -121,9 +121,7 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService
|
|
|
|
// 生成成品条码
|
|
|
|
// 生成成品条码
|
|
|
|
else if (mesBaseBarcodeInfo.getBarcodeType().equals(MesConstants.MES_BARCODE_TYPE_PRODUCT)) {
|
|
|
|
else if (mesBaseBarcodeInfo.getBarcodeType().equals(MesConstants.MES_BARCODE_TYPE_PRODUCT)) {
|
|
|
|
generateProductBarcode(mesBaseBarcodeInfo);
|
|
|
|
generateProductBarcode(mesBaseBarcodeInfo);
|
|
|
|
}
|
|
|
|
} else {//生成背板条码或者门板条码
|
|
|
|
|
|
|
|
|
|
|
|
else{//生成背板条码或者门板条码
|
|
|
|
|
|
|
|
generateBackOrDoorBarcode(mesBaseBarcodeInfo);
|
|
|
|
generateBackOrDoorBarcode(mesBaseBarcodeInfo);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -197,6 +195,7 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 无采购订单生成条码信息
|
|
|
|
* 无采购订单生成条码信息
|
|
|
|
|
|
|
|
*
|
|
|
|
* @param mesBaseBarcodeInfo
|
|
|
|
* @param mesBaseBarcodeInfo
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
@ -213,16 +212,18 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService
|
|
|
|
// 生成数量条的不同条码内容
|
|
|
|
// 生成数量条的不同条码内容
|
|
|
|
toInsertedBarcodeInfo = getInsertedBarcodeInfo(mesBaseBarcodeInfo, batchCode, userName, currentDate);
|
|
|
|
toInsertedBarcodeInfo = getInsertedBarcodeInfo(mesBaseBarcodeInfo, batchCode, userName, currentDate);
|
|
|
|
toInsertedBarcodeInfo.setSafeFlag(MesConstants.MES_ORDER_BIND_SAFE_FLAG_YES);
|
|
|
|
toInsertedBarcodeInfo.setSafeFlag(MesConstants.MES_ORDER_BIND_SAFE_FLAG_YES);
|
|
|
|
|
|
|
|
toInsertedBarcodeInfo.setSaleOrderId(0L);
|
|
|
|
toInsertedBarcodeInfos.add(toInsertedBarcodeInfo);
|
|
|
|
toInsertedBarcodeInfos.add(toInsertedBarcodeInfo);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return mesBaseBarcodeInfoMapper.batchMesBaseBarcodeInfo(toInsertedBarcodeInfos);
|
|
|
|
return mesBaseBarcodeInfoMapper.batchMesBaseBarcodeInfo(toInsertedBarcodeInfos);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 生成固定条码信息
|
|
|
|
* 生成固定条码信息
|
|
|
|
|
|
|
|
*
|
|
|
|
* @param mesBaseBarcodeInfo
|
|
|
|
* @param mesBaseBarcodeInfo
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
@ -246,30 +247,78 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void generateProductBarcode(MesBaseBarcodeInfo mesBaseBarcodeInfo) {
|
|
|
|
public void generateProductBarcode(MesBaseBarcodeInfo mesBaseBarcodeInfo) {
|
|
|
|
String planCode = mesBaseBarcodeInfo.getPlanCode();
|
|
|
|
String planCode;
|
|
|
|
String planDetailCode = mesBaseBarcodeInfo.getPlanDetailCode();
|
|
|
|
String planDetailCode;
|
|
|
|
|
|
|
|
Long saleOrderId;
|
|
|
|
|
|
|
|
String saleOrderCode;
|
|
|
|
|
|
|
|
Long materialId;
|
|
|
|
|
|
|
|
if (mesBaseBarcodeInfo.getSingleFlag().equals(MesConstants.MES_BARCODE_SINGLE_FLAG_YES)) {
|
|
|
|
|
|
|
|
String rawMaterialBarcode = mesBaseBarcodeInfo.getProductBarcode();
|
|
|
|
|
|
|
|
MesBaseBarcodeInfo rawBarcode = mesBaseBarcodeInfoMapper.selectMesBaseBarcodeInfoByBarcodeInfo(rawMaterialBarcode);
|
|
|
|
|
|
|
|
if (rawBarcode == null) {
|
|
|
|
|
|
|
|
throw new ServiceException("原材料条码有误");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
MesBaseBarcodeInfo queryBarcodeInfo = new MesBaseBarcodeInfo();
|
|
|
|
if (!rawBarcode.getBarcodeType().equals(MesConstants.MES_BARCODE_TYPE_RAW)) {
|
|
|
|
queryBarcodeInfo.setPlanDetailCode(planDetailCode);
|
|
|
|
throw new ServiceException("此条码为非原材料条码,不能生成成品条码");
|
|
|
|
List<MesBaseBarcodeInfo> mesBaseBarcodeInfos = mesBaseBarcodeInfoMapper.selectMesBaseBarcodeInfoList(queryBarcodeInfo);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (mesBaseBarcodeInfos != null && !mesBaseBarcodeInfos.isEmpty()) {
|
|
|
|
MesBaseBarcodeInfo bindBarcode = mesBaseBarcodeInfoMapper.selectMesBaseBarcodeInfoByBindBarcode(rawMaterialBarcode);
|
|
|
|
throw new ServiceException("此生产明细已经生成条码,不能重复生成");
|
|
|
|
if (bindBarcode == null) {
|
|
|
|
}
|
|
|
|
throw new ServiceException("此原材料条码没有绑定背板或门板");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
MesProductPlanDetail mesProductPlanDetail = mesProductPlanDetailMapper.selectMesProductPlanDetailByPlanDetailCode(planDetailCode);
|
|
|
|
MesBaseBarcodeInfo productBarcodeInfo = mesBaseBarcodeInfoMapper.selectMesBaseBarcodeInfoByProductBarcode(rawMaterialBarcode);
|
|
|
|
if (mesProductPlanDetail == null) {
|
|
|
|
if (productBarcodeInfo != null) {
|
|
|
|
throw new ServiceException("此生产明细不存在");
|
|
|
|
throw new ServiceException("此原材料条码已经生成过成品条码,不能重复生成");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!mesProductPlanDetail.getPlanDetailStatus().equals(MesConstants.MES_PRODUCT_PLAN_DETAIL_STATUS_FINISH) &&
|
|
|
|
planCode = bindBarcode.getPlanCode();
|
|
|
|
!mesProductPlanDetail.getPlanDetailStatus().equals(MesConstants.MES_PRODUCT_PLAN_DETAIL_STATUS_ABNORMAL_FINISH)) {
|
|
|
|
planDetailCode = bindBarcode.getPlanDetailCode();
|
|
|
|
throw new ServiceException("此生产明细还未完成,不能打印条码");
|
|
|
|
saleOrderId = bindBarcode.getSaleOrderId();
|
|
|
|
}
|
|
|
|
saleOrderCode = bindBarcode.getSaleorderCode();
|
|
|
|
|
|
|
|
materialId = rawBarcode.getMaterialId();
|
|
|
|
|
|
|
|
|
|
|
|
MesProductPlan productPlan = mesProductPlanMapper.selectOnlyMesProductPlanByPlanCode(planCode);
|
|
|
|
if (StringUtils.isEmpty(planCode) || StringUtils.isEmpty(planDetailCode)) {
|
|
|
|
if (productPlan == null) {
|
|
|
|
throw new ServiceException("绑定的门板或背板条码有误");
|
|
|
|
throw new ServiceException("此生产派工不存在");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (StringUtils.isEmpty(rawBarcode.getPalletInfoCode())) {
|
|
|
|
|
|
|
|
throw new ServiceException("此条码有误,未绑定托盘信息");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mesBaseBarcodeInfo.setPalletInfoCode(rawBarcode.getPalletInfoCode());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
planCode = mesBaseBarcodeInfo.getPlanCode();
|
|
|
|
|
|
|
|
planDetailCode = mesBaseBarcodeInfo.getPlanDetailCode();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MesBaseBarcodeInfo queryBarcodeInfo = new MesBaseBarcodeInfo();
|
|
|
|
|
|
|
|
queryBarcodeInfo.setPlanDetailCode(planDetailCode);
|
|
|
|
|
|
|
|
List<MesBaseBarcodeInfo> mesBaseBarcodeInfos = mesBaseBarcodeInfoMapper.selectMesBaseBarcodeInfoList(queryBarcodeInfo);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (mesBaseBarcodeInfos != null && !mesBaseBarcodeInfos.isEmpty()) {
|
|
|
|
|
|
|
|
throw new ServiceException("此生产明细已经生成条码,不能重复生成");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MesProductPlanDetail mesProductPlanDetail = mesProductPlanDetailMapper.selectMesProductPlanDetailByPlanDetailCode(planDetailCode);
|
|
|
|
|
|
|
|
if (mesProductPlanDetail == null) {
|
|
|
|
|
|
|
|
throw new ServiceException("此生产明细不存在");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!mesProductPlanDetail.getPlanDetailStatus().equals(MesConstants.MES_PRODUCT_PLAN_DETAIL_STATUS_FINISH) &&
|
|
|
|
|
|
|
|
!mesProductPlanDetail.getPlanDetailStatus().equals(MesConstants.MES_PRODUCT_PLAN_DETAIL_STATUS_ABNORMAL_FINISH)) {
|
|
|
|
|
|
|
|
throw new ServiceException("此生产明细还未完成,不能打印条码");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MesProductPlan productPlan = mesProductPlanMapper.selectOnlyMesProductPlanByPlanCode(planCode);
|
|
|
|
|
|
|
|
if (productPlan == null) {
|
|
|
|
|
|
|
|
throw new ServiceException("此生产派工不存在");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
saleOrderId = productPlan.getSaleOrderId();
|
|
|
|
|
|
|
|
saleOrderCode = productPlan.getSaleorderCode();
|
|
|
|
|
|
|
|
materialId = productPlan.getMaterialId();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -278,17 +327,17 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService
|
|
|
|
mesBaseBarcodeInfo.setBatchCode(barcode);// 成品的批次代码 == 条码内容
|
|
|
|
mesBaseBarcodeInfo.setBatchCode(barcode);// 成品的批次代码 == 条码内容
|
|
|
|
mesBaseBarcodeInfo.setBarcodeInfo(barcode);
|
|
|
|
mesBaseBarcodeInfo.setBarcodeInfo(barcode);
|
|
|
|
mesBaseBarcodeInfo.setAmount(new BigDecimal(1));
|
|
|
|
mesBaseBarcodeInfo.setAmount(new BigDecimal(1));
|
|
|
|
|
|
|
|
|
|
|
|
mesBaseBarcodeInfo.setBatchFlag(MesConstants.NOT_IS_BATCH);
|
|
|
|
mesBaseBarcodeInfo.setBatchFlag(MesConstants.NOT_IS_BATCH);
|
|
|
|
mesBaseBarcodeInfo.setSafeFlag(MesConstants.MES_ORDER_BIND_SAFE_FLAG_YES);
|
|
|
|
mesBaseBarcodeInfo.setSafeFlag(saleOrderId.equals(0L) ? MesConstants.MES_ORDER_BIND_SAFE_FLAG_YES : MesConstants.MES_ORDER_BIND_SAFE_FLAG_NO);
|
|
|
|
|
|
|
|
mesBaseBarcodeInfo.setMaterialId(materialId);
|
|
|
|
mesBaseBarcodeInfo.setMaterialId(productPlan.getMaterialId());
|
|
|
|
|
|
|
|
mesBaseBarcodeInfo.setPrintFlag(MesConstants.MES_BARCODE_PRINT_FLAG_NO);
|
|
|
|
mesBaseBarcodeInfo.setPrintFlag(MesConstants.MES_BARCODE_PRINT_FLAG_NO);
|
|
|
|
mesBaseBarcodeInfo.setSaleOrderId(productPlan.getSaleOrderId());
|
|
|
|
mesBaseBarcodeInfo.setSaleOrderId(saleOrderId);
|
|
|
|
mesBaseBarcodeInfo.setSaleorderCode(productPlan.getSaleorderCode());
|
|
|
|
mesBaseBarcodeInfo.setSaleorderCode(saleOrderCode);
|
|
|
|
|
|
|
|
mesBaseBarcodeInfo.setPlanCode(planCode);
|
|
|
|
|
|
|
|
mesBaseBarcodeInfo.setPlanDetailCode(planDetailCode);
|
|
|
|
mesBaseBarcodeInfo.setCreateTime(currentDate);
|
|
|
|
mesBaseBarcodeInfo.setCreateTime(currentDate);
|
|
|
|
mesBaseBarcodeInfo.setCreateBy(SecurityUtils.getUsername());
|
|
|
|
mesBaseBarcodeInfo.setCreateBy(SecurityUtils.getUsername());
|
|
|
|
|
|
|
|
|
|
|
|
mesBaseBarcodeInfoMapper.insertMesBaseBarcodeInfo(mesBaseBarcodeInfo);
|
|
|
|
mesBaseBarcodeInfoMapper.insertMesBaseBarcodeInfo(mesBaseBarcodeInfo);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -296,6 +345,7 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 生成背板或门板条码
|
|
|
|
* 生成背板或门板条码
|
|
|
|
|
|
|
|
*
|
|
|
|
* @param mesBaseBarcodeInfo
|
|
|
|
* @param mesBaseBarcodeInfo
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public void generateBackOrDoorBarcode(MesBaseBarcodeInfo mesBaseBarcodeInfo) {
|
|
|
|
public void generateBackOrDoorBarcode(MesBaseBarcodeInfo mesBaseBarcodeInfo) {
|
|
|
@ -323,7 +373,7 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
MesBaseBarcodeInfo bindBarcodeInfo = mesBaseBarcodeInfoMapper.selectMesBaseBarcodeInfoByBarcodeInfo(mesBaseBarcodeInfo.getBindBarcode());
|
|
|
|
MesBaseBarcodeInfo bindBarcodeInfo = mesBaseBarcodeInfoMapper.selectMesBaseBarcodeInfoByBarcodeInfo(mesBaseBarcodeInfo.getBindBarcode());
|
|
|
|
if(bindBarcodeInfo==null){
|
|
|
|
if (bindBarcodeInfo == null) {
|
|
|
|
throw new ServiceException("绑定的柜体码不存在");
|
|
|
|
throw new ServiceException("绑定的柜体码不存在");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -435,7 +485,7 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService
|
|
|
|
List<MesBaseBarcodeInfo> toUpdatedBaseBarcodeInfos = new ArrayList<>();
|
|
|
|
List<MesBaseBarcodeInfo> toUpdatedBaseBarcodeInfos = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
|
|
for (Long barcodeId : barcodeIds) {
|
|
|
|
for (Long barcodeId : barcodeIds) {
|
|
|
|
printBarcodesByBarcodeId(barcodeId,printType);
|
|
|
|
printBarcodesByBarcodeId(barcodeId, printType);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// for (MesBaseBarcodeInfo toUpdateMesBaseBarcodeInfo : toUpdatedBaseBarcodeInfos) {
|
|
|
|
// for (MesBaseBarcodeInfo toUpdateMesBaseBarcodeInfo : toUpdatedBaseBarcodeInfos) {
|
|
|
@ -463,7 +513,7 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Transactional(propagation = Propagation.REQUIRES_NEW)
|
|
|
|
@Transactional(propagation = Propagation.REQUIRES_NEW)
|
|
|
|
public void printBarcodesByBarcodeId(Long barcodeId,String printType){
|
|
|
|
public void printBarcodesByBarcodeId(Long barcodeId, String printType) {
|
|
|
|
MesBaseBarcodeInfo mesBaseBarcodeInfo = mesBaseBarcodeInfoMapper.selectMesBaseBarcodeInfoJoinByBarcodeId(barcodeId);
|
|
|
|
MesBaseBarcodeInfo mesBaseBarcodeInfo = mesBaseBarcodeInfoMapper.selectMesBaseBarcodeInfoJoinByBarcodeId(barcodeId);
|
|
|
|
String printFlag = mesBaseBarcodeInfo.getPrintFlag();
|
|
|
|
String printFlag = mesBaseBarcodeInfo.getPrintFlag();
|
|
|
|
if (printFlag.equals(MesConstants.MES_BARCODE_PRINT_FLAG_YES)) {
|
|
|
|
if (printFlag.equals(MesConstants.MES_BARCODE_PRINT_FLAG_YES)) {
|
|
|
|