From c3434b1fe0132372b34ff0a46d84e6129a094bfc Mon Sep 17 00:00:00 2001
From: L <L@132>
Date: 星期四, 28 八月 2025 08:43:15 +0800
Subject: [PATCH] *
---
src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java | 137 +++++++++++++++++++++++++++++++++++++--------
1 files changed, 111 insertions(+), 26 deletions(-)
diff --git a/src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java
index 8aae7d5..2fca288 100644
--- a/src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java
@@ -5,19 +5,17 @@
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.core.common.Cools;
import com.core.common.R;
+import com.core.common.SpringUtils;
import com.core.exception.CoolException;
import com.zy.asrs.domain.enums.TaskStatusType;
-import com.zy.asrs.entity.StaDesc;
-import com.zy.asrs.entity.TaskWrk;
-import com.zy.asrs.entity.ToWmsDTO;
+import com.zy.asrs.domain.enums.WorkNoType;
+import com.zy.asrs.entity.*;
import com.zy.asrs.entity.param.TaskOverParam;
import com.zy.asrs.entity.param.WMSAndAGVInterfaceParam;
-import com.zy.asrs.entity.param.taskCreateParam;
-import com.zy.asrs.service.ApiLogService;
-import com.zy.asrs.service.OpenService;
-import com.zy.asrs.service.StaDescService;
-import com.zy.asrs.service.TaskWrkService;
+import com.zy.asrs.entity.param.TaskCreateParam;
+import com.zy.asrs.service.*;
import com.zy.asrs.utils.Utils;
+import com.zy.common.service.CommonService;
import com.zy.common.utils.HttpHandler;
import com.zy.core.DevpThread;
import com.zy.core.cache.MessageQueue;
@@ -31,7 +29,6 @@
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
-import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.util.*;
@@ -47,6 +44,12 @@
@Autowired
private StaDescService staDescService;
+ @Autowired
+ private CommonService commonService;
+ @Autowired
+ private LocMastService locMastService;
+ @Autowired
+ private BasDevpService basDevpService;
@@ -60,20 +63,55 @@
@Override
- public R taskCreate(taskCreateParam param) {
+ public R taskCreate(TaskCreateParam param) {
TaskWrk taskWrk = taskWrkService.selectByTaskNo(param.getTaskNo());
if (taskWrk != null) {
+ try{
+ DeviceErrorService deviceErrorService = SpringUtils.getBean(DeviceErrorService.class);
+ deviceErrorService.addDeviceError("wms涓嬪彂浠诲姟寮傚父", 1, "浠诲姟宸插瓨鍦紝璇峰嬁閲嶅鎻愪氦,taskWrk:"+JSON.toJSONString(taskWrk));
+ } catch (Exception e2){
+// log.error("e2:"+e2.getMessage());
+ }
throw new CoolException(param.getTaskNo() + "浠诲姟宸插瓨鍦紝璇峰嬁閲嶅鎻愪氦");
}
if (param.getIoType().equals(0)){
+ try{
+ DeviceErrorService deviceErrorService = SpringUtils.getBean(DeviceErrorService.class);
+ deviceErrorService.addDeviceError("wms涓嬪彂浠诲姟寮傚父", 1, "鐢熸垚浠诲姟澶辫触锛屼换鍔$被鍨嬩笉瀛樺湪锛�,iotype:"+JSON.toJSONString(param.getIoType()));
+ } catch (Exception e2){
+// log.error("e2:"+e2.getMessage());
+ }
throw new CoolException("鐢熸垚浠诲姟澶辫触锛屼换鍔$被鍨嬩笉瀛樺湪锛�");
}
Date now = new Date();
taskWrk = new TaskWrk();
+ int workNo1 = 0;//鑾峰彇鍏ュ簱宸ヤ綔鍙�
+ if (param.getIoType() .equals(1)){
+ workNo1 = commonService.getWorkNo(WorkNoType.PAKIN.type);
+ } else if (param.getIoType() .equals(2)){
+ workNo1 = commonService.getWorkNo(WorkNoType.PAKOUT.type);
+ } else {
+ workNo1 = commonService.getWorkNo(WorkNoType.PICK.type);
+ }
taskWrk.setTaskNo(param.getTaskNo());//浠诲姟鍙�
+ taskWrk.setWrkNo(workNo1);
taskWrk.setStatus(TaskStatusType.RECEIVE.id);//浠诲姟鐘舵�侊細鎺ユ敹
taskWrk.setCreateTime(now);
+ taskWrk.setModiTime(now);
+ taskWrk.setAssignTime(new Date());
+ taskWrk.setModiUser(6666L);
+// try{
+// if (param.getIoType()>1){
+// LocMast locMast=locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no",param.getStartPoint()));
+// if (Utils.locNoRowBoolean(locMast.getRow1())){
+// param.setTaskPriority(11);
+// }
+// }
+// }catch (Exception e){
+// }
+ taskWrk.setIoPri(param.getTaskPriority());
+
taskWrk.setIoType(param.getIoType());//浠诲姟绫诲瀷
taskWrk.setIoPri(param.getTaskPriority());//浼樺厛绾�
taskWrk.setBarcode(param.getBarcode());//鏉$爜
@@ -81,22 +119,29 @@
if(param.getIoType() == 1){
taskWrk.setWrkSts(1);
if (!Cools.isEmpty(param.getTargetPoint())) {
- taskWrk.setTargetPoint(Utils.getWcsLocNo(param.getTargetPoint()));//缁堢偣
- taskWrk.setOriginTargetPoint(param.getTargetPoint());
+// taskWrk.setTargetPoint(Utils.getWcsLocNo(param.getTargetPoint()));//缁堢偣 杞崲涓�
+ taskWrk.setTargetPoint(param.getTargetPoint());//缁堢偣
+ taskWrk.setStartPoint(param.getStartPoint());
+ taskWrk.setOriginStartPoint(param.getStartPointSta().toString());
+ taskWrk.setOriginTargetPoint(param.getTargetPointSta().toString());
}
} else if (param.getIoType() == 2) {
taskWrk.setWrkSts(11);
if (!Cools.isEmpty(param.getStartPoint())) {
- taskWrk.setStartPoint(Utils.getWcsLocNo(param.getStartPoint()));//璧风偣
- taskWrk.setOriginStartPoint(param.getStartPoint());
+ taskWrk.setStartPoint(param.getStartPoint());//璧风偣
+ taskWrk.setTargetPoint(param.getTargetPoint());
}
taskWrk.setTargetPoint(param.getTargetPoint());
+ taskWrk.setOriginStartPoint(param.getStartPointSta().toString());
+ taskWrk.setOriginTargetPoint(param.getTargetPointSta().toString());
}else if (param.getIoType() == 3){
taskWrk.setWrkSts(11);
if (!Cools.isEmpty(param.getStartPoint())) {
taskWrk.setStartPoint(param.getStartPoint());//璧风偣
- taskWrk.setOriginStartPoint(param.getStartPoint());
+ taskWrk.setTargetPoint(param.getTargetPoint());
+ taskWrk.setOriginStartPoint("0");
+ taskWrk.setOriginTargetPoint("0");
}
}
@@ -107,6 +152,12 @@
}
if (!taskWrkService.insert(taskWrk)) {
+ try{
+ DeviceErrorService deviceErrorService = SpringUtils.getBean(DeviceErrorService.class);
+ deviceErrorService.addDeviceError("wms涓嬪彂浠诲姟寮傚父", 1, "鍒涘缓浠诲姟澶辫触锛�,param:"+JSON.toJSONString(param));
+ } catch (Exception e2){
+// log.error("e2:"+e2.getMessage());
+ }
return R.error("鍒涘缓浠诲姟澶辫触");
}
return R.ok();
@@ -155,14 +206,14 @@
,true
);
- if (jsonObject.getInteger("code").equals(200)) {
+ if (!Cools.isEmpty(jsonObject.getInteger("code")) && jsonObject.getInteger("code").equals(200)) {
//瑙f瀽
List<WMSAndAGVInterfaceParam> params = new ArrayList<>();
params.add(param);
WMSAndAGVInterfaceParam data = JSONObject.parseObject(jsonObject.get("data").toString(), WMSAndAGVInterfaceParam.class);
String msg = null;
try {
- taskCreate(new taskCreateParam(data));
+ taskCreate(new TaskCreateParam(data));
}catch (Exception e){
msg = e.getMessage();
}
@@ -213,12 +264,12 @@
} else {
staProtocol = staProtocol.clone();
}
- Short workNo = staProtocol.getWorkNo();
+ Integer workNo = staProtocol.getWorkNo();
if (wharfCode1.contains(param.getWharfCode())){
- if (!staProtocol.isLoading() && !staProtocol.isCar() && staProtocol.getWorkNo() >0){
+ if (!staProtocol.isLoading() && staProtocol.getWorkNo() >0){
//AGV鍑哄簱瀹屾垚浠ュ悗
- staProtocol.setWorkNo((short) 0);
- staProtocol.setStaNo((short)0);
+ staProtocol.setWorkNo( 0);
+ staProtocol.setStaNo(0);
boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(3, staProtocol));
if (result) {
@@ -230,10 +281,10 @@
for (DevpSlave.Sta inSta : devp.getInSta()) {
if (inSta.getBackSta().equals(staDesc.getStnNo())){
- if (staProtocol.isLoading() && !staProtocol.isCar() && workNo == 0){
+ if (staProtocol.isLoading() && workNo == 0){
//AGV鍏ュ簱瀹屾垚浠ュ悗
- staProtocol.setWorkNo((short) 9999);
- staProtocol.setStaNo(inSta.getStaNo().shortValue());
+ staProtocol.setWorkNo(9999);
+ staProtocol.setStaNo(inSta.getStaNo());
boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(3, staProtocol));
if (result) {
@@ -248,6 +299,40 @@
}
}
+
+// @Override
+// public R getAgvPickAndPlaceV1(TaskOverParam param) {
+// BasDevp basDevp = basDevpService.selectById(param.getStaNo());
+// if (Cools.isEmpty(basDevp)){
+// return R.error("绔欑偣鍙锋湁璇�"+param.getStaNo());
+// }
+// if (param.getType()==0 && basDevp.getAgvStartPick()==1){
+// return R.ok();
+// }else if (param.getType()==1 && basDevp.getAgvStartPlace()==1){
+// return R.ok();
+// }else {
+// return R.error("涓嶅厑璁�");
+// }
+// }
+
+// @Override
+// public R getAgvPickAndPlaceV2(TaskOverParam param) {
+// BasDevp basDevp = basDevpService.selectById(param.getStaNo());
+// if (Cools.isEmpty(basDevp)){
+// return R.error("绔欑偣鍙锋湁璇�"+param.getStaNo());
+// }
+// if (param.getType()==0){
+// basDevp.setAgvTargetPick(1);
+// basDevpService.updateById(basDevp);
+// return R.ok();
+// }else if (param.getType()==1){
+// basDevp.setAgvTargetPlace(1);
+// basDevpService.updateById(basDevp);
+// return R.ok();
+// }else {
+// return R.error("璇锋眰绫诲瀷寮傚父"+param.getType());
+// }
+// }
public List<Integer> getInEnableRoadway(){
int[] roadway = null;
@@ -272,7 +357,7 @@
} else {
staProtocol = staProtocol.clone();
}
- Short workNo = staProtocol.getWorkNo();
+ Integer workNo = staProtocol.getWorkNo();
if (workNo == 0 && !staProtocol.isLoading()){
if (Cools.isEmpty( map.get(inSta.getStaNo()))){
continue;
@@ -308,7 +393,7 @@
} else {
staProtocol = staProtocol.clone();
}
- Short workNo = staProtocol.getWorkNo();
+ Integer workNo = staProtocol.getWorkNo();
if (workNo == 0 && !staProtocol.isLoading()){
if (Cools.isEmpty( map.get(inSta.getStaNo()))){
continue;
--
Gitblit v1.9.1