From 0a4c32ca70dd7543596ac7234b06db343917f65e Mon Sep 17 00:00:00 2001
From: YYC <1833023622@qq.com>
Date: 星期一, 19 六月 2023 14:53:58 +0800
Subject: [PATCH] 新建接口
---
igds-inout/src/main/java/com/ld/igds/inout/manager/InoutManager.java | 227 +++++++++++++++++++++++++++++++++++---------------------
1 files changed, 142 insertions(+), 85 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 621ad16..6041858 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
@@ -16,6 +16,7 @@
import com.ld.igds.m.service.InoutCommonService;
import com.ld.igds.models.Depot;
import com.ld.igds.models.InoutConf;
+import com.ld.igds.models.InoutPrice;
import com.ld.igds.models.InoutSysConf;
import com.ld.igds.util.ContextUtil;
import com.ld.igds.util.DateUtil;
@@ -283,84 +284,84 @@
return inoutService.inoutProgressQuery(param);
}
- @Transactional(rollbackFor = Exception.class)
- public PageResponse<InoutData> updateCheck(InoutData data) throws Exception {
-
- if (InoutConstant.PROGRESS_RECORD.equals(data.getProgress())) {
- return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(),
- "褰撳墠娴佺▼宸茬粡缁撴潫锛屼笉鏀寔淇敼", data);
- }
-
- CheckUpdateResult checkResult = this.updateCheckItems(data);
- String tag = checkResult.getMsg();
-
- if (null != tag) {
- return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(),
- "鍚庡彴鎵ц寮傚父锛�" + tag, data);
- }
-
- // 鑾峰彇涓氬姟鏁版嵁淇℃伅
- InoutParam param = new InoutParam();
- param.setCompanyId(data.getCompanyId());
- param.setId(data.getId());
- InoutData progressData = inoutService.inoutProgressQuery(param);
- if (null == progressData) {
- return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(),
- "娌℃湁鑾峰彇鍒板嚭鍏ュ簱涓氬姟鏁版嵁淇℃伅锛屾洿鏂板け璐�", data);
- }
- if (InoutConstant.PROGRESS_RECORD.equals(progressData.getProgress())) {
- return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(),
- "褰撳墠娴佺▼宸茬粡缁撴潫锛屼笉鏀寔淇敼");
- }
- progressData.setCheckStatus(data.getCheckStatus());
-
- // 鏇存柊涓嬩竴涓姸鎬佸拰鍩烘湰淇℃伅
- if (InoutConstant.PROGRESS_CHECK.equals(progressData.getProgress())) {
- progressData = updateBasicInfo(progressData, null);
- // 鑻ュ寲楠岀粨鏋滀笉鍚堟牸锛屽垽鏂厤缃悗缁祦绋�
- if (InoutConstant.STATUS_UNPASS.equals(progressData
- .getCheckStatus())) {
- progressData = checkNoPass(progressData);
- }
- }
- progressData.setCheckUser(ContextUtil.getLoginUserCName());
-
- if (StringUtils.isNotEmpty(data.getDepotId())) {
- progressData.setDepotId(data.getDepotId());
- }
- if (StringUtils.isNotEmpty(data.getFoodVariety())) {
- progressData.setFoodVariety(data.getFoodVariety());
- }
- if (StringUtils.isNotEmpty(data.getFoodLevel())) {
- progressData.setFoodLevel(data.getFoodLevel());
- }
- if (StringUtils.isNotEmpty(data.getFoodLocation())) {
- progressData.setFoodLocation(data.getFoodLocation());
- }
- if (StringUtils.isNotEmpty(data.getFoodYear())) {
- progressData.setFoodYear(data.getFoodYear());
- }
- if (null != data.getPrice()) {
- progressData.setPrice(data.getPrice());
- }
- if (StringUtils.isNotEmpty(data.getRemarks())) {
- progressData.setRemarks(data.getRemarks());
- }
- if (StringUtils.isNotEmpty(data.getNoticeId())) {
- progressData.setNoticeId(data.getNoticeId());
- }
-
- String msg = inoutService.updateData(progressData);
-
- if (null != msg) {
- return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(), msg);
- }
- if (InoutConstant.PROGRESS_RECORD.equals(progressData.getProgress())) {
-
- inoutComplete(progressData);
- }
- return new PageResponse<>(RespCodeEnum.CODE_0000.getCode(), "鎵ц鎴愬姛");
- }
+// @Transactional(rollbackFor = Exception.class)
+// public PageResponse<InoutData> updateCheck(InoutData data) throws Exception {
+//
+// if (InoutConstant.PROGRESS_RECORD.equals(data.getProgress())) {
+// return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(),
+// "褰撳墠娴佺▼宸茬粡缁撴潫锛屼笉鏀寔淇敼", data);
+// }
+//
+// CheckUpdateResult checkResult = this.updateCheckItems(data);
+// String tag = checkResult.getMsg();
+//
+// if (null != tag) {
+// return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(),
+// "鍚庡彴鎵ц寮傚父锛�" + tag, data);
+// }
+//
+// // 鑾峰彇涓氬姟鏁版嵁淇℃伅
+// InoutParam param = new InoutParam();
+// param.setCompanyId(data.getCompanyId());
+// param.setId(data.getId());
+// InoutData progressData = inoutService.inoutProgressQuery(param);
+// if (null == progressData) {
+// return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(),
+// "娌℃湁鑾峰彇鍒板嚭鍏ュ簱涓氬姟鏁版嵁淇℃伅锛屾洿鏂板け璐�", data);
+// }
+// if (InoutConstant.PROGRESS_RECORD.equals(progressData.getProgress())) {
+// return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(),
+// "褰撳墠娴佺▼宸茬粡缁撴潫锛屼笉鏀寔淇敼");
+// }
+// progressData.setCheckStatus(data.getCheckStatus());
+//
+// // 鏇存柊涓嬩竴涓姸鎬佸拰鍩烘湰淇℃伅
+// if (InoutConstant.PROGRESS_CHECK.equals(progressData.getProgress())) {
+// progressData = updateBasicInfo(progressData, null);
+// // 鑻ュ寲楠岀粨鏋滀笉鍚堟牸锛屽垽鏂厤缃悗缁祦绋�
+// if (InoutConstant.STATUS_UNPASS.equals(progressData
+// .getCheckStatus())) {
+// progressData = checkNoPass(progressData);
+// }
+// }
+// progressData.setCheckUser(ContextUtil.getLoginUserCName());
+//
+// if (StringUtils.isNotEmpty(data.getDepotId())) {
+// progressData.setDepotId(data.getDepotId());
+// }
+// if (StringUtils.isNotEmpty(data.getFoodVariety())) {
+// progressData.setFoodVariety(data.getFoodVariety());
+// }
+// if (StringUtils.isNotEmpty(data.getFoodLevel())) {
+// progressData.setFoodLevel(data.getFoodLevel());
+// }
+// if (StringUtils.isNotEmpty(data.getFoodLocation())) {
+// progressData.setFoodLocation(data.getFoodLocation());
+// }
+// if (StringUtils.isNotEmpty(data.getFoodYear())) {
+// progressData.setFoodYear(data.getFoodYear());
+// }
+// if (null != data.getPrice()) {
+// progressData.setPrice(data.getPrice());
+// }
+// if (StringUtils.isNotEmpty(data.getRemarks())) {
+// progressData.setRemarks(data.getRemarks());
+// }
+// if (StringUtils.isNotEmpty(data.getNoticeId())) {
+// progressData.setNoticeId(data.getNoticeId());
+// }
+//
+// String msg = inoutService.updateData(progressData);
+//
+// if (null != msg) {
+// return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(), msg);
+// }
+// if (InoutConstant.PROGRESS_RECORD.equals(progressData.getProgress())) {
+//
+// inoutComplete(progressData);
+// }
+// return new PageResponse<>(RespCodeEnum.CODE_0000.getCode(), "鎵ц鎴愬姛");
+// }
/**
* 鍖栭獙缁撴灉涓嶉�氳繃鏃舵牎楠岄厤缃俊鎭�
@@ -450,12 +451,18 @@
data.setProgress(nextProgress);
}
+ if (InoutConstant.PROGRESS_CHECK.equals(data.getProgress())) {
+ data.setCheckUser(ContextUtil.getLoginUserCName());
+ data.setProgress(nextProgress);
+ return data;
+ }
+
if (InoutConstant.PROGRESS_WEIGHT_EMPTY.equals(curProgress)) {
data.setEmptyWeightTime(new Date());
data.setEmptyWeightUser(ContextUtil.getLoginUserCName());
data.setProgress(nextProgress);
-
}
+
if (InoutConstant.PROGRESS_WEIGHT_FULL.equals(curProgress)) {
data.setFullWeightTime(new Date());
data.setFullWeightUser(ContextUtil.getLoginUserCName());
@@ -469,14 +476,12 @@
data.setProgress(nextProgress);
}
-
//濡傛灉涓嬩竴涓暟鎹姸鎬�=娴佺▼缁撴潫锛岀洿鎺ヨˉ鍏呭畬鏁翠俊鎭�
if (InoutConstant.PROGRESS_RECORD.equals(nextProgress)) {
data.setCompleteTime(DateUtils.addMinutes(new Date(), 2));
data.setCompleteUser(ContextUtil.getLoginUserCName());
data.setProgress(nextProgress);
}
-
return data;
}
@@ -498,6 +503,14 @@
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())) {
data.setEmptyWeightTime(new Date());
data.setEmptyWeightUser(ContextUtil.getLoginUserCName());
@@ -1214,19 +1227,44 @@
return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(),
"褰撳墠娴佺▼宸茬粡缁撴潫锛屼笉鏀寔淇敼");
}
+
+ //鏇存柊鍖栭獙椤逛俊鎭�
+ CheckUpdateResult checkResult = checkStandardManager.updateCheckItems(data.getCheckId(), data.getCompanyId(), data.getCheckItems());
+ if (StringUtils.isNotEmpty(checkResult.getMsg())) {
+ return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(),
+ "鍚庡彴鎵ц寮傚父锛�" + checkResult.getMsg(), data);
+ }
+
+ //璁剧疆鍖栭獙淇℃伅
+ if (checkResult.getDeSum() > 0) {
+ data.setDeCheck(checkResult.getDeSum());
+ }
+ if (checkResult.getAddSum() > 0) {
+ data.setAddCheck(checkResult.getAddSum());
+ }
+ if (null == data.getCheckTime()) {
+ data.setCheckTime(new Date());
+ }
curData.setCheckStatus(data.getCheckStatus());
+ //鑾峰彇绯荤粺鍙傛暟閰嶇疆
+ InoutSysConf inoutSysConf = inoutCommonService.getCacheInoutSysConf(data.getCompanyId(), data.getDeptId());
+ if (null == inoutSysConf) {
+ return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(),
+ "鎻愮ず锛氬綋鍓嶅簱鍖烘湭閰嶇疆鍑哄叆搴撴祦绋嬩俊鎭紝璇疯仈绯荤鐞嗗憳", data);
+ }
//鏇存柊涓嬩竴娴佺▼鐘舵��
if (InoutConstant.PROGRESS_CHECK.equals(curData.getProgress())) {
- curData = updateBasicInfo(curData, null);
+ curData = updateBasicInfo(curData, inoutSysConf);
// 鑻ュ寲楠岀粨鏋滀笉鍚堟牸锛屽垽鏂厤缃悗缁祦绋�
if (InoutConstant.STATUS_UNPASS.equals(curData.getCheckStatus())) {
curData = checkNoPass(curData);
}
}
- data.setCheckStatus(curData.getCheckStatus());
//鍖栭獙浜恒�佸寲楠屾椂闂�
+ data.setCheckStatus(curData.getCheckStatus());
+ data.setProgress(curData.getProgress());
if (StringUtils.isEmpty(data.getCheckUser())) {
data.setCheckUser(ContextUtil.getLoginUserCName());
}
@@ -1235,11 +1273,9 @@
}
String msg = inoutService.updateCheckData(data);
-
if (null != msg) {
return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(), msg);
}
- //TODO 鏇存柊鍖栭獙椤逛俊鎭�
return new PageResponse<>(RespCodeEnum.CODE_0000.getCode(), "鎵ц鎴愬姛");
} catch (Exception e) {
@@ -1247,4 +1283,25 @@
"鍚庡彴寮傚父锛�" + e.getMessage(), null);
}
}
+
+ /**
+ * 鑾峰彇鍗曚环淇℃伅
+ *
+ * @param param
+ * @return
+ */
+ public PageResponse<InoutPrice> getPrice(InoutCheckParam param) {
+ try {
+
+ List<InoutPrice> price = inoutService.getPrice(param);
+ if(null == price || price.isEmpty()){
+ return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(), "鏈幏鍙栧埌绮瀹氫环閰嶇疆淇℃伅");
+ }
+ return new PageResponse<>(RespCodeEnum.CODE_0000, price.get(0));
+
+ } catch (Exception e) {
+ return new PageResponse<>(
+ RespCodeEnum.CODE_1111.getCode(), "鍚庡彴寮傚父锛�" + e.getMessage(), null);
+ }
+ }
}
\ No newline at end of file
--
Gitblit v1.9.3