From 3d0432367713440506f9ec105e95a12bdb001936 Mon Sep 17 00:00:00 2001
From: Junjie <540245094@qq.com>
Date: 星期二, 12 十二月 2023 16:47:24 +0800
Subject: [PATCH] #
---
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java | 104 +++++++++++++++++++++++++++++++++++----------------
1 files changed, 71 insertions(+), 33 deletions(-)
diff --git a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
index c66b089..bd53665 100644
--- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -5,11 +5,13 @@
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.fasterxml.jackson.databind.ObjectMapper;
import com.zy.asrs.domain.enums.TaskStatusType;
import com.zy.asrs.entity.*;
import com.zy.asrs.entity.param.WMSAndAGVInterfaceParam;
+import com.zy.asrs.entity.param.taskCreateParam;
import com.zy.asrs.mapper.*;
import com.zy.asrs.service.*;
import com.zy.asrs.utils.CommandUtils;
@@ -43,10 +45,7 @@
import org.springframework.transaction.annotation.Transactional;
import java.io.IOException;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
/**
* 绔嬩綋浠撳簱WCS绯荤粺涓绘祦绋嬩笟鍔�
@@ -93,7 +92,7 @@
private String movePath;
- public void generateStoreWrkFile() {
+ public void generateStoreWrkFile() throws IOException, InterruptedException {
// 鏍规嵁杈撻�佺嚎plc閬嶅巻
for (DevpSlave devp : slaveProperties.getDevp()) {
// 閬嶅巻鍏ュ簱鍙�
@@ -109,7 +108,7 @@
Short workNo = staProtocol.getWorkNo();
// 鍒ゆ柇鏄惁婊¤冻鍏ュ簱鏉′欢
if (staProtocol.isAutoing() && staProtocol.isLoading()
- && !staProtocol.isInEnable()
+ && staProtocol.isInEnable()
&& !staProtocol.isEmptyMk() && (workNo >= 0)
&& staProtocol.isPakMk()) {
@@ -150,7 +149,7 @@
staProtocol.setWorkNo(workNo);
staProtocol.setStaNo(inSta.getBackSta().shortValue());
devpThread.setPakMk(staProtocol.getSiteId(), false);
- MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
+ MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(3, staProtocol));
TaskWrk taskWrk = taskWrkMapper.selectByWrkNo(Integer.valueOf(workNo));
if (taskWrk != null) {
@@ -166,29 +165,68 @@
}
String barcode = barcodeThread.getBarcode();
if(!Cools.isEmpty(barcode)) {
-// ToWmsDTO toWmsDTO = new ToWmsDTO();
-// Map<String, Object> map = new HashMap<>();
-// map.put("x-api-key","7a15b5db-29b6-552c-8cff-0cfec3756da2");
-// List<Integer> list = openServiceImpl.getInEnableRoadway();
-//
-// //TaskWrk taskWrk = taskWrkService.selectByTaskNo(param.getTaskNo());
-// toWmsDTO.setWarehouseId("1688469798893297665");
-// toWmsDTO.setContainerCode(param.getContainerCode());
-// toWmsDTO.setApplyType("TUNNEL");
-// toWmsDTO.setWharfSource(null);
-// toWmsDTO.setCanInboundTunnels(list);
-// String response = null;
-// try {
-// response = new HttpHandler.Builder()
-// .setHeaders(map)
-// .setUri(wmsUrl)
-// .setPath("wcsManager/wcsInterface/inboundTaskApply")
-// .setJson(JSON.toJSONString(toWmsDTO))
-// .build()
-// .doPost();
-// }catch (Exception e){
-//
-// }
+ StaDescService staDescService = SpringUtils.getBean(StaDescService.class);
+
+ ToWmsDTO toWmsDTO = new ToWmsDTO();
+ Map<String, Object> map = new HashMap<>();
+ map.put("x-api-key","7a15b5db-29b6-552c-8cff-0cfec3756da2");
+ List<Integer> list = openServiceImpl.getInEnableRoadway();
+ TaskWrk taskWrk = taskWrkService.selectOne(new EntityWrapper<TaskWrk>().eq("barcode", barcode));
+
+ if (Cools.isEmpty(taskWrk)){
+ continue;
+ }
+ //StaDesc staDesc1 = staDescService.selectOne(new EntityWrapper<StaDesc>().eq("stn_no",inSta.getBackSta()));
+ if (taskWrk.getTargetPoint() != null && taskWrk.getStartPoint() != null && taskWrk.getWrkNo() != null && taskWrk.getWrkNo().shortValue() != workNo){
+ //鑾峰彇鍫嗗灈鏈虹珯鐐�
+ StaDesc staDesc = new StaDesc();
+ if (devp.getId() <= 1){
+ staDesc = staDescService.selectOne(new EntityWrapper<StaDesc>()
+ .eq("crn_no", taskWrk.getCrnNo()).eq("type_no",1).lt("crn_stn", 200));
+ }else {
+ staDesc = staDescService.selectOne(new EntityWrapper<StaDesc>()
+ .eq("crn_no", taskWrk.getCrnNo()).eq("type_no",1).ge("crn_stn", 200));
+ }
+ staProtocol.setWorkNo(taskWrk.getWrkNo().shortValue());
+ staProtocol.setStaNo(staDesc.getCrnStn().shortValue());
+ MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(3, staProtocol));
+ Thread.sleep(200);
+ }else {
+ //TaskWrk taskWrk = taskWrkService.selectByTaskNo(param.getTaskNo());
+ toWmsDTO.setWarehouseId("1688469798893297665");
+ toWmsDTO.setContainerCode(barcode);
+ toWmsDTO.setApplyType("TUNNEL_LOCATION");
+ toWmsDTO.setTaskTunnel(taskWrk.getCrnNo());
+ toWmsDTO.setCanInboundTunnels(list);
+ String response = null;
+ try {
+ response = new HttpHandler.Builder()
+ .setHeaders(map)
+ .setUri(wmsUrl)
+ .setPath("wcsManager/wcsInterface/inboundTaskApply")
+ .setJson(JSON.toJSONString(toWmsDTO))
+ .build()
+ .doPost();
+ }catch (Exception e){
+ log.error("wms閫氳澶辫触,"+e.getMessage());
+ continue;
+ }
+ JSONObject jsonObject = JSON.parseObject(response);
+ if (jsonObject.getInteger("code").equals(200)) {
+ GetWmsDto getWmsDto = JSON.parseObject(jsonObject.get("data").toString(), GetWmsDto.class);
+ taskWrk.setOriginTargetPoint(getWmsDto.getTargetLocationCode());
+ taskWrk.setTargetPoint(Utils.getWcsLocNo(getWmsDto.getTargetLocationCode()));
+ taskWrk.setStartPoint(String.valueOf(inSta.getBackSta()));
+ if (!taskWrkService.updateById(taskWrk)){
+ log.error("淇濆瓨wms搴撲綅鍙峰け璐�");
+ }
+
+ }else {
+ log.error("wms閫氳澶辫触,"+jsonObject.get("msg"));
+
+ }
+ }
+
}
}
@@ -405,7 +443,7 @@
// }
}
- return;
+ // return;
}
}
@@ -821,7 +859,7 @@
if (taskWrk.getIoType() == 1) {
//鍏ュ簱浠诲姟
taskWrk.setWrkSts(4);//3.鍚婅溅鍏ュ簱涓� => 4.鍏ュ簱瀹屾垚
- taskWrk.setStatus(TaskStatusType.COMPLETE.id);
+ //taskWrk.setStatus(TaskStatusType.COMPLETE.id);
taskWrk.setModiTime(now);
taskWrkService.updateById(taskWrk);
@@ -835,7 +873,7 @@
} else if (taskWrk.getIoType() == 2) {
//鍑哄簱浠诲姟
taskWrk.setWrkSts(14);//12.鍚婅溅鍑哄簱涓� => 14.鍑哄簱瀹屾垚
- taskWrk.setStatus(TaskStatusType.COMPLETE.id);
+// taskWrk.setStatus(TaskStatusType.COMPLETE.id);
taskWrk.setModiTime(now);
taskWrkService.updateById(taskWrk);
--
Gitblit v1.9.1