From ff31d592924958958c21fdef1975d499586d964f Mon Sep 17 00:00:00 2001
From: skyouc <creaycat@gmail.com>
Date: 星期五, 26 十二月 2025 17:41:43 +0800
Subject: [PATCH] BUG修复

---
 rsf-admin/src/page/basicInfo/basStation/BasStationCreate.jsx                                    |   12 ++
 rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/MatnrGroupServiceImpl.java |    4 
 rsf-admin/src/page/basicInfo/basContainer/BasContainerList.jsx                                  |    2 
 rsf-admin/src/i18n/core/chineseMessages.js                                                      |    3 
 rsf-admin/src/i18n/zh.js                                                                        |    1 
 rsf-admin/src/page/basicInfo/matnrGroup/MatnrGroupList.jsx                                      |   21 ++--
 rsf-server/src/main/java/com/vincent/rsf/server/manager/entity/BasStation.java                  |  111 ++++++++++++++++-----------
 rsf-admin/src/i18n/en.js                                                                        |    1 
 rsf-admin/src/page/ResourceContent.js                                                           |    3 
 rsf-server/src/main/java/com/vincent/rsf/server/common/exception/GlobalExceptionHandler.java    |   25 ++++++
 10 files changed, 121 insertions(+), 62 deletions(-)

diff --git a/rsf-admin/src/i18n/core/chineseMessages.js b/rsf-admin/src/i18n/core/chineseMessages.js
index fd05cb0..228f551 100644
--- a/rsf-admin/src/i18n/core/chineseMessages.js
+++ b/rsf-admin/src/i18n/core/chineseMessages.js
@@ -96,7 +96,8 @@
       delete_title: "鍒犻櫎 %{name} #%{id}",
       details: "Details",
       error: "A client error occurred and your request couldn't be completed.",
-      
+      delete_success: '鍒犻櫎鎴愬姛锛�',
+      delete_fail: '鍒犻櫎澶辫触锛�',
       invalid_form: "琛ㄥ崟鏃犳晥 璇锋鏌ユ槸鍚︽湁閿欒!",
       loading: "Please wait",
       no: "No",
diff --git a/rsf-admin/src/i18n/en.js b/rsf-admin/src/i18n/en.js
index 152654b..2f09aff 100644
--- a/rsf-admin/src/i18n/en.js
+++ b/rsf-admin/src/i18n/en.js
@@ -158,6 +158,7 @@
         warehouse: 'Warehouse',
         warehouseAreas: 'WarehouseAreas',
         loc: 'Loc',
+        locItem: 'LocItem',
         locType: 'LocType',
         locArea: 'locArea',
         locAreaMat: 'Logic Areas',
diff --git a/rsf-admin/src/i18n/zh.js b/rsf-admin/src/i18n/zh.js
index d8bd10b..67ea0fd 100644
--- a/rsf-admin/src/i18n/zh.js
+++ b/rsf-admin/src/i18n/zh.js
@@ -159,6 +159,7 @@
         warehouse: '浠撳簱',
         warehouseAreas: '搴撳尯',
         loc: '搴撲綅',
+        locItem: '搴撳瓨鏄庣粏',
         locType: '搴撲綅绫诲瀷(搴�)',
         locArea: '閫昏緫鍒嗗尯(搴�)',
         locAreaMat: '閫昏緫鍒嗗尯(搴�)',
diff --git a/rsf-admin/src/page/ResourceContent.js b/rsf-admin/src/page/ResourceContent.js
index f9764f6..07d6451 100644
--- a/rsf-admin/src/page/ResourceContent.js
+++ b/rsf-admin/src/page/ResourceContent.js
@@ -64,6 +64,7 @@
 import inStatisticItem from './statistics/inStockItem';
 import statisticCount from './statistics/stockStatisticNum';
 import preparation from "./orders/preparation";
+// import locItem from "./basicInfo/locItem";
 
 const ResourceContent = (node) => {
   switch (node.component) {
@@ -187,6 +188,8 @@
       return statisticCount;
     case "preparation":
       return preparation;
+    // case "locItem":
+    //   return locItem;
     default:
       return {
         list: ListGuesser,
diff --git a/rsf-admin/src/page/basicInfo/basContainer/BasContainerList.jsx b/rsf-admin/src/page/basicInfo/basContainer/BasContainerList.jsx
index 224f9f3..23e3cdf 100644
--- a/rsf-admin/src/page/basicInfo/basContainer/BasContainerList.jsx
+++ b/rsf-admin/src/page/basicInfo/basContainer/BasContainerList.jsx
@@ -112,7 +112,7 @@
                     <TopToolbar>
                         <InitButton setOpen={setOpen} />
                         <FilterButton />
-                        <MyCreateButton onClick={() => { setCreateDialog(true) }} />
+                        {/* <MyCreateButton onClick={() => { setCreateDialog(true) }} /> */}
                         <SelectColumnsButton preferenceKey='basContainer' />
                         <MyExportButton />
                     </TopToolbar>
diff --git a/rsf-admin/src/page/basicInfo/basStation/BasStationCreate.jsx b/rsf-admin/src/page/basicInfo/basStation/BasStationCreate.jsx
index 0993b27..be2b2a8 100644
--- a/rsf-admin/src/page/basicInfo/basStation/BasStationCreate.jsx
+++ b/rsf-admin/src/page/basicInfo/basStation/BasStationCreate.jsx
@@ -39,7 +39,7 @@
 
     const translate = useTranslate();
     const notify = useNotify();
-
+    const dicts = JSON.parse(localStorage.getItem('sys_dicts'))?.filter(dict => (dict.dictTypeCode == 'sys_station_type')) || [];
     const handleClose = (event, reason) => {
         if (reason !== "backdropClick") {
             setOpen(false);
@@ -97,6 +97,16 @@
                                     />
                                 </Grid>
                                 <Grid item xs={6} display="flex" gap={1}>
+                                    <AutocompleteInput
+                                        choices={dicts}
+                                        optionText="label"
+                                        label="table.field.basStation.type"
+                                        source="type"
+                                        optionValue="value"
+                                        parse={v => v}
+                                        validate={[required()]} />
+                                </Grid>
+                                <Grid item xs={6} display="flex" gap={1}>
                                     <SelectInput
                                         label="table.field.basStation.inAble"
                                         source="inAble"
diff --git a/rsf-admin/src/page/basicInfo/matnrGroup/MatnrGroupList.jsx b/rsf-admin/src/page/basicInfo/matnrGroup/MatnrGroupList.jsx
index 93a152c..61e2d69 100644
--- a/rsf-admin/src/page/basicInfo/matnrGroup/MatnrGroupList.jsx
+++ b/rsf-admin/src/page/basicInfo/matnrGroup/MatnrGroupList.jsx
@@ -197,15 +197,16 @@
             deleteOne(
                 RESOURCE,
                 { id: node.id },
-                {
-                    onSuccess: () => {
-                        handleRefresh();
-                        notify('Department deleted successfully', { type: 'info', messageArgs: { _: 'Department deleted successfully' } });
-                    },
-                    onError: (error) => {
-                        notify(`Error: ${error.message}`, { type: 'warning', messageArgs: { _: `Error: ${error.message}` } });
-                    },
-                }
+                    {
+                        onSuccess: () => {
+                            handleRefresh();
+                            const msg = translate('ra.message.delete_success');
+                            notify(msg, { type: 'success', messageArgs: { _: msg } });
+                        },
+                        onError: (error) => {
+                            notify(`Error: ${error.message}`, { type: 'warning', messageArgs: { _: `Error: ${error.message}` } });
+                        },
+                    }
             );
         }
     };
@@ -354,4 +355,4 @@
     );
 }
 
-export default MatnrGroupList;
\ No newline at end of file
+export default MatnrGroupList;
diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/common/exception/GlobalExceptionHandler.java b/rsf-server/src/main/java/com/vincent/rsf/server/common/exception/GlobalExceptionHandler.java
index 1c1bbc5..f26d109 100644
--- a/rsf-server/src/main/java/com/vincent/rsf/server/common/exception/GlobalExceptionHandler.java
+++ b/rsf-server/src/main/java/com/vincent/rsf/server/common/exception/GlobalExceptionHandler.java
@@ -6,6 +6,7 @@
 import com.vincent.rsf.server.common.utils.CommonUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.dao.DuplicateKeyException;
 import org.springframework.security.access.AccessDeniedException;
 import org.springframework.web.HttpRequestMethodNotSupportedException;
 import org.springframework.web.bind.annotation.ControllerAdvice;
@@ -13,6 +14,8 @@
 import org.springframework.web.bind.annotation.ResponseBody;
 
 import javax.servlet.http.HttpServletResponse;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
 /**
  * 鍏ㄥ眬寮傚父澶勭悊鍣�
@@ -54,6 +57,28 @@
         return R.error(e.getMessage());
     }
 
+    @ResponseBody
+    @ExceptionHandler(DuplicateKeyException.class)
+    public R duplicateKeyExceptionHandler(DuplicateKeyException e, HttpServletResponse response) {
+        CommonUtil.addCrossHeaders(response);
+        String msg = e.getMessage();
+        String out = "鍞竴绱㈠紩鍐茬獊";
+        try {
+            Pattern p = Pattern.compile("Duplicate entry '(.+?)' for key '(.+?)'");
+            Matcher m = p.matcher(msg);
+            if (m.find()) {
+                String value = m.group(1);
+                String key = m.group(2);
+                if ("idx_code".equalsIgnoreCase(key)) {
+                    out = "缂栫爜宸插瓨鍦細" + value;
+                } else {
+                    out = "鍞竴绱㈠紩[" + key + "]鍊煎凡瀛樺湪锛�" + value;
+                }
+            }
+        } catch (Exception ignore) {}
+        return R.error(out);
+    }
+
 
     @ResponseBody
     @ExceptionHandler(Throwable.class)
diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/manager/entity/BasStation.java b/rsf-server/src/main/java/com/vincent/rsf/server/manager/entity/BasStation.java
index 6481ea9..af2aaf9 100644
--- a/rsf-server/src/main/java/com/vincent/rsf/server/manager/entity/BasStation.java
+++ b/rsf-server/src/main/java/com/vincent/rsf/server/manager/entity/BasStation.java
@@ -14,7 +14,6 @@
 import com.vincent.rsf.server.system.service.DictTypeService;
 import org.springframework.format.annotation.DateTimeFormat;
 import java.text.SimpleDateFormat;
-import java.util.Date;
 
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
@@ -24,7 +23,6 @@
 import com.vincent.rsf.server.system.service.UserService;
 import com.vincent.rsf.server.system.entity.User;
 import java.io.Serializable;
-import java.util.Date;
 import java.util.stream.Collectors;
 
 @Data
@@ -36,14 +34,14 @@
     /**
      * id
      */
-    @ApiModelProperty(value= "id")
+    @ApiModelProperty(value = "id")
     @TableId(value = "id", type = IdType.AUTO)
     private Long id;
 
     /**
      * 绔欑偣鍚嶇О
      */
-    @ApiModelProperty(value= "绔欑偣鍚嶇О")
+    @ApiModelProperty(value = "绔欑偣鍚嶇О")
     private String stationName;
 
     @ApiModelProperty("绔欑偣绫诲瀷: {0:鍏夌數锛� 1:鏃犲厜鐢祡")
@@ -52,113 +50,113 @@
     /**
      * 鍙叆
      */
-    @ApiModelProperty(value= "鍙叆")
+    @ApiModelProperty(value = "鍙叆")
     private Integer inAble = 0;
 
     /**
      * 鍙嚭
      */
-    @ApiModelProperty(value= "鍙嚭")
+    @ApiModelProperty(value = "鍙嚭")
     private Integer outAble = 0;
 
     /**
      * 鐘舵��
      */
-    @ApiModelProperty(value= "鐘舵��")
+    @ApiModelProperty(value = "鐘舵��")
     private String useStatus;
 
     /**
      * 鎵�灞炲簱鍖篿d
      */
-    @ApiModelProperty(value= "鎵�灞炲簱鍖篿d")
+    @ApiModelProperty(value = "鎵�灞炲簱鍖篿d")
     private Long area;
 
     /**
      * 鏄惁鍙法鍖�
      */
-    @ApiModelProperty(value= "鏄惁鍙法鍖�")
+    @ApiModelProperty(value = "鏄惁鍙法鍖�")
     private Integer isCrossZone = 0;
 
     /**
      * 鍙法鍖哄尯鍩焛d
      */
-    @ApiModelProperty(value= "鍙法鍖哄尯鍩焛d")
+    @ApiModelProperty(value = "鍙法鍖哄尯鍩焛d")
     private String crossZoneArea;
 
     /**
      * 鏄惁wcs绔欑偣
      */
-    @ApiModelProperty(value= "鏄惁wcs绔欑偣")
+    @ApiModelProperty(value = "鏄惁wcs绔欑偣")
     private Integer isWcs = 0;
 
     /**
      * wcs绔欑偣淇℃伅
      */
-    @ApiModelProperty(value= "wcs绔欑偣淇℃伅")
+    @ApiModelProperty(value = "wcs绔欑偣淇℃伅")
     private String wcsData;
 
     /**
      * 瀹瑰櫒绫诲瀷
      */
-    @ApiModelProperty(value= "瀹瑰櫒绫诲瀷")
+    @ApiModelProperty(value = "瀹瑰櫒绫诲瀷")
     private String containerType;
 
     /**
      * 鏉$爜
      */
-    @ApiModelProperty(value= "鏉$爜")
+    @ApiModelProperty(value = "鏉$爜")
     @TableField(updateStrategy = FieldStrategy.IGNORED)
     private String barcode;
 
     /**
      * 鏄惁鑷姩璋冩嫧
      */
-    @ApiModelProperty(value= "鏄惁鑷姩璋冩嫧")
+    @ApiModelProperty(value = "鏄惁鑷姩璋冩嫧")
     private Integer autoTransfer;
 
     /**
      * 澶囨敞
      */
-    @ApiModelProperty(value= "澶囨敞")
+    @ApiModelProperty(value = "澶囨敞")
     private String memo;
 
-    @ApiModelProperty(value= "鏄惁鍒犻櫎 1: 鏄�  0: 鍚�  ")
+    @ApiModelProperty(value = "鏄惁鍒犻櫎 1: 鏄�  0: 鍚�  ")
     @TableLogic
     private Integer deleted;
 
     /**
      * 鍒涘缓浜�
      */
-    @ApiModelProperty(value= "鍒涘缓浜�")
+    @ApiModelProperty(value = "鍒涘缓浜�")
     private Long createBy;
 
     /**
      * 鍒涘缓鏃堕棿
      */
-    @ApiModelProperty(value= "鍒涘缓鏃堕棿")
-    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "鍒涘缓鏃堕棿")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     private Date createTime;
 
     /**
      * 鏇存柊浜�
      */
-    @ApiModelProperty(value= "鏇存柊浜�")
+    @ApiModelProperty(value = "鏇存柊浜�")
     private Long updateBy;
 
     /**
      * 鏇存柊鏃堕棿
      */
-    @ApiModelProperty(value= "鏇存柊鏃堕棿")
-    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "鏇存柊鏃堕棿")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     private Date updateTime;
 
-    @ApiModelProperty(value= "鐘舵��")
+    @ApiModelProperty(value = "鐘舵��")
     private Integer status;
 
     /**
      * 鎵�灞炴満鏋�
      */
-    @ApiModelProperty(value= "绉熸埛")
+    @ApiModelProperty(value = "绉熸埛")
     private Long tenantId;
 
     @TableField(exist = false)
@@ -167,15 +165,17 @@
     @TableField(exist = false)
     private List<Long> containerTypes;
 
-    public BasStation() {}
+    public BasStation() {
+    }
 
     public String getType$() {
-        if (this.type == null) return null;
+        if (this.type == null)
+            return null;
         return StationTypeEnum.getStationDesc(this.type);
     }
 
-    public List<Long> getContainerTypes$(){
-        if (Cools.isEmpty(this.containerType)){
+    public List<Long> getContainerTypes$() {
+        if (Cools.isEmpty(this.containerType)) {
             return new ArrayList<>();
         }
         DictDataService service = SpringUtils.getBean(DictDataService.class);
@@ -184,57 +184,74 @@
         List<Long> longs1 = JSONObject.parseArray(parse.toString(), Long.class);
         List<DictData> dictData = service.list(new LambdaQueryWrapper<DictData>()
                 .eq(DictData::getDictTypeCode, "sys_container_type")
-                .in(DictData::getValue, longs1)
-        );
+                .in(DictData::getValue, longs1));
         List<Long> longs = dictData.stream().map(DictData::getId).collect(Collectors.toList());
         return longs;
     }
 
-    public String getCreateTime$(){
-        if (Cools.isEmpty(this.createTime)){
+    public String getCreateTime$() {
+        if (Cools.isEmpty(this.createTime)) {
             return "";
         }
         return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.createTime);
     }
 
-    public String getUpdateTime$(){
-        if (Cools.isEmpty(this.updateTime)){
+    public String getUpdateTime$() {
+        if (Cools.isEmpty(this.updateTime)) {
             return "";
         }
         return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.updateTime);
     }
 
-    public String getUseStatus$(){
-        if (Cools.isEmpty(this.useStatus)){
+    public String getUseStatus$() {
+        if (Cools.isEmpty(this.useStatus)) {
             return "";
         }
         DictDataService service = SpringUtils.getBean(DictDataService.class);
         DictData dictData = service.getOne(new LambdaQueryWrapper<DictData>()
                 .eq(DictData::getDictTypeCode, "sys_sta_use_stas")
-                .eq(DictData::getValue, this.useStatus)
-        );
-        if (!Cools.isEmpty(dictData)){
+                .eq(DictData::getValue, this.useStatus));
+        if (!Cools.isEmpty(dictData)) {
             return String.valueOf(dictData.getLabel());
         }
         return "";
     }
 
+    public String getCreateBy$() {
+        UserService service = SpringUtils.getBean(UserService.class);
+        User user = service.getById(this.createBy);
+        if (!Cools.isEmpty(user)) {
+            return String.valueOf(user.getNickname());
+        }
+        return null;
+    }
 
+    public String getUpdateBy$() {
+        UserService service = SpringUtils.getBean(UserService.class);
+        User user = service.getById(this.updateBy);
+        if (!Cools.isEmpty(user)) {
+            return String.valueOf(user.getNickname());
+        }
+        return null;
+    }
 
-    public String getArea$(){
-        if (null == this.area){ return null; }
+    public String getArea$() {
+        if (null == this.area) {
+            return null;
+        }
         WarehouseAreasService service = SpringUtils.getBean(WarehouseAreasService.class);
         WarehouseAreas warehouseAreas = service.getById(this.area);
-        if (!Cools.isEmpty(warehouseAreas)){
+        if (!Cools.isEmpty(warehouseAreas)) {
             return String.valueOf(warehouseAreas.getName());
         }
         return null;
     }
 
-
-    public Boolean getStatusBool(){
-        if (null == this.status){ return null; }
-        switch (this.status){
+    public Boolean getStatusBool() {
+        if (null == this.status) {
+            return null;
+        }
+        switch (this.status) {
             case 1:
                 return true;
             case 0:
diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/MatnrGroupServiceImpl.java b/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/MatnrGroupServiceImpl.java
index 95ba62a..77ea6c1 100644
--- a/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/MatnrGroupServiceImpl.java
+++ b/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/MatnrGroupServiceImpl.java
@@ -13,7 +13,7 @@
 import org.springframework.stereotype.Service;
 
 import java.util.ArrayList;
-import java.util.List;
+import java.util.List;	
 import java.util.Map;
 import java.util.Objects;
 import java.util.stream.Collectors;
@@ -35,7 +35,7 @@
                         .like(MatnrGroup::getName, map.get("condition"))
                         .orderByAsc(MatnrGroup::getCode));
                 List<Long> collect = groups.stream().map(MatnrGroup::getId).collect(Collectors.toList());
-                List<MatnrGroup> list = this.list(new LambdaQueryWrapper<MatnrGroup>().in(MatnrGroup::getId, collect));
+                List<MatnrGroup> list = this.list(new LambdaQueryWrapper<MatnrGroup>().in(!collect.isEmpty(), MatnrGroup::getId, collect));
                 matnrs.addAll(list);
                 if (matnrs.isEmpty()) {
                     return new ArrayList<>();

--
Gitblit v1.9.1