From 10373a585e3d1d04a7eddb2e3297eeeb2c729e71 Mon Sep 17 00:00:00 2001
From: jiazx0107@163.com <jiazx0107@163.com>
Date: 星期一, 28 八月 2023 09:29:51 +0800
Subject: [PATCH] 更新MODBUS-TCP协议,调整配置
---
igds-inout/src/main/java/com/ld/igds/inout/manager/InoutManager.java | 1205 +++++++++++++++++++++++----------------------------------
1 files changed, 486 insertions(+), 719 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 417080f..ebba267 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
@@ -1,30 +1,28 @@
package com.ld.igds.inout.manager;
-import com.bstek.bdf2.core.business.IUser;
import com.ld.igds.check.CheckStandardManager;
import com.ld.igds.check.dto.CheckItemData;
import com.ld.igds.check.dto.CheckUpdateResult;
-import com.ld.igds.common.CoreCommonService;
import com.ld.igds.constant.RespCodeEnum;
import com.ld.igds.data.Page;
import com.ld.igds.data.PageResponse;
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.*;
+import com.ld.igds.inout.dto.InoutCheckData;
+import com.ld.igds.inout.dto.InoutCheckParam;
+import com.ld.igds.inout.dto.InoutData;
+import com.ld.igds.inout.dto.InoutParam;
import com.ld.igds.inout.service.InoutService;
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;
-import com.ld.igds.util.NumberUtil;
-import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.time.DateFormatUtils;
import org.apache.commons.lang3.time.DateUtils;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
@@ -38,22 +36,61 @@
*
* @author
*/
-@Slf4j
@Component
public class InoutManager {
- @Autowired
+ @Resource
private InoutService inoutService;
- @Autowired
+ @Resource
private CoreFileService fileService;
- @Autowired
- private CoreCommonService commonService;
@Resource
private InoutCommonService inoutCommonService;
- @Autowired
+ @Resource
private CheckStandardManager checkStandardManager;
@Resource
- private InoutDeviceManager inoutDeviceManager;
+ private InoutEventControlManager inoutEventControl;
+ @Resource
+ private CoreFileService coreFileService;
+
+ /**
+ * 鐩存帴浠庢暟鎹簱鏌ヨ锛屼笉鑰冭檻淇℃伅鐘舵��
+ *
+ * @param param
+ * @return
+ */
+ public PageResponse<InoutData> inoutQueryBack(InoutParam param) {
+ if (StringUtils.isEmpty(param.getPlateNum())
+ && StringUtils.isEmpty(param.getIntelCard())
+ && StringUtils.isEmpty(param.getUserId())) {
+
+ return new PageResponse<>(RespCodeEnum.CODE_1007.getCode(),
+ "鏌ヨ鍙傛暟涓嶅畬鏁达紝鏌ヨ澶辫触锛�");
+ }
+
+ // 鑾峰彇涓夊ぉ浠ュ唴鏈�鍚庝竴澶╄褰�
+ param.setStart(DateUtil.getNewByDay(new Date(), -3));
+ param.setType(null);
+ param.setProgress(null);
+
+ InoutData result = inoutService.getLastRecord(param);
+
+ if (null == result) {
+ return new PageResponse<>(RespCodeEnum.CODE_1007.getCode(),
+ "鏍规嵁褰撳墠鏉′欢鏈煡璇㈠埌杞﹁締淇℃伅锛�");
+ }
+
+ if (InoutConstant.PROGRESS_RECORD.equals(result.getProgress())) {
+ return new PageResponse<>(RespCodeEnum.CODE_2000.getCode(),
+ "褰撳墠杞﹁締娴佺▼宸茬粡缁撴潫", result);
+ }
+
+ if (!InoutConstant.PROGRESS_CARD_BACK.equals(result.getProgress())) {
+ return new PageResponse<>(RespCodeEnum.CODE_1008.getCode(),
+ "褰撳墠杞﹁締娴佺▼涓嶅湪褰撳墠鐜妭锛屾棤娉曟墽琛屽嚭搴�", result);
+ }
+
+ return new PageResponse<>(RespCodeEnum.CODE_0000, result);
+ }
/**
* 棣栧厛浠庣紦瀛樹腑鑾峰彇锛岀紦瀛樹腑锛屼粠鏁版嵁搴撲腑鑾峰彇
@@ -85,16 +122,16 @@
return new PageResponse<>(RespCodeEnum.CODE_0000, result);
}
-
- //娴佺▼绫诲瀷楠岃瘉
+ // 娴佺▼绫诲瀷楠岃瘉
if (!result.getType().equals(param.getType())) {
String msg = "娴佺▼閿欒锛氬綋鍓嶈溅杈嗘祦绋嬩负銆愬叆搴撱��";
- if (InoutConstant.TYPE_OUT.equals(result.getType())) msg = "娴佺▼閿欒锛氬綋鍓嶈溅杈嗘祦绋嬩负銆愬嚭搴撱��";
- return new PageResponse<>(RespCodeEnum.CODE_2000.getCode(), msg, result);
+ 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)
@@ -126,242 +163,6 @@
}
}
- public PageResponse<InoutData> outNextStep(InoutData data) throws Exception {
- String msg;
- IUser user = ContextUtil.getLoginUser();
- if (StringUtils.isEmpty(data.getCompanyId())) {
- data.setCompanyId(user.getCompanyId());
- }
- if (StringUtils.isEmpty(data.getDeptId())) {
- data.setDeptId(ContextUtil.subDeptId(user));
- }
- if (StringUtils.isEmpty(data.getIntelCard())) {
- data.setIntelCard(data.getUserId());
- }
-
- String curProgress = data.getProgress();
- List<FileData> files = data.getFiles();
-
- // 鏇存柊涓嬩竴涓姸鎬佸拰鍩烘湰淇℃伅
- InoutSysConf inoutSysConf = inoutCommonService.getCacheInoutSysConf(
- data.getCompanyId(), data.getDeptId());
- if (null == inoutSysConf
- || StringUtils.isEmpty(inoutSysConf.getProgressIn())) {
- return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(),
- "褰撳墠搴撳尯鏈厤缃嚭搴撴祦绋嬩俊鎭紝璇疯仈绯荤鐞嗗憳閰嶇疆銆�", data);
- }
- data = updateBasicInfo(data, inoutSysConf);
-
- // 濡傛灉褰撳墠鑺傜偣鏄敞鍐岋紝鍒欓渶瑕侀獙璇佷笅锛屾槸鍚︽湁涓哄畬鎴愮殑娴佺▼鍦ㄦ墽琛屼腑
- if (InoutConstant.PROGRESS_REGISTER.equals(curProgress)) {
- InoutData progressData = this.inoutProgressQuery(data);
- if (null != progressData) {
- return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(),
- "褰撳墠鍗$墖/杞︾墝鍙锋湁娴佺▼鏈粨鏉熴��", progressData);
- }
- }
-
- if (null != data.getPrice() && null != data.getRecordWeight()) {
- data.setSettleMoney(NumberUtil.keepPrecision(data.getPrice() * data.getRecordWeight(), 2));
- }
-
- // 娴佺▼瀹屾垚锛岀洿鎺ヨ皟鐢ㄦ祦绋嬪畬鎴愭帴鍙�
- if (InoutConstant.PROGRESS_RECORD.equals(data.getProgress())) {
- inoutService.updateData(data);
- // 鎵ц闄勪欢淇℃伅
- if (null != files) {
- fileService.saveInoutFiles(files, data.getCompanyId(),
- data.getId(), curProgress);
- }
-
- // 閫氱煡绉伴噸涓绘帶娴佺▼缁撴潫
- inoutDeviceManager.noticeProgressComplete(data);
-
- return inoutComplete(data);
- }
-
- // 璋冪敤淇濆瓨鏂规硶鎵ц
- if (StringUtils.isEmpty(data.getId())) {
- msg = inoutService.insertData(data);
- } else {
- msg = inoutService.updateData(data);
- }
-
- // 鎵ц闄勪欢淇℃伅
- if (null != files) {
- fileService.saveInoutFiles(files, data.getCompanyId(),
- data.getId(), curProgress);
- }
-
- if (null != msg) {
- return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(), msg,
- data);
- }
- return new PageResponse<>(RespCodeEnum.CODE_0000.getCode(), "鎵ц鎴愬姛",
- data);
- }
-
- public PageResponse<InoutData> inNextStep(InoutData data) throws Exception {
- String msg;
-
- String curProgress = data.getProgress();
- List<FileData> files = data.getFiles();
- if (StringUtils.isEmpty(data.getIntelCard())) {
- data.setIntelCard(data.getUserId());
- }
-
- // 鏇存柊涓嬩竴涓姸鎬佸拰鍩烘湰淇℃伅
- InoutSysConf inoutSysConf = inoutCommonService.getCacheInoutSysConf(data.getCompanyId(), data.getDeptId());
-
- if (null == inoutSysConf
- || StringUtils.isEmpty(inoutSysConf.getProgressIn())) {
- return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(),
- "褰撳墠搴撳尯鏈厤缃叆搴撴祦绋嬩俊鎭紝璇疯仈绯荤鐞嗗憳閰嶇疆銆�", data);
- }
-
- data = updateBasicInfo(data, inoutSysConf);
-
- // 濡傛灉褰撳墠鑺傜偣鏄敞鍐岋紝鍒欓渶瑕侀獙璇佷笅锛屾槸鍚︽湁涓哄畬鎴愮殑娴佺▼鍦ㄦ墽琛屼腑
- if (InoutConstant.PROGRESS_REGISTER.equals(curProgress)) {
- InoutData progressData = this.inoutProgressQuery(data);
- if (null != progressData) {
- return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(),
- "褰撳墠鍗$墖/杞︾墝鍙锋湁娴佺▼鏈粨鏉熴��", progressData);
- }
- }
-
- if (null != data.getPrice() && null != data.getRecordWeight()) {
- data.setSettleMoney(NumberUtil.keepPrecision(data.getPrice() * data.getRecordWeight(), 2));
- }
-
- // 娴佺▼瀹屾垚锛岀洿鎺ヨ皟鐢ㄦ祦绋嬪畬鎴愭帴鍙�
- if (InoutConstant.PROGRESS_RECORD.equals(data.getProgress())) {
- if (StringUtils.isEmpty(data.getCompanyId())) {
- data.setCompanyId(ContextUtil.getCompanyId());
- }
-
- inoutService.updateData(data);
- // 鎵ц闄勪欢淇℃伅
- if (null != files) {
- fileService.saveInoutFiles(files, data.getCompanyId(),
- data.getId(), curProgress);
- }
-
- // 閫氱煡绉伴噸涓绘帶娴佺▼缁撴潫
- inoutDeviceManager.noticeProgressComplete(data);
-
- return inoutComplete(data);
- }
-
- // 璋冪敤淇濆瓨鏂规硶鎵ц
- if (StringUtils.isEmpty(data.getId())) {
- msg = inoutService.insertData(data);
- } else {
- msg = inoutService.updateData(data);
- }
-
- // 鎵ц闄勪欢淇℃伅
- if (null != files) {
- fileService.saveInoutFiles(files, data.getCompanyId(),
- data.getId(), curProgress);
- }
-
- if (null != msg) {
- return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(), msg);
- }
-
- return new PageResponse<>(RespCodeEnum.CODE_0000.getCode(), "鎵ц鎴愬姛",
- data);
- }
-
- public InoutData inoutProgressQuery(InoutData data) throws Exception {
- InoutParam param = new InoutParam();
- param.setCompanyId(data.getCompanyId());
- param.setPlateNum(data.getPlateNum());
- param.setIntelCard(data.getIntelCard());
- param.setType(data.getType());
-
- 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(), "鎵ц鎴愬姛");
-// }
/**
* 鍖栭獙缁撴灉涓嶉�氳繃鏃舵牎楠岄厤缃俊鎭�
@@ -373,18 +174,19 @@
InoutSysConf inoutSysConf = inoutCommonService.getCacheInoutSysConf(
data.getCompanyId(), data.getDeptId());
- if (inoutSysConf.getNoPassNext().equals(InoutConstant.CHECK_NOPASS_RECORD)) {
+ if (inoutSysConf.getNoPassNext().equals(
+ InoutConstant.CHECK_NOPASS_RECORD)) {
// 娴佺▼缁撴潫
data.setProgress(InoutConstant.PROGRESS_RECORD);
data.setCompleteTime(new Date());
}
- if (inoutSysConf.getNoPassNext().equals(InoutConstant.CHECK_NOPASS_BACK)) {
+ if (inoutSysConf.getNoPassNext()
+ .equals(InoutConstant.CHECK_NOPASS_BACK)) {
// 绂诲簱鏀跺崱
data.setProgress(InoutConstant.PROGRESS_CARD_BACK);
}
return data;
}
-
/**
* 鏇存柊璐ㄦ淇℃伅
@@ -392,24 +194,53 @@
* @param data
* @return
*/
- private CheckUpdateResult updateCheckItems(InoutData data) {
- CheckUpdateResult result = new CheckUpdateResult();
- if (null == data.getCheckItems()) return result;
+ private InoutData updateCheckItems(InoutData data, boolean toSave) throws Exception {
- try {
- // 鏇存柊妫�楠岄」鏁版嵁
- result = checkStandardManager.updateCheckItems(data.getCheckId(), data.getCompanyId(), data.getCheckItems());
+ if (null == data.getCheckItems()) return data;
- // 灏嗗寲楠屾暟鎹瓨鍏ョ紦瀛樹腑
- inoutService.setCheckCache(data);
+ //璁剧疆娌℃湁璐ㄦID锛屽彇娑堟墽琛屾寔涔呭寲
+ if (!toSave) data.setCheckId(null);
- return result;
+ // 鏇存柊妫�楠岄」鏁版嵁
+ CheckUpdateResult checkUpdateResult = checkStandardManager.updateCheckItems(data.getCheckId(), data.getCompanyId(), data.getCheckItems());
- } catch (Exception e) {
- log.error("鍚庡彴寮傚父锛歿}", e);
- result.setMsg("鎵ц寮傚父锛�" + e.getMessage());
+ if (data.getDeCheck() == 0) {
+ data.setDeCheck(checkUpdateResult.getDeSum());
}
- return result;
+ if (data.getAddCheck() == 0) {
+ data.setAddCheck(checkUpdateResult.getAddSum());
+ }
+
+ return data;
+ }
+
+ private InoutData updateFiles(InoutData data) throws Exception {
+ List<FileData> files = data.getFiles();
+ if (null == files) {
+ return data;
+ }
+
+ for (FileData fileData : files) {
+ fileData.setFileId(ContextUtil.getUUID());
+ fileData.setCompanyId(data.getCompanyId());
+ fileData.setBizId(data.getId());
+ if ("HANDLE".equals(fileData.getBizTag())) {
+ if (data.getEmptyWeightTime().before(data.getFullWeightTime())) {
+ fileData.setCreateTime(DateUtils.addMinutes(data.getFullWeightTime(), -20));
+ } else {
+ fileData.setCreateTime(DateUtils.addMinutes(data.getEmptyWeightTime(), -20));
+ }
+ }
+ if ("WEIGHT_EMPTY".equals(fileData.getBizTag())) {
+ fileData.setCreateTime(data.getEmptyWeightTime());
+ }
+ if ("WEIGHT_FULL".equals(fileData.getBizTag())) {
+ fileData.setCreateTime(data.getFullWeightTime());
+ }
+ coreFileService.addRecord(fileData);
+ }
+
+ return data;
}
/**
@@ -417,7 +248,8 @@
*
* @return
*/
- private String getNextProgress(String curProgress, String type, InoutSysConf sysConf) {
+ private String getNextProgress(String curProgress, String type,
+ InoutSysConf sysConf) {
String nextProgress = null;
List<String> list = null;
if (InoutConstant.TYPE_IN.equals(type)) {
@@ -443,7 +275,8 @@
* @param data
* @return
*/
- private InoutData updateBasicInfo(InoutData data, String curProgress, String nextProgress) {
+ private InoutData updateBasicInfo(InoutData data, String curProgress,
+ String nextProgress) {
if (InoutConstant.PROGRESS_REGISTER.equals(curProgress)) {
data.setRegisterTime(new Date());
@@ -476,7 +309,7 @@
data.setProgress(nextProgress);
}
- //濡傛灉涓嬩竴涓暟鎹姸鎬�=娴佺▼缁撴潫锛岀洿鎺ヨˉ鍏呭畬鏁翠俊鎭�
+ // 濡傛灉涓嬩竴涓暟鎹姸鎬�=娴佺▼缁撴潫锛岀洿鎺ヨˉ鍏呭畬鏁翠俊鎭�
if (InoutConstant.PROGRESS_RECORD.equals(nextProgress)) {
data.setCompleteTime(DateUtils.addMinutes(new Date(), 2));
data.setCompleteUser(ContextUtil.getLoginUserCName());
@@ -487,190 +320,90 @@
}
/**
- * 褰撳墠鏂规硶闇�瑕佸垹闄�
- * <p>
- * 鏍规嵁闇�瑕佷繚瀛樼殑鏁版嵁锛岃皟鏁翠笅涓�涓祦绋嬬姸鎬� 涓嶅悓鐨勪粨搴撶粍缁囨祦绋嬪彲鑳戒笉涓�鏍凤紝闇�瑕佹牴鎹疄闄呰皟鏁�
+ * 鍗″洖鏀堕�昏緫澶勭悊
*
* @param data
* @return
*/
- private InoutData updateBasicInfo(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_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());
- data.setProgress(getNextProgress(data.getProgress(),
- data.getType(), sysConf));
-
- 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_WEIGHT_FULL.equals(data.getProgress())) {
- data.setFullWeightTime(new Date());
- data.setFullWeightUser(ContextUtil.getLoginUserCName());
- data.setProgress(getNextProgress(data.getProgress(),
- data.getType(), sysConf));
+ public PageResponse<InoutData> submitCardBack(InoutData data) {
+ try {
+ // 濡傛灉褰撳墠鏁版嵁宸茬粡缁撴潫
if (InoutConstant.PROGRESS_RECORD.equals(data.getProgress())) {
- data.setCompleteTime(DateUtils.addMinutes(new Date(), 2));
- data.setCompleteUser(ContextUtil.getLoginUserCName());
+
+ // 鍒犻櫎缂撳瓨
+ inoutService.delFromCache(data.getDeptId(), data.getType(),
+ data.getId());
+
+ return new PageResponse<>(RespCodeEnum.CODE_0000.getCode(),
+ "褰撹溅杈嗘祦绋嬪凡缁忓畬鎴愶紝鍗$墖宸插洖鏀�", data);
}
- return data;
+
+ // 濡傛灉褰撳墠娴佺▼涓嶆槸鍗″洖鏀�
+ if (!InoutConstant.PROGRESS_CARD_BACK.equals(data.getProgress())) {
+
+ return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(),
+ "褰撳墠娴佺▼鐜妭涓嶆纭紝涓嶈兘鎵ц鍗″洖鏀�", data);
+ }
+
+ // 濡傛灉褰撳墠娴佺▼鐘舵�佹槸鍗″洖鏀剁姸鎬侊紝灏辨槸瀹屾垚娴佺▼銆�
+ if (InoutConstant.PROGRESS_CARD_BACK.equals(data.getProgress())) {
+ return submitComplete(data);
+ }
+
+ } catch (Exception e) {
+ return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(),
+ "鍚庣鎵ц寮傚父锛�" + e.getMessage());
}
- 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;
+ return new PageResponse<>(RespCodeEnum.CODE_0000.getCode(), "鎵ц鎴愬姛",
+ data);
}
- public PageResponse<InoutData> inoutComplete(InoutData data) throws Exception {
+ public PageResponse<InoutData> submitComplete(InoutData data)
+ throws Exception {
if (StringUtils.isEmpty(data.getId())
- || StringUtils.isEmpty(data.getType())) {
+ || StringUtils.isEmpty(data.getType())
+ || StringUtils.isEmpty(data.getProgress())) {
return new PageResponse<>(RespCodeEnum.CODE_1007.getCode(),
"娌℃湁鑾峰彇鍒拌溅杈嗕俊鎭��", data);
}
+ data.setUpdateTime(new Date());
+ if (null == data.getCompleteTime()) {
+ data.setCompleteTime(DateUtil.getNewByMinute(new Date(), 2));
+ }
+ if (null == data.getCompleteUser()) {
+ data.setCompleteUser(ContextUtil.getLoginUserCName());
+ }
+
+ // 璁剧疆娴佺▼鑺傜偣鐩存帴瀹屾垚
InoutParam param = new InoutParam();
param.setCompanyId(data.getCompanyId());
param.setId(data.getId());
param.setType(data.getType());
param.setDeptId(data.getDeptId());
param.setIntelCard(data.getIntelCard());
- param.setUserId(ContextUtil.getLoginUserCName());
+ param.setUserId(data.getCompleteUser());
param.setDepotId(data.getDepotId());
- param.setCompleteTime(data.getCompleteTime());
- if (null == param.getCompleteTime()) {
- param.setCompleteTime(new Date());
- }
- // 璁剧疆娴佺▼鑺傜偣鐩存帴瀹屾垚
+ param.setCompleteTime(new Date());
param.setProgress(InoutConstant.PROGRESS_RECORD);
- if (null == data.getCompleteTime()) {
- data.setCompleteTime(DateUtil.getNewByMinute(new Date(), 2));
- }
String msg = inoutService.toComplete(param);
if (null != msg) {
return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(), msg);
}
-
- // 搴撳瓨璋冩暣
- commonService.initInoutDepotStore(data);
+ data.setCompleteTime(param.getCompleteTime());
+ data.setProgress(InoutConstant.PROGRESS_RECORD);
+ inoutService.updateInoutCache(data);
+ // 娴佺▼瀹屾垚鏀朵簨浠�
+ inoutEventControl.onInoutComplete(data);
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<InoutData> deleteInoutData(InoutData data, String msg) {
- try {
- data.setRemarks(msg);
- String result = this.delInoutData(data, false);
- if (null != result) {
- return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(),
- result, data);
- }
- } catch (Exception e) {
- log.error("鍚庡彴寮傚父:{}", e);
- return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(), "鍚庡彴寮傚父锛�"
- + e.getMessage(), data);
- }
- return new PageResponse<>(RespCodeEnum.CODE_0000.getCode(), "鎵ц瀹屾垚",
- data);
- }
-
- /**
- * 鍗″洖鏀堕�昏緫澶勭悊
- *
- * @param data
- * @return
- */
- public PageResponse<InoutData> inoutBack(InoutData data) {
- try {
- // 浠庣紦瀛樹腑鑾峰彇鏈�鏂扮殑鏁版嵁锛屽鏋滄病鏈夊垯琛ㄧず娴佺▼宸茬粡缁撴潫銆�
- InoutParam param = new InoutParam();
- param.setCompanyId(data.getCompanyId());
- param.setId(data.getId());
- InoutData curData = inoutService.inoutProgressQuery(param);
- if (InoutConstant.PROGRESS_RECORD.equals(curData.getProgress())) {
- return new PageResponse<>(RespCodeEnum.CODE_2000.getCode(),
- "褰撳墠鍗℃祦绋嬪凡缁忓畬鎴愶紝鏃犻渶鎵ц鍗″洖鏀�", data);
- }
- if (InoutConstant.RECORD_STATUS_DEL.equals(curData
- .getRecordStatus())) {
- return new PageResponse<>(RespCodeEnum.CODE_2000.getCode(),
- "褰撳墠鍗′俊鎭凡琚垹闄わ紝涓嶈兘鎵ц鍗″洖鏀�", data);
- }
-
- // 濡傛灉褰撳墠娴佺▼鐘舵�佹槸鍗″洖鏀剁姸鎬侊紝灏辨槸瀹屾垚娴佺▼銆�
- if (InoutConstant.PROGRESS_CARD_BACK.equals(curData.getProgress())) {
- return inoutComplete(curData);
- }
-
- // 濡傛灉鏄叾浠栫姸鎬侊紝鍒欐墽琛屽垹闄ら�昏緫
- return deleteInoutData(curData, "鍗″洖鏀跺垹闄�");
-
- } catch (Exception e) {
- return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(),
- "鍚庣鎵ц寮傚父锛�" + e.getMessage());
- }
- }
-
- /* ============================== 璇﹀崟椤甸潰鐩稿叧鎿嶄綔 ================================= */
/**
* 琛ュ崟鎿嶄綔 琛ュ崟鍥犱负瀹屾垚鏃堕棿涓嶇‘瀹氾紝鎵�浠ラ渶瑕佺郴缁熸牴鎹綋鍓嶆暟鎹繘琛岃嚜鍔ㄦ娴嬶紝璋冩暣鍘熸潵娴佹按淇℃伅鍜屽簱瀛�
@@ -679,11 +412,10 @@
* @return
* @throws Exception
*/
- @Transactional
public String addInoutData(InoutData data) throws Exception {
if (data.getSettleWeight() <= 0.0) {
- return "琛ュ崟鏁版嵁瑕佹眰缁撶畻閲嶉噺蹇呴』澶т簬0";
+ return "绯荤粺锛氳ˉ鍗曟暟鎹姹傜粨绠楅噸閲忓繀椤诲ぇ浜�0";
}
// 琛ュ崟鏁版嵁鐩存帴鍒扮粨鏋滅姸鎬�
@@ -703,7 +435,7 @@
data.setCompleteTime(new Date());
}
// 娉ㄥ唽鏃堕棿姣斿畬鎴愭椂闂存棭涓�涓皬鏃�
- data.setRegisterTime(DateUtil.getNewByMinute(new Date(), -60));
+ data.setRegisterTime(DateUtils.addMinutes(new Date(), -80));
if (StringUtils.isEmpty(data.getUserId())) {
data.setUserId(InoutConstant.DEFAULT_ID_CARD);
@@ -715,37 +447,54 @@
data.setCheckUser(loginUser);
}
- // 淇濆瓨妫�娴嬮」鐩�
- if (InoutConstant.TYPE_IN.equals(data.getType())) {
+ if (InoutConstant.TYPE_IN.equals(data.getType())) {
if (null == data.getFullWeightTime()) {
- data.setFullWeightTime(DateUtil.getNewByMinute(new Date(), -50));
+ data.setFullWeightTime(DateUtils.addMinutes(new Date(), -50));
}
if (null == data.getEmptyWeightTime()) {
- data.setEmptyWeightTime(DateUtil.getNewByMinute(new Date(), -10));
+ data.setEmptyWeightTime(DateUtils.addMinutes(new Date(), -10));
}
- // 鍏堟墽琛屽寲楠屼俊鎭繚瀛�
- CheckUpdateResult checkResult = checkStandardManager.updateCheckItems(data.getCheckId(), data.getCompanyId(), data.getCheckItems());
- if (null != checkResult) {
-// if (null == data.getWet())data.setWet(checkResult.getWet());
-// if (null == data.getImpurity())data.setImpurity(checkResult.getImpurity());
+ if (data.getCompleteTime().before(data.getEmptyWeightTime())) {
+ data.setEmptyWeightTime(DateUtils.addMinutes(data.getCompleteTime(), -10));
}
+ if (data.getEmptyWeightTime().before(data.getFullWeightTime())) {
+ data.setFullWeightTime(DateUtils.addMinutes(data.getEmptyWeightTime(), -40));
+ }
+ if (data.getFullWeightTime().before(data.getRegisterTime())) {
+ data.setRegisterTime(DateUtils.addMinutes(data.getFullWeightTime(), -30));
+ }
+
+ data = this.updateCheckItems(data, false);
} else {
if (null == data.getEmptyWeightTime()) {
- data.setEmptyWeightTime(DateUtil.getNewByMinute(new Date(), -50));
+ data.setEmptyWeightTime(DateUtils.addMinutes(new Date(), -50));
}
if (null == data.getFullWeightTime()) {
- data.setFullWeightTime(DateUtil.getNewByMinute(new Date(), -10));
+ data.setFullWeightTime(DateUtils.addMinutes(new Date(), -10));
+ }
+ if (data.getCompleteTime().before(data.getFullWeightTime())) {
+ data.setFullWeightTime(DateUtils.addMinutes(data.getCompleteTime(), -10));
+ }
+ if (data.getFullWeightTime().before(data.getEmptyWeightTime())) {
+ data.setEmptyWeightTime(DateUtils.addMinutes(data.getEmptyWeightTime(), -40));
+ }
+ if (data.getEmptyWeightTime().before(data.getRegisterTime())) {
+ data.setRegisterTime(DateUtils.addMinutes(data.getFullWeightTime(), -30));
}
}
- // 娣诲姞琛ュ崟鏁版嵁
- String msg = inoutService.insertData(data);
- // 鍒濆鍖栭獙璇佸嚭鍏ュ簱搴撳瓨
- commonService.initInoutDepotStore(data);
- return msg;
+ //鍏堜繚瀛樹富琛紝鍚庢墽琛屽瓙琛�
+ inoutService.insertData(data);
+
+ if (InoutConstant.TYPE_IN.equals(data.getType())) {
+ this.updateCheckItems(data, true);
+ }
+ this.updateFiles(data);
+
+ return null;
}
/**
@@ -755,102 +504,26 @@
* @return
* @throws Exception
*/
- @javax.transaction.Transactional(rollbackOn = Exception.class)
+ @Transactional
public String updateInoutData(InoutData data) throws Exception {
if (InoutConstant.RECORD_STATUS_DEL.equals(data.getRecordStatus())) {
return "绯荤粺锛氬凡缁忓垹闄ょ殑鏁版嵁涓嶆敮鎸佷慨鏀癸紒";
}
- if (InoutConstant.RECORD_STATUS_ERROR.equals(data.getRecordStatus())) {
- return "绯荤粺锛氬紓甯哥粓姝㈢殑鏁版嵁涓嶆敮鎸佷慨鏀癸紒";
- }
- // 濡傛灉娴佺▼鏈粨鏉燂紝鍙洿鏂版暟鎹�
- if (!InoutConstant.PROGRESS_RECORD.equals(data.getProgress())) {
- return inoutService.updateData(data);
- }
- // 濡傛灉鏄凡缁忓畬鎴愮殑鏁版嵁锛屽厛鑾峰彇鍒颁慨鏀圭洿鎺ョ殑鏁版嵁鏍规嵁鏁版嵁杩涜瀵规瘮
- InoutParam param = new InoutParam();
- param.setId(data.getId());
- param.setCompanyId(data.getCompanyId());
- param.setType(data.getType());
- InoutData record = inoutService.inoutQueryById(param);
-
- if (null == record) {
- return "褰撳墠淇敼鏁版嵁宸茬粡涓嶅瓨鍦紒";
- }
-
- // 閬垮厤鏁版嵁搴撲腑鐨勬暟鎹凡缁忚鍏朵粬浜轰慨鏀�
- if (InoutConstant.RECORD_STATUS_DEL.equals(record.getRecordStatus())) {
- return "绯荤粺锛氬凡缁忓垹闄ょ殑鏁版嵁涓嶆敮鎸佷慨鏀癸紒";
- }
- if (InoutConstant.RECORD_STATUS_ERROR.equals(record.getRecordStatus())) {
- return "绯荤粺锛氬紓甯哥粓姝㈢殑鏁版嵁涓嶆敮鎸佷慨鏀癸紒";
+ if (InoutConstant.PROGRESS_RECORD.equals(data.getProgress())) {
+ return "绯荤粺锛氭祦绋嬪凡缁忕粨鏉熺殑鏁版嵁涓嶆敮鎸佷慨鏀癸紒";
}
// 淇濆瓨妫�娴嬮」鐩�
if (InoutConstant.TYPE_IN.equals(data.getType())) {
- // 鍏堟墽琛屽寲楠屼俊鎭繚瀛�
- CheckUpdateResult checkResult = checkStandardManager
- .updateCheckItems(data.getCheckId(), data.getCompanyId(),
- data.getCheckItems());
- if (null != checkResult) {
-// if (null == data.getWet())
-// data.setWet(checkResult.getWet());
-// if (null == data.getImpurity())
-// data.setImpurity(checkResult.getImpurity());
- }
+ data = updateCheckItems(data, true);
}
- // 鏇存柊鏁版嵁
- inoutService.updateData(data);
- return null;
+ return inoutService.updateData(data);
}
- /**
- * 鍒犻櫎鎿嶄綔 鍒犻櫎鏁版嵁涓鸿蒋鍒犻櫎锛屽垹闄ゆ暟鎹悗闇�瑕佹牴鎹垹闄ゆ儏鍐佃仈鍔ㄥ簱瀛樼瓑淇℃伅
- *
- * @param data
- * @param selected 鏄惁宸茬粡鏌ヨ杩囨暟鎹�
- * @return
- * @throws Exception
- */
- @Transactional
- public String delInoutData(InoutData data, boolean selected)
- throws Exception {
-
- // 閬垮厤椤甸潰缂撳瓨棣栧厛鑾峰彇鏁版嵁搴撲腑鏈�鏂扮殑褰撳墠鏁版嵁淇℃伅
- InoutParam param = new InoutParam();
- param.setCompanyId(data.getCompanyId());
- param.setId(data.getId());
- param.setMsg(" [" + ContextUtil.getLoginUserCName() + "]鎵ц鍒犻櫎锛屽師鍥狅細"
- + data.getRemarks());
-
- if (!selected) {
- data = inoutService.inoutQueryById(param);
-
- if (InoutConstant.RECORD_STATUS_DEL.equals(data.getRecordStatus())) {
- return "宸茬粡鍒犻櫎鐨勬暟鎹紝涓嶆敮鎸侀噸澶嶅垹闄わ紒";
- }
- if (InoutConstant.RECORD_STATUS_ERROR
- .equals(data.getRecordStatus())) {
- return "褰撳墠鏁版嵁宸茬粡琚爣璁颁负寮傚父锛屼笉鏀寔鍒犻櫎锛�";
- }
- }
-
- // 鎵ц鍒犻櫎
- param.setProgress(InoutConstant.PROGRESS_RECORD);
- param.setRecordStatus(InoutConstant.RECORD_STATUS_DEL);
- param.setType(data.getType());
- inoutService.deleteData(param);
-
- // 濡傛灉娴佺▼鏈粨鏉燂紝鐩存帴鍒犻櫎锛屼笉鐗垫壇鍒拌仈鍔ㄨ皟鏁�
- if (!InoutConstant.PROGRESS_RECORD.equals(data.getProgress())) {
- return null;
- }
- return null;
- }
/**
* 寮傚父缁堟鎿嶄綔 璁剧疆寮傚父 涓轰簡閬垮厤椤甸潰鏁版嵁缂撳瓨锛岄渶瑕侀噸鏂拌幏鍙栨渶鏂版暟鎹垽鏂�
@@ -859,26 +532,25 @@
* @return
* @throws Exception
*/
- @Transactional
- public String errorInoutData(InoutData data) {
-
+ public String errorInoutData(InoutData data) throws Exception {
InoutParam param = new InoutParam();
param.setCompanyId(data.getCompanyId());
param.setId(data.getId());
- param.setMsg(" [" + ContextUtil.getLoginUserCName() + "]鎵ц寮傚父缁堟锛屽師鍥狅細"
- + data.getRemarks());
+
+ param.setMsg(" 浜�" + DateFormatUtils.format(new Date(), "yyyy-MM-dd HH:mm") + " 琚� " + ContextUtil.getLoginUserCName() + " 鎵ц缁堟锛屽師鍥狅細" + data.getRemarks());
+
data = inoutService.inoutQueryById(param);
- if (InoutConstant.RECORD_STATUS_DEL.equals(data.getRecordStatus())) {
- return "宸茬粡鍒犻櫎鐨勬暟鎹紝涓嶆敮鎸佸紓甯稿鐞嗭紒";
- }
- if (InoutConstant.RECORD_STATUS_ERROR.equals(data.getRecordStatus())) {
- return "涓嶆敮鎸侀噸澶嶅紓甯稿鐞嗭紒";
- }
if (InoutConstant.PROGRESS_RECORD.equals(data.getProgress())) {
return "娴佺▼缁撴潫鐨勬暟鎹笉鏀寔寮傚父澶勭悊锛�";
}
+ if (InoutConstant.RECORD_STATUS_DEL.equals(data.getRecordStatus())) {
+ return "褰撳墠淇℃伅宸插仛寮傚父澶勭悊锛屼笉鏀寔閲嶅鎵ц锛�";
+ }
+
+ param.setDeptId(data.getDeptId());
+ param.setType(data.getType());
return inoutService.inoutStop(param);
}
@@ -889,27 +561,25 @@
* @return
*/
public String completeInoutData(InoutData data) throws Exception {
- if (InoutConstant.RECORD_STATUS_DEL.equals(data.getRecordStatus())) {
- return "宸茬粡鍒犻櫎鐨勬暟鎹紝涓嶆敮鎸佸畬鎴愶紒";
- }
- if (InoutConstant.RECORD_STATUS_ERROR.equals(data.getRecordStatus())) {
- return "寮傚父缁堟鐨勬暟鎹紝涓嶆敮鎸佸畬鎴愶紒";
- }
- if (InoutConstant.PROGRESS_RECORD.equals(data.getProgress())) {
- return "娴佺▼宸插畬鎴愮殑鏁版嵁锛屼笉鏀寔瀹屾垚锛�";
- }
-
// 浠庢柊鏌ヨ鏁版嵁
InoutParam param = new InoutParam();
param.setId(data.getId());
param.setCompanyId(data.getCompanyId());
param.setType(data.getType());
- InoutData cuData = inoutService.inoutProgressQuery(param);
+ InoutData cuData = inoutService.inoutQueryById(param);
if (null == cuData) {
return "褰撳墠杞﹁締娴佺▼鐘舵�佸凡缁忓彉鍖栵紝璇峰埛鏂伴〉闈㈤噸鏂版搷浣滐紒";
}
+
if (!cuData.getProgress().equals(data.getProgress())) {
return "褰撳墠杞﹁締娴佺▼鐘舵�佸凡缁忓彉鍖栵紝璇峰埛鏂伴〉闈㈤噸鏂版搷浣滐紒";
+ }
+
+ if (InoutConstant.RECORD_STATUS_DEL.equals(cuData.getRecordStatus())) {
+ return "褰撳墠淇℃伅宸茬粡琚紓甯哥粓姝紝涓嶆敮鎸佸綋鍓嶅鐞嗭紒";
+ }
+ if (InoutConstant.PROGRESS_RECORD.equals(cuData.getProgress())) {
+ return "娴佺▼宸插畬鎴愮殑鏁版嵁锛屼笉鏀寔瀹屾垚锛�";
}
if (null == data.getCompleteTime()) {
@@ -931,15 +601,17 @@
String msg = inoutService.quickComplete(data);
- if (null == msg) {
- data.setProgress(InoutConstant.PROGRESS_RECORD);
- commonService.initInoutDepotStore(data);
- }
+
return msg;
}
- public void initLpr(InoutConf conf) {
- inoutDeviceManager.initLpr(conf);
+ /**
+ * 鍑哄叆搴撶櫥璁板垵濮嬪寲
+ *
+ * @param conf 杞︾墝璇嗗埆閰嶇疆淇℃伅
+ */
+ public void initInoutRegister(InoutConf conf) {
+ inoutEventControl.initInoutRegister(conf);
}
/**
@@ -951,7 +623,7 @@
*/
public PageResponse<InoutData> submitRegisterInout(InoutData data) throws Exception {
- //棣栧厛鍒ゆ柇娴佺▼涓槸鍚︽湁宸茬粡瀛樺湪鐨勮溅杈嗕俊鎭湭鎵ц瀹屾垚锛岀洿鎺ヤ粠鏁版嵁搴撲腑鏌ヨ
+ // 棣栧厛鍒ゆ柇娴佺▼涓槸鍚︽湁宸茬粡瀛樺湪鐨勮溅杈嗕俊鎭湭鎵ц瀹屾垚锛岀洿鎺ヤ粠鏁版嵁搴撲腑鏌ヨ
InoutParam param = new InoutParam();
param.setCompanyId(data.getCompanyId());
param.setPlateNum(data.getPlateNum());
@@ -965,128 +637,127 @@
"褰撳墠杞︾墝鎴栨櫤鎱у崱鏈夋鍦ㄦ墽琛屾祦绋嬫湭缁撴潫锛岃鑱旂郴绠$悊鍛�", data);
}
-
- //鑾峰彇绯荤粺鍙傛暟閰嶇疆
- InoutSysConf inoutSysConf = inoutCommonService.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 nextProgress = getNextProgress(curProgress, data.getType(), inoutSysConf);
-
+ String nextProgress = getNextProgress(curProgress, data.getType(),
+ inoutSysConf);
data = updateBasicInfo(data, curProgress, nextProgress);
String msg = inoutService.insertData(data);
if (null != msg) {
- return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(),
- msg, data);
+ return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(), msg, data);
}
// 鎵ц闄勪欢淇℃伅
fileService.saveInoutFiles(data.getFiles(), data.getCompanyId(), data.getId(), curProgress);
+ //鐧昏瀹屾垚浜嬩欢
+ inoutEventControl.onInoutRegister(data);
- return new PageResponse<>(RespCodeEnum.CODE_0000.getCode(), "鎵ц鎴愬姛", data);
+ return new PageResponse<>(RespCodeEnum.CODE_0000.getCode(), "鎵ц鎴愬姛",
+ data);
}
public PageResponse<InoutData> submitWeightIn(InoutData data) throws Exception {
- //鑾峰彇绯荤粺鍙傛暟閰嶇疆
- InoutSysConf inoutSysConf = inoutCommonService.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 nextProgress = getNextProgress(curProgress, data.getType(), inoutSysConf);
+ String nextProgress = getNextProgress(curProgress, data.getType(),
+ inoutSysConf);
data = updateBasicInfo(data, curProgress, nextProgress);
+ // 鍏ュ簱绉伴噸鍙兘璋冩暣璐ㄦ鍗�
+ data = updateCheckItems(data, true);
- //鍏ュ簱绉伴噸鍙兘璋冩暣璐ㄦ鍗�
- 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);
+ return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(), msg,
+ data);
}
// 鎵ц闄勪欢淇℃伅
fileService.saveInoutFiles(data.getFiles(), data.getCompanyId(), data.getId(), curProgress);
- //绉伴噸瀹屾垚锛岃皟鐢ㄥ嚭鍏ュ簱鎺у埗閫昏緫澶勭悊
- inoutDeviceManager.controlWeight(data, curProgress, nextProgress);
+ // 绉伴噸瀹屾垚浜嬩欢
+ inoutEventControl.onInoutWeight(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());
+ 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);
+ 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);
+ return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(), msg,
+ data);
}
// 鎵ц闄勪欢淇℃伅
- fileService.saveInoutFiles(data.getFiles(), data.getCompanyId(), data.getId(), curProgress);
+ fileService.saveInoutFiles(data.getFiles(), data.getCompanyId(),
+ data.getId(), curProgress);
- //绉伴噸鍚庢牴鎹綋鍓嶆祦绋嬬姸鎬佸拰涓嬩竴涓姸鎬侊紝閫氱煡绉伴噸鎺у埗鍣�
- inoutDeviceManager.controlWeight(data, curProgress, nextProgress);
+
+ // 绉伴噸瀹屾垚浜嬩欢
+ inoutEventControl.onInoutWeight(data, curProgress, nextProgress);
return new PageResponse<>(RespCodeEnum.CODE_0000.getCode(), "鎵ц鎴愬姛", data);
}
- public PageResponse<InoutData> submitHandle(InoutData data) throws Exception {
-
+ public PageResponse<InoutData> submitHandle(InoutData data)
+ throws Exception {
if (null == data.getHandleUser()) {
data.setHandleUser(ContextUtil.getLoginUserCName());
}
- //鑾峰彇绯荤粺鍙傛暟閰嶇疆
+ // 鑾峰彇绯荤粺鍙傛暟閰嶇疆
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) {
@@ -1096,9 +767,11 @@
// 鎵ц闄勪欢淇℃伅
fileService.saveInoutFiles(data.getFiles(), data.getCompanyId(), data.getId(), curProgress);
+ // 鍊间粨瀹屾垚瑙﹀彂浜嬩欢
+ inoutEventControl.onInoutHandle(data, curProgress, nextProgress);
+
return new PageResponse<>(RespCodeEnum.CODE_0000.getCode(), "鎵ц鎴愬姛", data);
}
-
/**
* 鏍规嵁鏉′欢鑾峰彇鎵︽牱鏁版嵁
@@ -1106,7 +779,8 @@
* @param param
* @return
*/
- public PageResponse<Page<InoutCheckData>> pageSampleData(InoutCheckParam param) {
+ public PageResponse<Page<InoutCheckData>> pageSampleData(
+ InoutCheckParam param) {
if (StringUtils.isEmpty(param.getCompanyId())) {
param.setCompanyId(ContextUtil.getCompanyId());
@@ -1115,66 +789,198 @@
param.setDeptId(ContextUtil.subDeptId(null));
}
- //鑻ユ煡璇㈡潯浠朵负宸叉墻鏍凤紝鍒欐祦绋嬬疆绌猴紱鑻ユ湭鎵︽牱锛屽垯娴佺▼涓嶅鐞嗭紝浠嶄负鎵︽牱鍖栭獙娴佺▼(CHECK)
+ // 鑻ユ煡璇㈡潯浠朵负宸叉墻鏍凤紝鍒欐祦绋嬬疆绌猴紱鑻ユ湭鎵︽牱锛屽垯娴佺▼涓嶅鐞嗭紝浠嶄负鎵︽牱鍖栭獙娴佺▼(CHECK)
if (!"NONE".equals(param.getSampleStatus())) {
param.setProgress(null);
}
- //鑾峰彇鎵︽牱鏁版嵁
+ // 鑾峰彇鎵︽牱鏁版嵁
Page<InoutCheckData> sampleList = inoutService.pageSampleData(param);
-
- if (null == sampleList.getRecords() || sampleList.getRecords().isEmpty()) {
+ 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(),
- "褰撳墠娴佺▼宸茬粡缁撴潫锛屼笉鏀寔淇敼");
- }
+ public PageResponse<InoutCheckData> submitSample(InoutCheckData data) throws Exception {
- //鎵︽牱鏃堕棿鍜屾墻鏍蜂汉
- if (StringUtils.isEmpty(data.getSampleUser())) {
- data.setSampleUser(ContextUtil.getLoginUserCName());
- }
- if (null == data.getSampleTime()) {
- data.setSampleTime(new Date());
- }
- String msg = inoutService.updateSampleData(data);
+ // 鑾峰彇涓氬姟鏁版嵁淇℃伅
+ InoutParam param = new InoutParam();
+ param.setCompanyId(data.getCompanyId());
+ param.setId(data.getId());
+ InoutData curData = inoutService.inoutProgressQuery(param);
- if (null != msg) {
- return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(), msg);
- }
- return new PageResponse<>(RespCodeEnum.CODE_0000.getCode(), "鎵ц鎴愬姛");
- } catch (Exception e) {
- log.error("鍚庡彴寮傚父:{}", e);
+ if (null == curData) {
return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(),
- "鍚庡彴寮傚父锛�" + e.getMessage(), null);
+ "娌℃湁鑾峰彇鍒板叆搴撲笟鍔℃暟鎹俊鎭紝鏇存柊澶辫触", 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);
+ }
+
+ // 鎵︽牱瀹屾垚瑙﹀彂浜嬩欢
+ inoutEventControl.onInSimple(data);
+
+ return new PageResponse<>(RespCodeEnum.CODE_0000.getCode(), "鎵ц鎴愬姛");
+ }
+
+ public PageResponse<InoutCheckData> submitCheck(InoutCheckData data) throws Exception {
+
+ // 鑾峰彇绯荤粺鍙傛暟閰嶇疆
+ InoutSysConf inoutSysConf = inoutCommonService.getCacheInoutSysConf(data.getCompanyId(), data.getDeptId());
+ if (null == inoutSysConf) {
+ return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(),
+ "鎻愮ず锛氬綋鍓嶅簱鍖烘湭閰嶇疆鍑哄叆搴撴祦绋嬩俊鎭紝璇疯仈绯荤鐞嗗憳", data);
+ }
+
+ // 鑾峰彇涓氬姟鏁版嵁淇℃伅
+ 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) {
+ curData.setDeCheck(checkResult.getDeSum());
+ data.setDeCheck(checkResult.getDeSum());
+ }
+ if (checkResult.getAddSum() > 0) {
+ curData.setAddCheck(checkResult.getAddSum());
+ data.setAddCheck(checkResult.getAddSum());
+ }
+ if (null == data.getCheckTime()) {
+ curData.setCheckTime(new Date());
+ data.setCheckTime(new Date());
+ }
+ curData.setCheckStatus(data.getCheckStatus());
+ curData.setFoodYear(data.getFoodYear());
+
+
+ // 鑾峰彇涓嬩竴涓祦绋嬬姸鎬�
+ String curProgress = curData.getProgress();
+ String nextProgress = getNextProgress(curProgress, curData.getType(), inoutSysConf);
+ curData = updateBasicInfo(curData, curProgress, nextProgress);
+
+ // 鑻ュ寲楠岀粨鏋滀笉鍚堟牸锛屽垽鏂厤缃悗缁祦绋�
+ if (InoutConstant.STATUS_UNPASS.equals(curData.getCheckStatus())) {
+ curData = checkNoPass(curData);
+ }
+
+ curData.setProgress(curData.getProgress());
+ curData.setType(curData.getType());
+ curData.setFoodLevel(data.getFoodLevel());
+ curData.setFoodVariety(data.getFoodVariety());
+ curData.setPrice(data.getPrice());
+ curData.setRemarks(data.getRemarks());
+ curData.setCheckItems(data.getCheckItems());
+ curData.setCheckTime(data.getCheckTime());
+ curData.setDepotId(data.getDepotId());
+
+ if (StringUtils.isEmpty(data.getCheckUser())) {
+ curData.setCheckUser(ContextUtil.getLoginUserCName());
+ }
+ if (null == data.getCheckTime()) {
+ curData.setCheckTime(new Date());
+ }
+
+ String msg = inoutService.updateCheckData(curData);
+
+ if (null != msg) {
+ return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(), msg);
+ }
+
+
+ // 璐ㄦ瀹屾垚瑙﹀彂浜嬩欢
+ inoutEventControl.onInCheck(data, curProgress, nextProgress);
+
+ return new PageResponse<>(RespCodeEnum.CODE_0000.getCode(), "鎵ц鎴愬姛");
+ }
+
+ public PageResponse<InoutCheckData> submitCheckData(InoutCheckData data) throws Exception {
+
+
+ // 鑾峰彇涓氬姟鏁版嵁淇℃伅
+ 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);
+ }
+
+ curData.setType(curData.getType());
+ curData.setFoodLevel(data.getFoodLevel());
+ curData.setFoodVariety(data.getFoodVariety());
+ curData.setPrice(data.getPrice());
+ curData.setDepotId(data.getDepotId());
+ curData.setCheckItems(data.getCheckItems());
+
+ String msg = inoutService.updateCheckData(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) {
+ public PageResponse<Page<InoutCheckData>> pageCheckData(
+ InoutCheckParam param) {
if (StringUtils.isEmpty(param.getCompanyId())) {
param.setCompanyId(ContextUtil.getCompanyId());
@@ -1189,7 +995,6 @@
Page<InoutCheckData> checkList = inoutService.pageCheckData(param);
-
if (null == checkList.getRecords() || checkList.getRecords().isEmpty()) {
return new PageResponse<>(RespCodeEnum.CODE_2000.getCode(),
"鑾峰彇鍒版暟鎹俊鎭负绌�");
@@ -1203,92 +1008,21 @@
* @param param
* @return
*/
- public PageResponse<List<CheckItemData>> getCheckItemData(InoutCheckParam param) {
+ public PageResponse<List<CheckItemData>> getCheckItemData(
+ InoutCheckParam param) {
try {
- List<CheckItemData> result = checkStandardManager.listCheckItem(param.getCheckId(),
- param.getCompanyId(), param.getFoodVariety());
+ List<CheckItemData> result = checkStandardManager.listCheckItem(
+ param.getCompanyId(), param.getCheckId(),
+ param.getFoodVariety());
return new PageResponse<>(RespCodeEnum.CODE_0000, result);
} catch (Exception e) {
- return new PageResponse<>(
- RespCodeEnum.CODE_1111.getCode(), "鍚庡彴寮傚父锛�" + e.getMessage(), null);
+ 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);
- }
- }
/**
* 鑾峰彇鍗曚环淇℃伅
@@ -1301,13 +1035,46 @@
List<InoutPrice> price = inoutService.getPrice(param);
if (null == price || price.isEmpty()) {
- return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(), "鏈幏鍙栧埌绮瀹氫环閰嶇疆淇℃伅");
+ 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);
+ return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(), "鍚庡彴寮傚父锛�"
+ + e.getMessage(), null);
}
}
+
+ /**
+ * @param param
+ * @return
+ */
+ public PageResponse<InoutCheckData> inoutDataByCheckId(InoutCheckParam param) {
+ if (StringUtils.isEmpty(param.getCheckId())) {
+ return new PageResponse<>(RespCodeEnum.CODE_1007.getCode(),
+ "鏌ヨ鍙傛暟涓嶅畬鏁达紝鏌ヨ澶辫触锛�");
+ }
+
+ InoutCheckData result;
+ try {
+ param.setProgress(InoutConstant.PROGRESS_CHECK);
+ result = inoutService.inoutDataByCheckId(param);
+ if (null == result) {
+ return new PageResponse<>(RespCodeEnum.CODE_2000.getCode(),
+ "绯荤粺鏈煡璇㈠埌鎵ц涓殑杞﹁締淇℃伅", null);
+ }
+
+ return new PageResponse<>(RespCodeEnum.CODE_0000, result);
+
+ } catch (Exception e) {
+ return new PageResponse<>(RespCodeEnum.CODE_2000.getCode(),
+ e.getMessage());
+ }
+ }
+
+ public void initInoutWeight(List<InoutConf> listInoutConf, String sort) {
+ inoutEventControl.initInoutWeight(listInoutConf, sort);
+ }
+
}
\ No newline at end of file
--
Gitblit v1.9.3