From bab6283f5c0b5da44b7a342f9daef35473a13ab7 Mon Sep 17 00:00:00 2001
From: dubin <bindu_bean@163.com>
Date: 星期四, 16 四月 2026 14:54:57 +0800
Subject: [PATCH] 初始化
---
src/main/java/com/zy/asrs/service/impl/WorkServiceImpl.java | 156 ++++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 152 insertions(+), 4 deletions(-)
diff --git a/src/main/java/com/zy/asrs/service/impl/WorkServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/WorkServiceImpl.java
index 6b14391..260b817 100644
--- a/src/main/java/com/zy/asrs/service/impl/WorkServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/WorkServiceImpl.java
@@ -1,5 +1,7 @@
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;
import com.core.common.BaseRes;
@@ -20,8 +22,12 @@
import com.zy.common.model.enums.WorkNoType;
import com.zy.common.properties.SlaveProperties;
import com.zy.common.service.CommonService;
+import com.zy.common.utils.HttpHandler;
import com.zy.common.utils.OutStockInterceptUtil;
import com.zy.common.web.WcsController;
+import com.zy.common.web.param.ReportParam;
+import com.zy.system.entity.Config;
+import com.zy.system.service.ConfigService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -82,6 +88,10 @@
private WaitPakinService waitPakinService;
@Autowired
private InventoryCheckOrderDetlService inventoryCheckOrderDetlService;
+ @Autowired
+ private ConfigService configService;
+ @Autowired
+ private ApiLogService apiLogService;
@Override
@Transactional
@@ -181,12 +191,12 @@
if (!locDetlDtos.isEmpty()) {
LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", locDetlDtos.get(0).getLocDetl().getLocNo()));
if (locMast.getLocSts().equals("F") || locMast.getLocSts().equals("D") ){
- if (locMast.getCrnNo() == 7){
- stockOutSXK(staNo, locDetlDtos, null, userId);
- }else {
+// if (locMast.getCrnNo() == 7){
+// stockOutSXK(staNo, locDetlDtos, null, userId);
+// }else {
// 鍚姩鍑哄簱寮�濮� 101.鍑哄簱
stockOut(staNo, locDetlDtos, null, userId);
- }
+// }
}else {
throw new CoolException("鎵�閫夊簱浣嶅瓨鍦ㄧ姸鎬佷笉涓篎銆丏鐨勫簱浣嶏紝搴撲綅鍙凤細"+locMast.getLocNo()+" 銆佸綋鍓嶇姸鎬侊細"+locMast.getLocSts()+"-"+locMast.getLocSts$());
@@ -298,6 +308,56 @@
}
} else {
throw new CoolException(dto.getLocNo() + "搴撲綅涓嶆槸鍦ㄥ簱鐘舵��");
+ }
+ String response = null;
+ Map<String, Object> requestParam = new LinkedHashMap<>();
+ int result = 0;
+ String wcsUrl = null;
+ String value = null;
+
+ // 璋冪敤WCS鎺ュ彛涓嬪彂鍑哄簱浠诲姟
+ try {
+ Config configUrl = configService.selectConfigByCode("wcsurl");
+ wcsUrl = configUrl.getValue();
+ Config config = configService.selectConfigByCode("wcsOutCreateTask");
+ value = config.getValue();
+ if (wcsUrl == null || value == null){
+ throw new CoolException("WCS鐩稿叧閰嶇疆鏈夎锛屽嚭搴撲换鍔′笅鍙戝け璐ワ紝璇锋鏌ョ浉鍏抽厤缃�");
+ }
+ requestParam.put("taskNo", workNo);
+ requestParam.put("staNo", staNo);
+ requestParam.put("locNo", Utils.getWcsLoc(dto.getLocNo()));
+ requestParam.put("taskPri",13);
+ response = new HttpHandler.Builder()
+ .setUri(wcsUrl)
+ .setPath(value)
+ .setJson(JSON.toJSONString(requestParam))
+ .setTimeout(30, TimeUnit.SECONDS)
+ .build()
+ .doPost();
+ if (response != null) {
+ JSONObject jsonObject = JSON.parseObject(response);
+ if (jsonObject.getInteger("code") == 200){
+ result = 1;
+ log.info("璋冪敤WCS鍑哄簱浠诲姟涓嬪彂鎺ュ彛鎴愬姛锛侊紒锛乽rl锛歿}锛況equest锛歿}锛況esponse锛歿}", wcsUrl + value,
+ JSON.toJSONString(requestParam), response);
+ }else {
+ throw new CoolException("璋冪敤WCS鍑哄簱浠诲姟涓嬪彂鎺ュ彛澶辫触锛屾帴鍙h繑鍥瀋ode寮傚父");
+ }
+ }else {
+ throw new CoolException("璋冪敤WCS鍑哄簱浠诲姟涓嬪彂鎺ュ彛澶辫触锛屾帴鍙f湭鍝嶅簲");
+ }
+ }catch (Exception e){
+ throw new CoolException("璋冪敤WCS鍑哄簱浠诲姟涓嬪彂鎺ュ彛寮傚父");
+ }finally {
+ ApiLog apiLog = new ApiLog();
+ apiLog.setNamespace("WMS涓嬪彂鍑哄簱浠诲姟鑷砏CS");
+ apiLog.setUrl(wcsUrl + value);
+ apiLog.setClientIp(wcsUrl);
+ apiLog.setRequest(JSON.toJSONString(requestParam));
+ apiLog.setResponse(response);
+ apiLog.setResult(result);apiLog.setCreateTime(new Date());
+ apiLogService.insert(apiLog);
}
}
}
@@ -502,6 +562,56 @@
}
} else {
throw new CoolException(taskDto.getLocNo() + "搴撲綅涓嶆槸鍦ㄥ簱鐘舵��");
+ }
+ String response = null;
+ Map<String, Object> requestParam = new LinkedHashMap<>();
+ int result = 0;
+ String wcsUrl = null;
+ String value = null;
+
+ // 璋冪敤WCS鎺ュ彛涓嬪彂鍑哄簱浠诲姟
+ try {
+ Config configUrl = configService.selectConfigByCode("wcsurl");
+ wcsUrl = configUrl.getValue();
+ Config config = configService.selectConfigByCode("wcsOutCreateTask");
+ value = config.getValue();
+ if (wcsUrl == null || value == null){
+ throw new CoolException("WCS鐩稿叧閰嶇疆鏈夎锛屽嚭搴撲换鍔′笅鍙戝け璐ワ紝璇锋鏌ョ浉鍏抽厤缃�");
+ }
+ requestParam.put("taskNo", workNo);
+ requestParam.put("staNo", staNo);
+ requestParam.put("locNo", Utils.getWcsLoc(locMast.getLocNo()));
+ requestParam.put("taskPri",13);
+ response = new HttpHandler.Builder()
+ .setUri(wcsUrl)
+ .setPath(value)
+ .setJson(JSON.toJSONString(requestParam))
+ .setTimeout(30, TimeUnit.SECONDS)
+ .build()
+ .doPost();
+ if (response != null) {
+ JSONObject jsonObject = JSON.parseObject(response);
+ if (jsonObject.getInteger("code") == 200){
+ result = 1;
+ log.info("璋冪敤WCS鍑哄簱浠诲姟涓嬪彂鎺ュ彛鎴愬姛锛侊紒锛乽rl锛歿}锛況equest锛歿}锛況esponse锛歿}", wcsUrl + value,
+ JSON.toJSONString(requestParam), response);
+ }else {
+ throw new CoolException("璋冪敤WCS鍑哄簱浠诲姟涓嬪彂鎺ュ彛澶辫触锛屾帴鍙h繑鍥瀋ode寮傚父");
+ }
+ }else {
+ throw new CoolException("璋冪敤WCS鍑哄簱浠诲姟涓嬪彂鎺ュ彛澶辫触锛屾帴鍙f湭鍝嶅簲");
+ }
+ }catch (Exception e){
+ throw new CoolException("璋冪敤WCS鍑哄簱浠诲姟涓嬪彂鎺ュ彛寮傚父");
+ }finally {
+ ApiLog apiLog = new ApiLog();
+ apiLog.setNamespace("WMS涓嬪彂鍑哄簱浠诲姟鑷砏CS");
+ apiLog.setUrl(wcsUrl + value);
+ apiLog.setClientIp(wcsUrl);
+ apiLog.setRequest(JSON.toJSONString(requestParam));
+ apiLog.setResponse(response);
+ apiLog.setResult(result);apiLog.setCreateTime(new Date());
+ apiLogService.insert(apiLog);
}
}
@@ -1710,6 +1820,44 @@
}
}
+ @Override
+ @Transactional
+ public void reportHandler(ReportParam param) {
+ WrkMast wrkMast = wrkMastService.selectOne(new EntityWrapper<WrkMast>().eq("wrk_no", param.getSuperTaskNo()));
+ if (wrkMast == null){
+ throw new CoolException("WCS涓婃姤WMS浠诲姟鍙锋病鏈夋壘鍒板搴斾换鍔★紝涓婄骇浠诲姟鍙�=" + param.getSuperTaskNo());
+ }
+ Long wrkSts = null;
+ if (wrkMast.getIoType() < 100){
+ if (param.getMsgDesc().equals("RGV_TASK_RUN")){
+ wrkSts = 201L;
+ }
+ if (param.getMsgDesc().equals("CRN_IN_TASK_RUN")){
+ wrkSts = 3L;
+ }
+ if (param.getMsgDesc().equals("CRN_IN_TASK_COMPLETE")){
+ wrkSts = 4L;
+ }
+ }else if (wrkMast.getIoType() > 100){
+ if (param.getMsgDesc().equals("CRN_OUT_TASK_RUN")){
+ wrkSts = 12L;
+ }
+ if (param.getMsgDesc().equals("CRN_OUT_TASK_COMPLETE") && wrkMast.getIoType() == 101){
+ wrkSts = 15L;
+ }
+ if (param.getMsgDesc().equals("CRN_OUT_TASK_COMPLETE")){
+ wrkSts = 14L;
+ }
+ }else {
+ throw new CoolException("鏈煡绫诲瀷鐨勫伐浣滄。");
+ }
+
+ wrkMast.setWrkSts(wrkSts);
+ wrkMast.setIoTime(new Date());
+ if (!wrkMastService.updateById(wrkMast)){
+ throw new CoolException("淇敼宸ヤ綔妗g姸鎬佸け璐�");
+ }
+ }
@Transactional(rollbackFor = Exception.class)
--
Gitblit v1.9.1