|
|
|
@ -1096,8 +1096,8 @@ public class OdsProcureOrderServiceImpl implements IOdsProcureOrderService {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@DS("#header.poolName")
|
|
|
|
|
public List<OdsProcureOrder> getIdCardList(OdsProcureOrder odsProcureOrder) {
|
|
|
|
|
// DynamicDataSourceContextHolder.push("ds_" + odsProcureOrder.getFactoryCode());
|
|
|
|
|
public String getIdCardList(OdsProcureOrder odsProcureOrder) {
|
|
|
|
|
// DynamicDataSourceContextHolder.push("ds_" + odsProcureOrder.getFactoryCode());
|
|
|
|
|
List<OdsProcureOrder> dtos = new ArrayList<>();
|
|
|
|
|
OdsProcureOrder order=odsProcureOrderMapper.selectOdsProcureOrderByID(odsProcureOrder.getID());
|
|
|
|
|
//根据采购单获取一托盘要装多少
|
|
|
|
@ -1107,7 +1107,7 @@ public class OdsProcureOrderServiceImpl implements IOdsProcureOrderService {
|
|
|
|
|
List<BaseProductAttached> baseProductAttacheds= baseProductAttachedMapper.selectBaseProductAttachedList(baseProductAttached);
|
|
|
|
|
if (baseProductAttacheds.size()==0){
|
|
|
|
|
//没有配置附属信息
|
|
|
|
|
return null;
|
|
|
|
|
return "没有配置附属信息";
|
|
|
|
|
}
|
|
|
|
|
String name = odsProcureOrderMapper.selectBaseSupplier(order);
|
|
|
|
|
order.setSupplierName(name);
|
|
|
|
@ -1134,6 +1134,7 @@ public class OdsProcureOrderServiceImpl implements IOdsProcureOrderService {
|
|
|
|
|
pw.setSupplierCode(order.getSupplierCode());
|
|
|
|
|
pw.setSupplierName(order.getSupplierName());
|
|
|
|
|
pw.setUserDefined8(order.getUserDefined8());
|
|
|
|
|
pw.setUserDefined7(order.getUserDefined7());
|
|
|
|
|
pw.setUserDefined11(order.getUserDefined11());
|
|
|
|
|
pw.setUnit(order.getUnit());
|
|
|
|
|
if(pall.compareTo(pn)<0) {//最后一托盘
|
|
|
|
@ -1157,9 +1158,88 @@ public class OdsProcureOrderServiceImpl implements IOdsProcureOrderService {
|
|
|
|
|
}else{
|
|
|
|
|
dtos.addAll(dtos0);
|
|
|
|
|
}
|
|
|
|
|
return dtos;
|
|
|
|
|
String msg= dayin(dtos);
|
|
|
|
|
return msg;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public String dayin( List<OdsProcureOrder> orderList) {
|
|
|
|
|
// 定义请求的URL地址
|
|
|
|
|
String url = "http://172.18.80.215:8022/printService/printServiceTest";
|
|
|
|
|
// 创建OkHttpClient实例,用于发送HTTP请求
|
|
|
|
|
OkHttpClient client = new OkHttpClient();
|
|
|
|
|
|
|
|
|
|
// 定义请求体的媒体类型为json
|
|
|
|
|
MediaType mediaType = MediaType.parse("application/json");
|
|
|
|
|
|
|
|
|
|
// 创建一个JSONArray,用于存储多个订单的信息
|
|
|
|
|
JSONArray jsonArray = new JSONArray();
|
|
|
|
|
try {
|
|
|
|
|
// 创建JSON对象payload,并设置请求参数
|
|
|
|
|
// 遍历传入的订单列表
|
|
|
|
|
for (OdsProcureOrder order : orderList) {
|
|
|
|
|
|
|
|
|
|
JSONObject payload = new JSONObject();
|
|
|
|
|
|
|
|
|
|
payload.put("supplier", order.getSupplierName());
|
|
|
|
|
|
|
|
|
|
payload.put("itemName", order.getMaterialDesc());
|
|
|
|
|
|
|
|
|
|
payload.put("itemCode", order.getMaterialCode());
|
|
|
|
|
|
|
|
|
|
payload.put("warehousingDate", order.getUserDefined11());
|
|
|
|
|
|
|
|
|
|
payload.put("batch", order.getUserDefined7());
|
|
|
|
|
|
|
|
|
|
payload.put("number", order.getPlanNumber());
|
|
|
|
|
payload.put("qrcode", order.getUserDefined1());
|
|
|
|
|
// 将当前订单的JSON对象添加到JSONArray中
|
|
|
|
|
jsonArray.add(payload);
|
|
|
|
|
}
|
|
|
|
|
// 创建请求体,将JSONArray转换为字符串
|
|
|
|
|
RequestBody body = RequestBody.create(mediaType, jsonArray.toString());
|
|
|
|
|
// 创建POST请求
|
|
|
|
|
Request request = new Request.Builder()
|
|
|
|
|
.url(url)
|
|
|
|
|
.post(body)
|
|
|
|
|
.build();
|
|
|
|
|
// 执行请求并获取响应
|
|
|
|
|
Response response = client.newCall(request).execute();
|
|
|
|
|
// 获取响应数据并转换为JSON对象
|
|
|
|
|
String responseData = response.body().string();
|
|
|
|
|
JSONObject result = JSONObject.parseObject(responseData);
|
|
|
|
|
// 获取返回结果结果JSON对象,请求编码、状态码和消息
|
|
|
|
|
result.get("msg");
|
|
|
|
|
|
|
|
|
|
String message = (String) result.get("code");
|
|
|
|
|
response.close();
|
|
|
|
|
return message;
|
|
|
|
|
} catch (IOException e) {
|
|
|
|
|
// 捕获IOException并处理异常
|
|
|
|
|
e.printStackTrace(); // 在控制台打印异常信息,建议记录到日志文件
|
|
|
|
|
return "请求失败,异常信息:" + e.getMessage(); // 返回异常信息
|
|
|
|
|
} finally {
|
|
|
|
|
// 关闭OkHttpClient
|
|
|
|
|
client.dispatcher().executorService().shutdown();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public String DesignatedPalletOutboundWCS(WMSDesignatedPalle wmsDesignatedPalle) {
|
|
|
|
|
// 定义请求的URL地址
|
|
|
|
|
String url = "http://192.168.202.37:9001/api/v1/ReceiveMesMsg/packingMaterialsOutBoundByPallet";
|
|
|
|
@ -1188,15 +1268,26 @@ public class OdsProcureOrderServiceImpl implements IOdsProcureOrderService {
|
|
|
|
|
.build();
|
|
|
|
|
// 执行请求并获取响应
|
|
|
|
|
Response response = client.newCall(request).execute();
|
|
|
|
|
// 获取响应数据并转换为JSON对象
|
|
|
|
|
String responseData = response.body().string();
|
|
|
|
|
JSONObject result = JSONObject.parseObject(responseData);
|
|
|
|
|
// 获取返回结果结果JSON对象,请求编码、状态码和消息
|
|
|
|
|
result.get("reqCode");
|
|
|
|
|
result.get("code");
|
|
|
|
|
String message = (String) result.get("message");
|
|
|
|
|
response.close();
|
|
|
|
|
return message;
|
|
|
|
|
// 确保响应体不为空
|
|
|
|
|
if (response.body() != null) {
|
|
|
|
|
// 获取响应数据并转换为字符串
|
|
|
|
|
String responseData = response.body().string();
|
|
|
|
|
// 将响应数据解析为JSON对象
|
|
|
|
|
JSONObject result = JSONObject.parseObject(responseData);
|
|
|
|
|
// 获取返回结果中的状态码
|
|
|
|
|
int code = result.getIntValue("code");
|
|
|
|
|
// 获取返回结果中的消息字段
|
|
|
|
|
String message = result.getString("msg");
|
|
|
|
|
|
|
|
|
|
// 判断状态码是否为0,表示成功
|
|
|
|
|
if (code == 0) {
|
|
|
|
|
return message; // 返回成功消息
|
|
|
|
|
} else {
|
|
|
|
|
return "打印失败,状态码:" + code; // 返回失败消息及状态码
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
return "响应体为空"; // 响应体为空的处理
|
|
|
|
|
}
|
|
|
|
|
} catch (IOException e) {
|
|
|
|
|
// 捕获IOException并处理异常
|
|
|
|
|
e.printStackTrace(); // 这里最好记录异常到日志文件或者进行其他处理
|
|
|
|
|