From 8257d89c461f6553d66fad1e5e3df3d172a00924 Mon Sep 17 00:00:00 2001
From: 1 <1>
Date: 星期六, 29 十一月 2025 18:10:18 +0800
Subject: [PATCH] #
---
src/main/java/com/zy/asrs/service/impl/WorkServiceImpl.java | 203 ++++++++++++++++++++++++++++++++++++++++----------
1 files changed, 160 insertions(+), 43 deletions(-)
diff --git a/src/main/java/com/zy/asrs/service/impl/WorkServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/WorkServiceImpl.java
index 50dea3e..c9c1985 100644
--- a/src/main/java/com/zy/asrs/service/impl/WorkServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/WorkServiceImpl.java
@@ -98,6 +98,12 @@
@Resource
private OrderPakoutService orderPakOutService;
+ @Resource
+ private BasAgvLocDetlService basAgvLocDetlService;
+
+ @Resource
+ private BasAgvWrkDetlService basAgvWrkDetlService;
+
@Override
@Transactional
public String startupFullPutStore(FullStoreParam param, Long userId) {
@@ -182,33 +188,37 @@
@Override
@Transactional
public void startupFullTakeStore(StockOutParam param, Long userId) {
- // 鐩爣绔欑偣鐘舵�佹娴�
- BasDevp staNo = basDevpService.checkSiteStatus(param.getOutSite());
- // 鑾峰彇搴撲綅鏄庣粏
- List<LocDetlDto> locDetlDtos = new ArrayList<>();
- for (StockOutParam.LocDetl paramLocDetl : param.getLocDetls()) {
- if (!Cools.isEmpty(paramLocDetl.getLocNo(), paramLocDetl.getMatnr(), paramLocDetl.getCount())) {
- LocDetl one = locDetlService.selectItem(paramLocDetl.getLocNo(), paramLocDetl.getMatnr(), paramLocDetl.getBatch(),paramLocDetl.getBrand()
- ,paramLocDetl.getStandby1(),paramLocDetl.getStandby2(),paramLocDetl.getStandby3(),paramLocDetl.getBoxType1(),paramLocDetl.getBoxType2(),paramLocDetl.getBoxType3());
- if (null != one) locDetlDtos.add(new LocDetlDto(one, paramLocDetl.getCount()));
+ try{
+ // 鐩爣绔欑偣鐘舵�佹娴�
+ BasDevp staNo = basDevpService.checkSiteStatus(param.getOutSite());
+ // 鑾峰彇搴撲綅鏄庣粏
+ List<LocDetlDto> locDetlDtos = new ArrayList<>();
+ for (StockOutParam.LocDetl paramLocDetl : param.getLocDetls()) {
+ if (!Cools.isEmpty(paramLocDetl.getLocNo(), paramLocDetl.getMatnr(), paramLocDetl.getCount())) {
+ LocDetl one = locDetlService.selectItem(paramLocDetl.getLocNo(), paramLocDetl.getMatnr(), paramLocDetl.getBatch(),paramLocDetl.getBrand()
+ ,paramLocDetl.getStandby1(),paramLocDetl.getStandby2(),paramLocDetl.getStandby3(),paramLocDetl.getBoxType1(),paramLocDetl.getBoxType2(),paramLocDetl.getBoxType3());
+ if (null != one) locDetlDtos.add(new LocDetlDto(one, paramLocDetl.getCount()));
+ }
}
- }
- if (!locDetlDtos.isEmpty()) {
- // 搴撲綅鍙烽泦鍚�
- List<String> locNoList = param.getLocDetls().stream().map(StockOutParam.LocDetl::getLocNo).distinct().collect(Collectors.toList());
- String firstFrozenLocNo = locMastMapper.findFirstFrozenLocNo(locNoList);
- if (firstFrozenLocNo != null) {
- throw new CoolException(firstFrozenLocNo + "搴撲綅宸茶鍐荤粨!");
+ if (!locDetlDtos.isEmpty()) {
+ // 搴撲綅鍙烽泦鍚�
+ List<String> locNoList = param.getLocDetls().stream().map(StockOutParam.LocDetl::getLocNo).distinct().collect(Collectors.toList());
+ String firstFrozenLocNo = locMastMapper.findFirstFrozenLocNo(locNoList);
+ if (firstFrozenLocNo != null) {
+ throw new CoolException(firstFrozenLocNo + "搴撲綅宸茶鍐荤粨!");
+ }
+ LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", locDetlDtos.get(0).getLocDetl().getLocNo()));
+ if (locMast.getLocSts().equals("F") || locMast.getLocSts().equals("D") ){
+ // 鍚姩鍑哄簱寮�濮� 101.鍑哄簱
+ stockOut(staNo, locDetlDtos, null, userId);
+ }else {
+ throw new CoolException("鎵�閫夊簱浣嶅瓨鍦ㄧ姸鎬佷笉涓篎銆丏鐨勫簱浣嶏紝搴撲綅鍙凤細"+locMast.getLocNo()+" 銆佸綋鍓嶇姸鎬侊細"+locMast.getLocSts()+"-"+locMast.getLocSts$());
+ }
+ } else {
+ throw new CoolException("搴撳瓨涓嶅瓨鍦�");
}
- LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", locDetlDtos.get(0).getLocDetl().getLocNo()));
- if (locMast.getLocSts().equals("F") || locMast.getLocSts().equals("D") ){
- // 鍚姩鍑哄簱寮�濮� 101.鍑哄簱
- stockOut(staNo, locDetlDtos, null, userId);
- }else {
- throw new CoolException("鎵�閫夊簱浣嶅瓨鍦ㄧ姸鎬佷笉涓篎銆丏鐨勫簱浣嶏紝搴撲綅鍙凤細"+locMast.getLocNo()+" 銆佸綋鍓嶇姸鎬侊細"+locMast.getLocSts()+"-"+locMast.getLocSts$());
- }
- } else {
- throw new CoolException("搴撳瓨涓嶅瓨鍦�");
+ } catch (Exception e){
+ throw new CoolException(e.getMessage());
}
}
@@ -311,14 +321,7 @@
dtos.add(new OutLocDto(locNo, locDetlDto));
}
}
- Config config = configService.selectConfigByCode("AutoMPArea");
-
- List<LocMast> list = locMastMapper.selectList(
- new EntityWrapper<LocMast>()
- .eq("whs_type", 5)
- .eq("loc_sts", "O")
- );
- LocMast locMastRgv = list.isEmpty() ? null : list.get(0);
+ Config configAutoMPArea = configService.selectConfigByCode("AutoMPArea");
Integer ioType = null;
// 鐢熸垚宸ヤ綔妗�
@@ -364,12 +367,26 @@
wrkMast.setEmptyMk("N"); // 绌烘澘
wrkMast.setLinkMis("N");
wrkMast.setBarcode(locMast.getBarcode());
-// if(locMastRgv !=null){
- if (Boolean.parseBoolean(config.getValue()) && locMastRgv.getLocNo() != null && ioType != 107) { //鑻ユ湁绌哄簱浣嶄笖閰嶇疆鍏佽鍒欑粦瀹氬叾澶囨枡搴撲綅鍙�
-// wrkMast.setLocNo(locMastRgv.getLocNo());
- wrkMast.setTakeNone("0"); //0rgv鏈彇锛�1rgv宸插彇璐�
+ wrkMast.setTakeNone("0"); //0闈炶嚜鍔�
+
+ List<BasAgvWrkDetl> basAgvWrkDetls = null;
+ List<BasAgvLocDetl> basAgvLocDetls = null;
+ try{
+ if (Boolean.parseBoolean(configAutoMPArea.getValue())){
+ if (wrkMast.getStaNoAgvSign()){
+ if (ioType==101){
+ // 鍏ㄦ澘鍑哄簱
+ basAgvLocDetls = new ArrayList<>();
+ } else {
+ // 鎷f枡鍑哄簱
+ basAgvWrkDetls = new ArrayList<>();
+ }
+ wrkMast.setTakeNone("1"); //绛夊緟涓嬪彂
+ } else {
+ wrkMast.setTakeNone("3"); //鏃犻渶AGV鎼繍
+ }
}
-// }
+ } catch (Exception e) {} //閰嶇疆椤逛笉瀛樺湪锛屼笉鍋氬鐞�
wrkMast.setAppeUser(userId); // 鎿嶄綔浜哄憳鏁版嵁
wrkMast.setAppeTime(now);
wrkMast.setModiUser(userId);
@@ -377,6 +394,7 @@
if (!wrkMastService.insert(wrkMast)) {
throw new CoolException("淇濆瓨宸ヤ綔妗eけ璐ワ紝鍑哄簱搴撲綅鍙凤細"+dto.getLocNo());
}
+
// 鐢熸垚宸ヤ綔妗f槑缁�
for (LocDetlDto detlDto : dto.getLocDetlDtos()) {
if (detlDto.getCount()==null || detlDto.getCount() <= 0.0D) {continue;}
@@ -391,6 +409,15 @@
wrkDetl.setAppeUser(userId);
wrkDetl.setModiTime(now);
wrkDetl.setModiUser(userId);
+
+ try{
+ if (basAgvWrkDetls != null){
+ BasAgvWrkDetl basAgvWrkDetl = new BasAgvWrkDetl();
+ basAgvWrkDetl.sync(wrkDetl);
+ basAgvWrkDetls.add(basAgvWrkDetl);
+ }
+ } catch (Exception e) {} //閰嶇疆椤逛笉瀛樺湪锛屼笉鍋氬鐞�
+
if (!wrkDetlService.insert(wrkDetl)) {
throw new CoolException("淇濆瓨宸ヤ綔妗f槑缁嗗け璐�");
}
@@ -412,6 +439,18 @@
// 淇敼搴撲綅鐘舵��: F.鍦ㄥ簱 ====>>> R.鍑哄簱棰勭害/P.鎷f枡/鐩樼偣/骞舵澘鍑哄簱涓�
locMast = locMastService.selectById(dto.getLocNo());
if (locMast.getLocSts().equals("F")) {
+
+ try{
+ if (basAgvLocDetls != null){
+ List<LocDetl> locDetlList = locDetlService.selectList(new EntityWrapper<LocDetl>().eq("loc_no", locMast.getLocNo()));
+ for (LocDetl locDetl : locDetlList) {
+ BasAgvLocDetl basAgvLocDetl = new BasAgvLocDetl();
+ basAgvLocDetl.sync(locDetl);
+ basAgvLocDetls.add(basAgvLocDetl);
+ }
+ }
+ } catch (Exception e) {} //閰嶇疆椤逛笉瀛樺湪锛屼笉鍋氬鐞�
+
locMast.setLocSts(ioType==101?"R":"P");
locMast.setModiUser(userId);
locMast.setModiTime(now);
@@ -419,8 +458,32 @@
throw new CoolException("棰勭害搴撲綅鐘舵�佸け璐ワ紝搴撲綅鍙凤細"+dto.getLocNo());
}
} else {
+ log.error(dto.getLocNo() + "搴撲綅涓嶆槸鍦ㄥ簱鐘舵��");
throw new CoolException(dto.getLocNo() + "搴撲綅涓嶆槸鍦ㄥ簱鐘舵��");
}
+
+ try{
+ // 澧炲姞AGV搴撳瓨涓浆鏁伴噺
+ if (basAgvLocDetls != null){
+ for (BasAgvLocDetl basAgvLocDetl : basAgvLocDetls) {
+ try{
+ basAgvLocDetlService.insert(basAgvLocDetl);
+ } catch (Exception e){
+ log.error("澧炲姞AGV搴撳瓨涓浆鏁伴噺澶辫触");
+ }
+ }
+ }
+ if (basAgvWrkDetls != null){
+ for (BasAgvWrkDetl basAgvWrkDetl : basAgvWrkDetls) {
+ try{
+ basAgvWrkDetlService.insert(basAgvWrkDetl);
+ } catch (Exception e){
+ log.error("澧炲姞AGV搴撳瓨涓浆鏁伴噺澶辫触");
+ }
+ }
+ }
+
+ }catch (Exception e){}
}
}
@@ -434,7 +497,7 @@
throw new CoolException("璁㈠崟鍑哄簱寮傚父锛岃鑱旂郴绠$悊鍛�");
}
}
- Config config = configService.selectConfigByCode("AutoMPArea");
+ Config configAutoMPArea = configService.selectConfigByCode("AutoMPArea");
// 鑾峰彇搴撲綅
LocMast locMast = locMastService.selectById(taskDto.getLocNo());
@@ -466,10 +529,27 @@
wrkMast.setSourceStaNo(staDesc.getCrnStn()); // 婧愮珯
wrkMast.setStaNo(staDesc.getStnNo()); // 鐩爣绔�
wrkMast.setSourceLocNo(taskDto.getLocNo()); // 婧愬簱浣�
- if (Boolean.parseBoolean(config.getValue()) && locMastRgv.getLocNo() != null) { //鑻ユ湁绌哄簱浣嶄笖閰嶇疆鍏佽鍒欑粦瀹氬叾澶囨枡搴撲綅鍙�
- wrkMast.setLocNo(locMastRgv.getLocNo());
- wrkMast.setTakeNone("0"); //0rgv鏈彇锛�1rgv宸插彇璐�
- }
+ wrkMast.setTakeNone("0"); //0闈炶嚜鍔�
+
+ List<BasAgvWrkDetl> basAgvWrkDetls = null;
+ List<BasAgvLocDetl> basAgvLocDetls = null;
+ try{
+ if (Boolean.parseBoolean(configAutoMPArea.getValue())){
+ if (wrkMast.getStaNoAgvSign()){
+ if (ioType==101){
+ // 鍏ㄦ澘鍑哄簱
+ basAgvLocDetls = new ArrayList<>();
+ } else {
+ // 鎷f枡鍑哄簱
+ basAgvWrkDetls = new ArrayList<>();
+ }
+ wrkMast.setTakeNone("1"); //绛夊緟涓嬪彂
+ } else {
+ wrkMast.setTakeNone("3"); //鏃犻渶AGV鎼繍
+ }
+ }
+ } catch (Exception e) {} //閰嶇疆椤逛笉瀛樺湪锛屼笉鍋氬鐞�
+
wrkMast.setFullPlt("Y"); // 婊℃澘锛歒
wrkMast.setPicking("N"); // 鎷f枡
wrkMast.setExitMk("N"); // 閫�鍑�
@@ -506,6 +586,15 @@
wrkDetl.setAppeUser(userId);
wrkDetl.setModiTime(now);
wrkDetl.setModiUser(userId);
+
+ try{
+ if (basAgvWrkDetls != null){
+ BasAgvWrkDetl basAgvWrkDetl = new BasAgvWrkDetl();
+ basAgvWrkDetl.sync(wrkDetl);
+ basAgvWrkDetls.add(basAgvWrkDetl);
+ }
+ } catch (Exception e) {} //閰嶇疆椤逛笉瀛樺湪锛屼笉鍋氬鐞�
+
if (!wrkDetlService.insert(wrkDetl)) {
throw new CoolException("淇濆瓨宸ヤ綔妗f槑缁嗗け璐�");
}
@@ -535,6 +624,17 @@
// 淇敼搴撲綅鐘舵��: F.鍦ㄥ簱 ====>>> R.鍑哄簱棰勭害/P.鎷f枡/鐩樼偣/骞舵澘鍑哄簱涓�
locMast = locMastService.selectById(taskDto.getLocNo());
if (locMast.getLocSts().equals("F")) {
+ try{
+ if (basAgvLocDetls != null){
+ List<LocDetl> locDetlList = locDetlService.selectList(new EntityWrapper<LocDetl>().eq("loc_no", locMast.getLocNo()));
+ for (LocDetl locDetl : locDetlList) {
+ BasAgvLocDetl basAgvLocDetl = new BasAgvLocDetl();
+ basAgvLocDetl.sync(locDetl);
+ basAgvLocDetls.add(basAgvLocDetl);
+ }
+ }
+ } catch (Exception e) {} //閰嶇疆椤逛笉瀛樺湪锛屼笉鍋氬鐞�
+
locMast.setLocSts(ioType==101?"R":"P");
locMast.setModiUser(userId);
locMast.setModiTime(now);
@@ -544,6 +644,23 @@
} else {
throw new CoolException(taskDto.getLocNo() + "搴撲綅涓嶆槸鍦ㄥ簱鐘舵��");
}
+
+
+
+ try{
+ // 澧炲姞AGV搴撳瓨涓浆鏁伴噺
+ if (basAgvLocDetls != null){
+ for (BasAgvLocDetl basAgvLocDetl : basAgvLocDetls) {
+ basAgvLocDetlService.insert(basAgvLocDetl);
+ }
+ }
+ if (basAgvWrkDetls != null){
+ for (BasAgvWrkDetl basAgvWrkDetl : basAgvWrkDetls) {
+ basAgvWrkDetlService.insert(basAgvWrkDetl);
+ }
+ }
+
+ }catch (Exception e){}
}
@Override
--
Gitblit v1.9.1