From 08cea428e888b6fdd2a3c3783e87e4f828385783 Mon Sep 17 00:00:00 2001 From: jiazx0107@163.com <jiazx0107@163.com> Date: 星期四, 08 六月 2023 08:55:47 +0800 Subject: [PATCH] 出入库优化-提交优化 --- igds-inout/src/main/java/com/ld/igds/inout/manager/InoutManager.java | 235 ++++++++++++++++++---------------------------------------- 1 files changed, 74 insertions(+), 161 deletions(-) diff --git a/igds-inout/src/main/java/com/ld/igds/inout/manager/InoutManager.java b/igds-inout/src/main/java/com/ld/igds/inout/manager/InoutManager.java index ac4dce1..621ad16 100644 --- a/igds-inout/src/main/java/com/ld/igds/inout/manager/InoutManager.java +++ b/igds-inout/src/main/java/com/ld/igds/inout/manager/InoutManager.java @@ -23,7 +23,6 @@ import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.time.DateUtils; -import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; @@ -48,8 +47,8 @@ private CoreFileService fileService; @Autowired private CoreCommonService commonService; - @Autowired - private InoutCommonService inoutManagerService; + @Resource + private InoutCommonService inoutCommonService; @Autowired private CheckStandardManager checkStandardManager; @Resource @@ -143,14 +142,14 @@ List<FileData> files = data.getFiles(); // 鏇存柊涓嬩竴涓姸鎬佸拰鍩烘湰淇℃伅 - InoutSysConf inoutSysConf = inoutManagerService.getCacheInoutSysConf( + InoutSysConf inoutSysConf = inoutCommonService.getCacheInoutSysConf( data.getCompanyId(), data.getDeptId()); if (null == inoutSysConf || StringUtils.isEmpty(inoutSysConf.getProgressIn())) { return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(), "褰撳墠搴撳尯鏈厤缃嚭搴撴祦绋嬩俊鎭紝璇疯仈绯荤鐞嗗憳閰嶇疆銆�", data); } - data = updateOutBasicInfo(data, inoutSysConf); + data = updateBasicInfo(data, inoutSysConf); // 濡傛灉褰撳墠鑺傜偣鏄敞鍐岋紝鍒欓渶瑕侀獙璇佷笅锛屾槸鍚︽湁涓哄畬鎴愮殑娴佺▼鍦ㄦ墽琛屼腑 if (InoutConstant.PROGRESS_REGISTER.equals(curProgress)) { @@ -211,7 +210,7 @@ } // 鏇存柊涓嬩竴涓姸鎬佸拰鍩烘湰淇℃伅 - InoutSysConf inoutSysConf = inoutManagerService.getCacheInoutSysConf(data.getCompanyId(), data.getDeptId()); + InoutSysConf inoutSysConf = inoutCommonService.getCacheInoutSysConf(data.getCompanyId(), data.getDeptId()); if (null == inoutSysConf || StringUtils.isEmpty(inoutSysConf.getProgressIn())) { @@ -219,7 +218,7 @@ "褰撳墠搴撳尯鏈厤缃叆搴撴祦绋嬩俊鎭紝璇疯仈绯荤鐞嗗憳閰嶇疆銆�", data); } - data = updateInBasicInfo(data, inoutSysConf); + data = updateBasicInfo(data, inoutSysConf); // 濡傛灉褰撳墠鑺傜偣鏄敞鍐岋紝鍒欓渶瑕侀獙璇佷笅锛屾槸鍚︽湁涓哄畬鎴愮殑娴佺▼鍦ㄦ墽琛屼腑 if (InoutConstant.PROGRESS_REGISTER.equals(curProgress)) { @@ -317,7 +316,7 @@ // 鏇存柊涓嬩竴涓姸鎬佸拰鍩烘湰淇℃伅 if (InoutConstant.PROGRESS_CHECK.equals(progressData.getProgress())) { - progressData = updateInBasicInfo(progressData, null); + progressData = updateBasicInfo(progressData, null); // 鑻ュ寲楠岀粨鏋滀笉鍚堟牸锛屽垽鏂厤缃悗缁祦绋� if (InoutConstant.STATUS_UNPASS.equals(progressData .getCheckStatus())) { @@ -325,10 +324,7 @@ } } progressData.setCheckUser(ContextUtil.getLoginUserCName()); -// if (StringUtils.isNotEmpty(data.getCustomerName())) { -// progressData.setCustomerId(data.getCustomerId()); -// progressData.setCustomerName(data.getCustomerName()); -// } + if (StringUtils.isNotEmpty(data.getDepotId())) { progressData.setDepotId(data.getDepotId()); } @@ -354,15 +350,6 @@ progressData.setNoticeId(data.getNoticeId()); } -// // 鍥炲~姘村垎鍜屾潅璐� -// if (checkResult.getWet() > 0) { -// progressData.setWet(checkResult.getWet()); -// } -// -// if (checkResult.getImpurity() > 0) { -// progressData.setImpurity(checkResult.getImpurity()); -// } - String msg = inoutService.updateData(progressData); if (null != msg) { @@ -382,7 +369,7 @@ * @return */ private InoutData checkNoPass(InoutData data) { - InoutSysConf inoutSysConf = inoutManagerService.getCacheInoutSysConf( + InoutSysConf inoutSysConf = inoutCommonService.getCacheInoutSysConf( data.getCompanyId(), data.getDeptId()); if (inoutSysConf.getNoPassNext().equals(InoutConstant.CHECK_NOPASS_RECORD)) { @@ -450,82 +437,59 @@ } /** - * 鏍规嵁闇�瑕佷繚瀛樼殑鏁版嵁锛岃皟鏁翠笅涓�涓祦绋嬬姸鎬� 涓嶅悓鐨勪粨搴撶粍缁囨祦绋嬪彲鑳戒笉涓�鏍凤紝闇�瑕佹牴鎹疄闄呰皟鏁� + * 鏍规嵁鏁版嵁褰撳墠鐘舵�佸拰涓嬩竴涓姸鎬侊紝鏇存柊鍩虹淇℃伅 * * @param data * @return */ - private InoutData updateInBasicInfo(InoutData data, InoutSysConf sysConf) { - if (null == sysConf) { - sysConf = inoutManagerService.getCacheInoutSysConf( - data.getCompanyId(), data.getDeptId()); - } + private InoutData updateBasicInfo(InoutData data, String curProgress, String nextProgress) { - if (InoutConstant.PROGRESS_REGISTER.equals(data.getProgress())) { + if (InoutConstant.PROGRESS_REGISTER.equals(curProgress)) { data.setRegisterTime(new Date()); data.setRegisterUser(ContextUtil.getLoginUserCName()); - data.setProgress(getNextProgress(data.getProgress(), - data.getType(), sysConf)); - - return data; + data.setProgress(nextProgress); } - if (InoutConstant.PROGRESS_WEIGHT_FULL.equals(data.getProgress())) { - data.setFullWeightTime(new Date()); - data.setFullWeightUser(ContextUtil.getLoginUserCName()); - data.setProgress(getNextProgress(data.getProgress(), - data.getType(), sysConf)); - return data; - } - if (InoutConstant.PROGRESS_CHECK.equals(data.getProgress())) { - data.setCheckUser(ContextUtil.getLoginUserCName()); - data.setProgress(getNextProgress(data.getProgress(), - data.getType(), sysConf)); - return data; - } - - if (InoutConstant.PROGRESS_WEIGHT_EMPTY.equals(data.getProgress())) { + if (InoutConstant.PROGRESS_WEIGHT_EMPTY.equals(curProgress)) { data.setEmptyWeightTime(new Date()); data.setEmptyWeightUser(ContextUtil.getLoginUserCName()); + data.setProgress(nextProgress); - data.setProgress(getNextProgress(data.getProgress(), - data.getType(), sysConf)); + } + if (InoutConstant.PROGRESS_WEIGHT_FULL.equals(curProgress)) { + data.setFullWeightTime(new Date()); + data.setFullWeightUser(ContextUtil.getLoginUserCName()); + data.setProgress(nextProgress); + } - if (InoutConstant.PROGRESS_RECORD.equals(data.getProgress())) { - data.setCompleteTime(DateUtils.addMinutes(new Date(), 2)); - data.setCompleteUser(ContextUtil.getLoginUserCName()); + if (InoutConstant.PROGRESS_HANDLE.equals(curProgress)) { + if (null == data.getHandleUser()) { + data.setHandleUser(ContextUtil.getLoginUserCName()); } - return data; + data.setProgress(nextProgress); } - if (InoutConstant.PROGRESS_HANDLE.equals(data.getProgress())) { - // 鏌ヨ缂撳瓨涓粨搴撲俊鎭紝鏍规嵁浠撳簱id璁剧疆鍊间粨浜轰负浠撳簱淇濈鍛� - Depot depot = commonService.getCacheDepot(data.getCompanyId(), - data.getDepotId()); - data.setHandleUser(depot == null ? "" : depot.getStoreKeeperName()); - data.setProgress(getNextProgress(data.getProgress(), - data.getType(), sysConf)); - return data; - } - - if (InoutConstant.PROGRESS_CARD_BACK.equals(data.getProgress())) { - data.setCompleteTime(new Date()); + //濡傛灉涓嬩竴涓暟鎹姸鎬�=娴佺▼缁撴潫锛岀洿鎺ヨˉ鍏呭畬鏁翠俊鎭� + if (InoutConstant.PROGRESS_RECORD.equals(nextProgress)) { + data.setCompleteTime(DateUtils.addMinutes(new Date(), 2)); data.setCompleteUser(ContextUtil.getLoginUserCName()); - data.setProgress(getNextProgress(data.getProgress(), - data.getType(), sysConf)); - return data; + data.setProgress(nextProgress); } + + return data; } /** + * 褰撳墠鏂规硶闇�瑕佸垹闄� + * <p> * 鏍规嵁闇�瑕佷繚瀛樼殑鏁版嵁锛岃皟鏁翠笅涓�涓祦绋嬬姸鎬� 涓嶅悓鐨勪粨搴撶粍缁囨祦绋嬪彲鑳戒笉涓�鏍凤紝闇�瑕佹牴鎹疄闄呰皟鏁� * * @param data * @return */ - private InoutData updateOutBasicInfo(InoutData data, InoutSysConf sysConf) { + private InoutData updateBasicInfo(InoutData data, InoutSysConf sysConf) { if (InoutConstant.PROGRESS_REGISTER.equals(data.getProgress())) { data.setRegisterTime(new Date()); data.setRegisterUser(ContextUtil.getLoginUserCName()); @@ -577,36 +541,6 @@ return data; } - -// public PageResponse<Page<InoutData>> pageRecordData(InoutParam param) { -// -// log.debug("鍒嗛〉淇℃伅--page={},limit={},cuur={}", param.getPage(), -// param.getLimit(), param.getCurr()); -// -// Page<InoutData> result = inoutService.pageRecordData(param); -// -// if (null == result.getRecords() || result.getRecords().isEmpty()) { -// return new PageResponse<>(RespCodeEnum.CODE_2000.getCode(), -// "鑾峰彇鍒版暟鎹俊鎭负绌�"); -// } -// -// return new PageResponse<>(RespCodeEnum.CODE_0000, result); -// } - -// /** -// * @param param -// * @return -// */ -// public PageResponse<Page<InoutData>> pageCheckData(InoutParam param) { -// // 濡傛灉鏄凡鍖栭獙锛屽垯灏嗘祦绋嬬姸鎬佺疆绌猴紝濡傛灉鏄湭鍖栭獙锛屽垯娴佺▼鐘舵�佷笉澶勭悊锛屼粛鏄疌HECK鐘舵�� -// if (!"NONE".equals(param.getCheckStatus())) { -// param.setProgress(null); -// } -// // 璁剧疆鍒嗗簱Id -// String deptId = ContextUtil.subDeptId(null); -// param.setDeptId(deptId); -// return pageRecordData(param); -// } public PageResponse<InoutData> inoutComplete(InoutData data) throws Exception { @@ -774,9 +708,6 @@ if (null == data.getFullWeightTime()) { data.setFullWeightTime(DateUtil.getNewByMinute(new Date(), -50)); } - if (null == data.getHandleEnd()) { - data.setHandleEnd(DateUtil.getNewByMinute(new Date(), -40)); - } if (null == data.getEmptyWeightTime()) { data.setEmptyWeightTime(DateUtil.getNewByMinute(new Date(), -10)); } @@ -790,9 +721,6 @@ } else { if (null == data.getEmptyWeightTime()) { data.setEmptyWeightTime(DateUtil.getNewByMinute(new Date(), -50)); - } - if (null == data.getHandleEnd()) { - data.setHandleEnd(DateUtil.getNewByMinute(new Date(), -40)); } if (null == data.getFullWeightTime()) { data.setFullWeightTime(DateUtil.getNewByMinute(new Date(), -10)); @@ -1026,19 +954,19 @@ //鑾峰彇绯荤粺鍙傛暟閰嶇疆 - InoutSysConf inoutSysConf = inoutManagerService.getCacheInoutSysConf(data.getCompanyId(), data.getDeptId()); + InoutSysConf inoutSysConf = inoutCommonService.getCacheInoutSysConf(data.getCompanyId(), data.getDeptId()); if (null == inoutSysConf) { return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(), "鎻愮ず锛氬綋鍓嶅簱鍖烘湭閰嶇疆鍑哄叆搴撴祦绋嬩俊鎭紝璇疯仈绯荤鐞嗗憳", data); } - String curProgress = data.getProgress(); //鑾峰彇涓嬩竴涓祦绋嬬姸鎬� + String curProgress = data.getProgress(); String nextProgress = getNextProgress(curProgress, data.getType(), inoutSysConf); - data.setRegisterTime(new Date()); - data.setRegisterUser(ContextUtil.getLoginUserCName()); - data.setProgress(nextProgress); + + + data = updateBasicInfo(data, curProgress, nextProgress); String msg = inoutService.insertData(data); @@ -1056,36 +984,17 @@ public PageResponse<InoutData> submitWeightIn(InoutData data) throws Exception { //鑾峰彇绯荤粺鍙傛暟閰嶇疆 - InoutSysConf inoutSysConf = inoutManagerService.getCacheInoutSysConf(data.getCompanyId(), data.getDeptId()); + InoutSysConf inoutSysConf = inoutCommonService.getCacheInoutSysConf(data.getCompanyId(), data.getDeptId()); if (null == inoutSysConf) { return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(), "鎻愮ず锛氬綋鍓嶇郴缁熶腑娴佺▼閰嶇疆寮傚父锛岃鑱旂郴绠$悊鍛�", data); } - String curProgress = data.getProgress(); //鑾峰彇涓嬩竴涓祦绋嬬姸鎬� + String curProgress = data.getProgress(); String nextProgress = getNextProgress(curProgress, data.getType(), inoutSysConf); - - if (InoutConstant.PROGRESS_WEIGHT_EMPTY.equals(curProgress)) { - data.setEmptyWeightTime(new Date()); - data.setEmptyWeightUser(ContextUtil.getLoginUserCName()); - data.setProgress(nextProgress); - - } - if (InoutConstant.PROGRESS_WEIGHT_FULL.equals(nextProgress)) { - data.setFullWeightTime(new Date()); - data.setFullWeightUser(ContextUtil.getLoginUserCName()); - data.setProgress(nextProgress); - } - - - //濡傛灉涓嬩竴涓暟鎹姸鎬�=娴佺▼缁撴潫 - if (InoutConstant.PROGRESS_RECORD.equals(nextProgress)) { - data.setCompleteTime(DateUtils.addMinutes(new Date(), 2)); - data.setCompleteUser(ContextUtil.getLoginUserCName()); - data.setProgress(nextProgress); - } + data = updateBasicInfo(data, curProgress, nextProgress); //鍏ュ簱绉伴噸鍙兘璋冩暣璐ㄦ鍗� @@ -1116,37 +1025,17 @@ public PageResponse<InoutData> submitWeightOut(InoutData data) throws Exception { //鑾峰彇绯荤粺鍙傛暟閰嶇疆 - InoutSysConf inoutSysConf = inoutManagerService.getCacheInoutSysConf(data.getCompanyId(), data.getDeptId()); + InoutSysConf inoutSysConf = inoutCommonService.getCacheInoutSysConf(data.getCompanyId(), data.getDeptId()); if (null == inoutSysConf) { return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(), "鎻愮ず锛氬綋鍓嶇郴缁熶腑娴佺▼閰嶇疆寮傚父锛岃鑱旂郴绠$悊鍛�", data); } - String curProgress = data.getProgress(); //鑾峰彇涓嬩竴涓祦绋嬬姸鎬� + String curProgress = data.getProgress(); String nextProgress = getNextProgress(curProgress, data.getType(), inoutSysConf); - - if (InoutConstant.PROGRESS_WEIGHT_EMPTY.equals(curProgress)) { - data.setEmptyWeightTime(new Date()); - data.setEmptyWeightUser(ContextUtil.getLoginUserCName()); - data.setProgress(nextProgress); - - } - if (InoutConstant.PROGRESS_WEIGHT_FULL.equals(nextProgress)) { - data.setFullWeightTime(new Date()); - data.setFullWeightUser(ContextUtil.getLoginUserCName()); - data.setProgress(nextProgress); - } - - - //濡傛灉涓嬩竴涓暟鎹姸鎬�=娴佺▼缁撴潫 - if (InoutConstant.PROGRESS_RECORD.equals(nextProgress)) { - data.setCompleteTime(DateUtils.addMinutes(new Date(), 2)); - data.setCompleteUser(ContextUtil.getLoginUserCName()); - data.setProgress(nextProgress); - } - + data = updateBasicInfo(data, curProgress, nextProgress); //鎵ц鏁版嵁鏇存柊 String msg = inoutService.updateData(data); @@ -1158,8 +1047,35 @@ // 鎵ц闄勪欢淇℃伅 fileService.saveInoutFiles(data.getFiles(), data.getCompanyId(), data.getId(), curProgress); - //绉伴噸瀹屾垚锛岃皟鐢ㄥ嚭鍏ュ簱鎺у埗閫昏緫澶勭悊 + //绉伴噸鍚庢牴鎹綋鍓嶆祦绋嬬姸鎬佸拰涓嬩竴涓姸鎬侊紝閫氱煡绉伴噸鎺у埗鍣� inoutDeviceManager.controlWeight(data, curProgress, nextProgress); + + return new PageResponse<>(RespCodeEnum.CODE_0000.getCode(), "鎵ц鎴愬姛", data); + } + + public PageResponse<InoutData> submitHandle(InoutData data) throws Exception { + //鑾峰彇绯荤粺鍙傛暟閰嶇疆 + InoutSysConf inoutSysConf = inoutCommonService.getCacheInoutSysConf(data.getCompanyId(), data.getDeptId()); + if (null == inoutSysConf) { + return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(), + "鎻愮ず锛氬綋鍓嶇郴缁熶腑娴佺▼閰嶇疆寮傚父锛岃鑱旂郴绠$悊鍛�", data); + } + + //鑾峰彇涓嬩竴涓祦绋嬬姸鎬� + String curProgress = data.getProgress(); + String nextProgress = getNextProgress(curProgress, data.getType(), inoutSysConf); + data = updateBasicInfo(data, curProgress, nextProgress); + + + //鎵ц鏁版嵁鏇存柊 + String msg = inoutService.updateDataByHandle(data); + + if (null != msg) { + return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(), msg, data); + } + + // 鎵ц闄勪欢淇℃伅 + fileService.saveInoutFiles(data.getFiles(), data.getCompanyId(), data.getId(), curProgress); return new PageResponse<>(RespCodeEnum.CODE_0000.getCode(), "鎵ц鎴愬姛", data); } @@ -1302,7 +1218,7 @@ //鏇存柊涓嬩竴娴佺▼鐘舵�� if (InoutConstant.PROGRESS_CHECK.equals(curData.getProgress())) { - curData = updateInBasicInfo(curData, null); + curData = updateBasicInfo(curData, null); // 鑻ュ寲楠岀粨鏋滀笉鍚堟牸锛屽垽鏂厤缃悗缁祦绋� if (InoutConstant.STATUS_UNPASS.equals(curData.getCheckStatus())) { curData = checkNoPass(curData); @@ -1330,8 +1246,5 @@ return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(), "鍚庡彴寮傚父锛�" + e.getMessage(), null); } - } - - } \ No newline at end of file -- Gitblit v1.9.3