From db0da79142146cd3de6e7fcca92dceeceb6d2665 Mon Sep 17 00:00:00 2001
From: skyouc
Date: 星期四, 04 九月 2025 13:42:27 +0800
Subject: [PATCH] 添加普通站点及下发任务站点管理功能

---
 rsf-admin/src/page/basicInfo/basStation/BasStationList.jsx                              |   53 +++---
 rsf-server/src/main/java/com/vincent/rsf/server/manager/schedules/TaskSchedules.java    |  172 ++++++++++++++++-----
 rsf-server/src/main/java/com/vincent/rsf/server/api/entity/enums/CallBackEvent.java     |   24 +++
 rsf-admin/src/i18n/zh.js                                                                |    1 
 rsf-server/src/main/java/com/vincent/rsf/server/manager/entity/BasStation.java          |   29 +--
 rsf-server/src/main/java/com/vincent/rsf/server/manager/enums/StationTypeEnum.java      |   33 ++++
 rsf-admin/src/i18n/en.js                                                                |    1 
 rsf-server/src/main/java/com/vincent/rsf/server/manager/schedules/AutoRunSchedules.java |  104 -------------
 rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/WcsServiceImpl.java    |   33 +++
 rsf-server/src/main/resources/application-dev.yml                                       |    8 
 10 files changed, 250 insertions(+), 208 deletions(-)

diff --git a/rsf-admin/src/i18n/en.js b/rsf-admin/src/i18n/en.js
index d908a9b..194a87e 100644
--- a/rsf-admin/src/i18n/en.js
+++ b/rsf-admin/src/i18n/en.js
@@ -233,6 +233,7 @@
                 stationName: 'stationName',
                 inAble: 'inAble',
                 outAble: 'outAble',
+                type: 'Site Type',
                 useStatus: 'useStatus',
                 status: 'status',
                 area: 'area',
diff --git a/rsf-admin/src/i18n/zh.js b/rsf-admin/src/i18n/zh.js
index 015c866..7de7d5e 100644
--- a/rsf-admin/src/i18n/zh.js
+++ b/rsf-admin/src/i18n/zh.js
@@ -254,6 +254,7 @@
             },
             basStation: {
                 stationName: '绔欑偣鍚嶇О',
+                type: '绔欑偣绫诲瀷',
                 inAble: '鑳藉叆',
                 outAble: '鑳藉嚭',
                 useStatus: '鐘舵��',
diff --git a/rsf-admin/src/page/basicInfo/basStation/BasStationList.jsx b/rsf-admin/src/page/basicInfo/basStation/BasStationList.jsx
index b757e28..7b02a1f 100644
--- a/rsf-admin/src/page/basicInfo/basStation/BasStationList.jsx
+++ b/rsf-admin/src/page/basicInfo/basStation/BasStationList.jsx
@@ -30,8 +30,8 @@
     ReferenceInput,
     ReferenceArrayInput,
     AutocompleteInput,
-    DeleteButton,    
-    
+    DeleteButton,
+
 } from 'react-admin';
 import { Box, Typography, Card, Stack } from '@mui/material';
 import { styled } from '@mui/material/styles';
@@ -64,10 +64,10 @@
 
 const filters = [
     <SearchInput source="condition" alwaysOn />,
-    <DateInput label='common.time.after' source="timeStart"  />,
-    <DateInput label='common.time.before' source="timeEnd"  />,
+    <DateInput label='common.time.after' source="timeStart" />,
+    <DateInput label='common.time.before' source="timeEnd" />,
 
-    <TextInput source="stationName" label="table.field.basStation.stationName" alwaysOn/>,
+    <TextInput source="stationName" label="table.field.basStation.stationName" alwaysOn />,
     <NumberInput source="inAble" label="table.field.basStation.inAble" />,
     <NumberInput source="outAble" label="table.field.basStation.outAble" />,
     <TextInput source="useStatus" label="table.field.basStation.useStatus" />,
@@ -127,26 +127,26 @@
                 <StyledDatagrid
                     preferenceKey='basStation'
                     bulkActionButtons={() => <BulkDeleteButton mutationMode={OPERATE_MODE} />}
-                    rowClick={(id, resource, record) => false}                    
+                    rowClick={(id, resource, record) => false}
                     expandSingle={true}
-                    omit={['id', 'createTime', 'createBy', 'memo','updateBy','autoTransfer']}
+                    omit={['id', 'createTime', 'createBy', 'memo', 'updateBy', 'autoTransfer']}
                 >
                     <NumberField source="id" />
+                    <TextField source="type$" label="table.field.basStation.type" />
                     <TextField source="stationName" label="table.field.basStation.stationName" />
                     <TextField source="useStatus$" label="table.field.basStation.useStatus" />
-                    <TextField source="barcode" label="table.field.basStation.barcode" />   
+                    <TextField source="barcode" label="table.field.basStation.barcode" />
                     <FunctionField
                         source="inAble"
                         label="table.field.basStation.inAble"
                         render={record => record.inAble === 1 ? '鏄�' : '鍚�'}
-                    />                    
+                    />
                     <FunctionField
                         source="outAble"
                         label="table.field.basStation.outAble"
                         render={record => record.inAble === 1 ? '鏄�' : '鍚�'}
                     />
-                    
-                    <NumberField source="area$" label="table.field.basStation.area" />                    
+                    <NumberField source="area$" label="table.field.basStation.area" />
                     <FunctionField
                         source="isCrossZone"
                         label="table.field.basStation.isCrossZone"
@@ -155,48 +155,43 @@
                     <WrapperField cellClassName="crossZoneArea" label="table.field.basStation.crossZoneArea">
                         <CrossZoneAreaField
                             open={areaFieldDialog}
-                            setOpen={setAreaFieldDialog}                
-                        />                        
-                    </WrapperField> 
+                            setOpen={setAreaFieldDialog}
+                        />
+                    </WrapperField>
                     <FunctionField
                         source="isWcs"
                         label="table.field.basStation.isWcs"
                         render={record => record.inAble === 1 ? '鏄�' : '鍚�'}
-                    />                   
-                    
+                    />
                     <WrapperField cellClassName="containerType" label="table.field.basStation.containerType">
                         <ContainerTypesField
                             open={areaFieldDialog2}
-                            setOpen={setAreaFieldDialog2}                
-                        />                        
+                            setOpen={setAreaFieldDialog2}
+                        />
                     </WrapperField>
                     <FunctionField
                         source="autoTransfer"
                         label="table.field.basStation.autoTransfer"
                         render={record => record.inAble === 1 ? '鏄�' : '鍚�'}
                     />
-                    <ReferenceField source="updateBy" label="common.field.updateBy" reference="user" link={false} sortable={false}>
-                        <TextField source="nickname" />
-                    </ReferenceField>
+                    <TextField source="updateBy$" label="common.field.updateBy" />
                     <DateField source="updateTime" label="common.field.updateTime" showTime />
-                    <ReferenceField source="createBy" label="common.field.createBy" reference="user" link={false} sortable={false}>
-                        <TextField source="nickname" />
-                    </ReferenceField>
-                    <DateField source="createTime" label="common.field.createTime" showTime />              
+                    <TextField source="createBy$" label="common.field.createBy" />
+                    <DateField source="createTime" label="common.field.createTime" showTime />
                     <BooleanField source="statusBool" label="common.field.status" sortable={false} />
                     <TextField source="memo" label="common.field.memo" sortable={false} />
-                    <WrapperField cellClassName="opt" label="common.field.opt">                        
+                    <WrapperField cellClassName="opt" label="common.field.opt">
                         <EditButton sx={{ padding: '1px', fontSize: '.75rem' }} />
                         <DeleteButton sx={{ padding: '1px', fontSize: '.75rem' }} mutationMode={OPERATE_MODE} />
-                    </WrapperField>                    
+                    </WrapperField>
                 </StyledDatagrid>
-                
+
             </List>
             <BasStationCreate
                 open={createDialog}
                 setOpen={setCreateDialog}
             />
-            
+
             <PageDrawer
                 title='BasStation Detail'
                 drawerVal={drawerVal}
diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/api/entity/enums/CallBackEvent.java b/rsf-server/src/main/java/com/vincent/rsf/server/api/entity/enums/CallBackEvent.java
new file mode 100644
index 0000000..a298394
--- /dev/null
+++ b/rsf-server/src/main/java/com/vincent/rsf/server/api/entity/enums/CallBackEvent.java
@@ -0,0 +1,24 @@
+package com.vincent.rsf.server.api.entity.enums;
+
+/**
+ * @author Ryan
+ * @date 2025/9/4
+ * @description: 鍥炶皟浜嬩欢
+ * @version 1.0
+ */
+public enum CallBackEvent {
+    /**浠诲姟鍥炶皟浜嬩欢*/
+    CALL_BACK_EVENT_START("START", "鍙栫瀹屾垚"),
+    CALL_BACK_EVENT_OBIT("OBIT", "鎼繍涓�"),
+    CALL_BACK_EVENT_END("END", "鏀剧瀹屾垚"),
+    ;
+
+    CallBackEvent( String event,  String desc) {
+        this.event = event;
+        this.desc = desc;
+    }
+
+    public String event;
+
+    public String desc;
+}
diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/WcsServiceImpl.java b/rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/WcsServiceImpl.java
index 6d24142..40d4c5d 100644
--- a/rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/WcsServiceImpl.java
+++ b/rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/WcsServiceImpl.java
@@ -18,6 +18,7 @@
 import com.vincent.rsf.server.api.entity.dto.LocTypeDto;
 import com.vincent.rsf.server.api.controller.erp.params.TaskInParam;
 import com.vincent.rsf.server.api.entity.dto.SyncLocsDto;
+import com.vincent.rsf.server.api.entity.enums.CallBackEvent;
 import com.vincent.rsf.server.api.entity.params.CommonRequest;
 import com.vincent.rsf.server.api.entity.params.ExMsgParams;
 import com.vincent.rsf.server.api.entity.params.WcsTaskParams;
@@ -464,13 +465,12 @@
         if (Objects.isNull(params)) {
             return R.error("鍙傛暟涓嶈兘涓虹┖锛侊紒");
         }
-
         Task task = taskService.getOne(new LambdaQueryWrapper<Task>().eq(Task::getTaskCode, params.getSeqNum()));
         if (Objects.isNull(task)) {
             throw new CoolException("浠诲姟涓嶅瓨鍦ㄥ彲宸茬粨鏉燂紒锛�");
         }
-
-        if (params.getEventType().equals("END")) {
+        /**鍙栫瀹屾垚*/
+        if (params.getEventType().equals(CallBackEvent.CALL_BACK_EVENT_END.event)) {
             if (task.getTaskType().equals(TaskType.TASK_TYPE_IN.type)
                     || task.getTaskType().equals(TaskType.TASK_TYPE_PICK_IN.type)
                     || task.getTaskType().equals(TaskType.TASK_TYPE_CHECK_IN.type)
@@ -482,10 +482,17 @@
                     throw new CoolException("浠诲姟鐘舵�佷慨鏀瑰け璐ワ紒锛�");
                 }
 
-                if (!basStationService.update(new LambdaUpdateWrapper<BasStation>()
-                        .eq(BasStation::getStationName, task.getOrgSite())
-                        .set(BasStation::getUseStatus, LocStsType.LOC_STS_TYPE_O.type))) {
-                    throw new CoolException("绔欑偣鐘舵�佷慨鏀瑰け璐ワ紒锛�");
+                if (!task.getTaskType().equals(TaskType.TASK_TYPE_LOC_MOVE.type)) {
+                    BasStation station = basStationService.getOne(new LambdaQueryWrapper<BasStation>().eq(BasStation::getStationName, task.getOrgSite()));
+                    if (Objects.isNull(station)) {
+                        throw new CoolException("鏁版嵁閿欒锛岀珯鐐逛笉瀛樺湪锛侊紒");
+                    }
+                    if (station.getType().equals(StationTypeEnum.STATION_TYPE_NORMAL.type)) {
+                        station.setUseStatus(LocStsType.LOC_STS_TYPE_O.type);
+                        if (!basStationService.updateById(station)) {
+                            throw new CoolException("绔欑偣鐘舵�佷慨鏀瑰け璐ワ紒锛�");
+                        }
+                    }
                 }
             } else if (task.getTaskType().equals(TaskType.TASK_TYPE_OUT.type)
                     || task.getTaskType().equals(TaskType.TASK_TYPE_PICK_AGAIN_OUT.type)
@@ -496,6 +503,18 @@
                         .set(Task::getTaskStatus, TaskStsType.COMPLETE_OUT.id))) {
                     throw new CoolException("浠诲姟鐘舵�佷慨鏀瑰け璐ワ紒锛�");
                 }
+                /**淇敼鍑哄簱绔欑偣鐘舵��*/
+                BasStation station = basStationService.getOne(new LambdaQueryWrapper<BasStation>()
+                        .eq(BasStation::getStationName, task.getTargSite()));
+                if (Objects.isNull(station)) {
+                    throw new CoolException("鏁版嵁閿欒锛岀珯鐐逛笉瀛樺湪锛侊紒");
+                }
+                if (station.getType().equals(StationTypeEnum.STATION_TYPE_NORMAL.type)) {
+                    station.setUseStatus(LocStsType.LOC_STS_TYPE_F.type);
+                    if (!basStationService.updateById(station)) {
+                        throw new CoolException("绔欑偣鐘舵�佷慨鏀瑰け璐ワ紒锛�");
+                    }
+                }
             }
         }
 
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 24f3eea..6481ea9 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
@@ -7,6 +7,7 @@
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.annotation.*;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.vincent.rsf.server.manager.enums.StationTypeEnum;
 import com.vincent.rsf.server.manager.service.WarehouseAreasService;
 import com.vincent.rsf.server.system.entity.DictData;
 import com.vincent.rsf.server.system.service.DictDataService;
@@ -44,6 +45,9 @@
      */
     @ApiModelProperty(value= "绔欑偣鍚嶇О")
     private String stationName;
+
+    @ApiModelProperty("绔欑偣绫诲瀷: {0:鍏夌數锛� 1:鏃犲厜鐢祡")
+    private Integer type;
 
     /**
      * 鍙叆
@@ -165,27 +169,10 @@
 
     public BasStation() {}
 
-
-
-//    BasStation basStation = new BasStation(
-//            null,    // 绔欑偣鍚嶇О
-//            null,    // 鍙叆
-//            null,    // 鍙嚭
-//            null,    // 鐘舵��
-//            null,    // 鎵�灞炲簱鍖篿d
-//            null,    // 鏄惁鍙法鍖�
-//            null,    // 鍙法鍖哄尯鍩焛d
-//            null,    // 鏄惁wcs绔欑偣
-//            null,    // wcs绔欑偣淇℃伅
-//            null,    // 瀹瑰櫒绫诲瀷
-//            null,    // 鏉$爜
-//            null,    // 鏄惁鑷姩璋冩嫧
-//            null,    // 澶囨敞
-//            null,    // 鍒涘缓浜�
-//            null,    // 鍒涘缓鏃堕棿
-//            null,    // 鏇存柊浜�
-//            null    // 鏇存柊鏃堕棿
-//    );
+    public String getType$() {
+        if (this.type == null) return null;
+        return StationTypeEnum.getStationDesc(this.type);
+    }
 
     public List<Long> getContainerTypes$(){
         if (Cools.isEmpty(this.containerType)){
diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/manager/enums/StationTypeEnum.java b/rsf-server/src/main/java/com/vincent/rsf/server/manager/enums/StationTypeEnum.java
new file mode 100644
index 0000000..9114759
--- /dev/null
+++ b/rsf-server/src/main/java/com/vincent/rsf/server/manager/enums/StationTypeEnum.java
@@ -0,0 +1,33 @@
+package com.vincent.rsf.server.manager.enums;
+
+/**
+ * @author Ryan
+ * @date 2025/9/4
+ * @description: 绔欑偣绫诲瀷
+ * @version 1.0
+ */
+public enum StationTypeEnum {
+    //绔欑偣绫诲瀷
+    STATION_TYPE_MUTI(0, "鍏夌數绔欑偣"),
+    STATION_TYPE_NORMAL(1, "鏅�氱珯鐐�"),
+            ;
+    /**绔欑偣绫诲瀷*/
+    public Integer type;
+    /**绔欑偣璇存槑*/
+    public String desc;
+
+    StationTypeEnum(Integer type, String desc) {
+        this.type = type;
+        this.desc = desc;
+    }
+
+    public static String  getStationDesc(Integer type) {
+        if (type.equals(STATION_TYPE_MUTI.type)) {
+            return STATION_TYPE_MUTI.desc;
+        } else if (type.equals(STATION_TYPE_NORMAL.type)) {
+            return STATION_TYPE_NORMAL.desc;
+        }
+        return null;
+    }
+
+}
diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/manager/schedules/AutoRunSchedules.java b/rsf-server/src/main/java/com/vincent/rsf/server/manager/schedules/AutoRunSchedules.java
index b7c426b..acc8148 100644
--- a/rsf-server/src/main/java/com/vincent/rsf/server/manager/schedules/AutoRunSchedules.java
+++ b/rsf-server/src/main/java/com/vincent/rsf/server/manager/schedules/AutoRunSchedules.java
@@ -242,7 +242,6 @@
             }
         }
 
-
         // 鍏ュ簱 搴旇鏍规嵁宸ヤ綔妗e洖鍘�
 //        this.runStaToLoc(locGroupList, staGroupList, staTaskMemo);
 
@@ -256,14 +255,6 @@
     private List<Loc> getAreaLocs(List<Integer> locGroupList, List<String> staGroupList, String memo) {
         Integer startRow = Collections.min(locGroupList);
         Integer endRow = Collections.max(locGroupList);
-
-        // STA IDLE
-//        LambdaQueryWrapper<BasStation> idleWrapper = new LambdaQueryWrapper<BasStation>().eq(BasStation::getUseStatus, LocStsType.LOC_STS_TYPE_O.type).in(BasStation::getStationName, staGroupList);
-//        List<BasStation> idleList = stationService.list(idleWrapper);
-//        if (Cools.isEmpty(idleList)) {
-//            return new ArrayList<>();
-//        }
-//        Collections.shuffle(idleList);
 
         // LOC STOCK
         LambdaQueryWrapper<Loc> stockWrapper = new LambdaQueryWrapper<Loc>().eq(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_F.type);
@@ -280,57 +271,8 @@
         Collections.shuffle(stockList);
 
         return stockList;
-        //鐢熸垚鍏ュ簱宸ヤ綔妗�
-//        generateTask(idleList.get(0).getStationName(), stockList.get(0).getCode(), idleList.get(0).getBarcode());
-    }
-
-
-    // 鍑哄簱
-    private void runLocToSta(List<Integer> locGroupList, List<String> staGroupList, String memo) {
-        Integer startRow = Collections.min(locGroupList);
-        Integer endRow = Collections.max(locGroupList);
-
-
-        // STA IDLE
-        LambdaQueryWrapper<BasStation> idleWrapper = new LambdaQueryWrapper<BasStation>().eq(BasStation::getUseStatus, LocStsType.LOC_STS_TYPE_O.type).in(BasStation::getStationName, staGroupList);
-        List<BasStation> idleList = stationService.list(idleWrapper);
-        if (Cools.isEmpty(idleList)) {
-            return;
-        }
-        Collections.shuffle(idleList);
-
-        // LOC STOCK
-        LambdaQueryWrapper<Loc> stockWrapper = new LambdaQueryWrapper<Loc>().eq(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_F.type);
-        if (null != startRow) {
-            stockWrapper.ge(Loc::getRow, startRow);
-        }
-        if (null != endRow) {
-            stockWrapper.le(Loc::getRow, endRow);
-        }
-        List<Loc> stockList = locService.list(stockWrapper);
-        if (Cools.isEmpty(stockList)) {
-            return;
-        }
-        Collections.shuffle(stockList);
-
-
-        Loc loc = stockList.get(0);
-        List<LocItem> list = locItemService.list(new LambdaQueryWrapper<LocItem>().eq(LocItem::getLocId, loc.getId()));
-        LocToTaskParams param = new LocToTaskParams();
-        param.setType(Constants.TASK_TYPE_OUT_STOCK);
-        param.setTarLoc(loc.getCode());
-        param.setItems(list);
-        param.setSiteNo(idleList.get(0).getStationName());
-        param.setMemo(memo);
-        //鐢熸垚鍑哄簱宸ヤ綔妗�
-        try {
-            locItemService.generateTask(TaskResouceType.TASK_RESOUCE_STOCK_TYPE.val, param, getLoginUserId());
-        } catch (Exception e) {
-            log.info("鐢熸垚鍑哄簱浠诲姟澶辫触", e);
-        }
 
     }
-
 
     // 绉诲簱
     private void runLocToLoc(List<Integer> locGroupList, String staTaskMemo) {
@@ -384,52 +326,6 @@
         }
 
     }
-
-    private void generateTask(String sourceStaNo, String locNo, String barcode) {
-        String ruleCode = SerialRuleUtils.generateRuleCode(SerialRuleCode.SYS_TASK_CODE, null);
-        if (StringUtils.isBlank(ruleCode)) {
-            throw new CoolException("缂栫爜閿欒锛氳纭缂栫爜銆孲YS_TASK_CODE銆嶆槸鍚﹀凡鐢熸垚!!");
-        }
-        Task task = new Task();
-        task.setTaskCode(ruleCode)
-                .setTaskStatus(TaskStsType.GENERATE_IN.id)
-                .setTaskType(TaskType.TASK_TYPE_IN.type)
-                .setResource(TaskResouceType.TASK_RESOUCE_PAKIN_TYPE.val)
-                .setTargLoc(locNo)
-                .setBarcode(barcode)
-                .setOrgSite(sourceStaNo)
-                .setCreateBy(6666L)
-                .setUpdateBy(6666L);
-
-        if (!taskService.save(task)) {
-            throw new CoolException("浠诲姟淇濆瓨澶辫触锛侊紒");
-        }
-        LambdaQueryWrapper<Matnr> wrapper = new LambdaQueryWrapper<>();
-        wrapper.eq(Matnr::getStatus, 1);
-        wrapper.orderByAsc(Matnr::getUpdateTime);
-        List<Matnr> list = matnrService.page(new Page<>(1, 100), wrapper).getRecords();
-        Collections.shuffle(list);
-        List<TaskItem> taskItems = new ArrayList<>();
-        int i = 0;
-        for (Matnr item : list) {
-            if (i > 5) {
-                break;
-            }
-            TaskItem taskItem = new TaskItem();
-            BeanUtils.copyProperties(item, taskItem);
-            taskItem.setTaskId(task.getId())
-                    .setOrderType(OrderType.ORDER_IN.type)
-                    .setCreateBy(6666L)
-                    .setUpdateBy(6666L)
-                    .setExtendFields(item.getExtendFields());
-            taskItems.add(taskItem);
-            item.setUpdateTime(new Date());
-            matnrService.updateById(item);
-            i++;
-        }
-        taskItemService.saveBatch(taskItems);
-    }
-
 
     public static List<String> getStaPrefixes(List<String> staGroupList) {
         Set<String> rowSet = new HashSet<>();
diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/manager/schedules/TaskSchedules.java b/rsf-server/src/main/java/com/vincent/rsf/server/manager/schedules/TaskSchedules.java
index 33a663a..d18a1c3 100644
--- a/rsf-server/src/main/java/com/vincent/rsf/server/manager/schedules/TaskSchedules.java
+++ b/rsf-server/src/main/java/com/vincent/rsf/server/manager/schedules/TaskSchedules.java
@@ -85,12 +85,12 @@
     private TransferOrderService transferOrderService;
     @Autowired
     private TransferService transferService;
-
     @Autowired
     private RestTemplate restTemplate;
-
     @Autowired
     private RemotesInfoProperties.RcsApi rcsApi;
+    @Autowired
+    private BasStationService basStationService;
 
     /**
      * @param
@@ -234,14 +234,9 @@
 //        }
     }
 
-    /**
-     * 浠诲姟鑷姩涓嬪彂
-     *
-     * @throws Exception
-     */
     @Scheduled(cron = "0/5 * * * * ?  ")
-
-    public void taskToWCS() {
+    @Transactional(rollbackFor = Exception.class)
+    public void pubTaskToWcs() {
         Long loginUserId = SystemAuthUtils.getLoginUserId();
         List<Integer> list = Arrays.asList(TaskType.TASK_TYPE_IN.type, TaskType.TASK_TYPE_OUT.type, TaskType.TASK_TYPE_LOC_MOVE.type, TaskType.TASK_TYPE_EMPITY_IN.type
                 , TaskType.TASK_TYPE_CHECK_IN.type, TaskType.TASK_TYPE_MERGE_IN.type, TaskType.TASK_TYPE_EMPITY_OUT.type,
@@ -252,36 +247,77 @@
                 .in(Task::getTaskStatus, integers)
                 .orderByDesc(Task::getSort));
         for (Task task : tasks) {
-//            Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getBarcode, task.getBarcode()));
-//            if (Objects.isNull(loc)) {
-//                continue;
-//            }
-//            //鍒ゆ柇鏄惁娣卞簱浣�
-//            if (!LocUtils.isShallowLoc(loc.getCode())) {
-//                //鑾峰彇娣卞簱浣嶅搴旂殑娴呭簱浣�
-//                String shallowLoc = LocUtils.getShallowLoc(loc.getCode());
-//                if (StringUtils.isBlank(shallowLoc)) {
-//                    continue;
-//                }
-//                Loc shalloc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getCode, shallowLoc));
-//                if (Objects.isNull(shalloc) || !shalloc.getUseStatus().equals(LocStsType.LOC_STS_TYPE_F.type)) {
-//                    //濡傛灉娴呭簱浣嶄笉鍦ㄥ簱璺冲嚭寰幆
-//                    continue;
-//                }
-//                LocToTaskParams params = new LocToTaskParams();
-//                params.setOrgLoc(shallowLoc).setType(TaskType.TASK_TYPE_LOC_MOVE.type + "");
-//                //鐢熸垚绉诲簱浠诲姟
-//                Task moveTask = locItemService.genMoveTask(params, loginUserId);
-//                moveTask.setSort(!Objects.isNull(task.getSort()) ? task.getSort() + 1 : Constants.TASK_SORT_DEFAULT_VALUE + 1);
-//                if (!taskService.updateById(moveTask)) {
-//                    throw new Exception("浠诲姟浼樺厛绾ф洿鏂板け璐ワ紒锛�");
-//                }
-//            }
-            //TODO 璋冪敤涓嬪彂浠诲姟鎺ュ彛
+            /**绉诲簱涓嶅仛绔欑偣鎿嶄綔*/
+            if (!task.getTaskType().equals(TaskType.TASK_TYPE_LOC_MOVE.type)) {
+                BasStation station = basStationService.getOne(new LambdaQueryWrapper<BasStation>().eq(BasStation::getStationName,
+                        task.getTaskStatus().equals(TaskStsType.GENERATE_IN.id) ? task.getOrgSite() : task.getTargSite()));
+                if (station.getType().equals(StationTypeEnum.STATION_TYPE_MUTI.type)) {
+                    continue;
+                }
+            }
+            /**涓嬪彂鏅�氱珯鐐逛换鍔★紝鎶ラ敊鍥炴粴锛屼笉鍐嶅線涓嬫墽琛�*/
+            pubTaskToWcs(task);
+        }
+    }
+
+    /**
+     * @author Ryan
+     * @date 2025/9/4
+     * @description: 鍏夌數绔欑偣浠诲姟涓嬪彂
+     * @version 1.0
+     */
+    @Scheduled(cron = "0/5 * * * * ?  ")
+    @Transactional(rollbackFor = Exception.class)
+    public void taskToWCS() throws Exception {
+        Long loginUserId = SystemAuthUtils.getLoginUserId();
+        List<Integer> list = Arrays.asList(TaskType.TASK_TYPE_IN.type, TaskType.TASK_TYPE_OUT.type, TaskType.TASK_TYPE_LOC_MOVE.type, TaskType.TASK_TYPE_EMPITY_IN.type
+                , TaskType.TASK_TYPE_CHECK_IN.type, TaskType.TASK_TYPE_MERGE_IN.type, TaskType.TASK_TYPE_EMPITY_OUT.type,
+                TaskType.TASK_TYPE_PICK_AGAIN_OUT.type, TaskType.TASK_TYPE_CHECK_OUT.type, TaskType.TASK_TYPE_MERGE_OUT.type);
+        List<Integer> integers = Arrays.asList(TaskStsType.GENERATE_IN.id, TaskStsType.GENERATE_OUT.id);
+        List<Task> tasks = taskService.list(new LambdaQueryWrapper<Task>()
+                .in(Task::getTaskType, list)
+                .in(Task::getTaskStatus, integers)
+                .orderByDesc(Task::getSort));
+        for (Task task : tasks) {
+            /**绉诲簱涓嶅仛绔欑偣鎿嶄綔*/
+            if (!task.getTaskType().equals(TaskType.TASK_TYPE_LOC_MOVE.type)) {
+                BasStation station = basStationService.getOne(new LambdaQueryWrapper<BasStation>().eq(BasStation::getStationName,
+                        task.getTaskStatus().equals(TaskStsType.GENERATE_IN.id) ? task.getOrgSite() : task.getTargSite()));
+                /**杩囨护鎺夋櫘閫氱珯鐐逛换鍔�*/
+                if (station.getType().equals(StationTypeEnum.STATION_TYPE_NORMAL.type)) {
+                    continue;
+                }
+                Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getBarcode, task.getBarcode()));
+                if (Objects.isNull(loc)) {
+                    continue;
+                }
+                //鍒ゆ柇鏄惁娣卞簱浣�
+                if (!LocUtils.isShallowLoc(loc.getCode())) {
+                    //鑾峰彇娣卞簱浣嶅搴旂殑娴呭簱浣�
+                    String shallowLoc = LocUtils.getShallowLoc(loc.getCode());
+                    if (StringUtils.isBlank(shallowLoc)) {
+                        continue;
+                    }
+                    Loc shalloc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getCode, shallowLoc));
+                    if (Objects.isNull(shalloc) || !shalloc.getUseStatus().equals(LocStsType.LOC_STS_TYPE_F.type)) {
+                        //濡傛灉娴呭簱浣嶄笉鍦ㄥ簱璺冲嚭寰幆
+                        continue;
+                    }
+                    LocToTaskParams params = new LocToTaskParams();
+                    params.setOrgLoc(shallowLoc).setType(TaskType.TASK_TYPE_LOC_MOVE.type + "");
+                    //鐢熸垚绉诲簱浠诲姟
+                    Task moveTask = locItemService.genMoveTask(params, loginUserId);
+                    moveTask.setSort(!Objects.isNull(task.getSort()) ? task.getSort() + 1 : Constants.TASK_SORT_DEFAULT_VALUE + 1);
+                    if (!taskService.updateById(moveTask)) {
+                        throw new Exception("浠诲姟浼樺厛绾ф洿鏂板け璐ワ紒锛�");
+                    }
+                }
+            }
+            /**涓嬪彂浠诲姟*/
             try {
                 pubTaskToWcs(task);
             } catch (Exception e) {
-                log.error(e.getMessage());
+                log.error("浠诲姟涓嬪彂澶辫触锛侊紒", e);
             }
         }
     }
@@ -321,16 +357,36 @@
         //浠诲姟绫诲瀷锛屼换鍔$紪鐮�
         itemParam.setTaskType(RcsTaskType.getTypeDesc(task.getTaskType()))
                 .setSeqNum(task.getTaskCode());
-
         //涓诲弬鏁�
         taskParams.setBatch(task.getBarcode());
 
-        if (task.getTaskType().equals(TaskType.TASK_TYPE_IN.type)
+        BasStation station = basStationService.getOne(new LambdaQueryWrapper<BasStation>().eq(BasStation::getStationName, task.getTargSite()));
+        if (Objects.isNull(station)) {
+            throw new CoolException("绔欑偣涓嶅瓨鍦紒锛�");
+        }
+        /**鍒ゆ柇鏄惁鍏夌數绔欑偣锛岄潪鍏夊簵绔欑偣闇�绠℃帶绔欑偣鐘舵��*/
+        if (station.getType().equals(StationTypeEnum.STATION_TYPE_NORMAL.type)) {
+            if (task.getTaskType() <= TaskType.TASK_TYPE_CHECK_IN.type && task.getTaskType().equals(TaskType.TASK_TYPE_LOC_MOVE.type)) {
+                if (!station.getUseStatus().equals(LocStsType.LOC_STS_TYPE_F.type)) {
+                    throw new CoolException("褰撳墠绔欑偣涓嶆槸F.鍦ㄥ簱鐘舵�侊紒锛�");
+                }
+            } else if (task.getTaskType() >= TaskType.TASK_TYPE_OUT.type) {
+                if (!station.getUseStatus().equals(LocStsType.LOC_STS_TYPE_O.type)) {
+                    throw new CoolException("鐩爣绔欑偣涓嶆槸O.绌洪棽鐘舵�侊紒锛�");
+                }
+            }
+        }
+        /**绉诲簱鍙傛暟*/
+        if (task.getTaskType().equals(TaskType.TASK_TYPE_LOC_MOVE.type)) {
+            itemParam.setOriLoc(task.getOrgLoc()).setDestLoc(task.getTargLoc());
+        } else if (task.getTaskType().equals(TaskType.TASK_TYPE_IN.type)
                 || task.getTaskType().equals(TaskType.TASK_TYPE_MERGE_IN.type)
                 || task.getTaskType().equals(TaskType.TASK_TYPE_EMPITY_IN.type)) {
+            /**鍏ㄦ澘鍏ュ簱鍙傛暟*/
             itemParam.setDestLoc(task.getTargLoc())
                     .setOriSta(task.getOrgSite());
         } else if (task.getTaskType().equals(TaskType.TASK_TYPE_CHECK_IN.type) || task.getTaskType().equals(TaskType.TASK_TYPE_PICK_IN.type)) {
+            /**鎷f枡/鐩樼偣鍏ュ簱鍙傛暟*/
             itemParam.setDestLoc(task.getTargLoc())
                     .setOriSta(task.getTargSite());
         } else if (task.getTaskType().equals(TaskType.TASK_TYPE_OUT.type)
@@ -338,13 +394,27 @@
                 || task.getTaskType().equals(TaskType.TASK_TYPE_EMPITY_OUT.type)
                 || task.getTaskType().equals(TaskType.TASK_TYPE_CHECK_OUT.type)
                 || task.getTaskType().equals(TaskType.TASK_TYPE_MERGE_OUT.type)) {
-
+            /**鍑哄簱鍙傛暟*/
             itemParam.setOriLoc(task.getOrgLoc())
                     .setDestSta(task.getTargSite());
-        } else if (task.getTaskType().equals(TaskType.TASK_TYPE_LOC_MOVE.type)) {
-            itemParam.setOriLoc(task.getOrgLoc()).setDestLoc(task.getTargLoc());
         } else {
+            /**绔欑偣闂寸Щ搴撳弬鏁�*/
             itemParam.setOriSta(task.getOrgSite()).setDestSta(task.getTargSite());
+
+            BasStation curSta = basStationService.getOne(new LambdaQueryWrapper<BasStation>().eq(BasStation::getStationName, task.getOrgSite()));
+            if (Objects.isNull(curSta)) {
+                throw new CoolException("绔欑偣涓嶅瓨鍦紒锛�");
+            }
+            if (curSta.getType().equals(StationTypeEnum.STATION_TYPE_NORMAL.type)) {
+                if (!curSta.getUseStatus().equals(LocStsType.LOC_STS_TYPE_F.type)) {
+                    throw new CoolException("褰撳墠绔欑偣涓嶆槸F.鍦ㄥ簱鐘舵�侊紒锛�");
+                }
+            }
+            if (station.getType().equals(StationTypeEnum.STATION_TYPE_NORMAL.type)) {
+                if (!station.getUseStatus().equals(LocStsType.LOC_STS_TYPE_O.type)) {
+                    throw new CoolException("鐩爣绔欑偣涓嶆槸O.绌洪棽鐘舵�侊紒锛�");
+                }
+            }
         }
 
         List<TaskItemParam> items = Arrays.asList(itemParam);
@@ -381,16 +451,32 @@
                                 .set(Task::getTaskStatus, TaskStsType.WCS_EXECUTE_IN.id))) {
                             throw new CoolException("浠诲姟鐘舵�佷慨鏀瑰け璐ワ紒锛�");
                         }
+                        /**鎺掗櫎绉诲簱鍔熻兘*/
+                        if (!task.getTaskType().equals(TaskType.TASK_TYPE_LOC_MOVE.type)) {
+                            /**濡傛灉鏄櫘閫氱珯鐐癸紝淇敼绔欑偣鐘舵�佷负鍑哄簱棰勭害*/
+                            if (station.getType().equals(StationTypeEnum.STATION_TYPE_NORMAL.type)) {
+                                station.setUseStatus(LocStsType.LOC_STS_TYPE_R.type);
+                                if (!basStationService.updateById(station)) {
+                                    throw new CoolException("绔欑偣棰勭害澶辫触锛侊紒");
+                                }
+                            }
+                        }
                     } else if (task.getTaskType().equals(TaskType.TASK_TYPE_OUT.type)
                             || task.getTaskType().equals(TaskType.TASK_TYPE_CHECK_OUT.type)
                             || task.getTaskType().equals(TaskType.TASK_TYPE_MERGE_OUT.type)
                             || task.getTaskType().equals(TaskType.TASK_TYPE_EMPITY_OUT.type)
-                            || task.getTaskType().equals(TaskType.TASK_TYPE_PICK_AGAIN_OUT.type)
-                    ) {
+                            || task.getTaskType().equals(TaskType.TASK_TYPE_PICK_AGAIN_OUT.type)) {
                         if (!taskService.update(new LambdaUpdateWrapper<Task>().eq(Task::getTaskCode, task.getTaskCode())
                                 .set(Task::getTaskStatus, TaskStsType.WCS_EXECUTE_OUT.id))) {
                             throw new CoolException("浠诲姟鐘舵�佷慨鏀瑰け璐ワ紒锛�");
                         }
+                        /**濡傛灉鏄櫘閫氱珯鐐癸紝淇敼绔欑偣鐘舵�佷负鍏ュ簱棰勭害*/
+                        if (station.getType().equals(StationTypeEnum.STATION_TYPE_NORMAL.type)) {
+                            station.setUseStatus(LocStsType.LOC_STS_TYPE_S.type);
+                            if (!basStationService.updateById(station)) {
+                                throw new CoolException("绔欑偣棰勭害澶辫触锛侊紒");
+                            }
+                        }
                     }
                 } else {
                     throw new CoolException("浠诲姟涓嬪彂澶辫触锛侊紒");
diff --git a/rsf-server/src/main/resources/application-dev.yml b/rsf-server/src/main/resources/application-dev.yml
index a817733..72f5cf3 100644
--- a/rsf-server/src/main/resources/application-dev.yml
+++ b/rsf-server/src/main/resources/application-dev.yml
@@ -14,10 +14,10 @@
 #    url: jdbc:mysql://47.76.147.249:3306/rsf?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai
 #    username: rsf
     username: root
-    url: jdbc:mysql://10.10.10.200:3306/rsf?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai
-    password: xltys1995
-#    url: jdbc:mysql://127.0.0.1:3306/rsf?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai
-#    password: 34821015
+#    url: jdbc:mysql://10.10.10.200:3306/rsf?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai
+#    password: xltys1995
+    url: jdbc:mysql://127.0.0.1:3306/rsf?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai
+    password: 34821015
     type: com.alibaba.druid.pool.DruidDataSource
     druid:
       initial-size: 5

--
Gitblit v1.9.1