From 8aaf98abf54109252764f9c7f8bd5bf28c073241 Mon Sep 17 00:00:00 2001
From: zwl <1051256694@qq.com>
Date: 星期一, 27 十月 2025 09:19:53 +0800
Subject: [PATCH] 更换批号
---
src/main/java/com/zy/asrs/controller/MobileController.java | 821 ++++++++++++++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 768 insertions(+), 53 deletions(-)
diff --git a/src/main/java/com/zy/asrs/controller/MobileController.java b/src/main/java/com/zy/asrs/controller/MobileController.java
index 0b1729b..5eff674 100644
--- a/src/main/java/com/zy/asrs/controller/MobileController.java
+++ b/src/main/java/com/zy/asrs/controller/MobileController.java
@@ -1,35 +1,46 @@
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;
+import com.baomidou.mybatisplus.plugins.Page;
import com.core.annotations.ManagerAuth;
import com.core.common.BaseRes;
import com.core.common.Cools;
import com.core.common.R;
-import com.core.exception.CoolException;
import com.zy.asrs.entity.*;
import com.zy.asrs.entity.param.CombParam;
import com.zy.asrs.entity.param.MobileAdjustParam;
+import com.zy.asrs.entity.param.OffSaleParam;
import com.zy.asrs.entity.result.MobileAdjustResult;
+import com.zy.asrs.mapper.ManLocDetlMapper;
import com.zy.asrs.service.*;
-import com.zy.common.model.LocDto;
-import com.zy.common.model.TaskDto;
+import com.zy.asrs.service.impl.MatServiceImpl;
import com.zy.common.model.WrkDto;
+import com.zy.common.utils.HttpHandler;
import com.zy.common.web.BaseController;
+import com.zy.system.entity.Config;
+import com.zy.system.service.ConfigService;
+import com.zy.third.entity.ExdvYanbu;
+import com.zy.third.mapper.ExdMaterialMapper;
+import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
+import javax.annotation.Resource;
+import java.text.SimpleDateFormat;
import java.util.*;
/**
* 绉诲姩绔帴鍙f帶鍒跺櫒
* Created by vincent on 2020/6/10
*/
+@Slf4j
@RestController
@RequestMapping("mobile")
-public class MobileController extends BaseController {
+public class MobileController extends BaseController {
@Autowired
private MobileService mobileService;
@@ -51,6 +62,45 @@
private BasDevpService basDevpService;
@Autowired
private PackService packService;
+ @Autowired
+ private ManLocDetlMapper manLocDetlMapper;
+
+ @Autowired
+ private ApiLogService apiLogService;
+
+ @Resource
+ private StaDescService staDescService;
+
+ @Value("${rcs.address.URL}")
+ private String url;
+ @Value("${rcs.address.reportTask}")
+ private String attrcs;
+ @Value("${rcs.address.siteBindAndUnbing}")
+ private String siteBindAndUnbing;
+ @Autowired
+ private ConfigService configService;
+
+ @Autowired
+ private ExdMaterialMapper exdMaterialMapper;
+ @Autowired
+ private MatServiceImpl matService;
+
+ // 鍟嗗搧涓婃灦
+ @RequestMapping("/mat/onSale/auth")
+ @ManagerAuth
+ public R matOnSale(@RequestBody CombParam combParam) {
+ mobileService.onSale(combParam);
+ return R.ok("涓婃灦鎴愬姛");
+ }
+
+ // 鍟嗗搧涓嬫灦
+ @RequestMapping("/mat/offSale/auth")
+ //@ManagerAuth
+ public R matOffSale(@RequestBody OffSaleParam offSaleParam) {
+ mobileService.offSale(offSaleParam);
+ return R.ok("涓嬫灦鎴愬姛");
+ }
+
// 缁勬墭 ----------------------------------------------------------------------------------------------------
@@ -60,7 +110,7 @@
*/
@RequestMapping("/order/search/orderNo/auth")
@ManagerAuth
- public R orderSearchByBarcode(@RequestParam String orderNo){
+ public R orderSearchByBarcode(@RequestParam String orderNo) {
Order order = orderService.selectByNo(orderNo);
if (order == null) {
return R.ok();
@@ -81,14 +131,15 @@
@RequestMapping("/comb/auth")
@ManagerAuth(memo = "缁勬墭")
- public R comb(@RequestBody CombParam combParam){
- mobileService.comb(combParam, getUserId());
+ public R comb(@RequestBody CombParam combParam) {
+ log.info("缁勬墭鏁版嵁锛歿}", combParam.toString());
+ mobileService.comb(combParam, getUserId(), getUser().getEmail());
return R.ok("缁勬墭鎴愬姛");
}
@RequestMapping("/pack/get/auth")
@ManagerAuth
- public R packGet(@RequestParam String barcode){
+ public R packGet(@RequestParam String barcode) {
Pack pack = packService.selectByBarcode(barcode);
if (pack == null) {
return R.ok();
@@ -101,7 +152,7 @@
@RequestMapping("/pack/comb/auth")
@ManagerAuth(memo = "涓嬬嚎缁勬墭")
- public R packComb(@RequestBody CombParam combParam){
+ public R packComb(@RequestBody CombParam combParam) {
mobileService.packComb(combParam, getUserId());
return R.ok("缁勬墭鎴愬姛");
}
@@ -114,7 +165,7 @@
@Deprecated
public R pakoutQuery(@RequestParam(required = false) String barcode,
@RequestParam(required = false) Integer staNo,
- @RequestParam(required = false) String matnr){
+ @RequestParam(required = false) String matnr) {
if (Cools.isEmpty(barcode) && Cools.isEmpty(matnr)) {
return R.ok();
}
@@ -138,7 +189,7 @@
*/
@RequestMapping("/pakout/confirm/barcode/auth")
@ManagerAuth
- public R pakoutQueryByBarcode(@RequestParam(required = false) String barcode){
+ public R pakoutQueryByBarcode(@RequestParam(required = false) String barcode) {
if (Cools.isEmpty(barcode)) {
return R.ok();
}
@@ -152,13 +203,23 @@
return R.ok();
}
+ // 鏍规嵁搴撲綅鐮佸拰鍟嗗搧鐮佹悳绱㈠晢鍝�
+ @RequestMapping("/mat/find/auth")
+ public R find(@RequestParam(required = false) String locNo
+ , @RequestParam(required = false) String matnr) {
+ //List<ManLocDetl> manLocDetls = manLocDetlMapper.selectItem0(locNo, matnr);
+ ManLocDetl manLocDetl = manLocDetlMapper.selectLocNo0(locNo, matnr);
+ return R.ok(manLocDetl);
+ //return R.ok(manLocDetlMapper.selectItem0(locNo, matnr));
+ }
+
/**
* 鍑哄簱纭 - 鎷f枡鍑哄簱 - 閫夋嫨鍏蜂綋鏉$爜鍟嗗搧
*/
@RequestMapping("/pakout/confirm/pick/auth")
@ManagerAuth
public R pakoutQueryByBarcode(@RequestParam(required = false) Integer wrkNo
- , @RequestParam(required = false) String matnr){
+ , @RequestParam(required = false) String matnr) {
if (Cools.isEmpty(wrkNo)) {
return R.ok();
}
@@ -221,47 +282,39 @@
for (WrkDto dto : dtos) {
WrkMast wrkMast = wrkMastService.selectById(dto.getWrkNo());
if (wrkMast != null) {
- // 101
- if (wrkMast.getIoType() == 101) {
- for (WrkDetl wrkDetl : dto.getWrkDetls()) {
- wrkDetlService.updateInspect(wrkDetl.getWrkNo(), wrkDetl.getMatnr(), wrkDetl.getBatch());
- }
+ for (WrkDetl wrkDetl : dto.getWrkDetls()) {
+ wrkDetlService.updateInspect(wrkDetl.getWrkNo(), wrkDetl.getMatnr(), wrkDetl.getBatch());
}
- // 103
- if (wrkMast.getIoType() == 103) {
- if (!wrkDetlService.delete(new EntityWrapper<WrkDetl>().eq("wrk_no", wrkMast.getWrkNo()))) {
- throw new CoolException("鎷f枡鍑哄簱纭澶辫触");
- }
- for (WrkDetl wrkDetl : dto.getWrkDetls()) {
- wrkDetl.setInspect(1);
- if (!wrkDetlService.insert(wrkDetl)) {
- throw new CoolException("鎷f枡鍑哄簱纭澶辫触");
- }
- }
+ if (wrkMast.getIoType() == 103 || wrkMast.getIoType() == 107) {
+ wrkMast.setWrkSts(34L);//涓嬫灦瀹屾垚绛夊緟鍥炲簱
+ } else {
+ wrkMast.setWrkSts(15L);
}
+ wrkMastService.updateById(wrkMast);
}
+
}
- for (Integer wrkNo : wrkNos) {
- WrkMast wrkMast = wrkMastService.selectById(wrkNo);
- if (wrkMast.getWrkSts() == 14 && (Cools.isEmpty(wrkMast.getInvWh()) || wrkMast.getInvWh().equals("N"))) {
- List<WrkDetl> wrkDetls = wrkDetlService.selectByWrkNo(wrkNo);
- boolean complete = true;
- for (WrkDetl wrkDetl : wrkDetls) {
- if (wrkDetl.getInspect() == null || wrkDetl.getInspect() == 0) {
- complete = false;
- break;
- }
- }
- if (complete) {
- wrkMast.setInvWh("Y");
- wrkMast.setModiTime(new Date());
- if (!wrkMastService.updateById(wrkMast)) {
- throw new CoolException("淇敼宸ヤ綔妗�" + wrkNo + "澶辫触");
- }
- }
- }
- }
+// for (Integer wrkNo : wrkNos) {
+// WrkMast wrkMast = wrkMastService.selectById(wrkNo);
+// if (wrkMast.getWrkSts() == 15 && (Cools.isEmpty(wrkMast.getInvWh()) || wrkMast.getInvWh().equals("N"))) {
+// List<WrkDetl> wrkDetls = wrkDetlService.selectByWrkNo(wrkNo);
+// boolean complete = true;
+// for (WrkDetl wrkDetl : wrkDetls) {
+// if (wrkDetl.getInspect() == null || wrkDetl.getInspect() == 0) {
+// complete = false;
+// break;
+// }
+// }
+// if (complete) {
+// wrkMast.setInvWh("Y");
+// wrkMast.setModiTime(new Date());
+// if (!wrkMastService.updateById(wrkMast)) {
+// throw new CoolException("淇敼宸ヤ綔妗�" + wrkNo + "澶辫触");
+// }
+// }
+// }
+// }
return R.ok("瀹屾垚纭");
}
@@ -270,7 +323,7 @@
@RequestMapping("/checkDetl/auth")
@ManagerAuth
- public R getCheckDetl(@RequestParam(required = false) Integer staNo) {
+ public synchronized R getCheckDetl(@RequestParam(required = false) Integer staNo) {
if (null == staNo || staNo == 0) {
return R.ok();
}
@@ -293,7 +346,7 @@
@RequestMapping("/adjust/auth")
@ManagerAuth(memo = "鐩樼偣")
- public R adjust(@RequestBody MobileAdjustParam combParam){
+ public R adjust(@RequestBody MobileAdjustParam combParam) {
mobileService.adjust(combParam, getUserId());
return R.ok("鐩樼偣鎴愬姛");
}
@@ -301,11 +354,673 @@
@PostMapping("/order/out/pakout/auth")
@ManagerAuth(memo = "璁㈠崟鍑哄簱")
public synchronized R pakoutByOrder(@RequestBody JSONObject param) {
- if(!param.containsKey("staNo") || !param.containsKey("orderNo")){
+ if (!param.containsKey("staNo") || !param.containsKey("orderNo")) {
return R.parse(BaseRes.PARAM);
}
- mobileService.pakoutByOrder(param,getUserId());
+ mobileService.pakoutByOrder(param, getUserId());
return R.ok("鍑哄簱鎴愬姛");
}
+ //------------------------------------------------------------------------------agv璋冨害--------------------------------------------------
+
+ /**
+ * 琛ョ┖鏉� 鍖哄煙鍒扮偣
+ *
+ * @param locNo 鐩爣绔欑偣
+ * @param size 鎵樼洏澶у皬 1锛氬皬鎵樼洏 2锛氬ぇ鎵樼洏
+ * @return
+ */
+ @RequestMapping("/FillEmptyPallets")
+ public synchronized R FillEmptyPallets(@RequestParam(required = false) String locNo
+ , @RequestParam(required = false) String size) {
+ if (Cools.isEmpty(locNo) || Cools.isEmpty(size)) {
+ return R.error("绔欑偣鎴栬�呭ぇ灏忎笉鑳戒负绌�");
+
+ }
+ //绌烘墭鐩樼紦鍐插尯 灏忥細E8 澶э細E9
+ String rStaNo = "E8";
+ if (size.equals("2")) {
+ rStaNo = "E9";
+ }
+ LinkedHashMap<String, Object> rcsParam = new LinkedHashMap<>();
+ rcsParam.put("taskType", "PF-FMR-COMMON");
+ List<LinkedHashMap<String, Object>> targetRoutes = new ArrayList<>();
+ LinkedHashMap<String, Object> t1 = new LinkedHashMap<>();
+ LinkedHashMap<String, Object> t2 = new LinkedHashMap<>();
+ t1.put("seq", 0);
+ t1.put("type", "ZONE");
+ t1.put("code", rStaNo);
+ t1.put("autoStart", 0);
+ t1.put("operation", "COLLECT");
+
+ t2.put("seq", 0);
+ t2.put("type", "SITE");
+ t2.put("code", locNo);
+ t2.put("autoStart", 0);
+ t2.put("operation", "DELIVERY");
+
+ targetRoutes.add(t1);
+ targetRoutes.add(t2);
+ rcsParam.put("targetRoute", targetRoutes);
+ rcsParam.put("initPriority", 100);
+
+
+ String response = "";
+ Boolean bool = false;
+ String msg = "";
+ HashMap<String, Object> map = new HashMap<>();
+ Date date = new Date();
+ String time = date.getTime() + "";
+
+ map.put("X-LR-REQUEST-ID", time);
+ try {
+ log.info("wms娲惧彂鎼繍浠诲姟缁橝GV鎼繍={}", rcsParam);
+ response = new HttpHandler.Builder()
+ .setHeaders(map)
+ .setUri(url)
+ .setHttps(true)
+ .setPath(attrcs)
+ .setJson(JSON.toJSONString(rcsParam))
+ .build()
+ .doPostCloseSSL();
+ JSONObject jsonObject = JSON.parseObject(response);
+ if (jsonObject.getString("code").equals("SUCCESS")) {
+ bool = true;
+ } else {
+ msg = jsonObject.getString("message");
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ log.error("wms娲惧彂鎼繍浠诲姟缁橝GV鎼繍澶辫触杩斿洖鍊�={}", response);
+ } finally {
+ apiLogService.save("wms娲惧彂鎼繍浠诲姟缁橝GV鎼繍"
+ , url + attrcs
+ , null
+ , "127.0.0.1"
+ , JSON.toJSONString(rcsParam)
+ , response
+ , bool
+ );
+ }
+
+ if (bool) {
+ return R.ok();
+ } else {
+ return R.error(msg);
+ }
+
+ }
+
+ /**
+ * 绌烘墭鐩樺洖搴�
+ *
+ * @param sourceStaNo 鍘熺珯鐐�
+ * @param barcode 鎵樼洏澶у皬 1锛氬皬鎵樼洏 2锛氬ぇ鎵樼洏 鐩爣鍖烘垨鑰呭贩閬�
+ * @return
+ */
+ @RequestMapping("/FillEmptyPalletsStack")
+ public synchronized R FillEmptyPalletsStack(@RequestParam(required = false) String sourceStaNo
+ , @RequestParam(required = false) String barcode) {
+ if (Cools.isEmpty(sourceStaNo) || Cools.isEmpty(barcode)) {
+ return R.error("绔欑偣鎴栬�呭ぇ灏忎笉鑳戒负绌�");
+
+ }
+ //绌烘墭鐩樼紦鍐插尯 灏忥細E8 澶э細E9
+ String rStaNo = "E8";
+ if (barcode.substring(0, 1).equals("9")) {
+ String type = "ZONE"; //鍖哄煙
+ if (barcode.substring(0, 1).equals("9")) {
+ rStaNo = "E9";
+ }
+ Config config = configService.selectOne(new EntityWrapper<Config>().eq("code", "autoE").eq("status", "1"));
+ if (config != null) {
+ type = "STACK"; //宸烽亾
+ if (Cools.isEmpty(config.getValue())) {
+ rStaNo = rStaNo + "01";
+ config.setValue("2");
+ } else if (config.getValue().equals("1")) {
+ rStaNo = rStaNo + "01";
+ config.setValue("2");
+ } else if (config.getValue().equals("2")) {
+ rStaNo = rStaNo + "02";
+ config.setValue("3");
+ } else if (config.getValue().equals("3")) {
+ rStaNo = rStaNo + "03";
+ config.setValue("1");
+ }
+ configService.updateById(config);
+ } else {
+ config = configService.selectOne(new EntityWrapper<Config>().eq("code", "autoE").eq("status", "1"));
+
+ if (config != null) {
+ type = "STACK"; //宸烽亾
+ if (Cools.isEmpty(config.getValue())) {
+ rStaNo = rStaNo + "01";
+ config.setValue("2");
+ } else if (config.getValue().equals("1")) {
+ rStaNo = rStaNo + "01";
+ config.setValue("2");
+ } else if (config.getValue().equals("2")) {
+ rStaNo = rStaNo + "02";
+ config.setValue("3");
+ } else if (config.getValue().equals("3")) {
+ rStaNo = rStaNo + "03";
+ config.setValue("1");
+ }
+ configService.updateById(config);
+ }
+ }
+
+ LinkedHashMap<String, Object> rcsParam = new LinkedHashMap<>();
+ rcsParam.put("taskType", "PF-FMR-COMMON");
+ List<LinkedHashMap<String, Object>> targetRoutes = new ArrayList<>();
+ LinkedHashMap<String, Object> t1 = new LinkedHashMap<>();
+ LinkedHashMap<String, Object> t2 = new LinkedHashMap<>();
+ t1.put("seq", 0);
+ t1.put("type", "SITE");
+ t1.put("code", sourceStaNo);
+ t1.put("autoStart", 0);
+ t1.put("operation", "COLLECT");
+
+ t2.put("seq", 0);
+ t2.put("type", type);
+ t2.put("code", rStaNo);
+ t2.put("autoStart", 0);
+ t2.put("operation", "DELIVERY");
+
+ targetRoutes.add(t1);
+ targetRoutes.add(t2);
+ rcsParam.put("targetRoute", targetRoutes);
+ rcsParam.put("initPriority", 100);
+
+
+ String response = "";
+ Boolean bool = false;
+ String msg = "";
+ HashMap<String, Object> map = new HashMap<>();
+ Date date = new Date();
+ String time = date.getTime() + "";
+
+ map.put("X-LR-REQUEST-ID", time);
+ try {
+ log.info("wms娲惧彂鎼繍浠诲姟缁橝GV鎼繍={}", rcsParam);
+ response = new HttpHandler.Builder()
+ .setHeaders(map)
+ .setUri(url)
+ .setHttps(true)
+ .setPath(attrcs)
+ .setJson(JSON.toJSONString(rcsParam))
+ .build()
+ .doPostCloseSSL();
+ JSONObject jsonObject = JSON.parseObject(response);
+ if (jsonObject.getString("code").equals("SUCCESS")) {
+ bool = true;
+ } else {
+ msg = jsonObject.getString("message");
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ log.error("wms娲惧彂鎼繍浠诲姟缁橝GV鎼繍澶辫触杩斿洖鍊�={}", response);
+ } finally {
+ apiLogService.save("wms娲惧彂鎼繍浠诲姟缁橝GV鎼繍"
+ , url + attrcs
+ , null
+ , "127.0.0.1"
+ , JSON.toJSONString(rcsParam)
+ , response
+ , bool
+ );
+ }
+
+ if (bool) {
+ return R.ok();
+ } else {
+ return R.error();
+ }
+ }
+ return R.error();
+ }
+
+ /**
+ * 鎵ц绉诲簱浠诲姟--鐐瑰埌鐐�
+ *
+ * @param sourceStaNo
+ * @param staNo
+ * @return
+ */
+ @RequestMapping("/SITESITEAGVMove")
+ public synchronized R SITESITEAGVMove(@RequestParam(required = false) String sourceStaNo
+ , @RequestParam(required = false) String staNo
+ , @RequestParam(required = false) String taskNo) {
+ if (Cools.isEmpty(sourceStaNo) || Cools.isEmpty(staNo)) {
+ return R.error("婧愮珯鐐瑰拰鐩爣绔欑偣涓嶈兘涓虹┖");
+
+ }
+
+ LinkedHashMap<String, Object> rcsParam = new LinkedHashMap<>();
+ rcsParam.put("taskType", "PF-FMR-COMMON");
+ if (!Cools.isEmpty(taskNo)) {
+ rcsParam.put("robotTaskCode", taskNo);
+ }
+
+ List<LinkedHashMap<String, Object>> targetRoutes = new ArrayList<>();
+ LinkedHashMap<String, Object> t1 = new LinkedHashMap<>();
+ LinkedHashMap<String, Object> t2 = new LinkedHashMap<>();
+ t1.put("seq", 0);
+ t1.put("type", "SITE");
+ t1.put("code", sourceStaNo);
+ t1.put("autoStart", 0);
+ t1.put("operation", "COLLECT");
+
+ t2.put("seq", 0);
+ t2.put("type", "SITE");
+ t2.put("code", staNo);
+ t2.put("autoStart", 0);
+ t2.put("operation", "DELIVERY");
+
+ targetRoutes.add(t1);
+ targetRoutes.add(t2);
+ rcsParam.put("targetRoute", targetRoutes);
+ rcsParam.put("initPriority", 100);
+
+
+ String response = "";
+ Boolean bool = false;
+ String msg = "";
+ HashMap<String, Object> map = new HashMap<>();
+ Date date = new Date();
+ String time = date.getTime() + "";
+
+ map.put("X-LR-REQUEST-ID", time);
+ try {
+ log.info("wms娲惧彂鐐瑰埌鐐规惉杩愪换鍔$粰AGV鎼繍={}", rcsParam);
+ response = new HttpHandler.Builder()
+ .setHeaders(map)
+ .setUri(url)
+ .setHttps(true)
+ .setPath(attrcs)
+ .setJson(JSON.toJSONString(rcsParam))
+ .build()
+ .doPostCloseSSL();
+ JSONObject jsonObject = JSON.parseObject(response);
+ if (jsonObject.getString("code").equals("SUCCESS")) {
+ bool = true;
+ } else {
+ msg = jsonObject.getString("message");
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ log.error("wms娲惧彂鐐瑰埌鐐规惉杩愪换鍔$粰AGV鎼繍澶辫触杩斿洖鍊�={}", response);
+ } finally {
+ apiLogService.save("wms娲惧彂鐐瑰埌鐐规惉杩愪换鍔$粰AGV鎼繍"
+ , url + attrcs
+ , null
+ , "127.0.0.1"
+ , JSON.toJSONString(rcsParam)
+ , response
+ , bool
+ );
+ }
+
+ if (bool) {
+ return R.ok();
+ } else {
+ return R.error(msg);
+ }
+
+ }
+
+ /**
+ * 鎵ц绉诲簱浠诲姟--鐐瑰埌鍖哄煙
+ *
+ * @param sourceStaNo
+ * @param staNo
+ * @return
+ */
+ @RequestMapping("/SITEZONEAGVMove")
+ public synchronized R SITEZONEAGVMove(@RequestParam(required = false) String sourceStaNo
+ , @RequestParam(required = false) String staNo
+ , @RequestParam(required = false) String taskNo) {
+ if (Cools.isEmpty(sourceStaNo) || Cools.isEmpty(staNo)) {
+ return R.error("婧愮珯鐐瑰拰鐩爣绔欑偣涓嶈兘涓虹┖");
+
+ }
+ LinkedHashMap<String, Object> rcsParam = new LinkedHashMap<>();
+ rcsParam.put("taskType", "PF-FMR-COMMON");
+ if (!Cools.isEmpty(taskNo)) {
+ rcsParam.put("robotTaskCode", taskNo);
+ }
+
+ List<LinkedHashMap<String, Object>> targetRoutes = new ArrayList<>();
+ LinkedHashMap<String, Object> t1 = new LinkedHashMap<>();
+ LinkedHashMap<String, Object> t2 = new LinkedHashMap<>();
+ t1.put("seq", 0);
+ t1.put("type", "SITE");
+ t1.put("code", sourceStaNo);
+ t1.put("autoStart", 0);
+ t1.put("operation", "COLLECT");
+
+ t2.put("seq", 0);
+ t2.put("type", "ZONE");
+ t2.put("code", staNo);
+ t2.put("autoStart", 0);
+ t2.put("operation", "DELIVERY");
+
+ targetRoutes.add(t1);
+ targetRoutes.add(t2);
+ rcsParam.put("targetRoute", targetRoutes);
+ rcsParam.put("initPriority", 100);
+
+
+ String response = "";
+ Boolean bool = false;
+ String msg = "";
+ HashMap<String, Object> map = new HashMap<>();
+ Date date = new Date();
+ String time = date.getTime() + "";
+
+ map.put("X-LR-REQUEST-ID", time);
+ try {
+ log.info("wms娲惧彂鐐瑰埌鍖哄煙鎼繍浠诲姟缁橝GV鎼繍={}", rcsParam);
+ response = new HttpHandler.Builder()
+ .setHeaders(map)
+ .setUri(url)
+ .setHttps(true)
+ .setPath(attrcs)
+ .setJson(JSON.toJSONString(rcsParam))
+ .build()
+ .doPostCloseSSL();
+ JSONObject jsonObject = JSON.parseObject(response);
+ if (jsonObject.getString("code").equals("SUCCESS")) {
+ bool = true;
+ } else {
+ msg = jsonObject.getString("message");
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ log.error("wms娲惧彂鐐瑰埌鍖哄煙鎼繍浠诲姟缁橝GV鎼繍澶辫触杩斿洖鍊�={}", response);
+ } finally {
+ apiLogService.save("wms娲惧彂鐐瑰埌鍖哄煙鎼繍浠诲姟缁橝GV鎼繍"
+ , url + attrcs
+ , null
+ , "127.0.0.1"
+ , JSON.toJSONString(rcsParam)
+ , response
+ , bool
+ );
+ }
+
+ if (bool) {
+ return R.ok();
+ } else {
+ return R.error(msg);
+ }
+
+ }
+
+ /**
+ * 鎵ц绉诲簱浠诲姟--鍖哄煙鍒扮偣
+ *
+ * @param sourceStaNo
+ * @param staNo
+ * @return
+ */
+ @RequestMapping("/ZONESITEAGVMove")
+ public synchronized R ZONESITEAGVMove(@RequestParam(required = false) String sourceStaNo
+ , @RequestParam(required = false) String staNo
+ , @RequestParam(required = false) String taskNo) {
+ if (Cools.isEmpty(sourceStaNo) || Cools.isEmpty(staNo)) {
+ return R.error("婧愮珯鐐瑰拰鐩爣绔欑偣涓嶈兘涓虹┖");
+
+ }
+ LinkedHashMap<String, Object> rcsParam = new LinkedHashMap<>();
+ rcsParam.put("taskType", "PF-FMR-COMMON");
+ if (!Cools.isEmpty(taskNo)) {
+ rcsParam.put("robotTaskCode", taskNo);
+ }
+
+ List<LinkedHashMap<String, Object>> targetRoutes = new ArrayList<>();
+ LinkedHashMap<String, Object> t1 = new LinkedHashMap<>();
+ LinkedHashMap<String, Object> t2 = new LinkedHashMap<>();
+ t1.put("seq", 0);
+ t1.put("type", "ZONE");
+ t1.put("code", sourceStaNo);
+ t1.put("autoStart", 0);
+ t1.put("operation", "COLLECT");
+
+ t2.put("seq", 0);
+ t2.put("type", "SITE");
+ t2.put("code", staNo);
+ t2.put("autoStart", 0);
+ t2.put("operation", "DELIVERY");
+
+ targetRoutes.add(t1);
+ targetRoutes.add(t2);
+ rcsParam.put("targetRoute", targetRoutes);
+ rcsParam.put("initPriority", 100);
+
+
+ String response = "";
+ Boolean bool = false;
+ String msg = "";
+ HashMap<String, Object> map = new HashMap<>();
+ Date date = new Date();
+ String time = date.getTime() + "";
+
+ map.put("X-LR-REQUEST-ID", time);
+ try {
+ log.info("wms娲惧彂鐐瑰埌鍖哄煙鎼繍浠诲姟缁橝GV鎼繍={}", rcsParam);
+ response = new HttpHandler.Builder()
+ .setHeaders(map)
+ .setUri(url)
+ .setHttps(true)
+ .setPath(attrcs)
+ .setJson(JSON.toJSONString(rcsParam))
+ .build()
+ .doPostCloseSSL();
+ JSONObject jsonObject = JSON.parseObject(response);
+ if (jsonObject.getString("code").equals("SUCCESS")) {
+ bool = true;
+ } else {
+ msg = jsonObject.getString("message");
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ log.error("wms娲惧彂鐐瑰埌鍖哄煙鎼繍浠诲姟缁橝GV鎼繍澶辫触杩斿洖鍊�={}", response);
+ } finally {
+ apiLogService.save("wms娲惧彂鐐瑰埌鍖哄煙鎼繍浠诲姟缁橝GV鎼繍"
+ , url + attrcs
+ , null
+ , "127.0.0.1"
+ , JSON.toJSONString(rcsParam)
+ , response
+ , bool
+ );
+ }
+
+ if (bool) {
+ return R.ok();
+ } else {
+ return R.error(msg);
+ }
+
+ }
+
+ /**
+ * AGV绔欑偣缁戝畾鍜岃В缁�
+ *
+ * @param sourceStaNo //绔欑偣
+ * @param barcodeType //鎵樼洏鐮�
+ * @param invoke //BIND涓虹粦瀹� UNBIND涓鸿В缁�
+ * @return
+ */
+ @RequestMapping("/siteBindAndUnbind")
+ public synchronized R siteBindAndUnbind(@RequestParam(required = false) String sourceStaNo
+ , @RequestParam(required = false) String barcodeType
+ , @RequestParam(required = false) String invoke) {
+ if (Cools.isEmpty(sourceStaNo) || Cools.isEmpty(barcodeType)) {
+ return R.error("绔欑偣鍜屾墭鐩樼被鍨嬩笉鑳戒负绌�");
+
+ }
+ if (barcodeType.substring(0, 1).equals("8")) {
+ barcodeType = "11";
+ } else if (barcodeType.substring(0, 1).equals("9")) {
+ barcodeType = "21";
+ }
+ LinkedHashMap<String, Object> rcsParam = new LinkedHashMap<>();
+ rcsParam.put("slotCategory", "SITE");
+ rcsParam.put("slotCode", sourceStaNo);
+ rcsParam.put("carrierCategory", "PALLET");
+ rcsParam.put("carrierType", barcodeType);//11涓哄皬鎵樼洏 21涓哄ぇ鎵樼洏
+ if (sourceStaNo.equals("101")) {
+ rcsParam.put("carrierDir", "0");
+ } else if (sourceStaNo.equals("R01") || sourceStaNo.equals("R03")) {
+ rcsParam.put("carrierDir", "-90");
+
+ } else if (sourceStaNo.equals("R02")) {
+ rcsParam.put("carrierDir", "90");
+ } else {
+ rcsParam.put("carrierDir", "180");
+ }
+
+ rcsParam.put("temporary", "");
+ rcsParam.put("invoke", invoke);
+
+
+ String response = "";
+ Boolean bool = false;
+ String msg = "";
+ HashMap<String, Object> map = new HashMap<>();
+ Date date = new Date();
+ String time = date.getTime() + "";
+
+ map.put("X-LR-REQUEST-ID", time);
+ try {
+ log.info("WMS瀹屾垚" + invoke + "agv绔欑偣={},涓婃姤鍙傛暟涓�={}", sourceStaNo, rcsParam);
+ response = new HttpHandler.Builder()
+ .setHeaders(map)
+ .setUri(url)
+ .setHttps(true)
+ .setPath(siteBindAndUnbing)
+ .setJson(JSON.toJSONString(rcsParam))
+ .build()
+ .doPostCloseSSL();
+ JSONObject jsonObject = JSON.parseObject(response);
+ if (jsonObject.getString("code").equals("SUCCESS")) {
+ bool = true;
+ } else {
+ msg = jsonObject.getString("message");
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ log.error("WMS瀹屾垚" + invoke + "agv绔欑偣澶辫触={}", response);
+ } finally {
+ apiLogService.save("WMS瀹屾垚" + invoke + "agv绔欑偣" + sourceStaNo
+ , url + siteBindAndUnbing
+ , null
+ , "127.0.0.1"
+ , JSON.toJSONString(rcsParam)
+ , response
+ , bool
+ );
+ }
+
+ if (bool) {
+ return R.ok();
+ } else {
+ return R.error(msg);
+ }
+
+ }
+
+ /**
+ * 绌烘澘鍥炲簱鎴栬�呮嫞鏂欏洖搴�
+ *
+ * @param sourceStaNo
+ * @param staNo
+ * @return
+ */
+ @RequestMapping("/AGVStartReturn")
+ public synchronized R AGVStartReturn(@RequestParam(required = false) String sourceStaNo
+ , @RequestParam(required = false) String staNo
+ , @RequestParam(required = false) String taskNo) {
+ if (Cools.isEmpty(sourceStaNo) || Cools.isEmpty(staNo)) {
+ return R.error("婧愮珯鐐瑰拰鎵樼洏鐮佷笉鑳戒负绌�");
+
+ }
+
+ R r = R.ok();
+
+ WrkMast wrkMast = wrkMastService.selectOne(new EntityWrapper<WrkMast>().eq("barcode", staNo).in("io_type", 103, 105, 107));
+ if (wrkMast == null) {
+ r = FillEmptyPalletsStack(sourceStaNo, staNo);
+ } else {
+ if (wrkMast.getWrkSts() > 30) {
+ return R.error("璇ユ墭鐩�={},娌℃湁涓嬫灦锛岃涓嬫灦鍚庡啀鍥炲簱锛侊紒锛�");
+ }
+ List<WrkMast> wrkMasts = wrkMastService.selectList(new EntityWrapper<WrkMast>().eq("sta_no", wrkMast.getStaNo()).in("io_type", 101, 103, 105, 107).lt("wrk_sts", 33));
+ if (!Cools.isEmpty(wrkMasts)) {
+ return R.error(wrkMast.getCrnNo() + "鍫嗗灈鏈�,鏈夊嚭搴撲换鍔★紝绂佹鍥炲簱锛侊紒锛�");
+ }
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+ String format = sdf.format(new Date());
+ String s = format + "-" + wrkMast.getWrkNo() + "-" + wrkMast.getBarcode();
+ r = SITESITEAGVMove(sourceStaNo, wrkMast.getStaNo$(), s);
+ if (r.get("code").equals(200)) {
+ wrkMast.setPdcType(s);
+ /**
+ * inv_wh
+ * 鎷f枡鍥炲簱杈撻�佺嚎鍑哄彂
+ * 0绛夊緟agv鏀捐揣瀹屾垚
+ * 1绛夊緟杈撻�佺嚎鍏ュ簱
+ * 2杈撻�佺嚎鍏ュ簱浠诲姟涓嬪彂鎴愬姛
+ */
+ wrkMast.setInvWh("0");
+ wrkMastService.updateById(wrkMast);
+ }
+ }
+
+ return r;
+ }
+
+ /**
+ * 鑾峰彇浠撳簱
+ *
+ * @return
+ */
+ @RequestMapping("/ck")
+ @PostMapping
+ public R AGVStartReturn() {
+ List<String> list = new ArrayList<>();
+ list.add("鍗婃垚鍝佷粨搴�");
+ list.add("鎴愬搧浠撳簱");
+ return R.ok(list);
+ }
+
+
+ @RequestMapping(value = "/mat/tiaoma/auth")
+ @ManagerAuth
+ public R find(@RequestParam("barcode") String barcode) {
+ ExdvYanbu barcode1 = exdMaterialMapper.getBacode(barcode);
+ if (barcode1 == null) {
+ return R.error("鎵规瀵瑰簲鐨勯獙甯冩暟鎹笉瀛樺湪");
+ }
+ Mat mat = matService.selectByMatnr(barcode1.getItemnumber());
+ mat.setAnfme(barcode1.getQty());
+ mat.setBc(barcode);
+ mat.setBatch(barcode1.getBatchno());
+ return R.ok(mat);
+ }
+
+ @RequestMapping(value = "/getOrderNo/auth")
+ @ManagerAuth
+ public R findOrderNo(@RequestParam("orderNo") String orderNo) {
+ Page<Order> orderPage = orderService.selectPage(new Page<>(0, 10), new EntityWrapper<Order>().like("order_no", "%" + orderNo + "%"));
+ List<String> objects = new ArrayList<>();
+ for (Order record : orderPage.getRecords()) {
+ objects.add(record.getOrderNo());
+ }
+ return R.ok(objects);
+ }
+
}
--
Gitblit v1.9.1