From 2079c881f143d0e2b7b91758113546b4e55225d5 Mon Sep 17 00:00:00 2001
From: lsh <lsh@163.com>
Date: 星期二, 11 十一月 2025 17:14:41 +0800
Subject: [PATCH] *
---
src/main/java/com/zy/asrs/controller/OrderPakoutController.java | 154 ++++++++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 144 insertions(+), 10 deletions(-)
diff --git a/src/main/java/com/zy/asrs/controller/OrderPakoutController.java b/src/main/java/com/zy/asrs/controller/OrderPakoutController.java
index 851ec8f..2779d77 100644
--- a/src/main/java/com/zy/asrs/controller/OrderPakoutController.java
+++ b/src/main/java/com/zy/asrs/controller/OrderPakoutController.java
@@ -1,5 +1,6 @@
package com.zy.asrs.controller;
+import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
@@ -9,10 +10,16 @@
import com.core.exception.CoolException;
import com.zy.asrs.entity.*;
import com.zy.asrs.entity.param.OrderDomainParam;
+import com.zy.asrs.entity.param.QualityGroupListParam;
+import com.zy.asrs.entity.result.OrderPakoutDetailVo;
+import com.zy.asrs.entity.result.OrderPakoutMainVo;
import com.zy.asrs.entity.result.WrkTraceVo;
import com.zy.asrs.service.*;
+import com.zy.common.constant.MesConstant;
import com.zy.common.model.DetlDto;
+import com.zy.common.utils.HttpHandler;
import com.zy.common.web.BaseController;
+import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
@@ -20,6 +27,7 @@
import java.util.*;
+@Slf4j
@RestController
@RequestMapping("order/pakout")
public class OrderPakoutController extends BaseController {
@@ -42,6 +50,8 @@
private WrkMastService wrkMastService;
@Autowired
private WrkMastLogService wrkMastLogService;
+ @Autowired
+ private ApiLogService apiLogService;
@RequestMapping(value = "/order/nav/list/auth")
@ManagerAuth
@@ -81,8 +91,10 @@
EntityWrapper<OrderPakout> wrapper = new EntityWrapper<>();
excludeTrash(param);
convert(param, wrapper);
- if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));} else {
- wrapper.orderBy("settle").orderBy("create_time", false);
+ if (!Cools.isEmpty(orderByField)){
+ wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));
+ } else {
+ wrapper.orderBy("update_time", false);
}
wrapper.eq("status", 1);
return R.ok(orderService.selectPage(new Page<>(curr, limit), wrapper));
@@ -243,7 +255,7 @@
}
@RequestMapping(value = "/order/delete/auth")
- @ManagerAuth(memo = "鎵嬪姩鍒犻櫎璁㈠崟")
+ @ManagerAuth(memo = "鎵嬪姩鍒犻櫎璁″垝缁勮揣鍗�")
@Transactional
public R delete(@RequestParam Long orderId){
orderService.remove(orderId);
@@ -255,6 +267,14 @@
// throw new CoolException("鍒犻櫎璁㈠崟澶辫触");
// }
// orderDetlService.modifyStatus(orderId, 0);
+ return R.ok();
+ }
+
+ @RequestMapping(value = "/order/abandoned/auth")
+ @ManagerAuth(memo = "鎵嬪姩搴熷純璁″垝缁勮揣鍗�")
+ @Transactional
+ public R abandoned(@RequestParam Long orderId){
+ orderService.updateSettle(orderId,99L,getUserId());
return R.ok();
}
@@ -302,15 +322,129 @@
@RequestParam(required = false)String orderByField,
@RequestParam(required = false)String orderByType,
@RequestParam Map<String, Object> param){
- EntityWrapper<OrderPakout> wrapper = new EntityWrapper<>();
- excludeTrash(param);
- convert(param, wrapper);
- if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));} else {
- wrapper.orderBy("settle").orderBy("create_time", false);
+
+ try{
+ String itemName = null;
+ String cstmrName = null;
+ Integer settle = null;
+ Integer status = null;
+ Date modiTimeStart = null, modiTimeEnd = null;
+ for (Map.Entry<String, Object> entry : param.entrySet()) {
+ String val = String.valueOf(entry.getValue());
+ if (Cools.isEmpty(val)) {
+ continue;
+ }
+ if (val.contains(RANGE_TIME_LINK)) {
+ String[] dates = val.split(RANGE_TIME_LINK);
+ modiTimeStart = DateUtils.convert(dates[0]);
+ modiTimeEnd = DateUtils.convert(dates[1]);
+ } else if (entry.getKey().equals("settle")) {
+ settle = Integer.parseInt(val);
+ } else if (entry.getKey().equals("status")) {
+ status = Integer.parseInt(val);
+ }
+// else if (entry.getKey().equals("order_no")) {
+// orderNo = val;
+// }
+ else if (entry.getKey().equals("item_name")) {
+ itemName = val;
+ } else if (entry.getKey().equals("cstmr_name")) {
+ cstmrName = val;
+ }
+ }
+ List<OrderPakoutMainVo> orderPakoutMainVos = orderService.selectOrderPakoutMainVoList(itemName, cstmrName, settle, status, modiTimeStart, modiTimeEnd, curr, limit);
+ Page<OrderPakoutMainVo> page = new Page<OrderPakoutMainVo>(curr, limit).setRecords(orderPakoutMainVos);
+ page.setTotal(orderService.selectOrderPakoutMainVoListTotal(itemName, cstmrName, settle, status, modiTimeStart, modiTimeEnd));
+ return R.ok(page);
+ } catch (Exception e){
+
}
- wrapper.eq("status", 1);
- return R.ok(orderService.selectPage(new Page<>(curr, limit), wrapper));
+ return R.error();
}
+
+ @RequestMapping(value = "/actual/shipment/order/report/auth")
+ @ManagerAuth(memo = "涓婃姤MES瀹為檯缁勮揣鍗�")
+ public R actualShipmentOrder(@RequestParam String itemName) {
+ Long userId = null;
+ try {
+ userId = getUserId();
+ if (Cools.isEmpty(userId)) {
+ return R.error("鐢ㄦ埛寮傚父").add("鐢ㄦ埛寮傚父");
+ }
+ } catch (Exception e){
+ return R.error("鐢ㄦ埛寮傚父").add("鐢ㄦ埛寮傚父");
+ }
+ List<OrderPakoutDetailVo> OrderPakoutDetailVoList = orderDetlService.selectOrderPakoutDetailVoListV1(itemName);
+ if (OrderPakoutDetailVoList.isEmpty()) {
+ return R.error("涓婃姤鏄庣粏涓虹┖锛侊紒锛�").add("涓婃姤鏄庣粏涓虹┖锛侊紒锛�");
+ }
+ List<String> boxList = new ArrayList<>();
+ List<String> rollList = new ArrayList<>();
+ for (OrderPakoutDetailVo orderDetl : OrderPakoutDetailVoList){
+ if (!boxList.contains(orderDetl.getBatch())){
+ boxList.add(orderDetl.getBatch());
+ }
+ if (!rollList.contains(orderDetl.getModel())){
+ rollList.add(orderDetl.getModel());
+ }
+ }
+ String box = String.join(",", boxList);
+ String roll = String.join(",", rollList);
+
+ QualityGroupListParam qualityGroupListParam = new QualityGroupListParam(itemName,box,roll);
+
+
+
+ String response = "";
+ boolean success = false;
+ try {
+ response = new HttpHandler.Builder()
+ .setUri(MesConstant.URL)
+ .setPath(MesConstant.PAKIN_URL)
+ .setJson(JSON.toJSONString(qualityGroupListParam))
+ .build()
+ .doPost();
+ JSONObject jsonObject = JSON.parseObject(response);
+ if (jsonObject.getBoolean("state")) {
+ success = true;
+ // 淇敼璁㈠崟鐘舵�� 4.瀹屾垚 ===>> 16.宸蹭笂鎶�
+ if (!orderService.updateItemName(itemName, 16L, userId)) {
+// throw new CoolException("鏈嶅姟鍣ㄥ唴閮ㄩ敊璇紝璇疯仈绯荤鐞嗗憳");
+ log.error("缁勮揣鍗曟洿鏂扮姸鎬佸け璐�!!!缁勮揣鍗曞彿"+itemName+".updateItemName");
+ } else {
+ return R.ok();
+ }
+ } else {
+ // 淇敼璁㈠崟鐘舵�� 4.瀹屾垚 ===>> 17.宸蹭笂鎶�
+ if (!orderService.updateItemName(itemName, 17L, userId)) {
+// throw new CoolException("鏈嶅姟鍣ㄥ唴閮ㄩ敊璇紝璇疯仈绯荤鐞嗗憳");
+ log.error("缁勮揣鍗曟洿鏂扮姸鎬佸け璐�!!!缁勮揣鍗曞彿"+itemName+".updateItemName");
+ }
+ log.error("璇锋眰鎺ュ彛澶辫触锛侊紒锛乽rl锛歿}锛況equest锛歿}锛況esponse锛歿}", MesConstant.URL+MesConstant.PAKIN_URL, JSON.toJSONString(qualityGroupListParam), response);
+ }
+ return R.error("涓婃姤mes绯荤粺澶辫触").add("涓婃姤mes绯荤粺澶辫触");
+ } catch (Exception e) {
+ // 淇敼璁㈠崟鐘舵�� 4.瀹屾垚 ===>> 17.宸蹭笂鎶�
+ if (!orderService.updateItemName(itemName, 17L, userId)) {
+ log.error("缁勮揣鍗曟洿鏂扮姸鎬佸け璐�!!!缁勮揣鍗曞彿"+itemName+".updateItemName");
+ }
+ log.error("fail", e);
+ } finally {
+ try {
+ // 淇濆瓨鎺ュ彛鏃ュ織
+ apiLogService.save(
+ "涓婃姤MES瀹為檯缁勮揣鍗�",
+ MesConstant.URL + MesConstant.PAKIN_URL,
+ null,
+ "127.0.0.1",
+ JSON.toJSONString(qualityGroupListParam),
+ response,
+ success
+ );
+ } catch (Exception e) { log.error("", e); }
+ }
+ return R.error("涓婃姤澶辫触").add("涓婃姤澶辫触");
+ }
}
--
Gitblit v1.9.1