From 9e19804493a3c4fdd894779b2b4664fe2f9ca9fe Mon Sep 17 00:00:00 2001
From: zjj <3272660260@qq.com>
Date: 星期四, 28 三月 2024 16:59:47 +0800
Subject: [PATCH] #立库转平库
---
src/main/java/com/zy/asrs/service/impl/WorkServiceImpl.java | 151 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 150 insertions(+), 1 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 823b26f..62c4de5 100644
--- a/src/main/java/com/zy/asrs/service/impl/WorkServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/WorkServiceImpl.java
@@ -182,7 +182,7 @@
String maxKeySql = "select min(FInterID) as num from CPICMO";
List<ERPselectParam> maxKeyList = erpSqlServer.select(maxKeySql, ERPselectParam.class);
Integer maxKey = maxKeyList.get(0).getNum();
- String ErpSql = "insert into CPICMO(FBrNo, FSourceBillNo, FBillNo, FTranType, FStatus, FMRP, FItemID, FQty, FCommitQty, FSourceEntryID, FClosed, FUnitID, FAuxCommitQty, FCancellation, FQtyFinish, FQtyScrap, FQtyLost, FAuxQtyFinish, FAuxQtyScrap, FAuxQtyLost, FMrpClosed, FBomInterID, FQtyPass, FAuxQtyPass, FQtyBack, FAuxQtyBack, FFinishTime, FReadyTIme, FPowerCutTime, FFixTime, FWaitItemTime, FWaitToolTime, FTaskID, FWorkTypeID, FCostObjID, FStockQty, FAuxStockQty, FSuspend, FReleasedQty, FReleasedAuxQty, FUnScheduledQty, FUnScheduledAuxQty, FSubEntryID, FScheduleID, FPlanOrderInterID, FProcessPrice, FProcessFee, FGMPBatchNo, FGMPCollectRate, FGMPItemBalance, FGMPBulkQty, FCustID, FMRPLockFlag, FHandworkClose, FInHighLimit, FInHighLimitQty, FInLowLimit, FInLowLimitQty, FChangeTimes, FCheckCommitQty, FAuxCheckCommitQty, FPlanConfirmed, FPlanMode, FMTONo, FPrintCount, FFinClosed, FStockFlag, FStartFlag, FVchBillNo, FVchInterID, FCardClosed, FHRReadyTime, FSourceTranType, FSourceInterId, FInterID, FAuxQty, FAuxInHighLimitQty, FAuxInLowLimitQty, Fnumber, FWorkShop) values (0, ''{6}'', '0', 85, 0, 1052, 0, 0, 0, 0, 0, 250, {5,number,#}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '0', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14036, '0', 0, 0, 14215, 0, '0', 0, 1059, 0, 0, 0, 0, {0,number,#}, {1,number,#}, {2,number,#}, {3,number,#}, ''{4}'', 11378)";
+ String ErpSql = "insert into CPICMO(FBrNo, FSourceBillNo, FBillNo, FTranType, FStatus, FMRP, FItemID, FQty, FCommitQty, FSourceEntryID, FClosed, FUnitID, FAuxCommitQty, FCancellation, FQtyFinish, FQtyScrap, FQtyLost, FAuxQtyFinish, FAuxQtyScrap, FAuxQtyLost, FMrpClosed, FBomInterID, FQtyPass, FAuxQtyPass, FQtyBack, FAuxQtyBack, FFinishTime, FReadyTIme, FPowerCutTime, FFixTime, FWaitItemTime, FWaitToolTime, FTaskID, FWorkTypeID, FCostObjID, FStockQty, FAuxStockQty, FSuspend, FReleasedQty, FReleasedAuxQty, FUnScheduledQty, FUnScheduledAuxQty, FSubEntryID, FScheduleID, FPlanOrderInterID, FProcessPrice, FProcessFee, FGMPBatchNo, FGMPCollectRate, FGMPItemBalance, FGMPBulkQty, FCustID, FMRPLockFlag, FHandworkClose, FInHighLimit, FInHighLimitQty, FInLowLimit, FInLowLimitQty, FChangeTimes, FCheckCommitQty, FAuxCheckCommitQty, FPlanConfirmed, FPlanMode, FMTONo, FPrintCount, FFinClosed, FStockFlag, FStartFlag, FVchBillNo, FVchInterID, FCardClosed, FHRReadyTime, FSourceTranType, FSourceInterId, FInterID, FAuxQty, FAuxInHighLimitQty, FAuxInLowLimitQty, Fnumber, FWorkShop, Fflag_rw) values (0, ''{6}'', '0', 85, 0, 1052, 0, 0, 0, 0, 0, 250, {5,number,#}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '0', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14036, '0', 0, 0, 14215, 0, '0', 0, 1059, 0, 0, 0, 0, {0,number,#}, {1,number,#}, {2,number,#}, {3,number,#}, ''{4}'', 11378, 1)";
ErpSql = MessageFormat.format(ErpSql, maxKey - 1, es.getCount(), es.getCount(), es.getCount(), es.getMatNo(), es.getCount(), es.getStr5());
erpSqlServer.update(ErpSql);
}
@@ -214,6 +214,35 @@
if (!locDetlDtos.isEmpty()) {
// 鍚姩鍑哄簱寮�濮� 101.鍑哄簱
stockOut(staNo, locDetlDtos, null, userId, agvSite);
+ } else {
+ throw new CoolException("搴撲綅鐗╂枡涓嶅瓨鍦�");
+ }
+ }
+
+ @Override
+ @Transactional
+ public void startupFullTakeStoreToP(StockOutParam param, Long userId) {
+ // 鐩爣绔欑偣鐘舵�佹娴�
+ BasDevp staNo = basDevpService.checkSiteStatus(param.getOutSite());
+ int agvSite = 0;
+ if (!Cools.isEmpty(staNo.getFronting()) && staNo.getFronting().equals("Y")) {
+ agvSite = staNo.getDevNo();
+ staNo = basDevpService.checkSiteStatus(201);
+ }
+ // 鑾峰彇搴撲綅鏄庣粏
+ List<LocDetlDto> locDetlDtos = new ArrayList<>();
+ for (StockOutParam.LocDetl paramLocDetl : param.getLocDetls()) {
+ if (!Cools.isEmpty(paramLocDetl.getLocNo(), paramLocDetl.getMatnr(), paramLocDetl.getCount())) {
+ LocDetl sqlParam = new LocDetl();
+ sqlParam.setLocNo(paramLocDetl.getLocNo());
+ sqlParam.setMatnr(paramLocDetl.getMatnr());
+ LocDetl one = locDetlService.selectOne(new EntityWrapper<>(sqlParam));
+ if (null != one) locDetlDtos.add(new LocDetlDto(one, paramLocDetl.getCount()));
+ }
+ }
+ if (!locDetlDtos.isEmpty()) {
+ // 鍚姩鍑哄簱寮�濮� 101.鍑哄簱
+ stockOutToP(staNo, locDetlDtos, null, userId, agvSite,param.getWarehouse());
} else {
throw new CoolException("搴撲綅鐗╂枡涓嶅瓨鍦�");
}
@@ -285,6 +314,123 @@
}
// 鐢熸垚宸ヤ綔妗f槑缁�
for (LocDetlDto detlDto : dto.getLocDetlDtos()) {
+ // 濡傛灉涓烘崱鏂欏嚭搴撻渶瑕佸垽鏂墭鐩樼爜鏄惁涓虹┖
+ if (ioType == 103) {
+ String zpallet = detlDto.getLocDetl().getZpallet();
+ if (Cools.isEmpty(zpallet)) {
+ throw new CoolException("鎷f枡鍑哄簱蹇呴』鍚湁鎵樼洏鐮�");
+ }
+ }
+ // 鍑哄簱鏃讹紝鏁伴噺涓�0鐨勭洿鎺ュ拷鐣�
+ if (detlDto.getCount() == null || detlDto.getCount() <= 0.0D) {
+ continue;
+ }
+ WrkDetl wrkDetl = new WrkDetl();
+ wrkDetl.setWrkNo(workNo);
+ wrkDetl.setIoTime(new Date());
+ Double anfme = ioType == 101 ? detlDto.getLocDetl().getAnfme() : detlDto.getCount();
+ wrkDetl.setAnfme(anfme); // 鏁伴噺
+ VersionUtils.setWrkDetl(wrkDetl, detlDto.getLocDetl()); // 鐗堟湰鎺у埗
+ wrkDetl.setAppeTime(new Date());
+ wrkDetl.setAppeUser(userId);
+ wrkDetl.setModiTime(new Date());
+ wrkDetl.setModiUser(userId);
+ if (!wrkDetlService.insert(wrkDetl)) {
+ throw new CoolException("淇濆瓨宸ヤ綔妗f槑缁嗗け璐�");
+ }
+ }
+ // 淇敼搴撲綅鐘舵��: F.鍦ㄥ簱 ====>>> R.鍑哄簱棰勭害/P.鎷f枡/鐩樼偣/骞舵澘鍑哄簱涓�
+ locMast = locMastService.selectById(dto.getLocNo());
+ if (locMast.getLocSts().equals("F")) {
+ locMast.setLocSts(ioType == 101 ? "R" : "P");
+ locMast.setModiUser(userId);
+ locMast.setModiTime(new Date());
+ if (!locMastService.updateById(locMast)) {
+ throw new CoolException("棰勭害搴撲綅鐘舵�佸け璐ワ紝搴撲綅鍙凤細" + dto.getLocNo());
+ }
+ } else {
+ throw new CoolException(dto.getLocNo() + "搴撲綅涓嶆槸鍦ㄥ簱鐘舵��");
+ }
+ }
+ // todo:luxiaotao
+ // 鍚屼竴鍒楃殑鍚屾椂鍑哄簱锛屽垯浼樺厛鍑烘祬搴撲綅
+ }
+
+
+ @Transactional
+ public void stockOutToP(BasDevp staNo, List<LocDetlDto> locDetlDtos, Integer ioType, Long userId, Integer agvSite ,String warehouse) {
+ // 鍚堝苟鍚岀被椤�
+ Set<String> locNos = new HashSet<>();
+ locDetlDtos.forEach(dto -> locNos.add(dto.getLocDetl().getLocNo()));
+ List<OutLocDto> dtos = new ArrayList<>();
+ for (String locNo : locNos) {
+ List<LocDetlDto> list = new ArrayList<>();
+ Iterator<LocDetlDto> iterator = locDetlDtos.iterator();
+ while (iterator.hasNext()) {
+ LocDetlDto dto = iterator.next();
+ if (locNo.equals(dto.getLocDetl().getLocNo())) {
+ list.add(dto);
+ iterator.remove();
+ }
+ }
+ dtos.add(new OutLocDto(locNo, list));
+ }
+ // 鐢熸垚宸ヤ綔妗�
+ for (OutLocDto dto : dtos) {
+ // 鍒ゆ柇鍏ュ嚭搴撶被鍨嬶細101.鍏ㄦ澘鍑哄簱 or 103.鎷f枡鍑哄簱
+ if (ioType == null) {
+ ioType = dto.isAll() ? 101 : 103;
+ }
+ // 鑾峰彇搴撲綅
+ LocMast locMast = locMastService.selectById(dto.getLocNo());
+ // 鑾峰彇璺緞
+ Wrapper<StaDesc> wrapper = new EntityWrapper<StaDesc>()
+ .eq("type_no", ioType)
+ .eq("stn_no", staNo.getDevNo())
+ .eq("crn_no", locMast.getCrnNo());
+ StaDesc staDesc = staDescService.selectOne(wrapper);
+ if (Cools.isEmpty(staDesc)) {
+ throw new CoolException("鍑哄簱璺緞涓嶅瓨鍦�");
+ }
+ // 鐢熸垚宸ヤ綔鍙�
+ int workNo = commonService.getWorkNo(DEFAULT_WORK_NO_TYPE);
+ // 鐢熸垚宸ヤ綔妗�
+ WrkMast wrkMast = new WrkMast();
+ wrkMast.setWrkNo(workNo);
+ wrkMast.setIoTime(new Date());
+ wrkMast.setWrkSts(11L); // 宸ヤ綔鐘舵�侊細11.鐢熸垚鍑哄簱ID
+ wrkMast.setIoType(ioType); // 鍏ュ嚭搴撶姸鎬�
+ wrkMast.setIoPri(13D); // 浼樺厛绾э細13
+ wrkMast.setCrnNo(locMast.getCrnNo());
+ wrkMast.setSourceStaNo(staDesc.getCrnStn()); // 婧愮珯
+ wrkMast.setStaNo(staDesc.getStnNo()); // 鐩爣绔�
+ wrkMast.setSourceLocNo(dto.getLocNo()); // 婧愬簱浣�
+ wrkMast.setBarcode(locMast.getBarcode()); // 鏉$爜
+ wrkMast.setFullPlt("Y"); // 婊℃澘锛歒
+ wrkMast.setPicking("N"); // 鎷f枡
+ wrkMast.setExitMk("N"); // 閫�鍑�
+ wrkMast.setEmptyMk("N"); // 绌烘澘
+ wrkMast.setLinkMis("N");
+ wrkMast.setCtnKind(agvSite); // 鍑哄簱涓嬬殑灏忚溅宸ヤ綔鍖虹珯濂�
+ wrkMast.setExitMk("N"); // 灏忚溅鏄惁鎼繍
+ wrkMast.setAppeUser(userId); // 鎿嶄綔浜哄憳鏁版嵁
+ wrkMast.setAppeTime(new Date());
+ wrkMast.setModiUser(userId);
+ wrkMast.setModiTime(new Date());
+ wrkMast.setPdcType("Y"); //鐢ㄤ綔绉诲簱鏍囪
+ wrkMast.setLogErrMemo(warehouse); //鐢ㄤ綔瀛樺偍浠撳簱鏍囪
+ if (!wrkMastService.insert(wrkMast)) {
+ throw new CoolException("淇濆瓨宸ヤ綔妗eけ璐ワ紝鍑哄簱搴撲綅鍙凤細" + dto.getLocNo());
+ }
+ // 鐢熸垚宸ヤ綔妗f槑缁�
+ for (LocDetlDto detlDto : dto.getLocDetlDtos()) {
+ // 濡傛灉涓烘崱鏂欏嚭搴撻渶瑕佸垽鏂墭鐩樼爜鏄惁涓虹┖
+ if (ioType == 103) {
+ String zpallet = detlDto.getLocDetl().getZpallet();
+ if (Cools.isEmpty(zpallet)) {
+ throw new CoolException("鎷f枡鍑哄簱蹇呴』鍚湁鎵樼洏鐮�");
+ }
+ }
// 鍑哄簱鏃讹紝鏁伴噺涓�0鐨勭洿鎺ュ拷鐣�
if (detlDto.getCount() == null || detlDto.getCount() <= 0.0D) {
continue;
@@ -494,6 +640,9 @@
if (Cools.isEmpty(locMast)) {
throw new CoolException(locNo + "搴撲綅涓嶅瓨鍦�");
}
+ if(!locMast.getLocSts().equals("D")){ //闈炲湪搴撶姸鎬�
+ continue;
+ }
// 鑾峰彇婧愮珯
Wrapper<StaDesc> wrapper = new EntityWrapper<StaDesc>()
.eq("type_no", 110)
--
Gitblit v1.9.1