|
|
|
@ -29,6 +29,7 @@ import com.hw.printer.api.domain.vo.PrinterVo;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import com.hw.mes.service.IMesBaseBarcodeInfoService;
|
|
|
|
|
import org.springframework.transaction.annotation.Propagation;
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
@ -216,6 +217,30 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 生成固定条码信息
|
|
|
|
|
* @param mesBaseBarcodeInfo
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public int generateRegularRawBarcode(MesBaseBarcodeInfo mesBaseBarcodeInfo) {
|
|
|
|
|
Date currentDate = new Date();
|
|
|
|
|
String userName = SecurityUtils.getUsername();
|
|
|
|
|
|
|
|
|
|
String barcodeInfo = Seq.getId(Seq.mesBarcodeSeqType, Seq.mesBarcodeCode);
|
|
|
|
|
mesBaseBarcodeInfo.setBarcodeInfo(barcodeInfo);
|
|
|
|
|
mesBaseBarcodeInfo.setBatchCode(barcodeInfo);
|
|
|
|
|
mesBaseBarcodeInfo.setPrintFlag(MesConstants.MES_BARCODE_PRINT_FLAG_YES);
|
|
|
|
|
mesBaseBarcodeInfo.setBatchFlag(MesConstants.IS_BATCH);
|
|
|
|
|
mesBaseBarcodeInfo.setBarcodeType(MesConstants.MES_BARCODE_TYPE_RAW_REGULAR);
|
|
|
|
|
mesBaseBarcodeInfo.setSafeFlag(MesConstants.MES_ORDER_BIND_SAFE_FLAG_YES);
|
|
|
|
|
mesBaseBarcodeInfo.setCreateBy(userName);
|
|
|
|
|
mesBaseBarcodeInfo.setCreateTime(currentDate);
|
|
|
|
|
|
|
|
|
|
return mesBaseBarcodeInfoMapper.insertMesBaseBarcodeInfo(mesBaseBarcodeInfo);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void generateProductBarcode(MesBaseBarcodeInfo mesBaseBarcodeInfo) {
|
|
|
|
|
String planCode = mesBaseBarcodeInfo.getPlanCode();
|
|
|
|
|
String planDetailCode = mesBaseBarcodeInfo.getPlanDetailCode();
|
|
|
|
@ -336,147 +361,172 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
|
@Transactional
|
|
|
|
|
public int printBarcodes(Long[] barcodeIds, String printType) {
|
|
|
|
|
//获取条码List
|
|
|
|
|
List<List<PrintContentVo>> printContents = new ArrayList<>();
|
|
|
|
|
List<MesBaseBarcodeInfo> toUpdatedBaseBarcodeInfos = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
for (Long barcodeId : barcodeIds) {
|
|
|
|
|
MesBaseBarcodeInfo mesBaseBarcodeInfo = mesBaseBarcodeInfoMapper.selectMesBaseBarcodeInfoJoinByBarcodeId(barcodeId);
|
|
|
|
|
String printFlag = mesBaseBarcodeInfo.getPrintFlag();
|
|
|
|
|
if (printFlag.equals(MesConstants.MES_BARCODE_PRINT_FLAG_YES)) {
|
|
|
|
|
throw new ServiceException("此物料条码[" + mesBaseBarcodeInfo.getBarcodeInfo() + "]已经打印过,不能重复打印");
|
|
|
|
|
}
|
|
|
|
|
printBarcodesByBarcodeId(barcodeId,printType);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// for (MesBaseBarcodeInfo toUpdateMesBaseBarcodeInfo : toUpdatedBaseBarcodeInfos) {
|
|
|
|
|
// toUpdateMesBaseBarcodeInfo.setPrintTime(DateUtils.getNowDate());
|
|
|
|
|
// toUpdateMesBaseBarcodeInfo.setPrintPerson(SecurityUtils.getUsername());
|
|
|
|
|
// toUpdateMesBaseBarcodeInfo.setPrintFlag(MesConstants.MES_BARCODE_PRINT_FLAG_YES);
|
|
|
|
|
// toUpdateMesBaseBarcodeInfo.setPrintNumber(1L);
|
|
|
|
|
// toUpdateMesBaseBarcodeInfo.setAcceptedDate(DateUtils.getNowDate());
|
|
|
|
|
// this.updateMesBaseBarcodeInfo(toUpdateMesBaseBarcodeInfo);
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// PrinterVo printerVo = new PrinterVo();
|
|
|
|
|
// printerVo.setPrintType(printType);
|
|
|
|
|
// printerVo.setPrintContents(printContents);
|
|
|
|
|
//
|
|
|
|
|
// //调用的打印接口
|
|
|
|
|
// R<?> printResultR = remotePrinterService.printBarcodes(printerVo, SecurityConstants.INNER);
|
|
|
|
|
// if (printResultR.getCode() != Constants.SUCCESS) {//抛出异常,回滚事务
|
|
|
|
|
// throw new RuntimeException(printResultR.getMsg());
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
return toUpdatedBaseBarcodeInfos.size();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Transactional(propagation = Propagation.REQUIRES_NEW)
|
|
|
|
|
public void printBarcodesByBarcodeId(Long barcodeId,String printType){
|
|
|
|
|
MesBaseBarcodeInfo mesBaseBarcodeInfo = mesBaseBarcodeInfoMapper.selectMesBaseBarcodeInfoJoinByBarcodeId(barcodeId);
|
|
|
|
|
String printFlag = mesBaseBarcodeInfo.getPrintFlag();
|
|
|
|
|
if (printFlag.equals(MesConstants.MES_BARCODE_PRINT_FLAG_YES)) {
|
|
|
|
|
throw new ServiceException("此物料条码[" + mesBaseBarcodeInfo.getBarcodeInfo() + "]已经打印过,不能重复打印");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String materialName = mesBaseBarcodeInfo.getMaterialName();
|
|
|
|
|
List<PrintContentVo> printContentVos = new ArrayList<>();
|
|
|
|
|
String materialName = mesBaseBarcodeInfo.getMaterialName();
|
|
|
|
|
List<PrintContentVo> printContentVos = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
PrintContentVo printMaterialCode = new PrintContentVo();
|
|
|
|
|
printMaterialCode.setKey(PrintContentVo.RAW_MATERIAL_LABEL_KEY_MATERIAL_CODE);
|
|
|
|
|
printMaterialCode.setValue(mesBaseBarcodeInfo.getMaterialCode());
|
|
|
|
|
printMaterialCode.setType(PrintContentVo.TYPE_TEXT);
|
|
|
|
|
PrintContentVo printMaterialCode = new PrintContentVo();
|
|
|
|
|
printMaterialCode.setKey(PrintContentVo.RAW_MATERIAL_LABEL_KEY_MATERIAL_CODE);
|
|
|
|
|
printMaterialCode.setValue(mesBaseBarcodeInfo.getMaterialCode());
|
|
|
|
|
printMaterialCode.setType(PrintContentVo.TYPE_TEXT);
|
|
|
|
|
|
|
|
|
|
PrintContentVo printPreMaterial = new PrintContentVo();
|
|
|
|
|
PrintContentVo printPreMaterial = new PrintContentVo();
|
|
|
|
|
// if (mesBaseBarcodeInfo.getBindFlag() == null) {
|
|
|
|
|
//
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
PrintContentVo printSaleOrderCode = new PrintContentVo();
|
|
|
|
|
printSaleOrderCode.setKey(PrintContentVo.RAW_MATERIAL_LABEL_KEY_SALE_ORDER_CODE);
|
|
|
|
|
printSaleOrderCode.setValue(mesBaseBarcodeInfo.getSaleorderCode());
|
|
|
|
|
printSaleOrderCode.setType(PrintContentVo.TYPE_TEXT);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PrintContentVo printBarCode = new PrintContentVo();
|
|
|
|
|
printBarCode.setKey(PrintContentVo.RAW_MATERIAL_LABEL_KEY_QRCODE);
|
|
|
|
|
printBarCode.setValue(mesBaseBarcodeInfo.getBarcodeInfo());
|
|
|
|
|
printBarCode.setType(PrintContentVo.TYPE_QRCODE);
|
|
|
|
|
|
|
|
|
|
if (printType.equals(PrinterVo.PRINT_TYPE_RAW_LABEL)) {
|
|
|
|
|
PrintContentVo printMaterialName = new PrintContentVo();
|
|
|
|
|
printMaterialName.setKey(PrintContentVo.RAW_MATERIAL_LABEL_KEY_MATERIAL_NAME);
|
|
|
|
|
materialName = materialName.length() <= 10 ? "\n" + materialName : materialName;
|
|
|
|
|
printMaterialName.setValue(materialName);
|
|
|
|
|
printMaterialName.setType(PrintContentVo.TYPE_TEXT);
|
|
|
|
|
|
|
|
|
|
PrintContentVo printBatchCode = new PrintContentVo();
|
|
|
|
|
printBatchCode.setKey(PrintContentVo.RAW_MATERIAL_LABEL_KEY_BATCH_CODE);
|
|
|
|
|
printBatchCode.setValue(mesBaseBarcodeInfo.getBatchCode());
|
|
|
|
|
printBatchCode.setType(PrintContentVo.TYPE_TEXT);
|
|
|
|
|
|
|
|
|
|
PrintContentVo printPoNo = new PrintContentVo();
|
|
|
|
|
printPoNo.setKey(PrintContentVo.RAW_MATERIAL_LABEL_KEY_PO_NO);
|
|
|
|
|
printPoNo.setValue(mesBaseBarcodeInfo.getPoNo());
|
|
|
|
|
printPoNo.setType(PrintContentVo.TYPE_TEXT);
|
|
|
|
|
|
|
|
|
|
String printPreMaterialKey = mesBaseBarcodeInfo.getBindFlag() != null && mesBaseBarcodeInfo.getBindFlag().equals(MesConstants.MES_MATERIAL_BIND_FLAG_YES)
|
|
|
|
|
? PrintContentVo.RAW_MATERIAL_LABEL_KEY_PRE_MATERIAL_YES : PrintContentVo.RAW_MATERIAL_LABEL_KEY_PRE_MATERIAL_NO;
|
|
|
|
|
printPreMaterial.setKey(printPreMaterialKey);
|
|
|
|
|
printPreMaterial.setType(PrintContentVo.TYPE_CHECKBOX);
|
|
|
|
|
|
|
|
|
|
PrintContentVo printMaterialSpec = new PrintContentVo();
|
|
|
|
|
printMaterialSpec.setKey(PrintContentVo.RAW_MATERIAL_LABEL_KEY_MATERIAL_SPEC);
|
|
|
|
|
printMaterialSpec.setValue(mesBaseBarcodeInfo.getMaterialSpec());
|
|
|
|
|
printMaterialSpec.setType(PrintContentVo.TYPE_TEXT);
|
|
|
|
|
|
|
|
|
|
PrintContentVo printQty = new PrintContentVo();
|
|
|
|
|
printQty.setKey(PrintContentVo.RAW_MATERIAL_LABEL_KEY_QTY);
|
|
|
|
|
DecimalFormat df = new DecimalFormat("#.##");
|
|
|
|
|
String formattedNumber = df.format(mesBaseBarcodeInfo.getAmount());
|
|
|
|
|
printQty.setValue(formattedNumber);
|
|
|
|
|
printQty.setType(PrintContentVo.TYPE_TEXT);
|
|
|
|
|
|
|
|
|
|
printContentVos.add(printMaterialName);
|
|
|
|
|
printContentVos.add(printBatchCode);
|
|
|
|
|
printContentVos.add(printPoNo);
|
|
|
|
|
printContentVos.add(printMaterialSpec);
|
|
|
|
|
printContentVos.add(printQty);
|
|
|
|
|
|
|
|
|
|
} else if (printType.equals(PrinterVo.PRINT_TYPE_PRODUCT_LABEL)) {
|
|
|
|
|
PrintContentVo printMaterialName = new PrintContentVo();
|
|
|
|
|
materialName = materialName.length() <= 8 ? "\n" + materialName : materialName;
|
|
|
|
|
printMaterialName.setKey(PrintContentVo.RAW_MATERIAL_LABEL_KEY_MATERIAL_NAME);
|
|
|
|
|
printMaterialName.setValue(materialName);
|
|
|
|
|
printMaterialName.setType(PrintContentVo.TYPE_TEXT);
|
|
|
|
|
|
|
|
|
|
PrintContentVo printQty = new PrintContentVo();
|
|
|
|
|
printQty.setKey(PrintContentVo.RAW_MATERIAL_LABEL_KEY_QTY);
|
|
|
|
|
printQty.setValue("1");
|
|
|
|
|
printQty.setType(PrintContentVo.TYPE_TEXT);
|
|
|
|
|
|
|
|
|
|
PrintContentVo printPlanCode = new PrintContentVo();
|
|
|
|
|
printPlanCode.setKey(PrintContentVo.PRODUCT_PLAN_CODE);
|
|
|
|
|
printPlanCode.setValue(mesBaseBarcodeInfo.getPlanCode());
|
|
|
|
|
printPlanCode.setType(PrintContentVo.TYPE_TEXT);
|
|
|
|
|
printContentVos.add(printMaterialName);
|
|
|
|
|
printContentVos.add(printQty);
|
|
|
|
|
printContentVos.add(printPlanCode);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
printContentVos.add(printMaterialCode);
|
|
|
|
|
printContentVos.add(printPreMaterial);
|
|
|
|
|
printContentVos.add(printSaleOrderCode);
|
|
|
|
|
printContentVos.add(printBarCode);
|
|
|
|
|
|
|
|
|
|
String checkStatus = mesBaseBarcodeInfo.getCheckStatus() == null ? "" : mesBaseBarcodeInfo.getCheckStatus();
|
|
|
|
|
if (checkStatus.equals(QmsConstants.QMS_CHECK_RESULT_CHECK_STATUS_PASS)) {
|
|
|
|
|
PrintContentVo printQcResult = new PrintContentVo();
|
|
|
|
|
printQcResult.setKey(PrintContentVo.RAW_MATERIAL_LABEL_KEY_QC_RESULT_YES);
|
|
|
|
|
printQcResult.setType(PrintContentVo.TYPE_CHECKBOX);
|
|
|
|
|
printContentVos.add(printQcResult);
|
|
|
|
|
} else if (checkStatus.equals(QmsConstants.QMS_CHECK_RESULT_CHECK_STATUS_FAIL)) {
|
|
|
|
|
PrintContentVo printQcResult = new PrintContentVo();
|
|
|
|
|
printQcResult.setKey(PrintContentVo.RAW_MATERIAL_LABEL_KEY_QC_RESULT_NO);
|
|
|
|
|
printQcResult.setType(PrintContentVo.TYPE_CHECKBOX);
|
|
|
|
|
printContentVos.add(printQcResult);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
printContents.add(printContentVos);
|
|
|
|
|
toUpdatedBaseBarcodeInfos.add(mesBaseBarcodeInfo);
|
|
|
|
|
PrintContentVo printSaleOrderCode = new PrintContentVo();
|
|
|
|
|
printSaleOrderCode.setKey(PrintContentVo.RAW_MATERIAL_LABEL_KEY_SALE_ORDER_CODE);
|
|
|
|
|
printSaleOrderCode.setValue(mesBaseBarcodeInfo.getSaleorderCode());
|
|
|
|
|
printSaleOrderCode.setType(PrintContentVo.TYPE_TEXT);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PrintContentVo printBarCode = new PrintContentVo();
|
|
|
|
|
printBarCode.setKey(PrintContentVo.RAW_MATERIAL_LABEL_KEY_QRCODE);
|
|
|
|
|
printBarCode.setValue(mesBaseBarcodeInfo.getBarcodeInfo());
|
|
|
|
|
printBarCode.setType(PrintContentVo.TYPE_QRCODE);
|
|
|
|
|
|
|
|
|
|
if (printType.equals(PrinterVo.PRINT_TYPE_RAW_LABEL)) {
|
|
|
|
|
PrintContentVo printMaterialName = new PrintContentVo();
|
|
|
|
|
printMaterialName.setKey(PrintContentVo.RAW_MATERIAL_LABEL_KEY_MATERIAL_NAME);
|
|
|
|
|
materialName = materialName.length() <= 10 ? "\n" + materialName : materialName;
|
|
|
|
|
printMaterialName.setValue(materialName.replaceAll("[\\x00-\\x1F\\x7F-\\x9F]", ""));
|
|
|
|
|
printMaterialName.setType(PrintContentVo.TYPE_TEXT);
|
|
|
|
|
|
|
|
|
|
PrintContentVo printBatchCode = new PrintContentVo();
|
|
|
|
|
printBatchCode.setKey(PrintContentVo.RAW_MATERIAL_LABEL_KEY_BATCH_CODE);
|
|
|
|
|
printBatchCode.setValue(mesBaseBarcodeInfo.getBatchCode());
|
|
|
|
|
printBatchCode.setType(PrintContentVo.TYPE_TEXT);
|
|
|
|
|
|
|
|
|
|
PrintContentVo printPoNo = new PrintContentVo();
|
|
|
|
|
printPoNo.setKey(PrintContentVo.RAW_MATERIAL_LABEL_KEY_PO_NO);
|
|
|
|
|
printPoNo.setValue(mesBaseBarcodeInfo.getPoNo());
|
|
|
|
|
printPoNo.setType(PrintContentVo.TYPE_TEXT);
|
|
|
|
|
|
|
|
|
|
String printPreMaterialKey = mesBaseBarcodeInfo.getBindFlag() != null && mesBaseBarcodeInfo.getBindFlag().equals(MesConstants.MES_MATERIAL_BIND_FLAG_YES)
|
|
|
|
|
? PrintContentVo.RAW_MATERIAL_LABEL_KEY_PRE_MATERIAL_YES : PrintContentVo.RAW_MATERIAL_LABEL_KEY_PRE_MATERIAL_NO;
|
|
|
|
|
printPreMaterial.setKey(printPreMaterialKey);
|
|
|
|
|
printPreMaterial.setType(PrintContentVo.TYPE_CHECKBOX);
|
|
|
|
|
|
|
|
|
|
PrintContentVo printMaterialSpec = new PrintContentVo();
|
|
|
|
|
printMaterialSpec.setKey(PrintContentVo.RAW_MATERIAL_LABEL_KEY_MATERIAL_SPEC);
|
|
|
|
|
printMaterialSpec.setValue(mesBaseBarcodeInfo.getMaterialSpec().replaceAll("[\\x00-\\x1F\\x7F-\\x9F]", ""));
|
|
|
|
|
printMaterialSpec.setType(PrintContentVo.TYPE_TEXT);
|
|
|
|
|
|
|
|
|
|
PrintContentVo printQty = new PrintContentVo();
|
|
|
|
|
printQty.setKey(PrintContentVo.RAW_MATERIAL_LABEL_KEY_QTY);
|
|
|
|
|
DecimalFormat df = new DecimalFormat("#.##");
|
|
|
|
|
String formattedNumber = df.format(mesBaseBarcodeInfo.getAmount());
|
|
|
|
|
printQty.setValue(formattedNumber);
|
|
|
|
|
printQty.setType(PrintContentVo.TYPE_TEXT);
|
|
|
|
|
|
|
|
|
|
printContentVos.add(printMaterialName);
|
|
|
|
|
printContentVos.add(printBatchCode);
|
|
|
|
|
printContentVos.add(printPoNo);
|
|
|
|
|
printContentVos.add(printMaterialSpec);
|
|
|
|
|
printContentVos.add(printQty);
|
|
|
|
|
|
|
|
|
|
} else if (printType.equals(PrinterVo.PRINT_TYPE_PRODUCT_LABEL)) {
|
|
|
|
|
PrintContentVo printMaterialName = new PrintContentVo();
|
|
|
|
|
materialName = materialName.length() <= 8 ? "\n" + materialName : materialName;
|
|
|
|
|
printMaterialName.setKey(PrintContentVo.RAW_MATERIAL_LABEL_KEY_MATERIAL_NAME);
|
|
|
|
|
printMaterialName.setValue(materialName);
|
|
|
|
|
printMaterialName.setType(PrintContentVo.TYPE_TEXT);
|
|
|
|
|
|
|
|
|
|
PrintContentVo printQty = new PrintContentVo();
|
|
|
|
|
printQty.setKey(PrintContentVo.RAW_MATERIAL_LABEL_KEY_QTY);
|
|
|
|
|
printQty.setValue("1");
|
|
|
|
|
printQty.setType(PrintContentVo.TYPE_TEXT);
|
|
|
|
|
|
|
|
|
|
PrintContentVo printPlanCode = new PrintContentVo();
|
|
|
|
|
printPlanCode.setKey(PrintContentVo.PRODUCT_PLAN_CODE);
|
|
|
|
|
printPlanCode.setValue(mesBaseBarcodeInfo.getPlanCode());
|
|
|
|
|
printPlanCode.setType(PrintContentVo.TYPE_TEXT);
|
|
|
|
|
printContentVos.add(printMaterialName);
|
|
|
|
|
printContentVos.add(printQty);
|
|
|
|
|
printContentVos.add(printPlanCode);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (MesBaseBarcodeInfo toUpdateMesBaseBarcodeInfo : toUpdatedBaseBarcodeInfos) {
|
|
|
|
|
toUpdateMesBaseBarcodeInfo.setPrintTime(DateUtils.getNowDate());
|
|
|
|
|
toUpdateMesBaseBarcodeInfo.setPrintPerson(SecurityUtils.getUsername());
|
|
|
|
|
toUpdateMesBaseBarcodeInfo.setPrintFlag(MesConstants.MES_BARCODE_PRINT_FLAG_YES);
|
|
|
|
|
toUpdateMesBaseBarcodeInfo.setPrintNumber(1L);
|
|
|
|
|
toUpdateMesBaseBarcodeInfo.setAcceptedDate(DateUtils.getNowDate());
|
|
|
|
|
this.updateMesBaseBarcodeInfo(toUpdateMesBaseBarcodeInfo);
|
|
|
|
|
printContentVos.add(printMaterialCode);
|
|
|
|
|
printContentVos.add(printPreMaterial);
|
|
|
|
|
printContentVos.add(printSaleOrderCode);
|
|
|
|
|
printContentVos.add(printBarCode);
|
|
|
|
|
|
|
|
|
|
String checkStatus = mesBaseBarcodeInfo.getCheckStatus() == null ? "" : mesBaseBarcodeInfo.getCheckStatus();
|
|
|
|
|
if (checkStatus.equals(QmsConstants.QMS_CHECK_RESULT_CHECK_STATUS_PASS)) {
|
|
|
|
|
PrintContentVo printQcResult = new PrintContentVo();
|
|
|
|
|
printQcResult.setKey(PrintContentVo.RAW_MATERIAL_LABEL_KEY_QC_RESULT_YES);
|
|
|
|
|
printQcResult.setType(PrintContentVo.TYPE_CHECKBOX);
|
|
|
|
|
printContentVos.add(printQcResult);
|
|
|
|
|
} else if (checkStatus.equals(QmsConstants.QMS_CHECK_RESULT_CHECK_STATUS_FAIL)) {
|
|
|
|
|
PrintContentVo printQcResult = new PrintContentVo();
|
|
|
|
|
printQcResult.setKey(PrintContentVo.RAW_MATERIAL_LABEL_KEY_QC_RESULT_NO);
|
|
|
|
|
printQcResult.setType(PrintContentVo.TYPE_CHECKBOX);
|
|
|
|
|
printContentVos.add(printQcResult);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// printContents.add(printContentVos);
|
|
|
|
|
// toUpdatedBaseBarcodeInfos.add(mesBaseBarcodeInfo);
|
|
|
|
|
|
|
|
|
|
mesBaseBarcodeInfo.setPrintTime(DateUtils.getNowDate());
|
|
|
|
|
mesBaseBarcodeInfo.setPrintPerson(SecurityUtils.getUsername());
|
|
|
|
|
mesBaseBarcodeInfo.setPrintFlag(MesConstants.MES_BARCODE_PRINT_FLAG_YES);
|
|
|
|
|
mesBaseBarcodeInfo.setPrintNumber(1L);
|
|
|
|
|
mesBaseBarcodeInfo.setAcceptedDate(DateUtils.getNowDate());
|
|
|
|
|
this.updateMesBaseBarcodeInfo(mesBaseBarcodeInfo);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PrinterVo printerVo = new PrinterVo();
|
|
|
|
|
printerVo.setPrintType(printType);
|
|
|
|
|
printerVo.setPrintContents(printContents);
|
|
|
|
|
printerVo.setPrintContentVos(printContentVos);
|
|
|
|
|
|
|
|
|
|
//调用的打印接口
|
|
|
|
|
R<?> printResultR = remotePrinterService.printBarcodes(printerVo, SecurityConstants.INNER);
|
|
|
|
|
if (printResultR.getCode() != Constants.SUCCESS) {//抛出异常,回滚事务
|
|
|
|
|
if (printResultR.getCode() != Constants.SUCCESS) {
|
|
|
|
|
throw new RuntimeException(printResultR.getMsg());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return toUpdatedBaseBarcodeInfos.size();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|