From 42bb7c4d621ce4ebe1c1d12203bf874f0b0b296e Mon Sep 17 00:00:00 2001
From: Administrator <1051256694@qq.com>
Date: 星期五, 24 四月 2026 14:37:20 +0800
Subject: [PATCH] 电视机入库托数修复
---
src/main/java/com/zy/asrs/controller/OpenController.java | 471 +++++++++++++++++++++++++++++++++++++++++++++++++++-------
1 files changed, 415 insertions(+), 56 deletions(-)
diff --git a/src/main/java/com/zy/asrs/controller/OpenController.java b/src/main/java/com/zy/asrs/controller/OpenController.java
index b812841..f87265d 100644
--- a/src/main/java/com/zy/asrs/controller/OpenController.java
+++ b/src/main/java/com/zy/asrs/controller/OpenController.java
@@ -37,6 +37,7 @@
private static final boolean auth = true;
private static final String sign_arm_order = "|s|LABEL_";
private static final String sign_arm_sku = "|sku|LABEL_";
+ private static final long MILLIS_PER_MINUTE = 60L * 1000L;
public static final ArrayList<String> APP_KEY_LIST = new ArrayList<String>() {{
add("ea1f0459efc02a79f046f982767939ae");
}};
@@ -57,12 +58,9 @@
private MatService matService;
@Autowired
- private ReportQueryMapper reportQueryMapper;
- @Autowired
- private WorkService workService;
-
- @Autowired
private LocMastService locMastService;
+ @Autowired
+ private ReportQueryMapper reportQueryMapper;
// @PostMapping("/order/matSync/default/v1")
//// @AppAuth(memo = "鍟嗗搧淇℃伅鍚屾鎺ュ彛")
// public synchronized R syncMatInfo(@RequestHeader(required = false) String appkey,
@@ -128,6 +126,23 @@
return R.ok().add(openService.pakinOrderComplete(param));
}
+ /**
+ * 鎵樼洏鍏ュ簱鍘嗗彶璁板綍閲嶆姤ERP
+ */
+ @PostMapping("/order/pakin/erp/report/v1")
+// @AppAuth(memo = "鍏ュ簱鍘嗗彶閲嶆姤ERP")
+ public synchronized R reportPakinHistoryToErp(@RequestBody(required = false) List<String> barcodes) {
+// auth(appkey, barcodes, request);
+ if (Cools.isEmpty(barcodes)) {
+ return R.parse(BaseRes.PARAM);
+ }
+ try {
+ return openService.reportPakinHistoryToErp(barcodes);
+ } catch (Exception e) {
+ return R.error(e.getMessage());
+ }
+ }
+
@@ -156,6 +171,7 @@
private void auth(String appkey, Object obj, HttpServletRequest request) {
log.info("{}鎺ュ彛琚闂紱appkey:{}锛涜姹傛暟鎹細{}", "open/sensorType/list/auth/v1", appkey, JSON.toJSONString(obj));
+ log.info("[auth] cache: {}", obj == null ? "null" : JSON.toJSONString(obj));
request.setAttribute("cache", obj);
if (!auth) {
return;
@@ -214,8 +230,8 @@
@PostMapping("/arm/task/v1")
@AppAuth(memo = "鍒嗘嫞绾夸笂鎶ユ帴鏀�")
public synchronized R TaskArmReport(@RequestHeader(required = false) String appkey,
- @RequestBody TaskArmReportParam param,
- HttpServletRequest request) {
+ @RequestBody TaskArmReportParam param,
+ HttpServletRequest request) {
auth(appkey, param, request);
if (Cools.isEmpty(param)) {
return R.parse(BaseRes.PARAM);
@@ -259,8 +275,8 @@
@PostMapping("/arm/task/cycle_result")
@AppAuth(memo = "鍗曠爜瀹屾垚")
public synchronized R TaskArmCycleResult(@RequestHeader(required = false) String appkey,
- @RequestBody TaskArmCycleResultParam param,
- HttpServletRequest request) {
+ @RequestBody TaskArmCycleResultParam param,
+ HttpServletRequest request) {
auth(appkey, param, request);
if (Cools.isEmpty(param)) {
return R.parse(BaseRes.PARAM);
@@ -291,8 +307,8 @@
@PostMapping("/arm/task/workspace_status")
@AppAuth(memo = "鎵樼洏瀹屾垚")
public synchronized R TaskArmWorkspaceStatus(@RequestHeader(required = false) String appkey,
- @RequestBody TaskArmWorkspaceStatusParam param,
- HttpServletRequest request) {
+ @RequestBody TaskArmWorkspaceStatusParam param,
+ HttpServletRequest request) {
auth(appkey, param, request);
if (Cools.isEmpty(param)) {
return R.parse(BaseRes.PARAM);
@@ -324,8 +340,8 @@
@PostMapping("/arm/task/loc_status")
// @AppAuth(memo = "鎵樼洏灏辩华鐘舵�佹煡璇�")
public synchronized R TaskArmLocStatus(@RequestHeader(required = false) String appkey,
- @RequestBody ArmOKParam param,
- HttpServletRequest request) {
+ @RequestBody ArmOKParam param,
+ HttpServletRequest request) {
auth(appkey, param, request);
if (Cools.isEmpty(param)) {
return R.parse(BaseRes.PARAM);
@@ -351,8 +367,8 @@
@PostMapping("/armAbnormalOperation")
// @AppAuth(memo = "寮傚父涓婃姤")
public synchronized R ArmAbnormalOperation(@RequestHeader(required = false) String appkey,
- @RequestBody TaskArmErrorParam param,
- HttpServletRequest request) {
+ @RequestBody TaskArmErrorParam param,
+ HttpServletRequest request) {
auth(appkey, param, request);
if (Cools.isEmpty(param.getArm_no())) {
return R.error("鏈烘鑷傜紪鍙穂Arm_no]涓嶈兘涓虹┖");
@@ -401,8 +417,12 @@
@PostMapping("/order/matSync/default/v2")
// @AppAuth(memo = "鍟嗗搧淇℃伅鍚屾鎺ュ彛")
- public synchronized R syncMatInfoV2(@RequestBody(required = false) List<MatSyncParam.MatParam> param){
-
+ public synchronized R syncMatInfoV2(@RequestBody(required = false) List<MatSyncParam.MatParam> param,
+ HttpServletRequest request) {
+ if (request != null) {
+ log.info("[syncMatInfoV2] cache: {}", param == null ? "null" : JSON.toJSONString(param));
+ request.setAttribute("cache", param);
+ }
System.out.println(param);
if (Cools.isEmpty(param)) {
return R.parse(BaseRes.PARAM);
@@ -427,16 +447,44 @@
* return
*/
@PostMapping("/station/all")
- public synchronized R stationAll(){
+ public synchronized R stationAll(HttpServletRequest request) {
+ if (request != null) {
+ String cachePayload = JSON.toJSONString(Collections.singletonMap("op", "stationAll"));
+ log.info("[stationAll] cache: {}", cachePayload);
+ request.setAttribute("cache", cachePayload);
+ }
return openService.stationAll();
}
/**
- * 缁勬墭淇℃伅涓嬪彂
- * return
+ * 7.3 缁勬墭淇℃伅涓嬪彂
*/
@PostMapping("/comb/auth")
- public synchronized R comb(@RequestBody ArrayList<MesToCombParam> param){
+ public synchronized R comb(@RequestBody ArrayList<MesToCombParam> param, HttpServletRequest request) {
+ if (request != null) {
+ log.info("[comb] cache: {}", param == null ? "null" : JSON.toJSONString(param));
+ request.setAttribute("cache", param);
+ }
+
+ if (Cools.isEmpty(param)) {
+ return R.error("娌℃湁鍏ュ簱鏁版嵁");
+ }
+ boolean boo =false;
+ for (MesToCombParam mesToCombParam : param) {
+ if (mesToCombParam.getOperateType()==2){
+ int countLoc = locDetlService.selectCount(new EntityWrapper<LocDetl>().eq("zpallet", mesToCombParam.getPalletId()));
+ int countWrk = wrkDetlService.selectCount(new EntityWrapper<WrkDetl>().eq("zpallet", mesToCombParam.getPalletId()));
+ int countwait = waitPakinService.selectCount(new EntityWrapper<WaitPakin>().eq("zpallet",mesToCombParam.getPalletId()).eq("io_status", "Y"));
+ if (countLoc > 0 || countWrk > 0 || countwait > 0) {
+ return R.error(mesToCombParam.getPalletId()+"-宸ヤ綔妗�/搴撳瓨鏉$爜鏁版嵁宸插瓨鍦�,鏃犳硶鍒犻櫎");
+ }
+ waitPakinService.delete(new EntityWrapper<WaitPakin>().eq("zpallet",mesToCombParam.getPalletId()));
+ boo = true;
+ }
+ }
+ if (boo){
+ return R.ok();
+ }
List<MesToCombParam> errorComb = Lists.newArrayList();
List<MesToCombParam> validComb = Lists.newArrayList();
for (MesToCombParam mesToCombParam : param) {
@@ -476,21 +524,79 @@
}
/**
- * 鍑哄簱閫氱煡鍗�
+ * 7.11 鍑哄簱閫氱煡鍗曪紙浼犻�掓湁搴忔棤搴忚鍒欙級
*/
-
@PostMapping("/outOrder")
- public synchronized R outOrder (@RequestBody ArrayList<OutTaskParam> params){
+ public synchronized R outOrder(@RequestBody ArrayList<OutTaskParam> params, HttpServletRequest request) {
+ int count = params.size();
if (Cools.isEmpty(params)) {
return R.error("璇锋眰鍙傛暟涓嶈兘涓虹┖");
}
- Set<String> orderIds = new LinkedHashSet<>();
+ log.info("[outOrder] cache: {}", JSON.toJSONString(params));
+ request.setAttribute("cache", params);
+ Map<String, List<OutTaskParam>> linesByBatchSeq = new LinkedHashMap<>();
for (OutTaskParam outTaskParam : params) {
if (Cools.isEmpty(outTaskParam) || Cools.isEmpty(outTaskParam.getOrderId())) {
return R.error("鍑哄簱鍗曞彿涓嶈兘涓虹┖");
}
- orderIds.add(outTaskParam.getOrderId());
+ if (Cools.isEmpty(outTaskParam.getBatchSeq())) {
+ outTaskParam.setBatchSeq(outTaskParam.getOrderId());
+ }
+ if (Cools.isEmpty(outTaskParam.getStationId())) {
+ return R.error("鎵樼洏銆�" + outTaskParam.getPalletId() + "銆嶅嚭搴撳彛缂栫爜涓嶈兘涓虹┖");
+ }
+ linesByBatchSeq.computeIfAbsent(outTaskParam.getBatchSeq(), k -> new ArrayList<>()).add(outTaskParam);
}
+
+ for (Map.Entry<String, List<OutTaskParam>> entry : linesByBatchSeq.entrySet()) {
+ List<OutTaskParam> lines = entry.getValue();
+ OutTaskParam head = lines.get(0);
+ String oid = head.getOrderId();
+ String batchSeq = head.getBatchSeq();
+ boolean hasZero = false;
+ boolean hasPositive = false;
+ List<Integer> orderedSeqs = new ArrayList<>(lines.size());
+ for (OutTaskParam line : lines) {
+ if (line.getSeq() == null) {
+ return R.error("鍑哄簱鍗曘��" + oid + "銆嶆壒娆°��" + batchSeq + "銆嶅簭鍙蜂笉鑳戒负绌�");
+ }
+ if (line.getSeq() < 0) {
+ return R.error("鍑哄簱鍗曘��" + oid + "銆嶆壒娆°��" + batchSeq + "銆嶅簭鍙蜂笉鑳藉皬浜�0");
+ }
+ if (line.getSeq() == 0) {
+ hasZero = true;
+ } else {
+ hasPositive = true;
+ orderedSeqs.add(line.getSeq());
+ }
+ }
+ if (hasZero && hasPositive) {
+ return R.error("鍑哄簱鍗曘��" + oid + "銆嶆壒娆°��" + batchSeq + "銆嶅簭鍙蜂笉鑳芥贩鐢ㄦ棤搴忓拰鏈夊簭");
+ }
+ if (!hasZero) {
+ Collections.sort(orderedSeqs);
+ for (int i = 0; i < orderedSeqs.size(); i++) {
+ if (!Objects.equals(orderedSeqs.get(i), i + 1)) {
+ return R.error("鍑哄簱鍗曘��" + oid + "銆嶆壒娆°��" + batchSeq + "銆嶅簭鍙蜂笉杩炶疮");
+ }
+ }
+ }
+ }
+
+ List<OutTaskParam> groupedParams = new ArrayList<>(params.size());
+ for (List<OutTaskParam> lines : linesByBatchSeq.values()) {
+ groupedParams.addAll(lines);
+ }
+
+ Set<String> seenPallet = new LinkedHashSet<>();
+ for (OutTaskParam outTaskParam : groupedParams) {
+ String pid = outTaskParam.getPalletId();
+ String palletKey = pid == null ? "" : pid;
+ if (!seenPallet.add(palletKey)) {
+ return R.error("鎵樼洏鍙烽噸澶嶏細" + (Cools.isEmpty(pid) ? "锛堢┖锛�" : pid));
+ }
+ }
+
// if (!orderIds.isEmpty()) {
// Set<String> existedOrderIds = new LinkedHashSet<>();
// List<WrkMast> wrkMasts = wrkMastService.selectList(new EntityWrapper<WrkMast>().in("user_no", orderIds));
@@ -510,54 +616,102 @@
// }
// }
- List<OutTaskParam> errorOutOrders = Lists.newArrayList();
- List<OutTaskParam> validOutOrders = Lists.newArrayList();
- for (OutTaskParam outTaskParam : params) {
- // TODO:寰呮脯瑭︼紝鏍¢搴瓨淇℃伅锛屼笉瀛樺湪鍓囪繑鍥�
+ List<OutTaskParam> missingStock = Lists.newArrayList();
+ List<OutTaskParam> missingLoc = Lists.newArrayList();
+ for (OutTaskParam outTaskParam : groupedParams) {
int countLoc = locDetlService.selectCount(new EntityWrapper<LocDetl>().eq("zpallet", outTaskParam.getPalletId()));
- if (countLoc == 0){
- errorOutOrders.add(outTaskParam);
+ if (countLoc == 0) {
+ missingStock.add(outTaskParam);
continue;
}
- validOutOrders.add(outTaskParam);
- }
- for (OutTaskParam outTaskParam : validOutOrders) {
LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_sts", "F").eq("barcode", outTaskParam.getPalletId()));
if (locMast == null) {
- throw new CoolException("娌℃湁鎵惧埌鎵樼洏鐮�=" + outTaskParam.getPalletId() + "瀵瑰簲鐨勫簱浣�");
+ missingLoc.add(outTaskParam);
}
}
-
- for (OutTaskParam outTaskParam : validOutOrders) {
- R r = openService.outOrder(outTaskParam,validOutOrders.size());
- if (!r.get("code").equals(200)){
- return r;
+ if (!missingStock.isEmpty()) {
+ List<String> missingPalletIds = new ArrayList<>(missingStock.size());
+ for (OutTaskParam p : missingStock) {
+ String pid = p.getPalletId();
+ missingPalletIds.add(Cools.isEmpty(pid) ? "锛堢┖锛�" : pid);
}
+ return R.error("搴撳瓨涓笉瀛樺湪璇ユ墭鐩橈細" + String.join("锛�", missingPalletIds)).add(missingStock);
+ }
+ if (!missingLoc.isEmpty()) {
+ List<String> badPalletIds = new ArrayList<>(missingLoc.size());
+ for (OutTaskParam p : missingLoc) {
+ String pid = p.getPalletId();
+ badPalletIds.add(Cools.isEmpty(pid) ? "锛堢┖锛�" : pid);
+ }
+ return R.error("娌℃湁鎵惧埌鎵樼洏鐮佸搴斿簱浣嶏細" + String.join("锛�", badPalletIds)).add(missingLoc);
}
- if(errorOutOrders.size() > 0) {
- return R.error("搴撳瓨涓笉瀛樺湪璇ユ墭鐩�").add(errorOutOrders);
- }
+ return openService.outOrderBatch(linesByBatchSeq,count);
+ }
- return R.ok();
+ /**
+ * 7.9 鍑哄簱寮傚父鍙樺姩涓婃姤
+ */
+ @PostMapping("/order/pakout/abnormal/report/v1")
+ public synchronized R outOrderAbnormalReport(@RequestBody OutOrderAbnormalReportParam param, HttpServletRequest request) {
+ if (request != null) {
+ log.info("[outOrderAbnormalReport] cache: {}", param == null ? "null" : JSON.toJSONString(param));
+ request.setAttribute("cache", param);
+ }
+ if (Cools.isEmpty(param) || Cools.isEmpty(param.getPalletId())) {
+ return R.error("palletId涓嶈兘涓虹┖");
+ }
+ return openService.outOrderAbnormalReport(param);
+ }
+
+ /**
+ * 7.10 鍑哄簱寮傚父鍙樺姩澶勭悊
+ */
+ @PostMapping("/order/pakout/abnormal/handle/v1")
+ public synchronized R outOrderAbnormalHandle(@RequestBody OutOrderAbnormalHandleParam param, HttpServletRequest request) {
+ if (request != null) {
+ log.info("[outOrderAbnormalHandle] cache: {}", param == null ? "null" : JSON.toJSONString(param));
+ request.setAttribute("cache", param);
+ }
+ if (Cools.isEmpty(param) || Cools.isEmpty(param.getPalletId())) {
+ return R.error("palletId涓嶈兘涓虹┖");
+ }
+ return openService.outOrderAbnormalHandle(param);
}
/**
* pause out order
*/
@PostMapping("/order/pakout/pause/default/v1")
- public synchronized R pakoutOrderPause(@RequestBody OpenOrderPakoutPauseParam param){
+ public synchronized R pakoutOrderPause(@RequestBody OpenOrderPakoutPauseParam param, HttpServletRequest request) {
+ if (request != null) {
+ log.info("[pakoutOrderPause] cache: {}", param == null ? "null" : JSON.toJSONString(param));
+ request.setAttribute("cache", param);
+ }
if (Cools.isEmpty(param) || Cools.isEmpty(param.getOrderId())) {
return R.error("orderNo is empty");
}
return openService.pakoutOrderPause(param);
}
+ private String buildOutOrderBatchKey(OutTaskParam param) {
+ return param.getOrderId() + "#" + param.getBatchSeq();
+ }
+
+ /**
+ * 鎺ㄨ崘鍑哄簱绔欑偣
+ */
+ @PostMapping("/pakoutStaNo")
+ public synchronized R pakoutStaNo(@RequestBody List<String> barcodes) {
+ String StaNo = "1,2,3,4,5";
+ return R.ok().add(StaNo);
+ }
+
/*************************************鐢佃鏈虹▼搴�***********************************************/
@GetMapping("/locDetl/statistics")
- public R locDetlStatistics(){
+ public synchronized R locDetlStatistics(){
HashMap<String, Object> param = new HashMap<>();
Page<LocDetl> stockStatis = locDetlService.getStockStatis(toPage(1, 100, param, LocDetl.class));
for (LocDetl locDetl : stockStatis.getRecords()) {
@@ -570,15 +724,15 @@
}
@GetMapping("/line/charts")
- public R locIoLineCharts(){
+ public synchronized R locIoLineCharts(){
Map<String,Object> map=new HashMap<String, Object>();
List<AxisBean> list = new ArrayList<AxisBean>();
List<WorkChartAxis> listChart = reportQueryMapper.getChartAxis();
if(listChart!=null) {
- ArrayList<Integer> data1 = new ArrayList<Integer>();
- ArrayList<Integer> data2 = new ArrayList<Integer>();
+ ArrayList<Number> data1 = new ArrayList<Number>();
+ ArrayList<Number> data2 = new ArrayList<Number>();
SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
Calendar calendar = Calendar.getInstance();
@@ -601,17 +755,150 @@
}
}
AxisBean inqty = new AxisBean();
- inqty.setName("鍏ュ簱鏁伴噺");
- Integer[] array1 = new Integer[data1.size()];
+ inqty.setName("鍏ュ簱鎵樼洏鏁�");
+ Number[] array1 = new Number[data1.size()];
inqty.setData(data1.toArray(array1));
list.add(inqty);
AxisBean outqty = new AxisBean();
- outqty.setName("鍑哄簱鏁伴噺");
- Integer[] array2 = new Integer[data2.size()];
+ outqty.setName("鍑哄簱鎵樼洏鏁�");
+ Number[] array2 = new Number[data2.size()];
outqty.setData(data2.toArray(array2));
list.add(outqty);
+
+ AxisBean teu= new AxisBean();
+ teu.setName("TEU");
+ List<WorkTeuTotalAxis> workTeuTotalAxes = reportQueryMapper.getteuTotal();
+ ArrayList<Number> data3 = new ArrayList<Number>();
+ for (WorkTeuTotalAxis w : workTeuTotalAxes) {
+ data3.add(w.getTeu_total());
+ }
+ Number[] array3 = new Number[data3.size()];
+ teu.setData(data3.toArray(array3));
+ list.add(teu);
+
+ AxisBean cube5 = new AxisBean();
+ cube5.setName("鍏ュ簱浣撶Н");
+ List<WorkCubeTotalAxis> workCubeTotalAxes = reportQueryMapper.getInboundCubeTotal();
+ Map<String, WorkCubeTotalAxis> cubeMap = new HashMap<String, WorkCubeTotalAxis>();
+ if (workCubeTotalAxes != null) {
+ for (WorkCubeTotalAxis w : workCubeTotalAxes) {
+ if (w.getYmd() != null) {
+ cubeMap.put(w.getYmd(), w);
+ }
+ }
+ }
+ ArrayList<Number> data4 = new ArrayList<Number>();
+ SimpleDateFormat sfCube = new SimpleDateFormat("yyyy-MM-dd");
+ Calendar calendarCube = Calendar.getInstance();
+ calendarCube.add(Calendar.DATE, -12);
+ for (int i = 0; i < 12; i++) {
+ calendarCube.add(Calendar.DATE, 1);
+ String str = sfCube.format(calendarCube.getTime());
+ WorkCubeTotalAxis cubeAxis = cubeMap.get(str);
+ data4.add(cubeAxis == null || cubeAxis.getCube5Total() == null ? 0 : cubeAxis.getCube5Total());
+ }
+ Number[] array4 = new Number[data4.size()];
+ cube5.setData(data4.toArray(array4));
+ list.add(cube5);
}
map.put("rows",list);
+ return R.ok(map);
+ }
+
+ /**
+ * 鍏ュ嚭搴撴寜灏忔椂鎶樼嚎锛氭í杞翠负銆屽綋鍓嶆暣鐐硅捣鍚戝墠鍏� 12 灏忔椂銆嶆粴鍔ㄧ獥鍙o紝涓庡簱琛� ymd锛坹yyy-MM-dd HH锛夊榻�
+ */
+ @GetMapping("/line/charts/hourly")
+ public synchronized R locIoLineChartsHourly() {
+ Map<String, Object> map = new HashMap<>();
+ List<AxisBean> list = new ArrayList<>();
+
+ List<WorkChartAxis> listChart = reportQueryMapper.getChartAxisHourly();
+ if (listChart == null) {
+ listChart = Collections.emptyList();
+ }
+
+ ArrayList<Integer> data1 = new ArrayList<>();
+ ArrayList<Integer> data2 = new ArrayList<>();
+ ArrayList<Double> data3 = new ArrayList<>();
+ ArrayList<Double> data4 = new ArrayList<>();
+ ArrayList<Double> data5 = new ArrayList<>();
+ List<String> categories = new ArrayList<>();
+
+ final int n = 12;
+ SimpleDateFormat sfKey = new SimpleDateFormat("yyyy-MM-dd HH");
+ Calendar calendar = Calendar.getInstance();
+ calendar.set(Calendar.MINUTE, 0);
+ calendar.set(Calendar.SECOND, 0);
+ calendar.set(Calendar.MILLISECOND, 0);
+ calendar.add(Calendar.HOUR_OF_DAY, -(n - 1));
+
+ for (int i = 0; i < n; i++) {
+ String key = sfKey.format(calendar.getTime());
+ categories.add(String.valueOf(calendar.get(Calendar.HOUR_OF_DAY)));
+
+ int inV = 0;
+ int outV = 0;
+ double inC = 0;
+ double outC = 0;
+ double outD = 0;
+ for (WorkChartAxis w : listChart) {
+ if (w.getYmd() != null && key.equals(w.getYmd().trim())) {
+ inV = w.getInqty();
+ outV = w.getOutqty();
+ inC = w.getCubeInqty();
+ outC = w.getCubeOutqty();
+ outD = w.getOutTeu();
+ break;
+ }
+ }
+ data1.add(inV);
+ data2.add(outV);
+ data3.add(inC);
+ data4.add(outC);
+ data5.add(outD);
+ calendar.add(Calendar.HOUR_OF_DAY, 1);
+ }
+
+ AxisBean inqty = new AxisBean();
+ inqty.setName("鍏ュ簱鎵樼洏鏁�");
+ Integer[] array1 = new Integer[data1.size()];
+ inqty.setData(data1.toArray(array1));
+ list.add(inqty);
+
+ AxisBean outqty = new AxisBean();
+ outqty.setName("鍑哄簱鎵樼洏鏁�");
+ Integer[] array2 = new Integer[data2.size()];
+ outqty.setData(data2.toArray(array2));
+ list.add(outqty);
+
+ if (data3.size() >0) {
+ AxisBean cubeInqty = new AxisBean();
+ cubeInqty.setName("鍏ュ簱浣撶Н");
+ Double [] array3 = new Double[data3.size()];
+ cubeInqty.setData(data3.toArray(array3));
+ list.add(cubeInqty);
+ }
+
+ if (data4.size() >0) {
+ AxisBean cubeOutqty = new AxisBean();
+ cubeOutqty.setName("鍑哄簱浣撶Н");
+ Double[] array4 = new Double[data4.size()];
+ cubeOutqty.setData(data4.toArray(array4));
+ list.add(cubeOutqty);
+ }
+
+ if (data5.size() >0) {
+ AxisBean cubeOutqty = new AxisBean();
+ cubeOutqty.setName("鍑哄簱TEU");
+ Double[] array5 = new Double[data4.size()];
+ cubeOutqty.setData(data5.toArray(array5));
+ list.add(cubeOutqty);
+ }
+
+
+ map.put("categories", categories);
+ map.put("rows", list);
return R.ok(map);
}
@@ -646,7 +933,8 @@
}
// 鎬诲簱浣嶆暟
- Integer total = (int) Arith.add(0, locUseRate.getFqty(), locUseRate.getOqty(), locUseRate.getUqty(), locUseRate.getXqty());
+ Integer total1 = (int) Arith.add(0, locUseRate.getFqty(), locUseRate.getOqty(), locUseRate.getUqty(), locUseRate.getXqty());
+ Integer total = total1>40000?6528:total1;
// 浣跨敤涓�
Integer used = locUseRate.getFqty() + locUseRate.getUqty();
// 搴撲綅浣跨敤鐜�
@@ -668,7 +956,11 @@
* 浠诲姟鏌ヨ鎺ュ彛
*/
@PostMapping("/queryTask")
- public synchronized R queryTask(@RequestBody QueryTaskParam param) {
+ public synchronized R queryTask(@RequestBody QueryTaskParam param, HttpServletRequest request) {
+ if (request != null) {
+ log.info("[queryTask] cache: {}", param == null ? "null" : JSON.toJSONString(param));
+ request.setAttribute("cache", param);
+ }
if (Cools.isEmpty(param)) {
return R.parse(BaseRes.PARAM);
}
@@ -686,7 +978,74 @@
map.put("taskNo", param.getTaskNo());
map.put("ioType", wrkMast.getIoType());
map.put("wrkDetls", wrkDetls);
+ Integer count = 0;
+ String supp = "";
+ //璇ヨ鍗曠疮璁″叆鍑哄簱浠舵暟
+ Integer ioType = wrkMast.getIoType();
+ Integer suppCount = 0;
+ Integer sum = 0;
+ if (ioType != null && ioType < 100) {
+ supp = String.valueOf(resolveInboundSupp(wrkMast));
+ map.put("supp", supp);
+ }else {
+ String[] split = wrkDetls.get(0).getSupp().split("/");
+ if (split != null && split.length > 0) {
+ sum = Integer.valueOf(split[split.length - 1]);
+ }else {
+ sum = Integer.valueOf(wrkDetls.get(0).getSupp());
+ }
+ List<WrkMast> userNo = wrkMastService.selectList(new EntityWrapper<WrkMast>().eq("user_no", wrkMast.getUserNo()).in("wrk_sts",11,12,21,22,25));
+ suppCount = sum - userNo.size()+1;
+ map.put("supp", suppCount + "/" + sum);
+ }
+
+ //鑰楁椂
+ Long costTime = resolveCostTime(wrkMast);
+ map.put("costTime", String.valueOf(costTime));
+
return R.ok().add(map);
}
+
+ Long resolveCostTime(WrkMast wrkMast) {
+ return resolveCostTime(wrkMast, new Date());
+ }
+
+ Long resolveCostTime(WrkMast wrkMast, Date now) {
+ if (wrkMast == null || wrkMast.getIoType() == null) {
+ return 0L;
+ }
+ if (wrkMast.getIoType() < 100) {
+ if (Cools.isEmpty(wrkMast.getTrainNo())) {
+ return 0L;
+ }
+ return minutesBetween(wrkMastService.firstInboundCreateTimeByTrainNo(wrkMast.getTrainNo()), resolveTaskCreateTime(wrkMast));
+ }
+ return minutesBetween(resolveTaskCreateTime(wrkMast), now);
+ }
+
+ int resolveInboundSupp(WrkMast wrkMast) {
+ if (wrkMast == null || wrkMast.getIoType() == null || wrkMast.getIoType() >= 100 || Cools.isEmpty(wrkMast.getTrainNo())) {
+ return 0;
+ }
+ return wrkMastService.finishedInboundPalletCountByTrainNo(wrkMast.getTrainNo());
+ }
+
+ private Date resolveTaskCreateTime(WrkMast wrkMast) {
+ if (wrkMast == null) {
+ return null;
+ }
+ return wrkMast.getAppeTime() == null ? wrkMast.getIoTime() : wrkMast.getAppeTime();
+ }
+
+ private Long minutesBetween(Date startTime, Date endTime) {
+ if (startTime == null || endTime == null) {
+ return 0L;
+ }
+ long diff = endTime.getTime() - startTime.getTime();
+ if (diff <= 0) {
+ return 0L;
+ }
+ return diff / MILLIS_PER_MINUTE;
+ }
}
--
Gitblit v1.9.1