From 177188e74cbb15581132578b7b2857957b667a94 Mon Sep 17 00:00:00 2001
From: Junjie <540245094@qq.com>
Date: 星期二, 21 十月 2025 16:24:23 +0800
Subject: [PATCH] #
---
src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java | 210 ++++++++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 195 insertions(+), 15 deletions(-)
diff --git a/src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java
index 2f25ad2..4cd06b4 100644
--- a/src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java
@@ -1,5 +1,6 @@
package com.zy.asrs.service.impl;
+import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
@@ -18,14 +19,16 @@
import com.zy.common.model.DetlDto;
import com.zy.common.model.enums.WorkNoType;
import com.zy.common.service.CommonService;
-import com.zy.common.utils.Synchro;
+import com.zy.common.utils.HttpHandler;
import com.zy.nc.service.NccJcQilibcBarcodeflowWmsService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
+import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
@@ -36,6 +39,9 @@
@Slf4j
@Service
public class MobileServiceImpl implements MobileService {
+
+ @Value("${wcs.url}")
+ private String wcsUrl;
@Autowired
private MatService matService;
@@ -77,6 +83,8 @@
private ManLocDetlService manLocDetlService;
@Autowired
private ManLocDetlMapper manLocDetlMapper;
+ @Autowired
+ private ReportToThirdService reportToThirdService;
@Autowired
private InventoryCheckOrderService inventoryCheckOrderService;
@@ -596,10 +604,12 @@
DetlDto detlDto = new DetlDto(elem.getMatnr(), elem.getBatch(), elem.getBrand(), elem.getStandby1(), elem.getStandby2(), elem.getStandby3(),
elem.getBoxType1(), elem.getBoxType2(), elem.getBoxType3(), elem.getAnfme());
detlDto.setWeight(elem.getWeight());
+ detlDto.setCstateid(elem.getCstateid());
if (DetlDto.has(detlDtos, detlDto)) {
DetlDto one = DetlDto.findDto(detlDtos, detlDto);
assert one != null;
one.setAnfme(one.getAnfme() + detlDto.getAnfme());
+ one.setWeight(one.getWeight() + detlDto.getWeight());
} else {
detlDtos.add(detlDto);
}
@@ -630,6 +640,7 @@
waitPakin.setStandby2(detlDto.getStandby2());
waitPakin.setStandby3(detlDto.getStandby3());
waitPakin.setTkFlag(param.getTkFlag());
+ waitPakin.setCstateid(detlDto.getCstateid());
if (!waitPakinService.insert(waitPakin)) {
throw new CoolException("淇濆瓨鍏ュ簱閫氱煡妗eけ璐�");
}
@@ -650,6 +661,17 @@
throw new CoolException("鍗曟嵁缂栧彿宸蹭綔涓氬畬鎴�");
}
+ List<WaitPakin> waitPakinList = waitPakinService.selectList(new EntityWrapper<WaitPakin>()
+ .eq("matnr", elem.getMatnr())
+ .eq("batch", elem.getBatch())
+ .eq("order_no", elem.getOrderNo())
+ .eq("anfme", elem.getAnfme())
+ .eq("standby1", elem.getStandby1())
+ );
+ if (!waitPakinList.isEmpty()) {
+ throw new CoolException("璇ヨ鍗曠墿鏂欏凡缁忕粍鎵橈紒");
+ }
+
// 璁㈠崟鏄庣粏鏁伴噺鏍¢獙
OrderDetl orderDetl = OrderInAndOutUtil.selectItem(Boolean.TRUE, order.getId(), elem.getMatnr(), elem.getBatch(), elem.getBrand(), elem.getStandby1(), elem.getStandby2(), elem.getStandby3(),
elem.getBoxType1(), elem.getBoxType2(), elem.getBoxType3());
@@ -665,6 +687,8 @@
DetlDto detlDto = new DetlDto(elem.getMatnr(), elem.getBatch(), elem.getBrand(), elem.getStandby1(), elem.getStandby2(), elem.getStandby3(),
elem.getBoxType1(), elem.getBoxType2(), elem.getBoxType3(), elem.getAnfme());
detlDto.setOrderNo(elem.getOrderNo());
+ detlDto.setWeight(elem.getWeight());
+ detlDto.setCstateid(elem.getCstateid());
if (DetlDto.has(detlDtos, detlDto)) {
DetlDto one = DetlDto.findDto(detlDtos, detlDto);
assert one != null;
@@ -700,6 +724,7 @@
waitPakin.setStandby2(detlDto.getStandby2());
waitPakin.setStandby3(detlDto.getStandby3());
waitPakin.setWeight(detlDto.getWeight());
+ waitPakin.setCstateid(detlDto.getCstateid());
if (!waitPakinService.insert(waitPakin)) {
throw new CoolException("淇濆瓨鍏ュ簱閫氱煡妗eけ璐�");
}
@@ -708,6 +733,53 @@
}
+ }
+
+ @Override
+ public void combCancel(CombCancelParam param, Long userId) {
+ if (Cools.isEmpty(param.getBarcode())) {
+ throw new CoolException(BaseRes.PARAM);
+ }
+
+ List<WaitPakin> waitPakins = waitPakinService.selectList(new EntityWrapper<WaitPakin>().
+ eq("zpallet", param.getBarcode()));
+ if (waitPakins.isEmpty()) {
+ throw new CoolException("鎵樼洏鏈粍鎵�");
+ }
+
+ for (WaitPakin waitPakin : waitPakins) {
+ if (!Cools.isEmpty(waitPakin.getOrderNo())) {
+ Order order = OrderInAndOutUtil.selectByNo(Boolean.TRUE, waitPakin.getOrderNo());
+ if (Cools.isEmpty(order)) {
+ throw new CoolException("鍗曟嵁缂栧彿涓嶅瓨鍦�");
+ }
+
+ if (order.getSettle() > 2) {
+ throw new CoolException("鍗曟嵁缂栧彿宸蹭綔涓氬畬鎴�");
+ }
+
+ // 璁㈠崟鏄庣粏鏁伴噺鏍¢獙
+ OrderDetlPakin orderDetlPakin = orderDetlPakinService.selectItem(order.getId(), waitPakin.getMatnr(), waitPakin.getBatch(), waitPakin.getBrand(), waitPakin.getStandby1(), waitPakin.getStandby2(), waitPakin.getStandby3(),
+ waitPakin.getBoxType1(), waitPakin.getBoxType2(), waitPakin.getBoxType3());
+ if (orderDetlPakin == null) {
+ continue;
+ }
+
+ Double workQty = orderDetlPakin.getWorkQty();
+ BigDecimal workQtyDecimal = new BigDecimal(workQty);
+ workQtyDecimal = workQtyDecimal.subtract(BigDecimal.valueOf(waitPakin.getAnfme()));
+
+ double newWorkQty = workQtyDecimal.doubleValue();
+ if (newWorkQty <= 0) {
+ newWorkQty = 0D;
+ }
+ orderDetlPakin.setWorkQty(newWorkQty);
+ orderDetlPakinService.updateById(orderDetlPakin);
+ }
+ }
+
+ waitPakinService.delete(new EntityWrapper<WaitPakin>()
+ .eq("zpallet", param.getBarcode()));
}
// 鍟嗗搧涓婃灦
@@ -783,11 +855,7 @@
Date now = new Date();
List<WrkDetl> wrkDetls = wrkDetlService.selectByWrkNo(wrkMast.getWrkNo());
- List<WrkDetl> list = param.getWrkDetls();
- LocDetlAdjustParam adjustParam = new LocDetlAdjustParam();
- List<LocDetlAdjustParam.LocDetlAdjust> locDetlAdjusts = new ArrayList<>();
-
- adjustParam.setLocNo(wrkMast.getSourceLocNo());
+ List<WrkDetl> list = JSON.parseArray(JSON.toJSONString(param.getWrkDetls()), WrkDetl.class);
// 淇敼鏁伴噺
Iterator<WrkDetl> iterator = wrkDetls.iterator();
while (iterator.hasNext()) {
@@ -839,13 +907,14 @@
throw new CoolException("娣诲姞" + wrkMast.getWrkNo() + "鐩樼偣浠诲姟锛�" + wrkDetl.getMatnr() + "鍟嗗搧锛�" + wrkDetl.getBatch() + "鎵瑰彿浠诲姟鏄庣粏澶辫触");
}
}
- List<WrkDetl> wrkDetls1 = wrkDetlService.selectByWrkNo(wrkMast.getWrkNo());
- for (WrkDetl wrkDetl : wrkDetls1) {
- LocDetlAdjustParam.LocDetlAdjust locDetlAdjust = new LocDetlAdjustParam.LocDetlAdjust(wrkDetl.getMatnr(), wrkDetl.getBatch(), wrkDetl.getAnfme());
- locDetlAdjusts.add(locDetlAdjust);
+ List<WrkDetl> paramWrkDetls = JSON.parseArray(JSON.toJSONString(param.getWrkDetls()), WrkDetl.class);
+ for (WrkDetl wrkDetl : paramWrkDetls) {
String locNo = Cools.isEmpty(wrkMast.getLocNo()) ? wrkMast.getSourceLocNo() : wrkMast.getLocNo();
- List<InventoryCheckOrderDetl> checkOrderDetls = inventoryCheckOrderDetlService.selectList(new EntityWrapper<InventoryCheckOrderDetl>().eq("loc_no", locNo));
+ List<InventoryCheckOrderDetl> checkOrderDetls = inventoryCheckOrderDetlService.selectList(new EntityWrapper<InventoryCheckOrderDetl>()
+ .eq("loc_no", locNo)
+ .eq("area", wrkDetl.getWrkNo())
+ );
for (InventoryCheckOrderDetl checkOrderDetl : checkOrderDetls) {
if (wrkDetl.getMatnr().equals(checkOrderDetl.getMatnr()) && Cools.eq(wrkDetl.getBatch(), checkOrderDetl.getBatch())) {
checkOrderDetl.setCheckAnfme(wrkDetl.getAnfme());
@@ -854,16 +923,14 @@
}
}
}
+
// 淇敼鐩樼偣浠诲姟涓绘。鐘舵��
- wrkMast.setFullPlt(wrkDetls1.size() != 0 ? "Y" : "N");
+ wrkMast.setFullPlt("Y");
wrkMast.setModiTime(now);
wrkMast.setModiUser(userId);
if (!wrkMastService.updateById(wrkMast)) {
throw new CoolException("淇敼鐩樼偣浠诲姟涓绘。澶辫触");
}
- adjustParam.setList(locDetlAdjusts);
- workService.adjustLocDetl2(adjustParam, userId);
-
}
@Override
@@ -1175,4 +1242,117 @@
throw new CoolException(locDetl.getLocNo() + "搴撲綅涓嶆槸鍦ㄥ簱鐘舵��");
}
}
+
+ @Override
+ public void checkOutSubmit(Integer orderId, Long userId) {
+ InventoryCheckOrder inventoryCheckOrder = inventoryCheckOrderService.selectOne(new EntityWrapper<InventoryCheckOrder>()
+ .eq("id", orderId));
+ if (inventoryCheckOrder == null) {
+ throw new CoolException("鐩樼偣鍗曚笉瀛樺湪");
+ }
+
+ if (!inventoryCheckOrder.getStatus().equals("1")) {
+ throw new CoolException("鐩樼偣鍗曠姸鎬佸凡涓婃姤");
+ }
+
+ List<InventoryCheckOrderDetl> checkOrderDetlList = inventoryCheckOrderDetlService.selectList(new EntityWrapper<InventoryCheckOrderDetl>()
+ .eq("order_no", inventoryCheckOrder.getOrderNo())
+ );
+ if (checkOrderDetlList.isEmpty()) {
+ throw new CoolException("鐩樼偣鍗曟棤鐗╂枡鏄庣粏");
+ }
+
+ boolean complete = true;
+ for (InventoryCheckOrderDetl checkOrderDetl : checkOrderDetlList) {
+ if (!checkOrderDetl.getStatus().equals("2")) {
+ complete = false;
+ }
+ }
+ if (complete) {
+ boolean result = reportToThirdService.reportCheckOrder(checkOrderDetlList);
+ if (!result) {
+ throw new CoolException("鐩樼偣鍗曚笂鎶ュけ璐�");
+ }
+ }else {
+ throw new CoolException("鐩樼偣鏈畬鎴愭棤娉曚笂鎶�");
+ }
+ }
+
+ @Override
+ public void toOutSta(PalletToOutStaParam param, Long userId) {
+ WrkMast wrkMast = wrkMastService.selectByBarcode(param.getBarcode());
+ if (wrkMast == null) {
+ throw new CoolException("宸ヤ綔妗d笉瀛樺湪");
+ }
+
+ if (wrkMast.getIoType() != 103) {
+ throw new CoolException("宸ヤ綔妗g被鍨嬩笉鏄嫞鏂欏嚭搴�");
+ }
+
+ if (wrkMast.getWrkSts() != 14) {
+ throw new CoolException("宸ヤ綔鐘舵�佹湭澶勪簬宸插嚭搴�");
+ }
+
+ String response = "";
+ try {
+ HashMap<String, Object> map = new HashMap<>();
+ map.put("wrkNo", wrkMast.getWrkNo());
+ map.put("sourceStaNo", wrkMast.getStaNo());
+ map.put("staNo", 1075);
+
+ response = new HttpHandler.Builder()
+ .setUri(wcsUrl)
+ .setPath("/open/toOutSta")
+ .setJson(JSON.toJSONString(map))
+ .build()
+ .doPost();
+ log.info("toOutSta:{},{}",map, response);
+ } catch (Exception e) {
+ log.error("fail", e);
+ }
+ }
+
+ @Override
+ public void toAllOut(PalletToAllOutParam param, Long userId) {
+ String barcodeSize = param.getBarcode().substring(0, 2);
+ String newBarcodeSize = param.getNewBarcode().substring(0, 2);
+ if (!barcodeSize.equals(newBarcodeSize)) {
+ throw new CoolException("鎵樼洏灏哄涓嶄竴鑷�");
+ }
+
+ WrkMast wrkMast = wrkMastService.selectByBarcode(param.getBarcode());
+ if (wrkMast == null) {
+ throw new CoolException("宸ヤ綔妗d笉瀛樺湪");
+ }
+
+ if (wrkMast.getIoType() != 103) {
+ throw new CoolException("宸ヤ綔妗g被鍨嬩笉鏄嫞鏂欏嚭搴�");
+ }
+
+ if (wrkMast.getWrkSts() != 14) {
+ throw new CoolException("宸ヤ綔鐘舵�佹湭澶勪簬宸插嚭搴�");
+ }
+
+ LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", wrkMast.getSourceLocNo()));
+ if (locMast == null) {
+ throw new CoolException("搴撲綅涓嶅瓨鍦�");
+ }
+
+ if (!locMast.getLocSts().equals("P")) {
+ throw new CoolException("搴撲綅绫诲瀷涓嶆槸鎷f枡鍑哄簱");
+ }
+
+ wrkMast.setBarcode(param.getNewBarcode());
+ wrkMast.setModiTime(new Date());
+ wrkMast.setModiUser(userId);
+ wrkMastService.updateById(wrkMast);
+
+ wrkDetlService.updateBarcode(wrkMast.getWrkNo(), param.getNewBarcode());
+
+ locMast.setBarcode(param.getNewBarcode());
+ locMast.setModiTime(new Date());
+ locMastService.updateById(locMast);
+
+ locDetlService.updateBarcode(locMast.getLocNo(), param.getNewBarcode());
+ }
}
--
Gitblit v1.9.1