From a3f8ef130d998973a5d36bb196e1607827de81e8 Mon Sep 17 00:00:00 2001
From: CZT <czt18638530771@163.com>
Date: 星期三, 30 八月 2023 16:06:13 +0800
Subject: [PATCH] 增加Modbus协议:温控控制
---
igds-inout/src/main/java/com/ld/igds/inout/manager/InoutManager.java | 406 +++++++++++++++++++++++++++++++++++----------------------
1 files changed, 250 insertions(+), 156 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 5c201ae..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
@@ -3,11 +3,11 @@
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.InoutCheckData;
import com.ld.igds.inout.dto.InoutCheckParam;
@@ -15,15 +15,11 @@
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 lombok.extern.slf4j.Slf4j;
-
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateFormatUtils;
import org.apache.commons.lang3.time.DateUtils;
@@ -31,7 +27,6 @@
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
-
import java.util.Arrays;
import java.util.Date;
import java.util.List;
@@ -41,7 +36,6 @@
*
* @author
*/
-@Slf4j
@Component
public class InoutManager {
@@ -50,13 +44,13 @@
@Resource
private CoreFileService fileService;
@Resource
- private CoreCommonService commonService;
- @Resource
private InoutCommonService inoutCommonService;
@Resource
private CheckStandardManager checkStandardManager;
@Resource
- private InoutDeviceManager inoutDeviceManager;
+ private InoutEventControlManager inoutEventControl;
+ @Resource
+ private CoreFileService coreFileService;
/**
* 鐩存帴浠庢暟鎹簱鏌ヨ锛屼笉鑰冭檻淇℃伅鐘舵��
@@ -200,26 +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;
}
/**
@@ -298,46 +319,6 @@
return data;
}
- public PageResponse<InoutData> submitComplete(InoutData data)
- throws Exception {
-
- if (StringUtils.isEmpty(data.getId())
- || 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(data.getCompleteUser());
- param.setDepotId(data.getDepotId());
- param.setCompleteTime(data.getCompleteTime());
- param.setProgress(InoutConstant.PROGRESS_RECORD);
-
- String msg = inoutService.toComplete(param);
-
- if (null != msg) {
- return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(), msg);
- }
-
- return new PageResponse<>(RespCodeEnum.CODE_0000.getCode(), null, data);
- }
-
/**
* 鍗″洖鏀堕�昏緫澶勭悊
*
@@ -378,6 +359,52 @@
data);
}
+
+ public PageResponse<InoutData> submitComplete(InoutData data)
+ throws Exception {
+
+ if (StringUtils.isEmpty(data.getId())
+ || 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(data.getCompleteUser());
+ param.setDepotId(data.getDepotId());
+ param.setCompleteTime(new Date());
+ param.setProgress(InoutConstant.PROGRESS_RECORD);
+
+ String msg = inoutService.toComplete(param);
+
+ if (null != msg) {
+ return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(), msg);
+ }
+ data.setCompleteTime(param.getCompleteTime());
+ data.setProgress(InoutConstant.PROGRESS_RECORD);
+ inoutService.updateInoutCache(data);
+ // 娴佺▼瀹屾垚鏀朵簨浠�
+ inoutEventControl.onInoutComplete(data);
+
+ return new PageResponse<>(RespCodeEnum.CODE_0000.getCode(), null, data);
+ }
+
/**
* 琛ュ崟鎿嶄綔 琛ュ崟鍥犱负瀹屾垚鏃堕棿涓嶇‘瀹氾紝鎵�浠ラ渶瑕佺郴缁熸牴鎹綋鍓嶆暟鎹繘琛岃嚜鍔ㄦ娴嬶紝璋冩暣鍘熸潵娴佹按淇℃伅鍜屽簱瀛�
*
@@ -388,7 +415,7 @@
public String addInoutData(InoutData data) throws Exception {
if (data.getSettleWeight() <= 0.0) {
- return "琛ュ崟鏁版嵁瑕佹眰缁撶畻閲嶉噺蹇呴』澶т簬0";
+ return "绯荤粺锛氳ˉ鍗曟暟鎹姹傜粨绠楅噸閲忓繀椤诲ぇ浜�0";
}
// 琛ュ崟鏁版嵁鐩存帴鍒扮粨鏋滅姸鎬�
@@ -408,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);
@@ -420,40 +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);
- return msg;
+ //鍏堜繚瀛樹富琛紝鍚庢墽琛屽瓙琛�
+ inoutService.insertData(data);
+
+ if (InoutConstant.TYPE_IN.equals(data.getType())) {
+ this.updateCheckItems(data, true);
+ }
+ this.updateFiles(data);
+
+ return null;
}
/**
@@ -470,44 +511,17 @@
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.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);
}
@@ -591,8 +605,13 @@
return msg;
}
- public void initLpr(InoutConf conf) {
- inoutDeviceManager.initLpr(conf);
+ /**
+ * 鍑哄叆搴撶櫥璁板垵濮嬪寲
+ *
+ * @param conf 杞︾墝璇嗗埆閰嶇疆淇℃伅
+ */
+ public void initInoutRegister(InoutConf conf) {
+ inoutEventControl.initInoutRegister(conf);
}
/**
@@ -602,8 +621,7 @@
* @return
* @throws Exception
*/
- public PageResponse<InoutData> submitRegisterInout(InoutData data)
- throws Exception {
+ public PageResponse<InoutData> submitRegisterInout(InoutData data) throws Exception {
// 棣栧厛鍒ゆ柇娴佺▼涓槸鍚︽湁宸茬粡瀛樺湪鐨勮溅杈嗕俊鎭湭鎵ц瀹屾垚锛岀洿鎺ヤ粠鏁版嵁搴撲腑鏌ヨ
InoutParam param = new InoutParam();
@@ -637,20 +655,20 @@
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);
+ fileService.saveInoutFiles(data.getFiles(), data.getCompanyId(), data.getId(), curProgress);
+
+ //鐧昏瀹屾垚浜嬩欢
+ inoutEventControl.onInoutRegister(data);
return new PageResponse<>(RespCodeEnum.CODE_0000.getCode(), "鎵ц鎴愬姛",
data);
}
- public PageResponse<InoutData> submitWeightIn(InoutData data)
- throws Exception {
+ public PageResponse<InoutData> submitWeightIn(InoutData data) throws Exception {
// 鑾峰彇绯荤粺鍙傛暟閰嶇疆
InoutSysConf inoutSysConf = inoutCommonService.getCacheInoutSysConf(
data.getCompanyId(), data.getDeptId());
@@ -666,13 +684,7 @@
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());
- }
+ data = updateCheckItems(data, true);
// 鎵ц鏁版嵁鏇存柊
String msg = inoutService.updateData(data);
@@ -683,14 +695,12 @@
}
// 鎵ц闄勪欢淇℃伅
- 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);
+ return new PageResponse<>(RespCodeEnum.CODE_0000.getCode(), "鎵ц鎴愬姛", data);
}
public PageResponse<InoutData> submitWeightOut(InoutData data)
@@ -721,11 +731,11 @@
fileService.saveInoutFiles(data.getFiles(), data.getCompanyId(),
data.getId(), curProgress);
- // 绉伴噸鍚庢牴鎹綋鍓嶆祦绋嬬姸鎬佸拰涓嬩竴涓姸鎬侊紝閫氱煡绉伴噸鎺у埗鍣�
- inoutDeviceManager.controlWeight(data, curProgress, nextProgress);
- return new PageResponse<>(RespCodeEnum.CODE_0000.getCode(), "鎵ц鎴愬姛",
- data);
+ // 绉伴噸瀹屾垚浜嬩欢
+ inoutEventControl.onInoutWeight(data, curProgress, nextProgress);
+
+ return new PageResponse<>(RespCodeEnum.CODE_0000.getCode(), "鎵ц鎴愬姛", data);
}
public PageResponse<InoutData> submitHandle(InoutData data)
@@ -736,8 +746,7 @@
}
// 鑾峰彇绯荤粺鍙傛暟閰嶇疆
- 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);
@@ -745,24 +754,23 @@
// 鑾峰彇涓嬩竴涓祦绋嬬姸鎬�
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.updateDataByHandle(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);
- return new PageResponse<>(RespCodeEnum.CODE_0000.getCode(), "鎵ц鎴愬姛",
- data);
+ // 鍊间粨瀹屾垚瑙﹀彂浜嬩欢
+ inoutEventControl.onInoutHandle(data, curProgress, nextProgress);
+
+ return new PageResponse<>(RespCodeEnum.CODE_0000.getCode(), "鎵ц鎴愬姛", data);
}
/**
@@ -831,6 +839,9 @@
return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(), msg);
}
+ // 鎵︽牱瀹屾垚瑙﹀彂浜嬩欢
+ inoutEventControl.onInSimple(data);
+
return new PageResponse<>(RespCodeEnum.CODE_0000.getCode(), "鎵ц鎴愬姛");
}
@@ -859,7 +870,6 @@
"褰撳墠娴佺▼宸茬粡缁撴潫锛屼笉鏀寔淇敼");
}
-
// 鏇存柊鍖栭獙椤逛俊鎭�
CheckUpdateResult checkResult = checkStandardManager.updateCheckItems(data.getCheckId(), data.getCompanyId(), data.getCheckItems());
if (StringUtils.isNotEmpty(checkResult.getMsg())) {
@@ -881,6 +891,7 @@
data.setCheckTime(new Date());
}
curData.setCheckStatus(data.getCheckStatus());
+ curData.setFoodYear(data.getFoodYear());
// 鑾峰彇涓嬩竴涓祦绋嬬姸鎬�
@@ -895,6 +906,13 @@
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());
@@ -909,7 +927,52 @@
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(), "淇濆瓨鎴愬姛");
}
/**
@@ -950,7 +1013,7 @@
try {
List<CheckItemData> result = checkStandardManager.listCheckItem(
- param.getCheckId(), param.getCompanyId(),
+ param.getCompanyId(), param.getCheckId(),
param.getFoodVariety());
return new PageResponse<>(RespCodeEnum.CODE_0000, result);
@@ -983,4 +1046,35 @@
}
}
+ /**
+ * @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