From 9145f8a44c6ae733019e43c775cc30243032e502 Mon Sep 17 00:00:00 2001
From: zwl <1051256694@qq.com>
Date: 星期三, 29 四月 2026 16:16:43 +0800
Subject: [PATCH] 拍照触发修改
---
src/main/java/com/zy/common/web/WcsController.java | 65 +++++++++++++++++++++++++++++++-
1 files changed, 62 insertions(+), 3 deletions(-)
diff --git a/src/main/java/com/zy/common/web/WcsController.java b/src/main/java/com/zy/common/web/WcsController.java
index fc0edeb..199f018 100644
--- a/src/main/java/com/zy/common/web/WcsController.java
+++ b/src/main/java/com/zy/common/web/WcsController.java
@@ -58,6 +58,8 @@
private WorkService workService;
@Autowired
private StaDescService staDescService;
+ @Autowired
+ private InboundCameraCaptureService inboundCameraCaptureService;
@PostMapping("/pakin/loc/v1")
@ResponseBody
@@ -83,6 +85,7 @@
}
WrkMast wrkMast1 = wrkMastService.selectByBarcode(param.getBarcode());
if (!Cools.isEmpty(wrkMast1) && wrkMast1.getWrkSts() == 2) {
+ triggerInboundCaptureAfterLocAssigned(wrkMast1);
StartupDto dto1 = new StartupDto();
dto1.setBarcode(param.getBarcode());
dto1.setStaNo(Integer.valueOf(wrkMast1.getStaNo()));
@@ -140,6 +143,7 @@
sourceStaNoEntity.setLocType1((short) (param.getLocType1()!=1?2:1));
LocTypeDto locTypeDto = new LocTypeDto(sourceStaNoEntity);
if (waitPakins.get(0).getMatnr().equals("emptyPallet")) {
+ // 绌烘墭鐩樼敱缁勬墭妗� matnr=emptyPallet 鏍囪瘑锛涘悗缁� CommonService 浼氭寜绐勫簱浣嶄紭鍏堛�乴ocType1=3 鍏滃簳瑙勫垯鎵惧簱浣嶃��
locTypeDto.setLocType2((short) 1);
}
@@ -181,6 +185,7 @@
}
sourceStaNo.setLocType1(param.getLocType1());
LocTypeDto locTypeDto = new LocTypeDto(sourceStaNo);
+ // AGV 绌烘墭鐩樼洿鍏ュ簱鍥哄畾璧� staDescId=10锛屾渶缁堢敱 CommonService.getLocNo 缁熶竴鎵ц鎵句綅瑙勫垯銆�
param.setIoType(10);
StartupDto dto = null;
switch (param.getIoType()) {
@@ -428,7 +433,7 @@
public StartupDto startupFullPutStoreAgv(Integer devpNo, String barcode, LocTypeDto locTypeDto, Integer outArea, Integer staDescId) {
// 婧愮珯鐐圭姸鎬佹娴�
// BasDevp sourceStaNo = basDevpService.checkSiteStatus(devpNo, true);
- // 妫�绱㈠簱浣�
+ // 妫�绱㈠簱浣嶏紱staDescId=10 鏃舵寜绌烘墭鐩樺叆鍙h瘑鍒紝杩涘叆 CommonService 鐨勪紭鍏堟睜 + locType1=3 鍏滃簳鎵句綅瑙勫垯銆�
FindLocNoAttributeVo findLocNoAttributeVo = new FindLocNoAttributeVo();
findLocNoAttributeVo.setOutArea(outArea);
// FindLocNoAttributeVo findLocNoAttributeVo = new FindLocNoAttributeVo(waitPakins.get(0));
@@ -462,7 +467,7 @@
try {
// 婧愮珯鐐圭姸鎬佹娴�
BasDevp sourceStaNo = basDevpService.checkSiteStatus(devpNo, true);
- // 妫�绱㈠簱浣�
+ // 妫�绱㈠簱浣嶏紱濡傛灉缁勬墭妗f槸 emptyPallet锛屽嵆浣� staDescId=1锛屼篃浼氬湪 CommonService 鍐呭垏鎹负绌烘墭鐩樻壘浣嶈鍒欍��
FindLocNoAttributeVo findLocNoAttributeVo = new FindLocNoAttributeVo(waitPakins.get(0));
// IoT 鎸囧畾浜嗙洰鏍囧簱浣嶆椂浼樺厛灏濊瘯璇ュ簱浣嶏紱涓嶅彲鐢ㄦ椂鍐嶉��鍥炵幇鏈夎嚜鍔ㄦ壘浣嶈鍒欍��
StartupDto dto = buildPreferredStartupDto(devpNo, extractPreferredInboundLoc(waitPakins));
@@ -493,6 +498,10 @@
wrkMast.setUserNo(waitPakins.get(0).getOrderNo());
wrkMast.setCubeNumber(waitPakins.get(0).getCubeNumber());
wrkMast.setCtnType(sourceStaNo.getCtnType()); // 瀹瑰櫒绫诲瀷
+ // WCS鐢宠鍏ュ簱鏃讹紝WMS鎵惧埌搴撲綅鍚庣珛鍗虫媿鐓э紱瀹氭椂浠诲姟鍙綔涓烘湭澶勭悊鐘舵�佺殑鍏滃簳銆�
+ wrkMast.setMemo(InboundCameraCaptureService.CAPTURE_PENDING);
+ wrkMast.setPlateNo(waitPakins.get(0).getPlateNo());
+ wrkMast.setTrainNo(waitPakins.get(0).getTrainNo());
// 鎿嶄綔浜哄憳鏁版嵁
wrkMast.setAppeTime(now);
wrkMast.setModiTime(now);
@@ -544,10 +553,60 @@
String wcsLoc = Utils.WMSLocToWCSLoc(dto.getLocNo());
dto.setLocNo(wcsLoc);
dto.setTaskNo(workNo + "");
+ triggerInboundCaptureAfterLocAssigned(wrkMast);
return dto;
} finally {
log.info("startupFullPutStore鑰楁椂:{}ms, sourceStaNo:{}, barcode:{}", System.currentTimeMillis() - startTime, devpNo, barcode);
}
+ }
+
+ private void triggerInboundCaptureAfterLocAssigned(WrkMast wrkMast) {
+ if (!shouldTriggerInboundCapture(wrkMast)) {
+ return;
+ }
+ try {
+ ensureInboundCapturePending(wrkMast);
+ inboundCameraCaptureService.processPendingCapture(wrkMast);
+ } catch (Exception e) {
+ log.warn("WCS鐢宠鍏ュ簱鍚庤Е鍙戞媿鐓уけ璐ワ細workNo={}, sourceStaNo={}, locNo={}, barcode={}",
+ wrkMast.getWrkNo(), wrkMast.getSourceStaNo(), wrkMast.getLocNo(), wrkMast.getBarcode(), e);
+ }
+ }
+
+ private boolean shouldTriggerInboundCapture(WrkMast wrkMast) {
+ if (wrkMast == null || wrkMast.getWrkNo() == null) {
+ return false;
+ }
+ if (wrkMast.getIoType() == null || wrkMast.getIoType() != 1) {
+ return false;
+ }
+ if (Cools.isEmpty(wrkMast.getSourceStaNo(), wrkMast.getLocNo(), wrkMast.getBarcode())) {
+ return false;
+ }
+ if (InboundCameraCaptureService.CAPTURE_RUNNING.equals(wrkMast.getMemo())) {
+ return false;
+ }
+ List<WrkDetl> wrkDetls = wrkDetlService.selectList(new EntityWrapper<WrkDetl>().eq("wrk_no", wrkMast.getWrkNo()));
+ if (Cools.isEmpty(wrkDetls)) {
+ return true;
+ }
+ for (WrkDetl wrkDetl : wrkDetls) {
+ if (wrkDetl != null && !Cools.isEmpty(wrkDetl.getPic())) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ private void ensureInboundCapturePending(WrkMast wrkMast) {
+ if (!Cools.isEmpty(wrkMast.getMemo())) {
+ return;
+ }
+ WrkMast update = new WrkMast();
+ update.setMemo(InboundCameraCaptureService.CAPTURE_PENDING);
+ update.setModiTime(new Date());
+ wrkMastService.update(update, new EntityWrapper<WrkMast>().eq("wrk_no", wrkMast.getWrkNo()));
+ wrkMast.setMemo(InboundCameraCaptureService.CAPTURE_PENDING);
}
/**
@@ -598,7 +657,7 @@
public StartupDto emptyPlateIn(Integer devpNo, LocTypeDto locTypeDto, String barcode) {
// 婧愮珯鐐圭姸鎬佹娴�
BasDevp sourceStaNo = basDevpService.checkSiteStatus(devpNo, true);
- // 妫�绱㈠簱浣�
+ // 妫�绱㈠簱浣嶏紱鏃х┖鎵樼洏鍏ュ簱鍏ュ彛鍥哄畾浼� staDescId=10锛屼粛澶嶇敤 CommonService 鐨勭粺涓�绌烘墭鐩樻壘浣嶈鍒欍��
FindLocNoAttributeVo findLocNoAttributeVo = new FindLocNoAttributeVo();
StartupDto dto = commonService.getLocNo(10, devpNo, findLocNoAttributeVo, locTypeDto);
--
Gitblit v1.9.1