From 61ceac3d348b5d2a58cba2bfde1002674368002e Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期四, 24 十二月 2020 16:54:14 +0800
Subject: [PATCH] #newVersion
---
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java | 316 ++++++++++++++++++++++++++++++++++++++++++++--------
1 files changed, 267 insertions(+), 49 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 8aba40d..1869f0d 100644
--- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -5,14 +5,19 @@
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.core.common.Cools;
import com.core.exception.CoolException;
+import com.zy.asrs.domain.enums.WorkNoType;
import com.zy.asrs.entity.*;
+import com.zy.asrs.mapper.BasCrnErrorMapper;
import com.zy.asrs.mapper.WaitPakinMapper;
import com.zy.asrs.mapper.WrkMastMapper;
import com.zy.asrs.service.*;
+import com.zy.asrs.utils.VersionUtils;
import com.zy.common.model.MatDto;
import com.zy.common.model.StartupDto;
import com.zy.common.service.CommonService;
import com.zy.common.utils.CollectionUtils;
+import com.zy.core.CrnThread;
+import com.zy.core.DevpThread;
import com.zy.core.cache.MessageQueue;
import com.zy.core.cache.SlaveConnection;
import com.zy.core.enums.*;
@@ -26,8 +31,6 @@
import com.zy.core.model.protocol.StaProtocol;
import com.zy.core.properties.SlaveProperties;
import com.zy.core.thread.BarcodeThread;
-import com.zy.core.thread.CrnThread;
-import com.zy.core.thread.DevpThread;
import com.zy.core.thread.LedThread;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@@ -55,24 +58,6 @@
@Autowired
private RowLastnoService rowLastnoService;
- public void test(){
- try {
- // 宸ヤ綔鍙�
- int workNo = commonService.getWorkNo(0);
- System.out.println(workNo);
- if (workNo > 0) {
- throw new CoolException("21321");
- }
- RowLastno rowLastno = rowLastnoService.selectById(1);
- rowLastno.setCurrentRow(rowLastno.getCurrentRow() + 1);
- rowLastnoService.updateById(rowLastno);
- System.out.println(rowLastno.getCurrentRow());
- } catch (Exception e) {
- e.printStackTrace();
- TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
- }
- }
-
@Autowired
private CommonService commonService;
@Autowired
@@ -92,9 +77,16 @@
@Autowired
private BasDevpService basDevpService;
@Autowired
+ private LocDetlService locDetlService;
+ @Autowired
+ private BasErrLogService basErrLogService;
+ @Autowired
+ private BasCrnErrorMapper basCrnErrorMapper;
+ @Autowired
private JdbcTemplate jdbcTemplate;
/**
+ * 缁勬墭
* 鍏ュ簱绔欙紝鏍规嵁鏉$爜鎵弿鐢熸垚鍏ュ簱宸ヤ綔妗o紝宸ヤ綔鐘舵�� 2
*/
@Async
@@ -106,14 +98,20 @@
// 鑾峰彇鏉$爜鎵弿浠俊鎭�
BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, inSta.getBarcode());
String barcode = barcodeThread.getBarcode();
+ if(!Cools.isEmpty(barcode)) {
+ System.err.println(barcode);
+ }
// 鑾峰彇鍏ュ簱绔欎俊鎭�
DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId());
StaProtocol staProtocol = devpThread.getStation().get(inSta.getStaNo());
if (staProtocol == null) {
continue;
+ } else {
+ staProtocol = staProtocol.clone();
}
// 鍒ゆ柇鏄惁婊¤冻鍏ュ簱鏉′欢
- if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.isInEnable()
+ if (staProtocol.isAutoing() && staProtocol.isLoading()
+// && staProtocol.isInEnable()
&& !staProtocol.isEmptyMk() && staProtocol.getWorkNo() == 0
&& staProtocol.isPakMk() && !Cools.isEmpty(barcode)) {
// 鍒ゆ柇閲嶅宸ヤ綔妗�
@@ -130,11 +128,11 @@
}
try {
- // 宸ヤ綔鍙�
- int workNo = commonService.getWorkNo(0);
// 妫�绱㈠簱浣�
List<String> matNos = waitPakins.stream().map(WaitPakin::getMatnr).distinct().collect(Collectors.toList());
StartupDto startupDto = commonService.getLocNo(1, 1, inSta.getStaNo(), matNos);
+ // 宸ヤ綔鍙�
+ int workNo = startupDto.getWorkNo();
// 鎻掑叆宸ヤ綔鏄庣粏妗�
wrkDetlService.createWorkDetail(workNo, waitPakins, barcode);
@@ -177,15 +175,18 @@
// 鍛戒护涓嬪彂鍖� --------------------------------------------------------------------------
+
// 鏇存柊绔欑偣淇℃伅 涓� 涓嬪彂plc鍛戒护
barcodeThread.setBarcode("");
staProtocol.setWorkNo((short) workNo);
staProtocol.setStaNo(startupDto.getStaNo().shortValue());
- staProtocol.setPakMk(false);
+ devpThread.setPakMk(staProtocol.getSiteId(), false);
boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
if (!result) {
throw new CoolException("鏇存柊plc绔欑偣淇℃伅澶辫触");
}
+
+
} catch (Exception e) {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
@@ -200,10 +201,11 @@
}
/**
+ * wms鍏ュ簱
* 鍏ュ簱绔欙紝鏍规嵁鏉$爜鎵弿鐢熸垚鍏ュ簱宸ヤ綔妗o紝宸ヤ綔鐘舵�� 1 ==>> 2
*/
@Async
- public void generateStoreWrkFile2() {
+ public void generateStoreWrkFile0() {
// 鏍规嵁杈撻�佺嚎plc閬嶅巻
for (DevpSlave devp : slaveProperties.getDevp()) {
// 閬嶅巻鍏ュ簱鍙�
@@ -211,7 +213,11 @@
// 鑾峰彇鍏ュ簱绔欎俊鎭�
DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId());
StaProtocol staProtocol = devpThread.getStation().get(inSta.getStaNo());
- if (staProtocol == null) { continue; }
+ if (staProtocol == null) {
+ continue;
+ } else {
+ staProtocol = staProtocol.clone();
+ }
// 鍒ゆ柇鏄惁婊¤冻鍏ュ簱鏉′欢
if (staProtocol.isAutoing() && staProtocol.isLoading()
&& !staProtocol.isEmptyMk() && staProtocol.getWorkNo() == 0
@@ -225,7 +231,7 @@
// 鏇存柊绔欑偣淇℃伅 涓� 涓嬪彂plc鍛戒护
staProtocol.setWorkNo(wrkMast.getWrkNo().shortValue());
staProtocol.setStaNo(wrkMast.getStaNo().shortValue());
- staProtocol.setPakMk(false);
+ devpThread.setPakMk(staProtocol.getSiteId(), false);
boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
if (result) {
// 鏇存柊宸ヤ綔涓绘。
@@ -257,7 +263,11 @@
// 鑾峰彇鎷f枡鍏ュ簱绔欎俊鎭�
DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId());
StaProtocol staProtocol = devpThread.getStation().get(pickSta.getStaNo());
- if (staProtocol == null) { continue; }
+ if (staProtocol == null) {
+ continue;
+ } else {
+ staProtocol = staProtocol.clone();
+ }
if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.isInEnable()
&& staProtocol.getWorkNo() > 0 && staProtocol.isPakMk()){
WrkMast wrkMast = wrkMastMapper.selectPickStep(staProtocol.getWorkNo().intValue());
@@ -277,16 +287,6 @@
StaDesc staDesc = staDescService.selectOne(wrapper);
if (Cools.isEmpty(staDesc)) {
log.error("鍏ュ簱璺緞涓嶅瓨鍦�");
- continue;
- }
-
- // 鏇存柊绔欑偣淇℃伅 涓� 涓嬪彂plc鍛戒护
- staProtocol.setWorkNo(wrkMast.getWrkNo().shortValue());
- staProtocol.setStaNo(wrkMast.getStaNo().shortValue());
- staProtocol.setPakMk(false);
- boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
- if (!result) {
- log.error("鍙戝竷鍛戒护鑷宠緭閫佺嚎闃熷垪澶辫触锛侊紒锛� [plc缂栧彿锛歿}]", devp.getId());
continue;
}
@@ -323,6 +323,16 @@
} catch (Exception e) {
e.printStackTrace();
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+ continue;
+ }
+
+ // 鏇存柊绔欑偣淇℃伅 涓� 涓嬪彂plc鍛戒护
+ staProtocol.setWorkNo(wrkMast.getWrkNo().shortValue());
+ staProtocol.setStaNo(wrkMast.getStaNo().shortValue());
+ devpThread.setPakMk(staProtocol.getSiteId(), false);
+ boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
+ if (!result) {
+ log.error("鍙戝竷鍛戒护鑷宠緭閫佺嚎闃熷垪澶辫触锛侊紒锛� [plc缂栧彿锛歿}]", devp.getId());
}
}
@@ -343,7 +353,11 @@
// 鑾峰彇鍫嗗灈鏈哄嚭搴撶珯淇℃伅
DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, crnStn.getDevpPlcId());
StaProtocol staProtocol = devpThread.getStation().get(crnStn.getStaNo());
- if (staProtocol == null) { continue; }
+ if (staProtocol == null) {
+ continue;
+ } else {
+ staProtocol = staProtocol.clone();
+ }
if (staProtocol.isAutoing() && staProtocol.isLoading() && (staProtocol.getWorkNo() == 0 || staProtocol.getStaNo() == null)) {
// 鏌ヨ宸ヤ綔妗�
WrkMast wrkMast = wrkMastMapper.selectPakOutStep2(staProtocol.getSiteId());
@@ -445,14 +459,18 @@
// 鑾峰彇鍫嗗灈鏈哄叆搴撶珯淇℃伅
DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, crnStn.getDevpPlcId());
StaProtocol staProtocol = devpThread.getStation().get(crnStn.getStaNo());
- if (staProtocol == null) { continue; }
+ if (staProtocol == null) {
+ continue;
+ } else {
+ staProtocol = staProtocol.clone();
+ }
// 鏌ヨ绔欑偣璇︾粏淇℃伅
BasDevp staDetl = basDevpService.selectById(crnStn.getStaNo());
if (staDetl == null) {
log.error("鍏ュ簱 ===>> 鍫嗗灈鏈虹珯鐐瑰湪鏁版嵁搴撲笉瀛樺湪, 绔欑偣缂栧彿={}", crnStn.getStaNo());
continue;
}
- if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.getWorkNo() > 0
+ if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.getWorkNo() > 0 && staProtocol.isInEnable()
&& staDetl.getCanining()!=null && staDetl.getCanining().equals("Y")) {
flag = true;
}
@@ -533,7 +551,11 @@
// 鑾峰彇鍫嗗灈鏈哄嚭搴撶珯淇℃伅
DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, crnStn.getDevpPlcId());
StaProtocol staProtocol = devpThread.getStation().get(crnStn.getStaNo());
- if (staProtocol == null) { continue; }
+ if (staProtocol == null) {
+ continue;
+ } else {
+ staProtocol = staProtocol.clone();
+ }
// 鏌ヨ绔欑偣璇︾粏淇℃伅
BasDevp staDetl = basDevpService.selectById(crnStn.getStaNo());
if (staDetl == null) {
@@ -542,7 +564,7 @@
}
// 鍒ゆ柇鍫嗗灈鏈哄嚭搴撶珯鐘舵��
if (staProtocol.isAutoing() && !staProtocol.isLoading() && staDetl.getCanouting() !=null && staDetl.getCanouting().equals("Y")
- && staProtocol.getWorkNo() == 0) {
+ && staProtocol.getWorkNo() == 0 && staProtocol.isOutEnable()) {
// 鍛戒护涓嬪彂鍖� --------------------------------------------------------------------------
// 鍫嗗灈鏈烘帶鍒惰繃婊�
@@ -687,8 +709,115 @@
/**
* 鍫嗗灈鏈哄紓甯镐俊鎭褰�
*/
+ @Async
public void recCrnErr(){
+ Date now = new Date();
+ for (CrnSlave crn : slaveProperties.getCrn()) {
+ // 鑾峰彇鍫嗗灈鏈轰俊鎭�
+ CrnThread crnThread = (CrnThread) SlaveConnection.get(SlaveType.Crn, crn.getId());
+ CrnProtocol crnProtocol = crnThread.getCrnProtocol();
+ if (crnProtocol == null) {
+ continue;
+ }
+ if (true) {
+// if (crnProtocol.getModeType() != CrnModeType.STOP) {
+ // 鏈変换鍔�
+ if (crnProtocol.getTaskNo() != 0) {
+ BasErrLog latest = basErrLogService.findLatestByTaskNo(crn.getId(), crnProtocol.getTaskNo().intValue());
+ // 鏈夊紓甯�
+ if (latest == null) {
+ if (crnProtocol.getAlarm1() != null && crnProtocol.getAlarm1() > 0) {
+ WrkMast wrkMast = wrkMastMapper.selectById(crnProtocol.getTaskNo());
+ BasCrnError crnError = basCrnErrorMapper.selectById(crnProtocol.getAlarm1());
+ BasErrLog basErrLog = new BasErrLog(
+ null, // 缂栧彿
+ wrkMast.getWrkNo(), // 宸ヤ綔鍙�
+ now, // 鍙戠敓鏃堕棿
+ null, // 缁撴潫鏃堕棿
+ wrkMast.getWrkSts(), // 宸ヤ綔鐘舵��
+ wrkMast.getIoType(), // 鍏ュ嚭搴撶被鍨�
+ crn.getId(), // 鍫嗗灈鏈�
+ null, // plc
+ wrkMast.getLocNo(), // 鐩爣搴撲綅
+ wrkMast.getStaNo(), // 鐩爣绔�
+ wrkMast.getSourceStaNo(), // 婧愮珯
+ wrkMast.getSourceLocNo(), // 婧愬簱浣�
+ wrkMast.getBarcode(), // 鏉$爜
+ crnProtocol.getAlarm1().intValue(), // 寮傚父鐮�
+ crnError.getErrName(), // 寮傚父
+ 1, // 寮傚父鎯呭喌
+ now, // 娣诲姞鏃堕棿
+ null, // 娣诲姞浜哄憳
+ now, // 淇敼鏃堕棿
+ null, // 淇敼浜哄憳
+ "浠诲姟涓紓甯�" // 澶囨敞
+ );
+ if (!basErrLogService.insert(basErrLog)) {
+ log.error("鍫嗗灈鏈簆lc寮傚父璁板綍澶辫触 ===>> [id:{}] [error:{}]", crn.getId(), crnError.getErrName());
+ }
+ }
+ } else {
+ // 寮傚父淇
+ if (crnProtocol.getAlarm1() == null || crnProtocol.getAlarm1() == 0) {
+ latest.setEndTime(now);
+ latest.setUpdateTime(now);
+ latest.setStatus(2);
+ if (!basErrLogService.updateById(latest)) {
+ log.error("鍫嗗灈鏈簆lc寮傚父璁板綍淇澶辫触 ===>> [id:{}] [errLogId:{}]", crn.getId(), latest.getId());
+ }
+ }
+ }
+ // 鏃犱换鍔�
+ } else {
+ BasErrLog latest = basErrLogService.findLatest(crn.getId());
+ // 鏈夊紓甯�
+ if (crnProtocol.getAlarm1() != null && crnProtocol.getAlarm1() > 0) {
+ // 璁板綍鏂板紓甯�
+ if (latest == null || (latest.getErrCode() != crnProtocol.getAlarm1().intValue())) {
+ BasCrnError crnError = basCrnErrorMapper.selectById(crnProtocol.getAlarm1());
+ BasErrLog basErrLog = new BasErrLog(
+ null, // 缂栧彿
+ null, // 宸ヤ綔鍙�
+ now, // 鍙戠敓鏃堕棿
+ null, // 缁撴潫鏃堕棿
+ null, // 宸ヤ綔鐘舵��
+ null, // 鍏ュ嚭搴撶被鍨�
+ crn.getId(), // 鍫嗗灈鏈�
+ null, // plc
+ null, // 鐩爣搴撲綅
+ null, // 鐩爣绔�
+ null, // 婧愮珯
+ null, // 婧愬簱浣�
+ null, // 鏉$爜
+ crnProtocol.getAlarm1().intValue(), // 寮傚父鐮�
+ crnError.getErrName(), // 寮傚父
+ 1, // 寮傚父鎯呭喌
+ now, // 娣诲姞鏃堕棿
+ null, // 娣诲姞浜哄憳
+ now, // 淇敼鏃堕棿
+ null, // 淇敼浜哄憳
+ "鏃犱换鍔″紓甯�" // 澶囨敞
+ );
+ if (!basErrLogService.insert(basErrLog)) {
+ log.error("鍫嗗灈鏈簆lc寮傚父璁板綍澶辫触 ===>> [id:{}] [error:{}]", crn.getId(), crnError.getErrName());
+ }
+ }
+ // 鏃犲紓甯�
+ } else {
+ // 寮傚父淇
+ if (latest != null && latest.getStatus() == 1) {
+ latest.setEndTime(now);
+ latest.setUpdateTime(now);
+ latest.setStatus(2);
+ if (!basErrLogService.updateById(latest)) {
+ log.error("鍫嗗灈鏈簆lc寮傚父璁板綍淇澶辫触 ===>> [id:{}] [errLogId:{}]", crn.getId(), latest.getId());
+ }
+ }
+ }
+ }
+ }
+ }
}
@@ -705,14 +834,18 @@
// 鑾峰彇绌烘澘鍏ュ簱绔欎俊鎭�
DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId());
StaProtocol staProtocol = devpThread.getStation().get(emptyInSta.getStaNo());
- if (staProtocol == null) { continue; }
+ if (staProtocol == null) {
+ continue;
+ } else {
+ staProtocol = staProtocol.clone();
+ }
// 绔欑偣鏉′欢鍒ゆ柇
if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.isInEnable()
&& staProtocol.isEmptyMk() && staProtocol.getWorkNo() == 0 && staProtocol.isPakMk()) {
- // 宸ヤ綔鍙�
- int workNo = commonService.getWorkNo(0);
// 妫�绱㈠簱浣�
StartupDto startupDto = commonService.getLocNo(1, 10, emptyInSta.getStaNo(), null);
+ // 宸ヤ綔鍙�
+ int workNo = startupDto.getWorkNo();
try {
// 鎻掑叆宸ヤ綔涓绘。
@@ -751,7 +884,7 @@
// 鏇存柊绔欑偣淇℃伅 涓� 涓嬪彂plc鍛戒护
staProtocol.setWorkNo((short) workNo);
staProtocol.setStaNo(startupDto.getStaNo().shortValue());
- staProtocol.setPakMk(false);
+ devpThread.setPakMk(staProtocol.getSiteId(), false);
boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
if (!result) {
throw new CoolException("鏇存柊plc绔欑偣淇℃伅澶辫触");
@@ -783,7 +916,11 @@
for (Integer staNo : led.getStaArr()) {
// 鑾峰彇鍙夎溅绔欑偣
StaProtocol staProtocol = devpThread.getStation().get(staNo);
- if (null == staProtocol || null == staProtocol.getWorkNo() || 0 == staProtocol.getWorkNo() || !staProtocol.isLoading()) { continue; }
+ if (null == staProtocol || null == staProtocol.getWorkNo() || 0 == staProtocol.getWorkNo() || !staProtocol.isLoading()) {
+ continue;
+ } else {
+ staProtocol = staProtocol.clone();
+ }
// 鑾峰彇宸ヤ綔妗f暟鎹�
WrkMast wrkMast = wrkMastMapper.selectById(staProtocol.getWorkNo());
if (null == wrkMast || wrkMast.getWrkSts() < 14 || wrkMast.getIoType() < 100) { continue; }
@@ -817,7 +954,7 @@
ledCommand.setStaNo(wrkMast.getStaNo());
if (wrkMast.getIoType() != 110) {
List<WrkDetl> wrkDetls = wrkDetlService.findByWorkNo(wrkMast.getWrkNo());
- wrkDetls.forEach(wrkDetl -> ledCommand.getMatDtos().add(new MatDto(wrkDetl.getMatnr(), wrkDetl.getMatnr(), wrkDetl.getAnfme())));
+ wrkDetls.forEach(wrkDetl -> ledCommand.getMatDtos().add(new MatDto(wrkDetl.getMatnr(), wrkDetl.getMaktx(), wrkDetl.getAnfme())));
}
commands.add(ledCommand);
}
@@ -870,6 +1007,11 @@
for (Integer staNo : led.getStaArr()) {
// 鑾峰彇鍙夎溅绔欑偣
StaProtocol staProtocol = devpThread.getStation().get(staNo);
+ if (staProtocol == null) {
+ continue;
+ } else {
+ staProtocol = staProtocol.clone();
+ }
if (staProtocol.getWorkNo() != 0) {
reset = false;
break;
@@ -886,4 +1028,80 @@
}
}
+ /**
+ * 鍫嗗灈鏈烘紨绀� ===>> 搴撲綅绉昏浆
+ */
+ @Async
+ public void crnDemoOfLocMove(Integer crn){
+ for (int i = 0; i < 5; i++) {
+
+ LocMast sourceLoc = locMastService.queryDemoSourceLoc(crn);
+ LocMast loc = locMastService.queryDemoLoc(crn);
+ if (null == sourceLoc || null == loc) {
+ break;
+ }
+ String sourceLocNo = sourceLoc.getLocNo();
+ String locNo = loc.getLocNo();
+
+ // 鑾峰彇宸ヤ綔鍙�
+ int workNo = commonService.getWorkNo(WorkNoType.PICK.type);
+ // 淇濆瓨宸ヤ綔妗�
+ WrkMast wrkMast = new WrkMast();
+ wrkMast.setWrkNo(workNo);
+ wrkMast.setIoTime(new Date());
+ wrkMast.setWrkSts(11L); // 宸ヤ綔鐘舵�侊細11.鐢熸垚鍑哄簱ID
+ wrkMast.setIoType(11); // 鍏ュ嚭搴撶姸鎬侊細 11.搴撴牸绉昏浇
+ wrkMast.setIoPri(13D);
+ wrkMast.setCrnNo(crn);
+ wrkMast.setSourceLocNo(sourceLocNo); // 婧愬簱浣�
+ wrkMast.setLocNo(locNo); // 鐩爣搴撲綅
+ wrkMast.setFullPlt("N"); // 婊℃澘锛歒
+ wrkMast.setPicking("N"); // 鎷f枡
+ wrkMast.setExitMk("N"); // 閫�鍑�
+ wrkMast.setEmptyMk(sourceLoc.getLocSts().equals("D")?"Y":"N"); // 绌烘澘
+ wrkMast.setBarcode(sourceLoc.getBarcode()); // 鎵樼洏鐮�
+ wrkMast.setLinkMis("N");
+ wrkMast.setAppeTime(new Date());
+ wrkMast.setModiTime(new Date());
+ int res = wrkMastMapper.insert(wrkMast);
+ if (res == 0) {
+ throw new CoolException("淇濆瓨宸ヤ綔妗eけ璐�");
+ }
+ // 宸ヤ綔妗f槑缁嗕繚瀛�
+ List<LocDetl> locDetls = locDetlService.selectList(new EntityWrapper<LocDetl>().eq("loc_no", sourceLocNo));
+ for (LocDetl locDetl : locDetls) {
+ WrkDetl wrkDetl = new WrkDetl();
+ wrkDetl.setWrkNo(workNo);
+ wrkDetl.setIoTime(new Date());
+ wrkDetl.setAnfme(locDetl.getAnfme());
+ VersionUtils.setWrkDetl(wrkDetl, locDetl); // 鐗堟湰鎺у埗
+ wrkDetl.setAppeTime(new Date());
+ wrkDetl.setModiTime(new Date());
+ if (!wrkDetlService.insert(wrkDetl)) {
+ throw new CoolException("淇濆瓨宸ヤ綔妗f槑缁嗗け璐�");
+ }
+ }
+ // 淇敼婧愬簱浣嶇姸鎬�
+ if (sourceLoc.getLocSts().equals("D") || sourceLoc.getLocSts().equals("F")) {
+ sourceLoc.setLocSts("R"); // R.鍑哄簱棰勭害
+ sourceLoc.setModiTime(new Date());
+ if (!locMastService.updateById(sourceLoc)){
+ throw new CoolException("鏇存柊婧愬簱浣嶇姸鎬佸け璐�");
+ }
+ } else {
+ throw new CoolException("婧愬簱浣嶅嚭搴撳け璐�");
+ }
+ // 淇敼鐩爣搴撲綅鐘舵��
+ if (loc.getLocSts().equals("O")) {
+ loc.setLocSts("S"); // S.鍏ュ簱棰勭害
+ loc.setModiTime(new Date());
+ if (!locMastService.updateById(loc)) {
+ throw new CoolException("鏇存柊鐩爣搴撲綅鐘舵�佸け璐�");
+ }
+ } else {
+ throw new CoolException("绉昏浆澶辫触");
+ }
+ }
+ }
+
}
--
Gitblit v1.9.1