|
|
@ -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,6 +212,7 @@ 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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -223,6 +223,7 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 生成固定条码信息
|
|
|
|
* 生成固定条码信息
|
|
|
|
|
|
|
|
*
|
|
|
|
* @param mesBaseBarcodeInfo
|
|
|
|
* @param mesBaseBarcodeInfo
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
@ -246,8 +247,51 @@ 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("原材料条码有误");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!rawBarcode.getBarcodeType().equals(MesConstants.MES_BARCODE_TYPE_RAW)) {
|
|
|
|
|
|
|
|
throw new ServiceException("此条码为非原材料条码,不能生成成品条码");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MesBaseBarcodeInfo bindBarcode = mesBaseBarcodeInfoMapper.selectMesBaseBarcodeInfoByBindBarcode(rawMaterialBarcode);
|
|
|
|
|
|
|
|
if (bindBarcode == null) {
|
|
|
|
|
|
|
|
throw new ServiceException("此原材料条码没有绑定背板或门板");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MesBaseBarcodeInfo productBarcodeInfo = mesBaseBarcodeInfoMapper.selectMesBaseBarcodeInfoByProductBarcode(rawMaterialBarcode);
|
|
|
|
|
|
|
|
if (productBarcodeInfo != null) {
|
|
|
|
|
|
|
|
throw new ServiceException("此原材料条码已经生成过成品条码,不能重复生成");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
planCode = bindBarcode.getPlanCode();
|
|
|
|
|
|
|
|
planDetailCode = bindBarcode.getPlanDetailCode();
|
|
|
|
|
|
|
|
saleOrderId = bindBarcode.getSaleOrderId();
|
|
|
|
|
|
|
|
saleOrderCode = bindBarcode.getSaleorderCode();
|
|
|
|
|
|
|
|
materialId = rawBarcode.getMaterialId();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (StringUtils.isEmpty(planCode) || StringUtils.isEmpty(planDetailCode)) {
|
|
|
|
|
|
|
|
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();
|
|
|
|
MesBaseBarcodeInfo queryBarcodeInfo = new MesBaseBarcodeInfo();
|
|
|
|
queryBarcodeInfo.setPlanDetailCode(planDetailCode);
|
|
|
|
queryBarcodeInfo.setPlanDetailCode(planDetailCode);
|
|
|
@ -272,23 +316,28 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService
|
|
|
|
throw new ServiceException("此生产派工不存在");
|
|
|
|
throw new ServiceException("此生产派工不存在");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
saleOrderId = productPlan.getSaleOrderId();
|
|
|
|
|
|
|
|
saleOrderCode = productPlan.getSaleorderCode();
|
|
|
|
|
|
|
|
materialId = productPlan.getMaterialId();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Date currentDate = new Date();
|
|
|
|
Date currentDate = new Date();
|
|
|
|
String barcode = Seq.getId(Seq.mesCompBarcodeSeqType, Seq.mesCompBarcodeCode);
|
|
|
|
String barcode = Seq.getId(Seq.mesCompBarcodeSeqType, Seq.mesCompBarcodeCode);
|
|
|
|
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)) {
|
|
|
|