|
@@ -386,8 +386,7 @@ public class AwaitSendController {
|
|
|
JSONObject jsonObject = JSONObject.parseObject(json);
|
|
|
boolean flag = jsonObject.getBoolean("Success");
|
|
|
if (flag) {
|
|
|
- // 替换产品名称
|
|
|
- json = json.replace(uuid, goodName.toString());
|
|
|
+
|
|
|
// 订单发货 : 仅针对已经通知通知配货的订单(如果已发货,此处不修改对应的订单数据)
|
|
|
SalesOrder salesOrder = new SalesOrder();
|
|
|
salesOrder.setSalesPostNum(jsonObject.getJSONObject("Order").getString("LogisticCode"));
|
|
@@ -399,27 +398,8 @@ public class AwaitSendController {
|
|
|
if (res == null || res <= 0) {
|
|
|
return ResponseJson.getFAILURE().addResponseKeyValue("error", "订单状态非通知配货,无法打印");
|
|
|
}
|
|
|
- // 保存HTML
|
|
|
- String filePath = request.getServletContext().getRealPath("/common/");
|
|
|
- File dir = new File(filePath + File.separator + "send_order");
|
|
|
- if (!dir.exists()) {
|
|
|
- dir.mkdir();
|
|
|
- }
|
|
|
- File file = new File(dir.getAbsolutePath() + File.separator + orderId + ".txt");
|
|
|
- if (!file.createNewFile()) {
|
|
|
- return ResponseJson.getFAILURE().addResponseKeyValue("error", "创建文件失败");
|
|
|
- }
|
|
|
- FileWriter fileWriter = null;
|
|
|
- try {
|
|
|
- fileWriter = new FileWriter(file, false);
|
|
|
- fileWriter.write(json);
|
|
|
- } catch (Exception e) {
|
|
|
- LOGGER.error("", e);
|
|
|
- } finally {
|
|
|
- if (fileWriter != null) {
|
|
|
- fileWriter.close();
|
|
|
- }
|
|
|
- }
|
|
|
+
|
|
|
+
|
|
|
|
|
|
/*子母单设置 state*/
|
|
|
if(logisticsInfo.getLogisticsIsLashSingle() == 1 && orders != null && orders.size() > 0){
|
|
@@ -464,30 +444,44 @@ public class AwaitSendController {
|
|
|
if (msg == null || msg <= 0) {
|
|
|
return ResponseJson.getFAILURE().addResponseKeyValue("error", "子订单状态非通知配货,无法打印");
|
|
|
}
|
|
|
- File fileTwo = new File(dir.getAbsolutePath() + File.separator + orders.get(i).getSalesOrderId() + ".txt");
|
|
|
- if (!fileTwo.createNewFile()) {
|
|
|
- return ResponseJson.getFAILURE().addResponseKeyValue("error", "创建子订单文件失败");
|
|
|
- }
|
|
|
- try {
|
|
|
- fileWriter = new FileWriter(fileTwo, false);
|
|
|
- fileWriter.write(subTemplates.toString());
|
|
|
- } catch (Exception e) {
|
|
|
- LOGGER.error("", e);
|
|
|
- } finally {
|
|
|
- if (fileWriter != null) {
|
|
|
- fileWriter.close();
|
|
|
- }
|
|
|
- }
|
|
|
}
|
|
|
- JSONObject jsonObject2 = JSONObject.parseObject(json);
|
|
|
- jsonObject2.put("SubPrintTemplates",subTemplates);
|
|
|
- json = jsonObject2.toString();
|
|
|
+
|
|
|
+ jsonObject.put("SubPrintTemplates",subTemplates);
|
|
|
+
|
|
|
}else{
|
|
|
// 获取电子面单失败
|
|
|
LOGGER.error("{} 获取电子面单失败,原因:{}", orderId, "子订单数量异常");
|
|
|
}
|
|
|
}
|
|
|
/*子母单设置 end*/
|
|
|
+
|
|
|
+ // 替换母订单产品名称
|
|
|
+ jsonObject.put("PrintTemplate",jsonObject.get("PrintTemplate").toString().replace(uuid, goodName.toString()));
|
|
|
+ json = jsonObject.toString();
|
|
|
+
|
|
|
+ // 保存HTML
|
|
|
+ String filePath = request.getServletContext().getRealPath("/common/");
|
|
|
+ File dir = new File(filePath + File.separator + "send_order");
|
|
|
+ if (!dir.exists()) {
|
|
|
+ dir.mkdir();
|
|
|
+ }
|
|
|
+ File file = new File(dir.getAbsolutePath() + File.separator + orderId + ".txt");
|
|
|
+ if (!file.createNewFile()) {
|
|
|
+ return ResponseJson.getFAILURE().addResponseKeyValue("error", "创建文件失败");
|
|
|
+ }
|
|
|
+ FileWriter fileWriter = null;
|
|
|
+ try {
|
|
|
+ fileWriter = new FileWriter(file, false);
|
|
|
+ fileWriter.write(jsonObject.toString());
|
|
|
+ } catch (Exception e) {
|
|
|
+ LOGGER.error("", e);
|
|
|
+ } finally {
|
|
|
+ if (fileWriter != null) {
|
|
|
+ fileWriter.close();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
} else {
|
|
|
// 获取电子面单失败
|
|
|
LOGGER.error("{} 获取电子面单失败,原因:{}", orderId, jsonObject.get("Reason"));
|