From 181252cf8ba494441b1fdb3873da7afa90ff0813 Mon Sep 17 00:00:00 2001
From: czt <czt18638530771@163.com>
Date: 星期四, 26 二月 2026 10:51:49 +0800
Subject: [PATCH] 库存统计优化,增加手动统计
---
fzzy-igdss-core/src/main/java/com/fzzy/igds/service/InoutRecordService.java | 252 ++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 244 insertions(+), 8 deletions(-)
diff --git a/fzzy-igdss-core/src/main/java/com/fzzy/igds/service/InoutRecordService.java b/fzzy-igdss-core/src/main/java/com/fzzy/igds/service/InoutRecordService.java
index 7b8097e..e3ae15f 100644
--- a/fzzy-igdss-core/src/main/java/com/fzzy/igds/service/InoutRecordService.java
+++ b/fzzy-igdss-core/src/main/java/com/fzzy/igds/service/InoutRecordService.java
@@ -4,6 +4,7 @@
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fzzy.igds.bill.InoutBill;
import com.fzzy.igds.constant.Constant;
+import com.fzzy.igds.constant.FoodLevel;
import com.fzzy.igds.constant.FoodVariety;
import com.fzzy.igds.constant.RedisConst;
import com.fzzy.igds.data.IgdsBaseParam;
@@ -23,6 +24,7 @@
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.time.DateFormatUtils;
import org.springframework.beans.BeanUtils;
+import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@@ -148,13 +150,14 @@
/**
* 鏍规嵁鏃堕棿绫诲瀷锛岃幏鍙栧凡瀹屾垚鐨勬甯稿崟鎹�
+ *
* @param timeType
* @param param
* @return
*/
public List<InoutRecord> getCompleteInoutByTime(String timeType, IgdsBaseParam param) {
- if(StringUtils.isBlank(timeType)){
- return null;
+ if (StringUtils.isBlank(timeType)) {
+ return null;
}
QueryWrapper<InoutRecord> queryWrapper = new QueryWrapper<>();
@@ -261,7 +264,7 @@
* @return
*/
public String addInoutRecordList(List<InoutRecord> list) {
- if(null == list || list.isEmpty()){
+ if (null == list || list.isEmpty()) {
return "鏂板澶辫触";
}
@@ -297,7 +300,7 @@
int num = inoutRecordMapper.insert(data);
//TODO 鏇存柊缂撳瓨
- //updateInoutCache(data);
+
return num;
}
@@ -318,6 +321,239 @@
//updateInoutCache(data);
return num;
+ }
+
+ /**
+ * 鏁版嵁淇敼锛屼繚鐣欎慨鏀硅褰�
+ *
+ * @param updateData
+ * @return
+ */
+ public int checkAndUpdate(InoutRecord updateData) {
+
+ //鑾峰彇鍘熸潵鐨勬暟鎹�
+ InoutParam param = new InoutParam();
+ param.setId(updateData.getId());
+ InoutRecord record = this.selectOne(param);
+
+ String updateLog = checkRemarks(updateData, record);
+ updateData.setUpdateLog(updateLog);
+
+ return updateInoutRecord(updateData);
+ }
+
+ /**
+ * 鏍¢獙淇敼淇℃伅
+ *
+ * @param updateData 淇敼鏁版嵁
+ * @param record 鍘熷鏁版嵁
+ * @return
+ */
+ public String checkRemarks(InoutRecord updateData, InoutRecord record) {
+
+ String updateLog0 = "銆�" + ContextUtil.getLoginUserName() + "銆戜簬[" + DateFormatUtils.format(new Date(), "yyyy-MM-dd HH:mm:ss") + "]淇敼鏁版嵁锛�";
+ String updateLog = "";
+
+ boolean updateTag = false;
+ //鏍¢獙浠撳簱淇℃伅
+ if (null != updateData.getDepotId() && null != record.getDepotId()) {
+ updateTag = !updateData.getDepotId().equals(record.getDepotId());
+ if (updateTag) {
+ updateLog += "[浠撳簱缂栫爜](" + record.getDepotId() + ")淇敼涓�(" + updateData.getDepotId() + "),";
+ }
+ }
+
+ //鏍¢獙鍝佺淇℃伅
+ if (null != updateData.getFoodVariety() && null != record.getFoodVariety()) {
+ updateTag = !updateData.getFoodVariety().equals(record.getFoodVariety());
+ if (updateTag) {
+ updateLog += "[鍝佺](" + FoodVariety.getMsg(record.getFoodVariety()) + ")淇敼涓�(" + FoodVariety.getMsg(updateData.getFoodVariety()) + "),";
+ }
+ }
+
+ //绮浜у湴
+ if (null != updateData.getFoodLocation() && null != record.getFoodLocation()) {
+ updateTag = !updateData.getFoodLocation().equals(record.getFoodLocation());
+ if (updateTag) {
+ updateLog += "[绮浜у湴](" + record.getFoodLocation() + ")淇敼涓�(" + updateData.getFoodLocation() + "),";
+ }
+ }
+
+ //绮绛夌骇
+ if (null != updateData.getFoodLevel() && null != record.getFoodLevel()) {
+ updateTag = !updateData.getFoodLevel().equals(record.getFoodLevel());
+ if (updateTag) {
+ updateLog += "[绮绛夌骇](" + FoodLevel.getMsg(record.getFoodLevel()) + ")淇敼涓�(" + FoodLevel.getMsg(updateData.getFoodLevel()) + "),";
+ }
+ }
+
+ //绮骞翠唤
+ if (null != updateData.getFoodYear() && null != record.getFoodYear()) {
+ updateTag = !updateData.getFoodYear().equals(record.getFoodYear());
+ if (updateTag) {
+ updateLog += "[绮骞翠唤](" + record.getFoodYear() + ")淇敼涓�(" + updateData.getFoodYear() + "),";
+ }
+ }
+
+ //鎵胯繍浜�
+ if (null != updateData.getUserName() && null != record.getUserName()) {
+ updateTag = !updateData.getUserName().equals(record.getUserName());
+ if (updateTag) {
+ updateLog += "[鎵胯繍浜篯(" + record.getUserName() + ")淇敼涓�(" + updateData.getUserName() + "),";
+ }
+ }
+
+ //鏍¢獙閫氱煡鍗曚俊鎭�
+ if (null != updateData.getNoticeId() && null != record.getNoticeId()) {
+ updateTag = !updateData.getNoticeId().equals(record.getNoticeId());
+ if (updateTag) {
+ updateLog += "[閫氱煡鍗曠紪鐮乚(" + record.getNoticeId() + ")淇敼涓�(" + updateData.getNoticeId() + "),";
+ }
+ }
+
+ //鏍¢獙寰�鏉ュ崟浣嶄俊鎭�
+ if (null != updateData.getCustomerName() && null != record.getCustomerName()) {
+ updateTag = !updateData.getCustomerName().equals(record.getCustomerName());
+ if (updateTag) {
+ updateLog += "[寰�鏉ュ崟浣峕(" + record.getCustomerName() + ")淇敼涓�(" + updateData.getCustomerName() + "),";
+ }
+ }
+
+ //鍗曚环
+ if (null != updateData.getPrice() && null != record.getPrice()) {
+ updateTag = !updateData.getPrice().equals(record.getPrice());
+ if (updateTag) {
+ updateLog += "[鍗曚环](" + record.getPrice() + ")淇敼涓�(" + updateData.getPrice() + "),";
+ }
+ }
+
+ //缁撶畻閲戦
+ if (null != updateData.getSettleMoney() && null != record.getSettleMoney()) {
+ updateTag = !updateData.getSettleMoney().equals(record.getSettleMoney());
+ if (updateTag) {
+ updateLog += "[缁撶畻閲戦](" + record.getSettleMoney() + ")淇敼涓�(" + updateData.getSettleMoney() + "),";
+ }
+ }
+
+ //姘村垎
+ if (null != updateData.getPerWet() && null != record.getPerWet()) {
+ updateTag = !updateData.getPerWet().equals(record.getPerWet());
+ if (updateTag) {
+ updateLog += "[姘村垎](" + record.getPerWet() + ")淇敼涓�(" + updateData.getPerWet() + "),";
+ }
+ }
+
+ //鏉傝川
+ if (null != updateData.getPerImpurity() && null != record.getPerImpurity()) {
+ updateTag = !updateData.getPerImpurity().equals(record.getPerImpurity());
+ if (updateTag) {
+ updateLog += "[鏉傝川](" + record.getPerImpurity() + ")淇敼涓�(" + updateData.getPerImpurity() + "),";
+ }
+ }
+
+ //姣涢噸
+ if (null != updateData.getFullWeight() && null != record.getFullWeight()) {
+ updateTag = !updateData.getFullWeight().equals(record.getFullWeight());
+ if (updateTag) {
+ updateLog += "[姣涢噸](" + record.getFullWeight() + ")淇敼涓�(" + updateData.getFullWeight() + "),";
+ }
+ }
+
+ //鐨噸
+ if (null != updateData.getEmptyWeight() && null != record.getEmptyWeight()) {
+ updateTag = !updateData.getEmptyWeight().equals(record.getEmptyWeight());
+ if (updateTag) {
+ updateLog += "[鐨噸](" + record.getEmptyWeight() + ")淇敼涓�(" + updateData.getEmptyWeight() + "),";
+ }
+ }
+
+ //鎵i噸
+ if (null != updateData.getDeOther() && null != record.getDeOther()) {
+ updateTag = !updateData.getDeOther().equals(record.getDeOther());
+ if (updateTag) {
+ updateLog += "[鎵i噸](" + record.getDeOther() + ")淇敼涓�(" + updateData.getDeOther() + "),";
+ }
+ }
+
+ //缁撶畻閲嶉噺
+ if (null != updateData.getSettleWeight() && null != record.getSettleWeight()) {
+ updateTag = !updateData.getSettleWeight().equals(record.getSettleWeight());
+ if (updateTag) {
+ updateLog += "[缁撶畻閲嶉噺](" + record.getSettleWeight() + ")淇敼涓�(" + updateData.getSettleWeight() + "),";
+ }
+ }
+
+ //鍑哄叆搴撻噸閲�
+ if (null != updateData.getRecordWeight() && null != record.getRecordWeight()) {
+ updateTag = !updateData.getRecordWeight().equals(record.getRecordWeight());
+ if (updateTag) {
+ updateLog += "[鍑哄叆搴撻噸閲廬(" + record.getRecordWeight() + ")淇敼涓�(" + updateData.getRecordWeight() + "),";
+ }
+ }
+
+ //鐧昏鏃堕棿
+ if (null != updateData.getRegisterTime() && null != record.getRegisterTime()) {
+ updateTag = !updateData.getRegisterTime().equals(record.getRegisterTime());
+ if (updateTag) {
+ updateLog += "[鐧昏鏃堕棿](" + DateFormatUtils.format(record.getRegisterTime(), "yyyy-MM-dd HH:mm:ss") + ")淇敼涓�(" + DateFormatUtils.format(updateData.getRegisterTime(), "yyyy-MM-dd HH:mm:ss") + "),";
+ }
+ }
+
+ //婊¤溅鏃堕棿
+ if (null != updateData.getFullWeightTime() && null != record.getFullWeightTime()) {
+ updateTag = !updateData.getFullWeightTime().equals(record.getFullWeightTime());
+ if (updateTag) {
+ updateLog += "[婊¤溅鏃堕棿](" + DateFormatUtils.format(record.getFullWeightTime(), "yyyy-MM-dd HH:mm:ss") + ")淇敼涓�(" + DateFormatUtils.format(updateData.getFullWeightTime(), "yyyy-MM-dd HH:mm:ss") + "),";
+ }
+ }
+
+ //绌鸿溅鏃堕棿
+ if (null != updateData.getEmptyWeightTime() && null != record.getEmptyWeightTime()) {
+ updateTag = !updateData.getEmptyWeightTime().equals(record.getEmptyWeightTime());
+ if (updateTag) {
+ updateLog += "[绌鸿溅鏃堕棿](" + DateFormatUtils.format(record.getEmptyWeightTime(), "yyyy-MM-dd HH:mm:ss") + ")淇敼涓�(" + DateFormatUtils.format(updateData.getEmptyWeightTime(), "yyyy-MM-dd HH:mm:ss") + "),";
+ }
+ }
+
+ //瀹屾垚鏃堕棿
+ if (null != updateData.getCompleteTime() && null != record.getCompleteTime()) {
+ updateTag = !updateData.getCompleteTime().equals(record.getCompleteTime());
+ if (updateTag) {
+ updateLog += "[瀹屾垚鏃堕棿](" + DateFormatUtils.format(record.getCompleteTime(), "yyyy-MM-dd HH:mm:ss") + ")淇敼涓�(" + DateFormatUtils.format(updateData.getCompleteTime(), "yyyy-MM-dd HH:mm:ss") + "),";
+ }
+ }
+
+ //婊¤溅绉伴噸浜�
+ if (null != updateData.getFullWeightUser() && null != record.getFullWeightUser()) {
+ updateTag = !updateData.getFullWeightUser().equals(record.getFullWeightUser());
+ if (updateTag) {
+ updateLog += "[婊¤溅绉伴噸浜篯(" + record.getFullWeightUser() + ")淇敼涓�(" + updateData.getFullWeightUser() + "),";
+ }
+ }
+
+ //绌鸿溅绉伴噸浜�
+ if (null != updateData.getEmptyWeightUser() && null != record.getEmptyWeightUser()) {
+ updateTag = !updateData.getEmptyWeightUser().equals(record.getEmptyWeightUser());
+ if (updateTag) {
+ updateLog += "[绌鸿溅绉伴噸浜篯(" + record.getEmptyWeightUser() + ")淇敼涓�(" + updateData.getEmptyWeightUser() + "),";
+ }
+ }
+
+ //澶囨敞璇存槑
+ if (null != updateData.getRemarks() && null != record.getRemarks()) {
+ updateTag = !updateData.getRemarks().equals(record.getRemarks());
+ if (updateTag) {
+ updateLog += "[澶囨敞璇存槑](" + record.getRemarks() + ")淇敼涓�(" + updateData.getRemarks() + "),";
+ }
+ }
+
+ if (StringUtils.isBlank(updateLog)) {
+ return record.getUpdateLog() == null ? "" : record.getUpdateLog();
+ }
+
+ updateLog0 = updateLog0 + updateLog;
+
+ return record.getUpdateLog() == null ? updateLog0 : (record.getUpdateLog() + "锛�" + updateLog0);
}
/**
@@ -452,7 +688,7 @@
public String inWeightBill(InoutRecord data) {
// 鑾峰彇琛ㄥ崟鏁版嵁
- InoutPrintBill bill = this.createBillData(data, "鍏ュ簱鍒掔爜鍗�");
+ InoutPrintBill bill = this.createBillData(data, "-鍏ュ簱鍗�");
// 璋冩暣妯$増鏁版嵁骞惰繑鍥�
String htmlStr = InoutBill.IN_WEIGHT_DEFAULT;
@@ -504,7 +740,7 @@
htmlStr = htmlStr.replace("impurity", bill.getImpurity() + "");
htmlStr = htmlStr.replace("checkStatus", bill.getCheckStatus());
- htmlStr = htmlStr.replace("remark", bill.getRemark());
+ htmlStr = htmlStr.replace("remark", "");
htmlStr = htmlStr.replace("moneyName", bill.getMoneyName());
htmlStr = htmlStr.replace("unitName", bill.getUnitName());
@@ -534,7 +770,7 @@
*/
public String outWeightBill(InoutRecord data) {
// 鑾峰彇琛ㄥ崟鏁版嵁
- InoutPrintBill bill = this.createBillData(data, "鍑哄簱鍒掔爜鍗�");
+ InoutPrintBill bill = this.createBillData(data, "-鍑哄簱鍗�");
//榛樿妯$増
String htmlStr = InoutBill.OUT_WEIGHT_DEFAULT;
@@ -567,7 +803,7 @@
new DecimalFormat("0.00").format(bill.getNetWeight()));
htmlStr = htmlStr.replace("dePackage",
new DecimalFormat("0.00").format(bill.getDePackage()));
- htmlStr = htmlStr.replace("remark", bill.getRemark());
+ htmlStr = htmlStr.replace("remark", "");
htmlStr = htmlStr.replace("settleWeight",
new DecimalFormat("0.00").format(bill.getSettleWeight()));
--
Gitblit v1.9.3