feat 货位打印逻辑
This commit is contained in:
parent
8e405d9153
commit
ef462ce7d3
@ -0,0 +1,9 @@
|
|||||||
|
package com.cim.idm.model;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class StorageObject {
|
||||||
|
private String CODE;
|
||||||
|
private String NAME;
|
||||||
|
}
|
@ -1,5 +1,6 @@
|
|||||||
package com.cim.idm.service.Impl;
|
package com.cim.idm.service.Impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.text.CharSequenceUtil;
|
||||||
import com.cim.idm.constants.CustomExceptionCode;
|
import com.cim.idm.constants.CustomExceptionCode;
|
||||||
import com.cim.idm.constants.MsgConstants;
|
import com.cim.idm.constants.MsgConstants;
|
||||||
import com.cim.idm.constants.PolicyDef;
|
import com.cim.idm.constants.PolicyDef;
|
||||||
@ -10,13 +11,13 @@ import com.cim.idm.framework.exception.IDMFrameDBErrorSignal;
|
|||||||
import com.cim.idm.framework.orm.info.KeyInfo;
|
import com.cim.idm.framework.orm.info.KeyInfo;
|
||||||
import com.cim.idm.framework.orm.service.CommonServiceDAO;
|
import com.cim.idm.framework.orm.service.CommonServiceDAO;
|
||||||
import com.cim.idm.framework.util.time.TimeStampUtil;
|
import com.cim.idm.framework.util.time.TimeStampUtil;
|
||||||
import com.cim.idm.model.BSLabel;
|
import com.cim.idm.model.*;
|
||||||
import com.cim.idm.model.BSLabelKey;
|
|
||||||
import com.cim.idm.model.LabelParameterObject;
|
|
||||||
import com.cim.idm.model.PrintRequest;
|
|
||||||
import com.cim.idm.mwmsextend.generic.util.CommonUtil;
|
import com.cim.idm.mwmsextend.generic.util.CommonUtil;
|
||||||
import com.cim.idm.wmsextend.generic.errorHandler.CustomException;
|
import com.cim.idm.wmsextend.generic.errorHandler.CustomException;
|
||||||
import com.cim.idm.wmsextend.generic.util.ObjectUtil;
|
import com.cim.idm.wmsextend.generic.util.ObjectUtil;
|
||||||
|
import com.cim.idm.wmspackage.storage.StorageServiceProxy;
|
||||||
|
import com.cim.idm.wmspackage.storage.management.data.StorageSpec;
|
||||||
|
import com.cim.idm.wmspackage.storage.management.data.StorageSpecKey;
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@ -849,6 +850,47 @@ public class BSLabelServiceImpl extends CommonServiceDAO<BSLabelKey, BSLabel> im
|
|||||||
// labelPrint(pgData, requestUrl, pr, params);
|
// labelPrint(pgData, requestUrl, pr, params);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 货位打印
|
||||||
|
*/
|
||||||
|
public String storagePrint(StoragePrintDto data) throws IllegalArgumentException, CustomException {
|
||||||
|
// 获取数据
|
||||||
|
StorageSpecKey storageSpecKey = new StorageSpecKey();
|
||||||
|
storageSpecKey.setStorageName(data.getStorageName());
|
||||||
|
storageSpecKey.setSiteName(data.getSiteName());
|
||||||
|
StorageSpec storageSpec = null;
|
||||||
|
try {
|
||||||
|
storageSpec = StorageServiceProxy.getStorageSpecService().selectByKey(storageSpecKey);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new CustomException("未找到该货位!");
|
||||||
|
}
|
||||||
|
StorageObject storageObject = new StorageObject();
|
||||||
|
storageObject.setCODE(storageSpec.getKey().getStorageName());
|
||||||
|
storageObject.setNAME(storageSpec.getDescription());
|
||||||
|
|
||||||
|
// 打印机数据
|
||||||
|
// 名称
|
||||||
|
String printer = CharSequenceUtil.isEmpty(data.getPrinterName())
|
||||||
|
? getDefaultPrinter() : data.getPrinterName();
|
||||||
|
// 地址
|
||||||
|
String requestUrl = getRequestUrlByServer("LabelRequestURL");
|
||||||
|
// 参数(BSLABELASSIGNPARAMETER 表中映射关系)
|
||||||
|
List<String> params = getLabelAssignParameter("storageLabel001");
|
||||||
|
// 模板
|
||||||
|
String labelPath = "D:\\storage.btw";
|
||||||
|
|
||||||
|
// 打印请求
|
||||||
|
PrintRequest pr = new PrintRequest();
|
||||||
|
pr.setLibraryID(UUID.randomUUID().toString());
|
||||||
|
pr.setAbsolutePath(labelPath);
|
||||||
|
pr.setCopies(1);
|
||||||
|
pr.setSerialNumbers(0);
|
||||||
|
pr.setStartingPosition(0);
|
||||||
|
pr.setPrinter(printer);
|
||||||
|
pr.setPrintRequestID(UUID.randomUUID().toString());
|
||||||
|
return labelPrint(storageObject, requestUrl, pr, params);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* rePrintArriveMaterial
|
* rePrintArriveMaterial
|
||||||
* @param UserId
|
* @param UserId
|
||||||
|
@ -62,6 +62,18 @@ public class LabelServiceImpl implements LabelService {
|
|||||||
return urlFull;
|
return urlFull;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String storagePrint(StoragePrintDto data) throws CustomException {
|
||||||
|
String urlFull = "";
|
||||||
|
try {
|
||||||
|
urlFull = bsLabelService.storagePrint(data);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
throw new CustomException( "标签打印异常... " + e.getMessage());
|
||||||
|
}
|
||||||
|
return urlFull;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void labelPrintTest1(LabelPrintDto1 data) throws CustomException {
|
public void labelPrintTest1(LabelPrintDto1 data) throws CustomException {
|
||||||
try {
|
try {
|
||||||
|
@ -44,6 +44,12 @@ public interface LabelService {
|
|||||||
* @throws IllegalArgumentException 如果data为null。
|
* @throws IllegalArgumentException 如果data为null。
|
||||||
*/
|
*/
|
||||||
String labelPrintTest(LabelPrintDto data) throws CustomException;
|
String labelPrintTest(LabelPrintDto data) throws CustomException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 货位打印
|
||||||
|
*/
|
||||||
|
String storagePrint(StoragePrintDto data) throws CustomException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 标签存量打印修改品名
|
* 标签存量打印修改品名
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user