From ac4341ea6b66ae02427d39d35f41d42d78b2eb2e Mon Sep 17 00:00:00 2001 From: Junjie <fallin.jie@qq.com> Date: 星期五, 14 二月 2025 10:08:32 +0800 Subject: [PATCH] # --- zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/timer/TaskTimer.java | 102 ++++++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 97 insertions(+), 5 deletions(-) diff --git a/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/timer/TaskTimer.java b/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/timer/TaskTimer.java index 10399de..b03a3c6 100644 --- a/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/timer/TaskTimer.java +++ b/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/timer/TaskTimer.java @@ -6,6 +6,7 @@ import com.zy.asrs.framework.exception.CoolException; import com.zy.asrs.wms.asrs.entity.*; import com.zy.asrs.wms.asrs.entity.enums.LocStsType; +import com.zy.asrs.wms.asrs.entity.enums.TaskStsType; import com.zy.asrs.wms.asrs.service.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.annotation.Scheduled; @@ -62,7 +63,7 @@ InterceptorIgnoreHelper.handle(IgnoreStrategy.builder().tenantLine(true).build()); try { //鑾峰彇鍏ュ簱瀹屾垚浠诲姟 - List<Task> list = taskService.list(new LambdaQueryWrapper<Task>().eq(Task::getTaskSts, 99)); + List<Task> list = taskService.list(new LambdaQueryWrapper<Task>().eq(Task::getTaskSts, TaskStsType.COMPLETE_IN.id)); if (list.isEmpty()) { return; } @@ -73,6 +74,9 @@ case 1://鍏ュ簱 executeTask1(task); break; + case 11://搴撲綅绉昏浆 + executeTask11(task); + break; case 53://鎷f枡鍐嶅叆搴� executeTask53(task); break; @@ -80,7 +84,7 @@ throw new CoolException("鏈煡浠诲姟绫诲瀷"); } - task.setTaskSts(100L);//100.搴撳瓨鏇存柊瀹屾垚 + task.setTaskSts(TaskStsType.UPDATED_IN.id);//100.搴撳瓨鏇存柊瀹屾垚 task.setUpdateTime(new Date()); if (!taskService.updateById(task)) { throw new CoolException("搴撳瓨鏇存柊澶辫触"); @@ -100,7 +104,7 @@ InterceptorIgnoreHelper.handle(IgnoreStrategy.builder().tenantLine(true).build()); try { //鑾峰彇鍑哄簱瀹屾垚浠诲姟 - List<Task> list = taskService.list(new LambdaQueryWrapper<Task>().eq(Task::getTaskSts, 199)); + List<Task> list = taskService.list(new LambdaQueryWrapper<Task>().eq(Task::getTaskSts, TaskStsType.COMPLETE_OUT.id)); if (list.isEmpty()) { return; } @@ -117,7 +121,7 @@ throw new CoolException("鏈煡浠诲姟绫诲瀷"); } - task.setTaskSts(200L);//200.搴撳瓨鏇存柊瀹屾垚 + task.setTaskSts(TaskStsType.UPDATED_OUT.id);//200.搴撳瓨鏇存柊瀹屾垚 if (!taskService.updateById(task)) { throw new CoolException("搴撳瓨鏇存柊澶辫触"); } @@ -194,6 +198,7 @@ for (WaitPakin waitPakin : waitPakins) { WaitPakinLog waitPakinLog = new WaitPakinLog(); waitPakinLog.sync(waitPakin); + waitPakinLog.setId(null); if (!waitPakinLogService.save(waitPakinLog)) { throw new CoolException("缁勬墭閫氱煡妗h浆鍘嗗彶妗eけ璐�"); } @@ -201,6 +206,88 @@ //鍒犻櫎缁勬墭閫氱煡妗� waitPakinService.removeById(waitPakin.getId()); } + } + + //搴撲綅绉昏浆 + private void executeTask11(Task task) { + Long hostId = task.getHostId(); + + Loc originLoc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getLocNo, task.getOriginLoc()).eq(Loc::getHostId, hostId)); + if (originLoc == null) { + throw new CoolException("婧愬簱浣嶄笉瀛樺湪"); + } + + if (originLoc.getLocStsId() != LocStsType.R.val()) { + throw new CoolException("搴撲綅鐘舵�佷笉澶勪簬R.鍑哄簱棰勭害"); + } + + Loc targetLoc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getLocNo, task.getTargetLoc()).eq(Loc::getHostId, hostId)); + if (targetLoc == null) { + throw new CoolException("鐩爣搴撲綅涓嶅瓨鍦�"); + } + + if (targetLoc.getLocStsId() != LocStsType.S.val()) { + throw new CoolException("搴撲綅鐘舵�佷笉澶勪簬S.鍏ュ簱棰勭害"); + } + + originLoc.setLocStsId(LocStsType.O.val()); + originLoc.setUpdateTime(new Date()); + originLoc.setBarcode(""); + if (!locService.updateById(originLoc)) { + throw new CoolException("搴撲綅鐘舵�佹洿鏂板け璐�"); + } + + targetLoc.setLocStsId(LocStsType.F.val()); + targetLoc.setUpdateTime(new Date()); + targetLoc.setBarcode(task.getBarcode()); + if (!locService.updateById(targetLoc)) { + throw new CoolException("搴撲綅鐘舵�佹洿鏂板け璐�"); + } + + List<TaskDetl> taskDetls = taskDetlService.getTaskDetlByTaskId(task.getId()); + if (taskDetls.isEmpty()) { + throw new CoolException("浠诲姟鏄庣粏涓嶅瓨鍦�"); + } + + //娣诲姞搴撳瓨鏄庣粏 + for (TaskDetl taskDetl : taskDetls) { + LocDetl locDetl = new LocDetl(); + locDetl.setLocId(targetLoc.getId()); + locDetl.setLocNo(targetLoc.getLocNo()); + locDetl.setMatId(taskDetl.getMatId()); + locDetl.setMatnr(taskDetl.getMat$().getMatnr()); + locDetl.setOrderNo(taskDetl.getOrderNo()); + locDetl.setBatch(taskDetl.getBatch()); + locDetl.setAnfme(taskDetl.getAnfme()); + locDetl.setHostId(hostId); + if (!locDetlService.save(locDetl)) { + throw new CoolException("鎻掑叆搴撳瓨鏄庣粏澶辫触"); + } + + //娣诲姞搴撳瓨鏄庣粏鎵╁睍瀛楁 + List<TaskDetlField> detlFields = taskDetlFieldService.list(new LambdaQueryWrapper<TaskDetlField>().eq(TaskDetlField::getDetlId, taskDetl.getId()).eq(TaskDetlField::getHostId, hostId)); + for (TaskDetlField detlField : detlFields) { + LocDetlField locDetlField = new LocDetlField(); + locDetlField.setDetlId(locDetl.getId()); + locDetlField.setFieldId(detlField.getFieldId()); + locDetlField.setName(detlField.getName()); + locDetlField.setValue(detlField.getValue()); + locDetlField.setHostId(hostId); + if (!locDetlFieldService.save(locDetlField)) { + throw new CoolException("鎻掑叆鏄庣粏鎵╁睍瀛楁澶辫触"); + } + } + } + + List<LocDetl> locDetls = locDetlService.list(new LambdaQueryWrapper<LocDetl>().eq(LocDetl::getLocId, originLoc.getId())); + for (LocDetl locDetl : locDetls) { + boolean remove = locDetlFieldService.remove(new LambdaQueryWrapper<LocDetlField>().eq(LocDetlField::getDetlId, locDetl.getId())); + boolean result = locDetlService.removeById(locDetl.getId()); + if (!result) { + throw new CoolException("娓呴櫎鏄庣粏澶辫触"); + } + } + } //鎷f枡鍐嶅叆搴� @@ -230,6 +317,11 @@ //娣诲姞搴撳瓨鏄庣粏 for (TaskDetl taskDetl : taskDetls) { + double anfme = taskDetl.getStock() - taskDetl.getAnfme(); + if (anfme <= 0) { + continue; + } + LocDetl locDetl = new LocDetl(); locDetl.setLocId(loc.getId()); locDetl.setLocNo(loc.getLocNo()); @@ -237,7 +329,7 @@ locDetl.setMatnr(taskDetl.getMat$().getMatnr()); locDetl.setOrderNo(taskDetl.getOrderNo()); locDetl.setBatch(taskDetl.getBatch()); - locDetl.setAnfme(taskDetl.getStock() - taskDetl.getAnfme()); + locDetl.setAnfme(anfme); locDetl.setHostId(hostId); if (!locDetlService.save(locDetl)) { throw new CoolException("鎻掑叆搴撳瓨鏄庣粏澶辫触"); -- Gitblit v1.9.1