Merge remote-tracking branch 'origin/main'
This commit is contained in:
commit
8fc39fbfa8
@ -69,6 +69,25 @@ public class LabelController {
|
|||||||
return JsonResponse.success();
|
return JsonResponse.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@RequestMapping(value = "/storagePrint", method = RequestMethod.POST)
|
||||||
|
public AjaxResult storagePrint(@RequestBody JSONObject in) throws CustomException {
|
||||||
|
// 获取信息
|
||||||
|
String printName = in.get("PRINTNAME").toString();
|
||||||
|
// 数据
|
||||||
|
List<Map<String,Object>> dataList = (List) in.get("LIST");
|
||||||
|
// 打印
|
||||||
|
List<String> resList = new ArrayList<>();
|
||||||
|
for (Map<String, Object> data : dataList) {
|
||||||
|
StoragePrintDto storagePrintDto = new StoragePrintDto();
|
||||||
|
storagePrintDto.setPrinterName(printName);
|
||||||
|
storagePrintDto.setSiteName(data.get("SITENAME").toString());
|
||||||
|
storagePrintDto.setStorageName(data.get("STORAGENAME").toString());
|
||||||
|
String urlInfo = labelService.storagePrint(storagePrintDto);
|
||||||
|
resList.add(urlInfo);
|
||||||
|
}
|
||||||
|
return AjaxResult.me().setResultObj(resList);
|
||||||
|
}
|
||||||
|
|
||||||
@RequestMapping(value = "/labelPrintTest", method = RequestMethod.POST)
|
@RequestMapping(value = "/labelPrintTest", method = RequestMethod.POST)
|
||||||
//@Operation(summary = "标签打印测试, 测试只能打印 标签模板没有参数的标签. ")
|
//@Operation(summary = "标签打印测试, 测试只能打印 标签模板没有参数的标签. ")
|
||||||
public AjaxResult labelPrintTest(@RequestBody JSONObject in) throws CustomException {
|
public AjaxResult labelPrintTest(@RequestBody JSONObject in) throws CustomException {
|
||||||
|
@ -0,0 +1,9 @@
|
|||||||
|
package com.cim.idm.model;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class StorageObject {
|
||||||
|
private String CODE;
|
||||||
|
private String NAME;
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
package com.cim.idm.model;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class StoragePrintDto {
|
||||||
|
|
||||||
|
// sdk
|
||||||
|
private String siteName;
|
||||||
|
|
||||||
|
// 货位名称
|
||||||
|
private String storageName;
|
||||||
|
|
||||||
|
// 打印机名称
|
||||||
|
private String printerName;
|
||||||
|
}
|
@ -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;
|
||||||
@ -848,6 +849,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
|
||||||
|
@ -61,6 +61,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 {
|
||||||
|
@ -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