From 81e151f26b6852416ae0b7679d081900c9e64ace Mon Sep 17 00:00:00 2001
From: Fancy <Fancy.fx@outlook.com>
Date: 星期三, 17 七月 2024 14:51:15 +0800
Subject: [PATCH] status and result change
---
pms-parent/pms-web-station/src/main/java/com/dy/pmsStation/workOrder/WorkOrderSv.java | 35 +++++++++++++++++++++++------------
1 files changed, 23 insertions(+), 12 deletions(-)
diff --git a/pms-parent/pms-web-station/src/main/java/com/dy/pmsStation/workOrder/WorkOrderSv.java b/pms-parent/pms-web-station/src/main/java/com/dy/pmsStation/workOrder/WorkOrderSv.java
index 4f9fdf4..bd51d42 100644
--- a/pms-parent/pms-web-station/src/main/java/com/dy/pmsStation/workOrder/WorkOrderSv.java
+++ b/pms-parent/pms-web-station/src/main/java/com/dy/pmsStation/workOrder/WorkOrderSv.java
@@ -15,6 +15,7 @@
import com.dy.pmsGlobal.pojoPr.PrProductionNode;
import com.dy.pmsGlobal.pojoSta.StaAssemblyWorkHistory;
import com.dy.pmsGlobal.pojoSta.StaAssemblyWorkLast;
+import com.dy.pmsGlobal.util.QrCodeConstant;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
@@ -155,11 +156,16 @@
if (workLasts.size() > 0) {
List<StaAssemblyWorkLast> userStationList = workLasts.stream().filter(item -> userId == item.getUserId()).collect(Collectors.toList());
if (userStationList.size() == 0) {
- throw new RuntimeException("鍛樺伐(" + workLasts.get(0).getUserName() + ")缂栫爜:" + workLasts.get(0).getUserId() + "宸茬粡缁戝畾璇ュ伐绔�(" + workLasts.get(0).getStationName() + ")缂栫爜:" + workLasts.get(0).getStationId() + ".璇峰厛璁╁叾瑙g粦");
+ //鍒犻櫎宸ョ珯鐧诲綍淇℃伅
+ for (int i = 0; i < workLasts.size(); i++) {
+ logout(workLasts.get(i).getId().toString());
+ }
+ //throw new RuntimeException("鍛樺伐(" +userInfo.getName() + ")缂栫爜:" + workLasts.get(0).getUserId() + "宸茬粡缁戝畾璇ュ伐绔�(" + stationInfo.getName() + ")缂栫爜:" + workLasts.get(0).getStationId() + ".璇峰厛璁╁叾瑙g粦");
} else {
BeanUtils.copyProperties(userStationList.get(0), result);
}
- } else {
+ }
+ if (result.getId() == null) {
result.setUserId(userInfo.getId());
result.setUserName(userInfo.getName());
result.setStationId(stationInfo.getId());
@@ -170,6 +176,9 @@
}
public StaAssemblyWorkLast getWorkLast(String workId) {
+ if (StringUtils.isBlank(workId)) {
+ throw new RuntimeException("鐧诲綍ID涓虹┖,璇疯仈绯荤鐞嗗憳鏌ョ湅骞惰В鍐抽棶棰�.");
+ }
StaAssemblyWorkLast result = assemblyWorkLastDao.selectByPrimaryKey(Long.parseLong(workId));
if (result == null) {
throw new RuntimeException("绯荤粺涓病鏈夎鏉$櫥褰曚俊鎭�");
@@ -185,33 +194,34 @@
//鐩存帴鍒犻櫎璁板綍
logout(result.getId().toString());
result.setId(null);
- if(userInfo == null){
+ result.setStatus(STATUS_WORK_LAST_LOGOUT);
+ if (userInfo == null) {
result.setUserId(null);
result.setUserName("");
}
- if(stationInfo == null){
+ if (stationInfo == null) {
result.setStationId(null);
result.setStationName("");
}
- if(assyPlan == null){
+ if (assyPlan == null) {
result.setPlanId(null);
result.setPlanName("");
}
- if(!hasNodeId){
+ if (!hasNodeId) {
result.setNodeId(null);
result.setNodeName("");
}
return result;
- }else {
+ } else {
result.setPlanName(assyPlan.getName());
result.setProcessName(assyPlan.getProcessName());
result.setNodeName(assyPlan.getProcess().getNodes().get(0).getContent());
//鎵惧埌瀵瑰簲鐨勪骇鍝佷俊鎭�
- PltProduct product = productDao.selectByPrimaryKey(assyPlan.getProId());
+ PltProduct product = productDao.selectByPrimaryKey(assyPlan.getProId());
if (product != null) {
result.setProId(product.getId());
result.setProName(product.getName());
- String devicePrefix = "110" + product.getCode() + assyPlan.getBatchNo();
+ String devicePrefix = QrCodeConstant.TypeProduct + product.getCode() + assyPlan.getBatchNo();
result.setDevicePrefix(devicePrefix);
}
}
@@ -235,7 +245,7 @@
param.setStatus(STATUS_NORMAL);
List<StaAssemblyWorkLast> workLasts = assemblyWorkLastDao.selectList(param);
if (workLasts.size() > 0) {
- result = getWorkLast(workLasts.get(0).getId().toString());
+ result = getWorkLast(workLasts.get(0).getId().toString());
}
result.setStationId(stationInfo.getId());
result.setStationName(stationInfo.getName());
@@ -293,13 +303,13 @@
result.setProcessName(assyPlan.getProcessName());
result.setNodeName(assyPlan.getProcess().getNodes().get(0).getContent());
//鎵惧埌瀵瑰簲鐨勪骇鍝佷俊鎭�
- PltProduct product = productDao.selectByPrimaryKey(assyPlan.getProId());
+ PltProduct product = productDao.selectByPrimaryKey(assyPlan.getProId());
if (product == null) {
throw new RuntimeException("浜у搧淇℃伅鏈夎鎴栬鍏朵粬浜哄憳淇敼,璇风櫥褰曠鐞嗙郴缁熸煡鐪嬩换鍔″叧鑱斾骇鍝両D涓�:" + assyPlan.getProId());
}
result.setProId(product.getId());
result.setProName(product.getName());
- String devicePrefix = "110" + product.getCode() + assyPlan.getBatchNo();
+ String devicePrefix = QrCodeConstant.TypeProduct + product.getCode() + assyPlan.getBatchNo();
result.setDevicePrefix(devicePrefix);
return result;
}
@@ -317,6 +327,7 @@
// 淇濆瓨history
StaAssemblyWorkHistory history = new StaAssemblyWorkHistory();
BeanUtils.copyProperties(workLast, history);
+ history.setWorkId(workLast.getId());
//history.setId(null);
int count = assemblyWorkHistoryDao.insertSelective(history);
//鍒犻櫎last
--
Gitblit v1.8.0