From 589c4d5ba3b5477164cbd07aefca2438303e598a Mon Sep 17 00:00:00 2001
From: YYC <1833023622@qq.com>
Date: 星期一, 19 六月 2023 20:06:29 +0800
Subject: [PATCH] 安防管理
---
igds-inout/src/main/java/com/ld/igds/inout/manager/InoutManager.java | 709 ++++++++++++++++++++++++++++++++++++----------------------
1 files changed, 438 insertions(+), 271 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 0a0dac8..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;
@@ -23,7 +24,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 +48,8 @@
private CoreFileService fileService;
@Autowired
private CoreCommonService commonService;
- @Autowired
- private InoutCommonService inoutManagerService;
+ @Resource
+ private InoutCommonService inoutCommonService;
@Autowired
private CheckStandardManager checkStandardManager;
@Resource
@@ -143,14 +143,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 +211,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 +219,7 @@
"褰撳墠搴撳尯鏈厤缃叆搴撴祦绋嬩俊鎭紝璇疯仈绯荤鐞嗗憳閰嶇疆銆�", data);
}
- data = updateInBasicInfo(data, inoutSysConf);
+ data = updateBasicInfo(data, inoutSysConf);
// 濡傛灉褰撳墠鑺傜偣鏄敞鍐岋紝鍒欓渶瑕侀獙璇佷笅锛屾槸鍚︽湁涓哄畬鎴愮殑娴佺▼鍦ㄦ墽琛屼腑
if (InoutConstant.PROGRESS_REGISTER.equals(curProgress)) {
@@ -284,96 +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 = updateInBasicInfo(progressData, null);
- // 鑻ュ寲楠岀粨鏋滀笉鍚堟牸锛屽垽鏂厤缃悗缁祦绋�
- if (InoutConstant.STATUS_UNPASS.equals(progressData
- .getCheckStatus())) {
- progressData = checkNoPass(progressData);
- }
- }
- 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());
- }
- 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());
- }
-
-// // 鍥炲~姘村垎鍜屾潅璐�
-// if (checkResult.getWet() > 0) {
-// progressData.setWet(checkResult.getWet());
-// }
+// @Transactional(rollbackFor = Exception.class)
+// public PageResponse<InoutData> updateCheck(InoutData data) throws Exception {
//
-// if (checkResult.getImpurity() > 0) {
-// progressData.setImpurity(checkResult.getImpurity());
-// }
-
- 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(), "鎵ц鎴愬姛");
- }
+// 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(), "鎵ц鎴愬姛");
+// }
/**
* 鍖栭獙缁撴灉涓嶉�氳繃鏃舵牎楠岄厤缃俊鎭�
@@ -382,7 +370,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)) {
@@ -397,14 +385,20 @@
return data;
}
+
+ /**
+ * 鏇存柊璐ㄦ淇℃伅
+ *
+ * @param data
+ * @return
+ */
private CheckUpdateResult updateCheckItems(InoutData data) {
CheckUpdateResult result = new CheckUpdateResult();
- if (null == data.getCheckItems())
- return result;
+ if (null == data.getCheckItems()) return result;
+
try {
// 鏇存柊妫�楠岄」鏁版嵁
- result = checkStandardManager.updateCheckItems(data.getCheckId(),
- data.getCompanyId(), data.getCheckItems());
+ result = checkStandardManager.updateCheckItems(data.getCheckId(), data.getCompanyId(), data.getCheckItems());
// 灏嗗寲楠屾暟鎹瓨鍏ョ紦瀛樹腑
inoutService.setCheckCache(data);
@@ -444,17 +438,63 @@
}
/**
+ * 鏍规嵁鏁版嵁褰撳墠鐘舵�佸拰涓嬩竴涓姸鎬侊紝鏇存柊鍩虹淇℃伅
+ *
+ * @param data
+ * @return
+ */
+ private InoutData updateBasicInfo(InoutData data, String curProgress, String nextProgress) {
+
+ if (InoutConstant.PROGRESS_REGISTER.equals(curProgress)) {
+ data.setRegisterTime(new Date());
+ data.setRegisterUser(ContextUtil.getLoginUserCName());
+ 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());
+ data.setProgress(nextProgress);
+ }
+
+ if (InoutConstant.PROGRESS_HANDLE.equals(curProgress)) {
+ if (null == data.getHandleUser()) {
+ data.setHandleUser(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);
+ }
+
+ return data;
+ }
+
+ /**
+ * 褰撳墠鏂规硶闇�瑕佸垹闄�
+ * <p>
* 鏍规嵁闇�瑕佷繚瀛樼殑鏁版嵁锛岃皟鏁翠笅涓�涓祦绋嬬姸鎬� 涓嶅悓鐨勪粨搴撶粍缁囨祦绋嬪彲鑳戒笉涓�鏍凤紝闇�瑕佹牴鎹疄闄呰皟鏁�
*
* @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, InoutSysConf sysConf) {
if (InoutConstant.PROGRESS_REGISTER.equals(data.getProgress())) {
data.setRegisterTime(new Date());
data.setRegisterUser(ContextUtil.getLoginUserCName());
@@ -464,13 +504,6 @@
return data;
}
- 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(),
@@ -481,56 +514,6 @@
if (InoutConstant.PROGRESS_WEIGHT_EMPTY.equals(data.getProgress())) {
data.setEmptyWeightTime(new Date());
data.setEmptyWeightUser(ContextUtil.getLoginUserCName());
-
- data.setProgress(getNextProgress(data.getProgress(),
- data.getType(), sysConf));
-
- if (InoutConstant.PROGRESS_RECORD.equals(data.getProgress())) {
- data.setCompleteTime(DateUtils.addMinutes(new Date(), 2));
- data.setCompleteUser(ContextUtil.getLoginUserCName());
- }
- return data;
- }
-
- 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());
- data.setCompleteUser(ContextUtil.getLoginUserCName());
- data.setProgress(getNextProgress(data.getProgress(),
- data.getType(), sysConf));
- return data;
- }
- return data;
- }
-
- /**
- * 鏍规嵁闇�瑕佷繚瀛樼殑鏁版嵁锛岃皟鏁翠笅涓�涓祦绋嬬姸鎬� 涓嶅悓鐨勪粨搴撶粍缁囨祦绋嬪彲鑳戒笉涓�鏍凤紝闇�瑕佹牴鎹疄闄呰皟鏁�
- *
- * @param data
- * @return
- */
- private InoutData updateOutBasicInfo(InoutData data, InoutSysConf sysConf) {
- if (InoutConstant.PROGRESS_REGISTER.equals(data.getProgress())) {
- data.setRegisterTime(new Date());
- data.setRegisterUser(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());
data.setProgress(getNextProgress(data.getProgress(),
data.getType(), sysConf));
@@ -570,36 +553,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);
}
@@ -642,20 +595,20 @@
return new PageResponse<>(RespCodeEnum.CODE_0000.getCode(), null, data);
}
- /**
- * 鎵︽牱鍖栭獙椤甸潰鑾峰彇妫�楠岄」鏉$洰淇℃伅
- *
- * @param data
- * @return
- */
- public PageResponse<List<CheckItemData>> getCheckItem(InoutData data) {
-
- List<CheckItemData> result = checkStandardManager.listCheckItem(
- data.getCheckId(), data.getCompanyId(), data.getDeptId(),
- data.getFoodVariety());
-
- return new PageResponse<>(RespCodeEnum.CODE_0000, result);
- }
+// /**
+// * 鎵︽牱鍖栭獙椤甸潰鑾峰彇妫�楠岄」鏉$洰淇℃伅
+// *
+// * @param data
+// * @return
+// */
+// public PageResponse<List<CheckItemData>> getCheckItem(InoutData data) {
+//
+// List<CheckItemData> result = checkStandardManager.listCheckItem(
+// data.getCheckId(), data.getCompanyId(), data.getDeptId(),
+// data.getFoodVariety());
+//
+// return new PageResponse<>(RespCodeEnum.CODE_0000, result);
+// }
/**
* 鍒犻櫎骞跺畬鎴�
@@ -768,9 +721,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));
}
@@ -784,9 +734,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));
@@ -858,7 +805,6 @@
// 鏇存柊鏁版嵁
inoutService.updateData(data);
- // this.autoCheckByUpdate(data, record);
return null;
}
@@ -972,9 +918,6 @@
if (StringUtils.isEmpty(data.getDepotId())) {
return "璇峰~鍐欎粨搴撲俊鎭紒";
}
-// if (StringUtils.isEmpty(data.getCustomerId())) {
-// return "璇峰~鍐欏線鏉ュ崟浣嶄俊鎭紒";
-// }
if (StringUtils.isEmpty(data.getFoodYear())) {
return "璇峰~鍐欑伯椋熷勾浠戒俊鎭紒";
}
@@ -997,28 +940,6 @@
public void initLpr(InoutConf conf) {
inoutDeviceManager.initLpr(conf);
- }
-
- /**
- * 鑾峰彇鍑哄叆搴撹澶囬厤缃俊鎭�
- *
- * @param companyId
- * @param deptId
- * @return
- */
- public List<InoutConf> getListInoutConf(String companyId, String deptId) {
- return inoutManagerService.getCacheInoutConf(companyId, deptId);
- }
-
- /**
- * 鎿嶄綔閬撻椄璁惧
- *
- * @param param
- * @return
- */
- public PageResponse<List<CheckItemData>> gateCtrl(InoutGateDto param) {
-
- return new PageResponse<>(RespCodeEnum.CODE_0000.getCode(), "", null);
}
/**
@@ -1046,19 +967,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);
@@ -1070,6 +991,104 @@
// 鎵ц闄勪欢淇℃伅
fileService.saveInoutFiles(data.getFiles(), data.getCompanyId(), data.getId(), curProgress);
+
+ return new PageResponse<>(RespCodeEnum.CODE_0000.getCode(), "鎵ц鎴愬姛", data);
+ }
+
+ public PageResponse<InoutData> submitWeightIn(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);
+
+
+ //鍏ュ簱绉伴噸鍙兘璋冩暣璐ㄦ鍗�
+ CheckUpdateResult checkUpdateResult = updateCheckItems(data);
+ if (data.getDeCheck() == 0) {
+ data.setDeCheck(checkUpdateResult.getDeSum());
+ }
+ if (data.getAddCheck() == 0) {
+ data.setAddCheck(checkUpdateResult.getAddSum());
+ }
+
+ //鎵ц鏁版嵁鏇存柊
+ String msg = inoutService.updateData(data);
+
+ if (null != msg) {
+ return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(), msg, data);
+ }
+
+ // 鎵ц闄勪欢淇℃伅
+ 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> submitWeightOut(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.updateData(data);
+
+ if (null != msg) {
+ return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(), msg, data);
+ }
+
+ // 鎵ц闄勪欢淇℃伅
+ 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);
}
@@ -1091,7 +1110,7 @@
}
//鑻ユ煡璇㈡潯浠朵负宸叉墻鏍凤紝鍒欐祦绋嬬疆绌猴紱鑻ユ湭鎵︽牱锛屽垯娴佺▼涓嶅鐞嗭紝浠嶄负鎵︽牱鍖栭獙娴佺▼(CHECK)
- if ("SAMPLE".equals(param.getSampleStatus())) {
+ if (!"NONE".equals(param.getSampleStatus())) {
param.setProgress(null);
}
@@ -1107,34 +1126,182 @@
}
@Transactional(rollbackFor = Exception.class)
- public PageResponse<InoutCheckData> updateSampleData(InoutCheckData data) throws Exception {
+ public PageResponse<InoutCheckData> updateSampleData(InoutCheckData data) {
- // 鑾峰彇涓氬姟鏁版嵁淇℃伅
- InoutParam param = new InoutParam();
- param.setCompanyId(data.getCompanyId());
- param.setId(data.getId());
- InoutData curData = inoutService.inoutProgressQuery(param);
- if (null == curData) {
+ 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(),
+ "褰撳墠娴佺▼宸茬粡缁撴潫锛屼笉鏀寔淇敼");
+ }
+
+ //鎵︽牱鏃堕棿鍜屾墻鏍蜂汉
+ if (StringUtils.isEmpty(data.getSampleUser())) {
+ data.setSampleUser(ContextUtil.getLoginUserCName());
+ }
+ if (null == data.getSampleTime()) {
+ data.setSampleTime(new Date());
+ }
+ String msg = inoutService.updateSampleData(data);
+
+ 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(),
- "娌℃湁鑾峰彇鍒板叆搴撲笟鍔℃暟鎹俊鎭紝鏇存柊澶辫触", data);
+ "鍚庡彴寮傚父锛�" + e.getMessage(), null);
}
- 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(), "鎵ц鎴愬姛");
}
+ /**
+ * @param param
+ * @return
+ */
+ public PageResponse<Page<InoutCheckData>> pageCheckData(InoutCheckParam param) {
+
+ if (StringUtils.isEmpty(param.getCompanyId())) {
+ param.setCompanyId(ContextUtil.getCompanyId());
+ }
+ if (StringUtils.isEmpty(param.getDeptId())) {
+ param.setDeptId(ContextUtil.subDeptId(null));
+ }
+ // 濡傛灉鏄凡鍖栭獙锛屽垯灏嗘祦绋嬬姸鎬佺疆绌猴紝濡傛灉鏄湭鍖栭獙锛屽垯娴佺▼鐘舵�佷笉澶勭悊锛屼粛鏄疌HECK鐘舵��
+ if (!"NONE".equals(param.getCheckStatus())) {
+ param.setProgress(null);
+ }
+
+ Page<InoutCheckData> checkList = inoutService.pageCheckData(param);
+
+
+ if (null == checkList.getRecords() || checkList.getRecords().isEmpty()) {
+ return new PageResponse<>(RespCodeEnum.CODE_2000.getCode(),
+ "鑾峰彇鍒版暟鎹俊鎭负绌�");
+ }
+ return new PageResponse<>(RespCodeEnum.CODE_0000, checkList);
+ }
+
+ /**
+ * 鑾峰彇鍖栭獙椤逛俊鎭�
+ *
+ * @param param
+ * @return
+ */
+ public PageResponse<List<CheckItemData>> getCheckItemData(InoutCheckParam param) {
+
+ try {
+ List<CheckItemData> result = checkStandardManager.listCheckItem(param.getCheckId(),
+ param.getCompanyId(), param.getFoodVariety());
+
+ return new PageResponse<>(RespCodeEnum.CODE_0000, result);
+ } catch (Exception e) {
+ return new PageResponse<>(
+ RespCodeEnum.CODE_1111.getCode(), "鍚庡彴寮傚父锛�" + e.getMessage(), null);
+ }
+ }
+
+ @Transactional(rollbackFor = Exception.class)
+ public PageResponse<InoutCheckData> updateCheckData(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(),
+ "褰撳墠娴佺▼宸茬粡缁撴潫锛屼笉鏀寔淇敼");
+ }
+
+ //鏇存柊鍖栭獙椤逛俊鎭�
+ 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, inoutSysConf);
+ // 鑻ュ寲楠岀粨鏋滀笉鍚堟牸锛屽垽鏂厤缃悗缁祦绋�
+ if (InoutConstant.STATUS_UNPASS.equals(curData.getCheckStatus())) {
+ curData = checkNoPass(curData);
+ }
+ }
+
+ //鍖栭獙浜恒�佸寲楠屾椂闂�
+ data.setCheckStatus(curData.getCheckStatus());
+ data.setProgress(curData.getProgress());
+ if (StringUtils.isEmpty(data.getCheckUser())) {
+ data.setCheckUser(ContextUtil.getLoginUserCName());
+ }
+ if (null == data.getCheckTime()) {
+ data.setCheckTime(new Date());
+ }
+
+ String msg = inoutService.updateCheckData(data);
+ if (null != msg) {
+ return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(), msg);
+ }
+
+ return new PageResponse<>(RespCodeEnum.CODE_0000.getCode(), "鎵ц鎴愬姛");
+ } catch (Exception e) {
+ return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(),
+ "鍚庡彴寮傚父锛�" + 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