feat(载具):修改
This commit is contained in:
parent
2bcd2c7422
commit
1a9cfd95dd
@ -29,7 +29,6 @@ import lombok.RequiredArgsConstructor;
|
|||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -160,6 +159,7 @@ public class WmsCarrierController {
|
|||||||
@ApiOperation(value = "托盘码创建")
|
@ApiOperation(value = "托盘码创建")
|
||||||
public R trayNumberCreate(String printName, String count) {
|
public R trayNumberCreate(String printName, String count) {
|
||||||
String site = TenantContextHolder.getTenantId();
|
String site = TenantContextHolder.getTenantId();
|
||||||
|
String userName = SecurityUtils.getUserName();
|
||||||
List<JSONObject> jsonObjects = new ArrayList<>();
|
List<JSONObject> jsonObjects = new ArrayList<>();
|
||||||
if (StrUtil.isBlank(printName)) {
|
if (StrUtil.isBlank(printName)) {
|
||||||
throw BusinessException.build("打印机名称名称不能为空!");
|
throw BusinessException.build("打印机名称名称不能为空!");
|
||||||
@ -184,35 +184,32 @@ public class WmsCarrierController {
|
|||||||
List<Carrier> carrierByNo = wmsCarrierMapper.findCarrierByNo(String.valueOf(nextNumberResponseId), site);
|
List<Carrier> carrierByNo = wmsCarrierMapper.findCarrierByNo(String.valueOf(nextNumberResponseId), site);
|
||||||
if (carrierByNo.isEmpty()) {
|
if (carrierByNo.isEmpty()) {
|
||||||
Carrier carrier = new Carrier();
|
Carrier carrier = new Carrier();
|
||||||
carrier.setHandle(Carrier.genHandle(site, nextNumberResponseId));
|
|
||||||
carrier.setCarrier(nextNumberResponseId);
|
|
||||||
carrier.setDescription("托盘码");
|
|
||||||
carrier.setStatus("Y");
|
|
||||||
carrier.setCreator(SecurityUtils.getUserName());
|
|
||||||
carrier.setCreateTime(LocalDateTime.now());
|
|
||||||
carrier.setSite(site);
|
carrier.setSite(site);
|
||||||
carrier.setCarrierTypeBo(CarrierType.genHandle(site, "TP"));
|
carrier.setCarrierTypeBo(CarrierType.genHandle(site, "TP"));
|
||||||
wmsCarrierService.save(carrier);
|
wmsCarrierService.save(carrier);
|
||||||
}
|
}
|
||||||
// 组装打印数据
|
// 组装打印数据
|
||||||
|
JSONObject param = new JSONObject();
|
||||||
JSONObject printRequestObj = new JSONObject();
|
JSONObject printRequestObj = new JSONObject();
|
||||||
|
printRequestObj.put("PRINT_SERVER", null);
|
||||||
printRequestObj.put("PRINT_NAME", printName);
|
printRequestObj.put("PRINT_NAME", printName);
|
||||||
printRequestObj.put("LABEL_QTY", Math.toIntExact(1));
|
printRequestObj.put("LABEL_QTY", Math.toIntExact(1));
|
||||||
printRequestObj.put("TEMPLATE", "TPBatcuNumber01.lab");
|
printRequestObj.put("TEMPLATE", "TPBatcuNumber01.lab");
|
||||||
printRequestObj.put("batchNumber", nextNumberResponseId);
|
printRequestObj.put("TRANSACTION_ID", UUID.randomUUID().toString());
|
||||||
jsonObjects.add(printRequestObj);
|
JSONObject paramMap = new JSONObject();
|
||||||
|
paramMap.put("batchNumber",nextNumberResponseId);
|
||||||
|
printRequestObj.put("PRINT_DATA", JSONObject.toJSON(paramMap));
|
||||||
|
param.put("PRINT_REQUEST", printRequestObj);
|
||||||
|
jsonObjects.add(param);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 生成托盘码
|
// 生成托盘码
|
||||||
if (!nextNumberResponseIds.isEmpty()) {
|
if (!nextNumberResponseIds.isEmpty()) {
|
||||||
for (JSONObject pintData : jsonObjects) {
|
for (JSONObject pintData : jsonObjects) {
|
||||||
// 开个独立的线程,避免阻塞
|
// 开个独立的线程,避免阻塞
|
||||||
try {
|
ThreadPoolUtil.execute(() -> {
|
||||||
remotePrintService.remotePrintSaveLog(pintData);
|
remotePrintService.remotePrintSaveLog(pintData);
|
||||||
} catch (Exception e) {
|
});
|
||||||
throw BusinessException.build("调用打印失败:" + e.getMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
return R.ok(nextNumberResponseIds);
|
return R.ok(nextNumberResponseIds);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user