From ae2c433ecf08e10d55488320e5db0936ca323710 Mon Sep 17 00:00:00 2001 From: czt <czt18638530771@163.com> Date: 星期三, 31 五月 2023 20:44:21 +0800 Subject: [PATCH] 扦样提交3 --- igds-inout/src/main/java/com/ld/igds/inout/manager/InoutManager.java | 130 ++++++++++++++++++++++++++++--------------- 1 files changed, 84 insertions(+), 46 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 7d28481..a3e5e3d 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 @@ -11,9 +11,7 @@ import com.ld.igds.file.CoreFileService; import com.ld.igds.file.dto.FileData; import com.ld.igds.inout.InoutConstant; -import com.ld.igds.inout.dto.InoutData; -import com.ld.igds.inout.dto.InoutGateDto; -import com.ld.igds.inout.dto.InoutParam; +import com.ld.igds.inout.dto.*; import com.ld.igds.inout.service.InoutService; import com.ld.igds.m.service.InoutCommonService; import com.ld.igds.models.Depot; @@ -22,10 +20,10 @@ import com.ld.igds.util.ContextUtil; import com.ld.igds.util.DateUtil; import com.ld.igds.util.NumberUtil; -import com.ld.igds.util.RespUtil; 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; @@ -58,7 +56,7 @@ private InoutDeviceManager inoutDeviceManager; /** - * 褰撳墠鍏堜粠褰撴棩缂撳瓨涓幏鍙栨暟鎹紝濡傛灉缂撳瓨涓病鏈夊啀浠庢暟鎹簱鑾峰彇 + * 棣栧厛浠庣紦瀛樹腑鑾峰彇锛岀紦瀛樹腑锛屼粠鏁版嵁搴撲腑鑾峰彇 * * @param param * @return @@ -69,22 +67,17 @@ && StringUtils.isEmpty(param.getUserId())) { return new PageResponse<>(RespCodeEnum.CODE_1007.getCode(), - "鍙傛暟涓嶅畬鏁达紝鏃犳硶鑾峰彇淇℃伅锛�"); - } - - if (StringUtils.isEmpty(param.getCompanyId())) { - param.setCompanyId(ContextUtil.getCompanyId()); + "鏌ヨ鍙傛暟涓嶅畬鏁达紝鏌ヨ澶辫触锛�"); } InoutData result; String progress = param.getProgress(); try { param.setProgress(null); - result = inoutService.inoutProgressQuery(param); if (null == result) { return new PageResponse<>(RespCodeEnum.CODE_2000.getCode(), - "鏈壘鍒版祦绋嬩腑鐨勮溅杈嗭紒", null); + "绯荤粺涓烘煡璇㈠埌鎵ц涓殑杞﹁締淇℃伅", null); } // 濡傛灉娌℃湁娴佺▼鏉′欢璇存槑涓嶉渶瑕佸仛鍒ゆ柇锛岀洿鎺ヨ繑鍥� @@ -92,17 +85,16 @@ return new PageResponse<>(RespCodeEnum.CODE_0000, result); } + + //娴佺▼绫诲瀷楠岃瘉 if (!result.getType().equals(param.getType())) { - if (InoutConstant.TYPE_IN.equals(result.getType())) { - return new PageResponse<>(RespCodeEnum.CODE_2000.getCode(), - "绯荤粺锛氬綋鍓嶈溅杈嗕笟鍔′负銆愬叆搴撱��", result); - } else { - return new PageResponse<>(RespCodeEnum.CODE_2000.getCode(), - "绯荤粺锛氬綋鍓嶈溅杈嗕笟鍔′负銆愬嚭搴撱��", result); - } + String msg = "娴佺▼閿欒锛氬綋鍓嶈溅杈嗘祦绋嬩负銆愬叆搴撱��"; + if (InoutConstant.TYPE_OUT.equals(result.getType())) msg = "娴佺▼閿欒锛氬綋鍓嶈溅杈嗘祦绋嬩负銆愬嚭搴撱��"; + return new PageResponse<>(RespCodeEnum.CODE_2000.getCode(), msg, result); } - // 褰撳墠鏍囩鏍囩ず鏃㈠彲浠ユ槸绌鸿溅绉伴噸涔熷彲浠ユ槸婊¤溅 + + //娴佺▼鐜妭楠岃瘉 if (progress.equals(InoutConstant.PROGRESS_WEIGHT_TAG)) { if (result.getProgress().equals( InoutConstant.PROGRESS_WEIGHT_EMPTY) @@ -111,7 +103,7 @@ // 琛ㄧず褰撳墠娴佺▼姝e父 } else { return new PageResponse<>(RespCodeEnum.CODE_2000.getCode(), - "闈炲綋鍓嶆祦绋嬶紝璇峰埌" + "鎻愮ず锛氶潪褰撳墠鐜妭锛岃鍒�" + InoutConstant.getProcessName( param.getType(), result.getProgress()), result); @@ -119,33 +111,10 @@ } else { if (!result.getProgress().equals(progress)) { return new PageResponse<>(RespCodeEnum.CODE_2000.getCode(), - "闈炲綋鍓嶆祦绋嬶紝璇峰埌" + "鎻愮ず锛氶潪褰撳墠鐜妭锛岃鍒�" + InoutConstant.getProcessName( param.getType(), result.getProgress()), result); - } - } - - // 鏍规嵁褰撳墠鏁版嵁鍒ゆ柇鏄惁鎺ㄩ�� - inoutService.notifyWeb(result); - - //涓哄綋鍓嶆暟鎹坊鍔犲寲楠岄」鐩拰姘村垎鍜屾潅璐ㄧ殑鍖栭獙缁撴灉,鐢ㄤ簬鍑哄叆搴撳鎵i噸璁$畻 - if (InoutConstant.TYPE_IN.equals(result.getType())) { - List<CheckItemData> checkItemDataList = inoutService.getCheckCache(result.getCompanyId(), result.getCheckId()); - result.setCheckItems(checkItemDataList); - if (null != checkItemDataList && checkItemDataList.size() > 0) { - for (CheckItemData checkItem : checkItemDataList) { - if (StringUtils.isEmpty(checkItem.getValue())) { - continue; - } - -// if (InoutConstant.CHECK_ITEM_C01.equals(checkItem.getStandardId())) { -// result.setWet(Double.valueOf(checkItem.getValue())); -// } -// if (InoutConstant.CHECK_ITEM_C02.equals(checkItem.getStandardId())) { -// result.setImpurity(Double.valueOf(checkItem.getValue())); -// } - } } } @@ -1105,4 +1074,73 @@ return new PageResponse<>(RespCodeEnum.CODE_0000.getCode(), "鎵ц鎴愬姛", data); } -} + + /** + * 鏍规嵁鏉′欢鑾峰彇鎵︽牱鏁版嵁 + * + * @param param + * @return + */ + public PageResponse<Page<InoutCheckData>> pageSampleData(InoutCheckParam param) { + + if (StringUtils.isEmpty(param.getCompanyId())) { + param.setCompanyId(ContextUtil.getCompanyId()); + } + if (StringUtils.isEmpty(param.getDeptId())) { + param.setDeptId(ContextUtil.subDeptId(null)); + } + + //鑻ユ煡璇㈡潯浠朵负宸叉墻鏍凤紝鍒欐祦绋嬬疆绌猴紱鑻ユ湭鎵︽牱锛屽垯娴佺▼涓嶅鐞嗭紝浠嶄负鎵︽牱鍖栭獙娴佺▼(CHECK) + if ("SAMPLE".equals(param.getSampleStatus())) { + param.setProgress(null); + } + + //鑾峰彇鎵︽牱鏁版嵁 + Page<InoutCheckData> sampleList = inoutService.pageSampleData(param); + + + if (null == sampleList.getRecords() || sampleList.getRecords().isEmpty()) { + return new PageResponse<>(RespCodeEnum.CODE_2000.getCode(), + "鑾峰彇鍒版暟鎹俊鎭负绌�"); + } + return new PageResponse<>(RespCodeEnum.CODE_0000, sampleList); + } + + @Transactional(rollbackFor = Exception.class) + public PageResponse<InoutCheckData> updateSampleData(InoutCheckData data){ + + try { + // 鑾峰彇涓氬姟鏁版嵁淇℃伅 + InoutParam param = new InoutParam(); + param.setCompanyId(data.getCompanyId()); + param.setId(data.getId()); + InoutData curData = inoutService.inoutProgressQuery(param); + if (null == curData) { + return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(), + "娌℃湁鑾峰彇鍒板叆搴撲笟鍔℃暟鎹俊鎭紝鏇存柊澶辫触", data); + } + if (InoutConstant.PROGRESS_RECORD.equals(curData.getProgress())) { + return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(), + "褰撳墠娴佺▼宸茬粡缁撴潫锛屼笉鏀寔淇敼"); + } + + //鎵︽牱淇℃伅 + curData.setSampleTime(data.getSampleTime()); + curData.setSampleType(data.getSampleType()); + curData.setSampleUser(data.getSampleUser()); + + String msg = inoutService.updateSampleData(curData); + + if (null != msg) { + return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(), msg); + } + + return new PageResponse<>(RespCodeEnum.CODE_0000.getCode(), "鎵ц鎴愬姛"); + } catch (Exception e) { + log.error("鍚庡彴寮傚父:{}", e); + return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(), + "鍚庡彴寮傚父锛�" + e.getMessage(), null); + } + } + +} \ No newline at end of file -- Gitblit v1.9.3