From 8c189a920cd9ce13729626310f20014a427dc9cb Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@63.com>
Date: 星期六, 21 五月 2022 15:59:05 +0800
Subject: [PATCH] #
---
src/main/java/com/zy/asrs/controller/MobileController.java | 314 ++++++++++++++++++++++++++++++++++++++++++---------
1 files changed, 255 insertions(+), 59 deletions(-)
diff --git a/src/main/java/com/zy/asrs/controller/MobileController.java b/src/main/java/com/zy/asrs/controller/MobileController.java
index 9e8be25..43b1323 100644
--- a/src/main/java/com/zy/asrs/controller/MobileController.java
+++ b/src/main/java/com/zy/asrs/controller/MobileController.java
@@ -2,25 +2,24 @@
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.core.annotations.ManagerAuth;
-import com.core.common.BaseRes;
import com.core.common.Cools;
import com.core.common.R;
-import com.zy.asrs.entity.LocDetl;
-import com.zy.asrs.entity.LocMast;
+import com.core.exception.CoolException;
+import com.zy.asrs.entity.*;
import com.zy.asrs.entity.param.CombParam;
-import com.zy.asrs.service.LocDetlService;
-import com.zy.asrs.service.LocMastService;
-import com.zy.asrs.service.MobileService;
-import com.zy.common.model.MobileLocDetlVo;
+import com.zy.asrs.entity.param.MobileAdjustParam;
+import com.zy.asrs.entity.result.MobileAdjustResult;
+import com.zy.asrs.service.*;
+import com.zy.common.model.WrkDto;
import com.zy.common.web.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
-import java.util.ArrayList;
-import java.util.List;
+import java.util.*;
/**
* 绉诲姩绔帴鍙f帶鍒跺櫒
@@ -36,67 +35,264 @@
private LocMastService locMastService;
@Autowired
private LocDetlService locDetlService;
+ @Autowired
+ private OrderService orderService;
+ @Autowired
+ private DocTypeService docTypeService;
+ @Autowired
+ private WrkMastService wrkMastService;
+ @Autowired
+ private WrkDetlService wrkDetlService;
+ @Autowired
+ private BasDevpService basDevpService;
+ @Autowired
+ private PackService packService;
+
+ // 缁勬墭 ----------------------------------------------------------------------------------------------------
/**
- * 缁勬墭
+ * 鏍规嵁鍗曞彿妫�绱㈠崟鎹暟鎹�
+ * http://localhost:8081/jkwms/mobile/order/serach/orderNo/auth?orderNo=123123
*/
+ @RequestMapping("/order/search/orderNo/auth")
+ @ManagerAuth
+ public R orderSearchByBarcode(@RequestParam String orderNo){
+ Order order = orderService.selectByNo(orderNo);
+ if (order == null) {
+ return R.ok();
+ }
+ DocType docType = docTypeService.selectById(order.getDocType());
+ if (docType.getPakin() == null || docType.getPakin() != 1) {
+ return R.ok();
+ }
+ if (order.getSettle() > 2) {
+ return R.ok();
+ }
+ List<OrderDetl> orderDetls = orderService.selectWorkingDetls(order.getId());
+ if (Cools.isEmpty(orderDetls)) {
+ return R.ok();
+ }
+ return R.ok().add(orderDetls);
+ }
+
@RequestMapping("/comb/auth")
@ManagerAuth(memo = "缁勬墭")
public R comb(@RequestBody CombParam combParam){
mobileService.comb(combParam, getUserId());
- return R.ok();
+ return R.ok("缁勬墭鎴愬姛");
}
-
- /**
- * 缁勬墭
- */
- @RequestMapping("/comb/form")
- @ManagerAuth(memo = "缁勬墭")
- public R combForm(@RequestParam CombParam combParam){
- mobileService.comb(combParam, getUserId());
- return R.ok();
- }
-
- /**
- * 鏍规嵁搴撲綅鍙锋煡鎵惧簱瀛樻槑缁�
- */
- @RequestMapping("/locDetl")
+ @RequestMapping("/pack/get/auth")
@ManagerAuth
- public R getLocDetl(@RequestParam(required = false)String locNo,
- @RequestParam(required = false)String matNo){
- if (!Cools.isEmpty(locNo)) {
- LocMast locMast = locMastService.selectById(locNo);
- if (null == locMast || !"F".equals(locMast.getLocType())) {
- return R.parse(BaseRes.EMPTY);
- }
- List<LocDetl> locDetls = locDetlService.selectList(new EntityWrapper<LocDetl>()
- .eq("loc_no", locNo).orderBy("appe_time", false));
- List<MobileLocDetlVo> res = new ArrayList<>();
- locDetls.forEach(locDetl -> {
- MobileLocDetlVo vo = new MobileLocDetlVo();
- vo.setLocNo(locDetl.getLocNo());
- vo.setMatnr(locDetl.getMatnr());
- vo.setMaktx(locDetl.getMaktx());
- vo.setCount(locDetl.getAnfme());
- res.add(vo);
- });
- return R.ok().add(res);
+ public R packGet(@RequestParam String barcode){
+ Pack pack = packService.selectByBarcode(barcode);
+ if (pack == null) {
+ return R.ok();
}
- if (!Cools.isEmpty(matNo)) {
- List<LocDetl> locDetls = locDetlService.selectList(new EntityWrapper<LocDetl>()
- .eq("matnr", matNo).orderBy("appe_time", false));
- List<MobileLocDetlVo> res = new ArrayList<>();
- locDetls.forEach(locDetl -> {
- MobileLocDetlVo vo = new MobileLocDetlVo();
- vo.setLocNo(locDetl.getLocNo());
- vo.setMatnr(locDetl.getMatnr());
- vo.setMaktx(locDetl.getMaktx());
- vo.setCount(locDetl.getAnfme());
- res.add(vo);
- });
- return R.ok().add(res);
+ if (pack.getSettle() == 1L) {
+ return R.ok().add(pack);
}
- return R.parse(BaseRes.PARAM);
+ return R.ok("缁勬墭鎴愬姛");
}
+
+ @RequestMapping("/pack/comb/auth")
+ @ManagerAuth(memo = "涓嬬嚎缁勬墭")
+ public R packComb(@RequestBody CombParam combParam){
+ mobileService.packComb(combParam, getUserId());
+ return R.ok("缁勬墭鎴愬姛");
+ }
+
+
+ // 鍑哄簱 ---------------------------------------------------------------------------------------------------
+
+ @RequestMapping("/pakout/query/auth")
+ @ManagerAuth
+ @Deprecated
+ public R pakoutQuery(@RequestParam(required = false) String barcode,
+ @RequestParam(required = false) Integer staNo,
+ @RequestParam(required = false) String matnr){
+ if (Cools.isEmpty(barcode) && Cools.isEmpty(matnr)) {
+ return R.ok();
+ }
+ if (!Cools.isEmpty(barcode)) {
+ List<WrkDetl> wrkDetls = wrkDetlService.selectList(new EntityWrapper<WrkDetl>().eq("zpallet", barcode));
+ return R.ok().add(wrkDetls);
+ }
+ if (!Cools.isEmpty(matnr)) {
+ if (!Cools.isEmpty(staNo)) {
+ List<WrkDetl> wrkDetls = wrkDetlService.selectPakoutQuery(staNo, matnr);
+ return R.ok().add(wrkDetls);
+ }
+ }
+ return R.ok();
+ }
+
+ /**
+ * 鍑哄簱纭 - 鎵墭鐩樼爜
+ * 1.鍏ㄦ澘 杩斿洖 101
+ * 2.鎷f枡 杩斿洖 103
+ */
+ @RequestMapping("/pakout/confirm/barcode/auth")
+ @ManagerAuth
+ public R pakoutQueryByBarcode(@RequestParam(required = false) String barcode){
+ if (Cools.isEmpty(barcode)) {
+ return R.ok();
+ }
+ WrkMast wrkMast = wrkMastService.selectByBarcode(barcode);
+ if (wrkMast != null) {
+ List<WrkDetl> wrkDetls = wrkDetlService.selectByWrkNo(wrkMast.getWrkNo());
+ // 鍘婚櫎宸插嚭搴撶‘璁ょ殑鏄庣粏
+ wrkDetls.removeIf(wrkDetl -> wrkDetl.getInspect() != null && wrkDetl.getInspect() != 0);
+ return R.ok().add(Cools.add("wrkNo", wrkMast.getWrkNo()).add("ioType", wrkMast.getIoType()).add("list", wrkDetls));
+ }
+ return R.ok();
+ }
+
+ /**
+ * 鍑哄簱纭 - 鎷f枡鍑哄簱 - 閫夋嫨鍏蜂綋鏉$爜鍟嗗搧
+ */
+ @RequestMapping("/pakout/confirm/pick/auth")
+ @ManagerAuth
+ public R pakoutQueryByBarcode(@RequestParam(required = false) Integer wrkNo
+ , @RequestParam(required = false) String matnr){
+ if (Cools.isEmpty(wrkNo)) {
+ return R.ok();
+ }
+ if (Cools.isEmpty(matnr)) {
+ return R.ok();
+ }
+ WrkMast wrkMast = wrkMastService.selectById(wrkNo);
+ if (wrkMast == null) {
+ return R.ok();
+ }
+ String orderNo = null;
+ List<WrkDetl> wrkDetls = wrkDetlService.selectByWrkNo(wrkMast.getWrkNo());
+ for (WrkDetl wrkDetl : wrkDetls) {
+ if (Cools.isEmpty(orderNo)) {
+ orderNo = wrkDetl.getOrderNo();
+ }
+ if ((wrkDetl.getMatnr() + "-" + wrkDetl.getBatch()).equals(matnr)) {
+ return R.ok().add(wrkDetl);
+ }
+ }
+ // 鏇挎崲 鏄庣粏
+ List<LocDetl> locDetls = locDetlService.selectList(new EntityWrapper<LocDetl>().eq("loc_no", wrkMast.getSourceLocNo()));
+ for (LocDetl locDetl : locDetls) {
+ if ((locDetl.getMatnr() + "-" + locDetl.getBatch()).equals(matnr)) {
+ WrkDetl wrkDetl = new WrkDetl();
+ wrkDetl.sync(locDetl);
+ wrkDetl.setOrderNo(orderNo);
+ wrkDetl.setIoTime(wrkMast.getIoTime());
+ wrkDetl.setWrkNo(wrkNo);
+ return R.ok().add(wrkDetl);
+ }
+ }
+ return R.error("绯荤粺閿欒锛屾潯鐮佷笉瀛樺湪");
+ }
+
+
+ @RequestMapping("/pakout/confirm/auth")
+ @ManagerAuth
+ @Transactional
+ public R pakoutConfirm(@RequestBody List<WrkDetl> list) {
+ if (Cools.isEmpty(list)) {
+ return R.ok();
+ }
+ Set<Integer> wrkNos = new HashSet<>();
+ List<WrkDto> dtos = new ArrayList<>();
+ for (WrkDetl wrkDetl : list) {
+ if (wrkNos.contains(wrkDetl.getWrkNo())) {
+ for (WrkDto dto : dtos) {
+ if (dto.getWrkNo().equals(wrkDetl.getWrkNo())) {
+ dto.getWrkDetls().add(wrkDetl);
+ break;
+ }
+ }
+ } else {
+ wrkNos.add(wrkDetl.getWrkNo());
+ dtos.add(new WrkDto(wrkDetl.getWrkNo(), wrkDetl));
+ }
+ }
+
+ 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());
+ }
+ }
+ // 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枡鍑哄簱纭澶辫触");
+ }
+ }
+ }
+ }
+ }
+
+ 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 + "澶辫触");
+ }
+ }
+ }
+ }
+ return R.ok("瀹屾垚纭");
+ }
+
+
+ // 鐩樼偣 ----------------------------------------------------------------------------------------------------
+
+ @RequestMapping("/checkDetl/auth")
+ @ManagerAuth
+ public R getCheckDetl(@RequestParam(required = false) Integer staNo) {
+ if (null == staNo || staNo == 0) {
+ return R.ok();
+ }
+ BasDevp basDevp = basDevpService.selectById(staNo);
+ if (null != basDevp && basDevp.getWrkNo() != null) {
+ WrkMast wrkMast = wrkMastService.selectById(basDevp.getWrkNo());
+ if (wrkMast != null && wrkMast.getIoType() == 107) {
+ List<WrkDetl> wrkDetls = wrkDetlService.selectByWrkNo(wrkMast.getWrkNo());
+ if (!Cools.isEmpty(wrkDetls)) {
+ MobileAdjustResult result = new MobileAdjustResult();
+ result.setStaNo(staNo);
+ result.setWrkNo(wrkMast.getWrkNo());
+ result.setWrkDetls(wrkDetls);
+ return R.ok().add(result);
+ }
+ }
+ }
+ return R.ok();
+ }
+
+ @RequestMapping("/adjust/auth")
+ @ManagerAuth(memo = "鐩樼偣")
+ public R adjust(@RequestBody MobileAdjustParam combParam){
+ mobileService.adjust(combParam, getUserId());
+ return R.ok("鐩樼偣鎴愬姛");
+ }
+
+
}
--
Gitblit v1.9.1