From 85305eb814a51fde36b45dc78938ef8e2bc156bd Mon Sep 17 00:00:00 2001
From: czt <czt18638530771@163.com>
Date: 星期日, 08 二月 2026 23:33:21 +0800
Subject: [PATCH] 客户问题优化调整7-增加库存修改及记录
---
fzzy-igdss-view/src/main/java/com/fzzy/igds/DepotPR.java | 17 ++
fzzy-igdss-view/src/main/java/com/fzzy/igds/Depot.view.xml | 263 ++++++++++++++++++++++++++++++++++++++++++-
fzzy-igdss-core/src/main/java/com/fzzy/igds/service/DepotService.java | 79 ++++++++++--
3 files changed, 333 insertions(+), 26 deletions(-)
diff --git a/fzzy-igdss-core/src/main/java/com/fzzy/igds/service/DepotService.java b/fzzy-igdss-core/src/main/java/com/fzzy/igds/service/DepotService.java
index 1ce91a6..813f14a 100644
--- a/fzzy-igdss-core/src/main/java/com/fzzy/igds/service/DepotService.java
+++ b/fzzy-igdss-core/src/main/java/com/fzzy/igds/service/DepotService.java
@@ -10,7 +10,9 @@
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.utils.StringUtils;
import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.time.DateFormatUtils;
import org.springframework.stereotype.Service;
+
import javax.annotation.Resource;
import java.util.*;
@@ -27,30 +29,32 @@
private DepotMapper depotMapper;
@Resource
private RedisCache redisCache;
+ @Resource
+ private DepotStoreService depotStoreService;
/**
* 鏌ヨ搴撳尯涓嬩粨搴撳垪琛�
*
* @param companyId
* @param deptId
- * @param idDesc 鏄惁ID鍊掑簭鎺掑垪
+ * @param idDesc 鏄惁ID鍊掑簭鎺掑垪
* @return
*/
public List<Depot> getData(String companyId, String deptId, boolean idDesc) {
if (StringUtils.isEmpty(companyId)) {
companyId = ContextUtil.getCompanyId();
}
-
+
QueryWrapper<Depot> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("company_id", companyId);
- if(StringUtils.isNotBlank(deptId)){
+ if (StringUtils.isNotBlank(deptId)) {
queryWrapper.likeRight("dept_id", deptId);
}
-
- if(idDesc){
+
+ if (idDesc) {
//ID鍊掑簭
queryWrapper.orderByDesc("id");
- }else {
+ } else {
//搴忓彿姝e簭
queryWrapper.orderByAsc("order_num");
}
@@ -60,6 +64,7 @@
/**
* 鏍规嵁搴撳瓨琛ㄤ俊鎭紝鏇存柊浠撳簱搴撳瓨
+ *
* @param data
*/
public void updateByDepotStore(DepotStore data) {
@@ -91,11 +96,55 @@
depot.setCreateBy(ContextUtil.getLoginUserName());
depot.setCreateTime(new Date());
depotMapper.insert(depot);
- }else {
+ } else {
depot.setUpdateBy(ContextUtil.getLoginUserName());
depot.setUpdateTime(new Date());
depotMapper.updateById(depot);
}
+ flushCache(depot.getCompanyId());
+ }
+
+ /**
+ * 鏇存柊搴撳瓨淇℃伅
+ *
+ * @param depot
+ */
+ public void updateStorageReal(Depot depot) {
+
+ Depot cacheDepot = this.getCacheDepot(depot.getCompanyId(), depot.getId());
+
+ depot.setUpdateBy(ContextUtil.getLoginUserName());
+ depot.setUpdateTime(new Date());
+ depot.setRemark("銆�" + ContextUtil.getLoginUserName() + "銆戜簬[" + DateFormatUtils.format(new Date(), "yyyy-MM-dd HH:mm:ss") + "]淇敼搴撳瓨锛�" + cacheDepot.getStorageReal() + "-->" + depot.getStorageReal());
+ depotMapper.updateById(depot);
+
+ DepotStore lastData = new DepotStore();
+
+ //涓婚敭ID瑙勫垯锛歽yyyMMddHHmm_浠撳簱缂栫爜
+ lastData.setId(DateFormatUtils.format(new Date(), "yyyyMMddHHmm") + "_" + depot.getId() + "_HAND");
+ lastData.setCompanyId(depot.getCompanyId());
+ lastData.setDeptId(depot.getId());
+ lastData.setDepotId(depot.getId());
+ lastData.setStorageReal(0.0);
+ lastData.setUpdateTime(new Date());
+ lastData.setUpdateBy("绯荤粺瀹氭椂缁熻");
+
+
+ lastData.setDepotStatus(depot.getDepotStatus());
+ lastData.setFoodVariety(depot.getFoodVariety());
+ lastData.setFoodLevel(depot.getFoodLevel());
+ lastData.setFoodLocation(depot.getFoodLocation());
+ lastData.setFoodLocationId(depot.getFoodLocationId());
+ lastData.setFoodType(depot.getFoodType());
+ lastData.setFoodYear(depot.getFoodYear());
+
+
+ lastData.setStorageReal(depot.getStorageReal());
+ lastData.setCreateTime(new Date()); //璁剧疆涓烘渶鏂版椂闂达紝鍏朵粬绯荤粺鍙互閫氳繃姝ゆ椂闂存煡璇㈡暟鎹槸鍚︽湁鏇存柊淇敼锛屽悓姝ュ埌鐪佸钩鍙版帴鍙c��
+ lastData.setCreateBy(ContextUtil.getLoginUserName());
+ lastData.setRemark("銆�" + ContextUtil.getLoginUserName() + "銆戜簬[" + DateFormatUtils.format(new Date(), "yyyy-MM-dd HH:mm:ss") + "]淇敼搴撳瓨涓猴細" + depot.getStorageReal());
+
+ depotStoreService.updateAndSave(lastData);
flushCache(depot.getCompanyId());
}
@@ -124,7 +173,7 @@
if (StringUtils.isEmpty(depotId)) {
return;
}
-
+
UpdateWrapper<Depot> updateWrapper = new UpdateWrapper<>();
updateWrapper.eq("id", depotId).set("depot_status", status);
depotMapper.update(null, updateWrapper);
@@ -152,7 +201,7 @@
companyId = ContextUtil.getCompanyId();
}
- List<Depot> list = this.getData(companyId,null, false);
+ List<Depot> list = this.getData(companyId, null, false);
this.setCacheDepotList(list, companyId);
}
@@ -211,10 +260,10 @@
//缂撳瓨鑾峰彇涓虹┖锛屽垯鏌ヨ鏁版嵁搴�
if (list.isEmpty()) {
- list = this.getData(companyId,null, false);
+ list = this.getData(companyId, null, false);
setCacheDepotList(list, companyId);
}
- if(!list.isEmpty()){
+ if (!list.isEmpty()) {
//閲嶆柊鎺掑簭
Collections.sort(list, (p1, p2) -> p1.getOrderNum() - p2.getOrderNum());
}
@@ -242,7 +291,7 @@
result.add(depot);
}
}
- if(!result.isEmpty()){
+ if (!result.isEmpty()) {
//閲嶆柊鎺掑簭
Collections.sort(list, (p1, p2) -> p1.getOrderNum() - p2.getOrderNum());
}
@@ -266,7 +315,7 @@
String key = RedisConst.buildKey(companyId, RedisConst.KEY_DEPOT, depotId);
Depot depot = redisCache.getCacheObject(key);
if (null == depot) {
- depot = depotMapper.selectById(depotId);
+ depot = depotMapper.selectById(depotId);
redisCache.setCacheObject(key, depot);
}
return depot;
@@ -287,11 +336,11 @@
}
List<Depot> depotList = getCacheDepotList(ContextUtil.getCompanyId(), deptId);
- if(null == depotList || depotList.isEmpty()){
+ if (null == depotList || depotList.isEmpty()) {
return null;
}
for (Depot depot : depotList) {
- if(depotName.equals(depot.getName())){
+ if (depotName.equals(depot.getName())) {
return depot.getId();
}
}
diff --git a/fzzy-igdss-view/src/main/java/com/fzzy/igds/Depot.view.xml b/fzzy-igdss-view/src/main/java/com/fzzy/igds/Depot.view.xml
index 4e02327..278207c 100644
--- a/fzzy-igdss-view/src/main/java/com/fzzy/igds/Depot.view.xml
+++ b/fzzy-igdss-view/src/main/java/com/fzzy/igds/Depot.view.xml
@@ -83,8 +83,20 @@
}else{
$notify("璇烽�夋嫨闇�瑕佷慨鏀圭殑浠撳簱鈥︹��");
}</ClientEvent>
- <Property name="caption">淇敼</Property>
+ <Property name="caption">淇℃伅淇敼</Property>
<Property name="exClassName">btn2</Property>
+ <Property name="width">100</Property>
+ <Property name="iconClass">fa fa-pencil-square-o</Property>
+ </ToolBarButton>
+ <ToolBarButton>
+ <ClientEvent name="onClick">var select = view.get("#dataGridDepot").get("selection");
+ if(select){
+ view.get("#depotdialog2").show();
+ }else{
+ $notify("璇烽�夋嫨闇�瑕佷慨鏀圭殑浠撳簱鈥︹��");
+ }</ClientEvent>
+ <Property name="caption">搴撳瓨淇敼</Property>
+ <Property name="exClassName">btn4</Property>
<Property name="width">100</Property>
<Property name="iconClass">fa fa-pencil-square-o</Property>
</ToolBarButton>
@@ -107,16 +119,6 @@
<Property name="iconClass">fa fa-refresh</Property>
<Property name="width">100</Property>
<Property name="action">ajaxRefreshCache</Property>
- </ToolBarButton>
- <ToolBarButton>
- <ClientEvent name="onClick">var url = "com.fzzy.igds.DepotStore.d";
-var panelId = window.frameElement.getAttribute('data-id');
-window.parent.$.modal.openTab("搴撳瓨绠$悊", url, false, panelId);</ClientEvent>
- <Property name="caption">搴撳瓨绠$悊</Property>
- <Property name="iconClass">fa fa-book</Property>
- <Property name="exClassName">btn1</Property>
- <Property name="visible">false</Property>
- <Property name="width">100</Property>
</ToolBarButton>
</ToolBar>
<DataGrid id="dataGridDepot" layoutConstraint="padding:8">
@@ -389,6 +391,236 @@
</Children>
<Tools/>
</Dialog>
+ <Dialog id="depotdialog2" layout="regionPadding:8">
+ <Property name="iconClass">fa fa-tasks</Property>
+ <Property name="caption">浠撳簱淇℃伅</Property>
+ <Property name="width">80%</Property>
+ <Property name="height">90%</Property>
+ <Property name="closeable">false</Property>
+ <Buttons>
+ <Button>
+ <ClientEvent name="onClick">//鍚屾椂鎻愪氦鍘嗗彶涔�
+ var data = view.get("#dataSetdepot.data:#");
+ view.get("#updateactionSave2").execute(function(result){
+ if(result){
+ $notify(result);
+ }else{
+ self.get("parent").hide();
+ query();
+ }
+ });</ClientEvent>
+ <Property name="caption">淇濆瓨</Property>
+ <Property name="iconClass">fa fa-check-circle</Property>
+ <Property name="exClassName">btn1</Property>
+ <Property name="width">120</Property>
+ </Button>
+ <Button>
+ <ClientEvent name="onClick">var cur = view.get("#dataSetdepot.data:#");
+ if(cur) cur.cancel();
+ self.get("parent").hide();</ClientEvent>
+ <Property name="caption">鍙栨秷</Property>
+ <Property name="exClassName">btn3</Property>
+ <Property name="iconClass">fa fa-times-circle</Property>
+ <Property name="width">120</Property>
+ </Button>
+ </Buttons>
+ <Children>
+ <FieldSet layout="padding:5">
+ <Property name="caption">鍩烘湰淇℃伅</Property>
+ <Buttons/>
+ <Children>
+ <AutoForm>
+ <Property name="dataSet">dataSetdepot</Property>
+ <Property name="readOnly">false</Property>
+ <Property name="labelSeparator"> : </Property>
+ <Property name="labelAlign">right</Property>
+ <Property name="cols">*,*,*,*,*,*</Property>
+ <Property name="labelWidth">80</Property>
+ <AutoFormElement layoutConstraint="colSpan:2">
+ <Property name="name">id</Property>
+ <Property name="property">id</Property>
+ <Property name="readOnly">true</Property>
+ <Editor>
+ <TextEditor>
+ <Property name="blankText">-- 绯荤粺鑷姩鐢熸垚 --</Property>
+ </TextEditor>
+ </Editor>
+ </AutoFormElement>
+ <AutoFormElement layoutConstraint="colSpan:2">
+ <Property name="name">name</Property>
+ <Property name="property">name</Property>
+ <Property name="readOnly">true</Property>
+ <Editor/>
+ </AutoFormElement>
+ <AutoFormElement layoutConstraint="colSpan:2">
+ <Property name="name">deptId</Property>
+ <Property name="property">deptId</Property>
+ <Property name="readOnly">true</Property>
+ <Editor/>
+ </AutoFormElement>
+ <AutoFormElement layoutConstraint="colSpan:2">
+ <Property name="name">storageMax</Property>
+ <Property name="property">storageMax</Property>
+ <Property name="readOnly">true</Property>
+ <Editor/>
+ </AutoFormElement>
+ <AutoFormElement layoutConstraint="colSpan:2">
+ <Property name="name">storeType</Property>
+ <Property name="property">storeType</Property>
+ <Property name="readOnly">true</Property>
+ <Editor/>
+ </AutoFormElement>
+ <AutoFormElement layoutConstraint="colSpan:2">
+ <Property name="name">depotStatus</Property>
+ <Property name="property">depotStatus</Property>
+ <Property name="trigger">autoMappingDropDown2</Property>
+ <Property name="readOnly">true</Property>
+ <Editor/>
+ </AutoFormElement>
+ <AutoFormElement layoutConstraint="colSpan:2">
+ <Property name="name">depotType</Property>
+ <Property name="property">depotType</Property>
+ <Property name="readOnly">true</Property>
+ <Editor/>
+ </AutoFormElement>
+ <AutoFormElement layoutConstraint="colSpan:2">
+ <Property name="name">storeKeeperName</Property>
+ <Property name="property">storeKeeperName</Property>
+ <Property name="trigger">triggerUserList</Property>
+ <Property name="readOnly">true</Property>
+ <Editor/>
+ </AutoFormElement>
+ <AutoFormElement layoutConstraint="colSpan:2">
+ <Property name="name">orderNum</Property>
+ <Property name="property">orderNum</Property>
+ <Property name="readOnly">true</Property>
+ <Editor/>
+ </AutoFormElement>
+ <AutoFormElement layoutConstraint="colSpan:4">
+ <Property name="name">remark</Property>
+ <Property name="property">remark</Property>
+ <Property name="readOnly">true</Property>
+ <Editor/>
+ </AutoFormElement>
+ <AutoFormElement layoutConstraint="colSpan:2">
+ <Property name="name">updateTime</Property>
+ <Property name="property">updateTime</Property>
+ <Property name="readOnly">true</Property>
+ <Editor/>
+ </AutoFormElement>
+ </AutoForm>
+ </Children>
+ </FieldSet>
+ <FieldSet layout="padding:5">
+ <Property name="caption">鍌ㄧ伯淇℃伅</Property>
+ <Buttons/>
+ <Children>
+ <AutoForm>
+ <Property name="dataSet">dataSetdepot</Property>
+ <Property name="readOnly">false</Property>
+ <Property name="labelSeparator"> : </Property>
+ <Property name="labelAlign">right</Property>
+ <Property name="cols">*,*,*,*,*,*</Property>
+ <Property name="labelWidth">80</Property>
+ <AutoFormElement layoutConstraint="colSpan:2">
+ <Property name="name">storageReal</Property>
+ <Property name="property">storageReal</Property>
+ <Property name="readOnly">false</Property>
+ <Editor/>
+ </AutoFormElement>
+ <AutoFormElement layoutConstraint="colSpan:2">
+ <Property name="name">foodVariety</Property>
+ <Property name="property">foodVariety</Property>
+ <Property name="readOnly">true</Property>
+ <Editor/>
+ </AutoFormElement>
+ <AutoFormElement layoutConstraint="colSpan:2">
+ <Property name="name">foodLevel</Property>
+ <Property name="property">foodLevel</Property>
+ <Property name="readOnly">true</Property>
+ <Editor/>
+ </AutoFormElement>
+ <AutoFormElement layoutConstraint="colSpan:2">
+ <Property name="name">foodYear</Property>
+ <Property name="property">foodYear</Property>
+ <Property name="readOnly">true</Property>
+ <Editor/>
+ </AutoFormElement>
+ <AutoFormElement layoutConstraint="colSpan:2">
+ <Property name="name">foodLocation</Property>
+ <Property name="property">foodLocation</Property>
+ <Property name="trigger">ddFoodOrigin</Property>
+ <Property name="readOnly">true</Property>
+ <Editor/>
+ </AutoFormElement>
+ <AutoFormElement layoutConstraint="colSpan:2">
+ <Property name="name">storeDate</Property>
+ <Property name="property">storeDate</Property>
+ <Property name="readOnly">true</Property>
+ <Editor/>
+ </AutoFormElement>
+ </AutoForm>
+ </Children>
+ </FieldSet>
+ <FieldSet layout="padding:5">
+ <Property name="caption">鍏朵粬淇℃伅</Property>
+ <Buttons/>
+ <Children>
+ <AutoForm>
+ <Property name="dataSet">dataSetdepot</Property>
+ <Property name="readOnly">false</Property>
+ <Property name="labelSeparator"> : </Property>
+ <Property name="labelAlign">right</Property>
+ <Property name="cols">*,*,*,*,*,*,*,*</Property>
+ <Property name="labelWidth">100</Property>
+ <AutoFormElement layoutConstraint="colSpan:2">
+ <Property name="name">length</Property>
+ <Property name="property">length</Property>
+ <Property name="readOnly">true</Property>
+ <Editor/>
+ </AutoFormElement>
+ <AutoFormElement layoutConstraint="colSpan:2">
+ <Property name="name">width</Property>
+ <Property name="property">width</Property>
+ <Property name="readOnly">true</Property>
+ <Editor/>
+ </AutoFormElement>
+ <AutoFormElement layoutConstraint="colSpan:2">
+ <Property name="name">height</Property>
+ <Property name="property">height</Property>
+ <Property name="readOnly">true</Property>
+ <Editor/>
+ </AutoFormElement>
+ <AutoFormElement layoutConstraint="colSpan:2">
+ <Property name="name">bulkWeight</Property>
+ <Property name="property">bulkWeight</Property>
+ <Property name="readOnly">true</Property>
+ <Editor/>
+ </AutoFormElement>
+ <AutoFormElement layoutConstraint="colSpan:2">
+ <Property name="name">perWet</Property>
+ <Property name="property">perWet</Property>
+ <Property name="readOnly">true</Property>
+ <Editor/>
+ </AutoFormElement>
+ <AutoFormElement layoutConstraint="colSpan:2">
+ <Property name="name">perImpurity</Property>
+ <Property name="property">perImpurity</Property>
+ <Property name="readOnly">true</Property>
+ <Editor/>
+ </AutoFormElement>
+ <AutoFormElement layoutConstraint="colSpan:2">
+ <Property name="name">checkDate</Property>
+ <Property name="property">checkDate</Property>
+ <Property name="readOnly">true</Property>
+ <Editor/>
+ </AutoFormElement>
+ </AutoForm>
+ </Children>
+ </FieldSet>
+ </Children>
+ <Tools/>
+ </Dialog>
<UpdateAction id="updateactionSave">
<Property name="executingMessage">姝e湪鎵ц涓�..</Property>
<Property name="dataResolver">depotPR#saveOrUpdate</Property>
@@ -398,6 +630,15 @@
<Property name="alias">data</Property>
</UpdateItem>
</UpdateAction>
+ <UpdateAction id="updateactionSave2">
+ <Property name="executingMessage">姝e湪鎵ц涓�..</Property>
+ <Property name="dataResolver">depotPR#saveOrUpdate2</Property>
+ <UpdateItem>
+ <Property name="dataSet">dataSetdepot</Property>
+ <Property name="dataPath">[#current]</Property>
+ <Property name="alias">data</Property>
+ </UpdateItem>
+ </UpdateAction>
<AjaxAction id="deleteAjaxAction">
<Property name="successMessage">鍒犻櫎鎴愬姛</Property>
<Property name="service">depotPR#deleteDepot</Property>
diff --git a/fzzy-igdss-view/src/main/java/com/fzzy/igds/DepotPR.java b/fzzy-igdss-view/src/main/java/com/fzzy/igds/DepotPR.java
index 1d60830..916771f 100644
--- a/fzzy-igdss-view/src/main/java/com/fzzy/igds/DepotPR.java
+++ b/fzzy-igdss-view/src/main/java/com/fzzy/igds/DepotPR.java
@@ -64,6 +64,23 @@
}
/**
+ * 鏇存柊搴撳瓨淇℃伅
+ * depotPR#saveOrUpdate2
+ *
+ * @param data
+ * @return
+ */
+ @DataResolver
+ @Transactional
+ public String saveOrUpdate2(Depot data) {
+
+ Depot depot = new Depot();
+ BeanUtils.copyProperties(data, depot);
+ depotService.updateStorageReal(depot);
+ return null;
+ }
+
+ /**
* depotPR#deleteDepot
*
* @param data
--
Gitblit v1.9.3