From 49a2abb6748b5013c24cc4257b9cc4f060720250 Mon Sep 17 00:00:00 2001
From: 野心家 <1051256694@qq.com>
Date: 星期一, 29 一月 2024 20:55:40 +0800
Subject: [PATCH] #
---
src/main/java/com/zy/asrs/service/impl/TaskWrkServiceImpl.java | 23 ++++++++++++-----------
1 files changed, 12 insertions(+), 11 deletions(-)
diff --git a/src/main/java/com/zy/asrs/service/impl/TaskWrkServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/TaskWrkServiceImpl.java
index 40ad2b0..6a4c4f3 100644
--- a/src/main/java/com/zy/asrs/service/impl/TaskWrkServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/TaskWrkServiceImpl.java
@@ -1,6 +1,7 @@
package com.zy.asrs.service.impl;
import com.alibaba.fastjson.JSON;
+import com.core.common.Cools;
import com.core.exception.CoolException;
import com.zy.asrs.domain.enums.TaskStatusType;
import com.zy.asrs.domain.enums.WorkNoType;
@@ -24,6 +25,7 @@
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
@@ -59,7 +61,7 @@
}
@Override
- @Transactional
+ @Transactional(propagation = Propagation.REQUIRES_NEW)
public void distribute(String taskNo, Long userId) {
TaskWrk taskWrk = this.selectByTaskNo(taskNo);
if (taskWrk == null) {
@@ -89,7 +91,7 @@
@Override
public void startup(TaskWrk taskWrk, Long userId) {
//鍏ュ簱浠诲姟娲惧彂
- StaDesc staDesc = staDescService.queryCrn(taskWrk.getIoType(), Integer.parseInt(taskWrk.getStartPoint()));
+ StaDesc staDesc = staDescService.queryCrn(taskWrk.getIoType(), Integer.parseInt(taskWrk.getStartPoint()), taskWrk.getCrnNo());
if (staDesc == null) {
throw new CoolException("鍏ュ簱璺緞涓嶅瓨鍦�");
}
@@ -120,7 +122,7 @@
crnCommand.setDestinationPosY(Utils.getLevShort(taskWrk.getTargetPoint())); // 鐩爣搴撲綅灞�
crnCommand.setDestinationPosZ(Utils.getRowShort(taskWrk.getTargetPoint())); // 鐩爣搴撲綅鎺�
crnCommand.setCommand((short)1);
- if (!CommandUtils.offer(SlaveType.Crn, taskWrk.getCrnNo(), new Task(2, crnCommand))) {
+ if (!CommandUtils.offer(SlaveType.Crn, taskWrk.getCrnNo(), new Task(5, crnCommand))) {
log.error("鍫嗗灈鏈哄懡浠ょ敓鎴愬け璐ワ紝鍫嗗灈鏈哄彿={}锛屼换鍔℃暟鎹�={}", taskWrk.getCrnNo(), JSON.toJSON(crnCommand));
throw new CoolException("鍫嗗灈鏈哄懡浠ょ敓鎴愬け璐�");
}
@@ -129,7 +131,7 @@
@Override
public void stockOut(TaskWrk taskWrk, Long userId) {
//鍑哄簱浠诲姟娲惧彂
- StaDesc staDesc = staDescService.queryCrn(taskWrk.getIoType(), Integer.parseInt(taskWrk.getTargetPoint()));
+ StaDesc staDesc = staDescService.queryCrn(taskWrk.getIoType(), Integer.parseInt(taskWrk.getTargetPoint()), taskWrk.getCrnNo());
if (staDesc == null) {
return;//涓嶅瓨鍦ㄨ矾寰�
}
@@ -160,7 +162,7 @@
crnCommand.setDestinationPosY(crnStn.getLev().shortValue()); // 鐩爣搴撲綅鍒�
crnCommand.setDestinationPosZ(crnStn.getRow().shortValue()); // 鐩爣搴撲綅灞�
crnCommand.setCommand((short)1);
- if (!CommandUtils.offer(SlaveType.Crn, taskWrk.getCrnNo(), new Task(2, crnCommand))) {
+ if (!CommandUtils.offer(SlaveType.Crn, taskWrk.getCrnNo(), new Task(5, crnCommand))) {
log.error("鍫嗗灈鏈哄懡浠ょ敓鎴愬け璐ワ紝鍫嗗灈鏈哄彿={}锛屼换鍔℃暟鎹�={}", taskWrk.getCrnNo(), JSON.toJSON(crnCommand));
throw new CoolException("鍫嗗灈鏈哄懡浠ょ敓鎴愬け璐�");
}
@@ -170,7 +172,7 @@
StaProtocol staProtocol = devpThread.getStation().get(crnStn.getStaNo()).clone();
staProtocol.setWorkNo(taskWrk.getWrkNo().shortValue());
staProtocol.setStaNo((short) Integer.parseInt(taskWrk.getTargetPoint()));
- if (!CommandUtils.offer(SlaveType.Devp, crnStn.getDevpPlcId(), new Task(2, staProtocol))) {
+ if (!CommandUtils.offer(SlaveType.Devp, crnStn.getDevpPlcId(), new Task(3, staProtocol))) {
log.error("杈撻�佺嚎鍛戒护鐢熸垚澶辫触锛屽爢鍨涙満鍙�={}锛屼换鍔℃暟鎹�={}", taskWrk.getCrnNo(), JSON.toJSON(crnCommand));
throw new CoolException("杈撻�佺嚎鍛戒护鐢熸垚澶辫触");
}
@@ -179,16 +181,15 @@
@Override
public void locMove(TaskWrk taskWrk, Long userId) {
//搴撴牸绉昏浇浠诲姟娲惧彂
- StaDesc staDesc = staDescService.queryCrn(taskWrk.getIoType(), Integer.parseInt(taskWrk.getTargetPoint()));
- if (staDesc == null) {
- return;//涓嶅瓨鍦ㄨ矾寰�
- }
+ if (Cools.isEmpty(taskWrk.getTargetPoint())){
+ return;
+ }
int workNo = commonService.getWorkNo(WorkNoType.OTHER.type);//鑾峰彇宸ヤ綔鍙�
taskWrk.setWrkNo(workNo);//宸ヤ綔鍙�
taskWrk.setStatus(TaskStatusType.DISTRIBUTE.id);//娲惧彂鐘舵��
taskWrk.setAssignTime(new Date());//娲惧彂鏃堕棿
taskWrk.setWrkSts(11);//宸ヤ綔鐘舵�� 11.鐢熸垚鍑哄簱ID
- taskWrk.setCrnNo(staDesc.getCrnNo());//鍫嗗灈鏈哄彿
+ //taskWrk.setCrnNo(staDesc.getCrnNo());//鍫嗗灈鏈哄彿
taskWrk.setModiTime(new Date());
taskWrk.setModiUser(userId);
updateById(taskWrk);
--
Gitblit v1.9.1