wanshenmean
9 天以前 4fc1be40676b5f9928da3a83bdb1c215d0584ae9
Merge branch 'dev' of http://115.159.85.185:8098/r/SuZhouGuanHong/ShanMeiXinNengYuan into dev
已添加1个文件
已修改15个文件
387 ■■■■ 文件已修改
Code/WCS/WIDESEAWCS_Client/src/views/taskinfo/task.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_DTO/TaskInfo/WMSTaskDTO.cs 48 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/System/Sys_DictionaryController.cs 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/appsettings.json 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code/WMS/WIDESEA_WMSClient/src/views/system/Sys_Log.vue 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code/WMS/WIDESEA_WMSClient/src/views/taskinfo/task_hty.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/LocationInfoService.cs 24 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code/WMS/WIDESEA_WMSServer/WIDESEA_DTO/Task/WMSTaskDTO.cs 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code/WMS/WIDESEA_WMSServer/WIDESEA_ITaskInfoService/ITaskService.cs 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code/WMS/WIDESEA_WMSServer/WIDESEA_SystemService/Sys_DictionaryService.cs 67 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_AGV.cs 142 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_WCS.cs 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/TaskInfo/TaskController.cs 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/appsettings.json 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目资料/极卷库AGV接口/~$极卷库出入库.docx 补丁 | 查看 | 原始文档 | blame | 历史
Code/WCS/WIDESEAWCS_Client/src/views/taskinfo/task.vue
@@ -52,7 +52,7 @@
        },
        {
          title: "任务状态",
          field: "taskState",
          field: "taskStatus",
          type: "selectList",
          dataKey: "taskState",
          data: [],
@@ -111,7 +111,7 @@
        bind: { key: "taskType", data: [] },
      },
      {
        field: "taskState",
        field: "taskStatus",
        title: "任务状态",
        type: "int",
        width: 150,
Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_DTO/TaskInfo/WMSTaskDTO.cs
@@ -1,4 +1,6 @@
using System;
using Magicodes.ExporterAndImporter.Core;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -11,17 +13,17 @@
        /// <summary>
        /// WMS任务主键
        /// </summary>
        public int Id {  get; set; }
        public int Id { get; set; }
        /// <summary>
        /// ä»»åŠ¡å·
        /// </summary>
        public int TaskNum {  get; set; }
        public int TaskNum { get; set; }
        /// <summary>
        /// æ‰˜ç›˜å·
        /// </summary>
        public string PalletCode {  get; set; }
        public string PalletCode { get; set; }
        /// <summary>
        /// å··é“号
@@ -31,7 +33,7 @@
        /// <summary>
        /// ä»»åŠ¡ç±»åž‹
        /// </summary>
        public int TaskType {  get; set; }
        public int TaskType { get; set; }
        /// <summary>
        /// ä»»åŠ¡çŠ¶æ€
@@ -41,16 +43,44 @@
        /// <summary>
        /// èµ·ç‚¹
        /// </summary>
        public string SourceAddress {  get; set; }
        public string SourceAddress { get; set; }
        /// <summary>
        /// ç»ˆç‚¹
        /// </summary>
        public string TargetAddress {  get; set; }
        public string TargetAddress { get; set; }
        /// <summary>
        /// å½“前位置
        /// </summary>
        public string CurrentAddress { get; set; }
        /// <summary>
        /// ä¸‹ä¸€åœ°å€
        /// </summary>
        public string NextAddress { get; set; }
        /// <summary>
        /// ä¼˜å…ˆçº§
        /// </summary>
        public int Grade {  get; set; }
        public int Grade { get; set; }
        /// <summary>
        ///
        /// </summary>
        public int WarehouseId { get; set; }
        /// <summary>
        ///
        /// </summary>
        public string AGVArea { get; set; }
        /// <summary>
        ///
        /// </summary>
        public int PalletType { get; set; }
    }
}
}
Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/System/Sys_DictionaryController.cs
@@ -318,6 +318,28 @@
                            }
                            #endregion
                            #region TaskRobotStatusEnum
                            {
                                Type type = typeof(TaskRobotStatusEnum);
                                List<int> enums = Enum.GetValues(typeof(TaskRobotStatusEnum)).Cast<int>().ToList();
                                int index = 0;
                                foreach (var item in enums)
                                {
                                    FieldInfo? fieldInfo = typeof(TaskRobotStatusEnum).GetField(((TaskRobotStatusEnum)item).ToString());
                                    DescriptionAttribute? description = fieldInfo.GetCustomAttribute<DescriptionAttribute>();
                                    if (description != null)
                                    {
                                        data.Add(new { key = item.ToString(), value = description.Description });
                                    }
                                    else
                                    {
                                        data.Add(new { key = item.ToString(), value = item.ToString() });
                                    }
                                    index++;
                                }
                            }
                            #endregion
                            result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data };
                        }
                        break;
@@ -369,7 +391,7 @@
                            result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data };
                        }
                        break;
                        case "dispatchId":
                    case "dispatchId":
                        {
                            Type type = typeof(IJob);
                            var basePath = AppContext.BaseDirectory;
@@ -403,4 +425,4 @@
            }
        }
    }
}
}
Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/appsettings.json
@@ -32,7 +32,8 @@
  //5.PostgreSQL
  "DBType": "SqlServer",
  //连接字符串
  "ConnectionString": "Data Source=.;Initial Catalog=WIDESEAWCS_ShanMei;User ID=sa;Password=P@ssw0rd;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
  //"ConnectionString": "Data Source=.;Initial Catalog=WIDESEAWCS_ShanMei;User ID=sa;Password=P@ssw0rd;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
  "ConnectionString": "Data Source=.;Initial Catalog=WIDESEAWCS_ShanMei;User ID=sa;Password=123456;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
  //跨域
  "Cors": {
@@ -128,4 +129,4 @@
      "MaxMemoryPolicy": "allkeys-lru" //内存淘汰策略:allkeys-lru, volatile-lru, noeviction等
    }
  }
}
}
Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs
@@ -112,6 +112,7 @@
                    InitializeTaskOnReceive(task, item);
                    tasks.Add(task);
                }
                // TOOD: è¿™é‡Œæ³¨æ„æ·»åŠ é”™è¯¯è¦è¿”å›žé”™è¯¯
                BaseDal.AddData(tasks);
                _taskExecuteDetailService.AddTaskExecuteDetail(tasks.Select(x => x.TaskNum).ToList(), "接收WMS任务");
@@ -726,4 +727,4 @@
        [DataLength(22)]
        public string Barcode { get; set; }
    }
}
}
Code/WMS/WIDESEA_WMSClient/src/views/system/Sys_Log.vue
@@ -62,7 +62,7 @@
        field: "beginDate",
        title: "开始时间",
        type: "datetime",
        width: 140,
        width: 70,
        align: "left",
        sortable: true,
      },
@@ -70,7 +70,7 @@
        field: "elapsedTime",
        title: "时长",
        type: "int",
        width: 60,
        width: 40,
        align: "left",
      },
      {
@@ -86,14 +86,14 @@
        field: "requestParam",
        title: "请求参数",
        type: "string",
        width: 70,
        width: 100,
        align: "left",
      },
      {
        field: "responseParam",
        title: "响应参数",
        type: "string",
        width: 70,
        width: 100,
        align: "left",
      },
      {
@@ -153,5 +153,4 @@
    };
  },
});
</script>
</script>
Code/WMS/WIDESEA_WMSClient/src/views/taskinfo/task_hty.vue
@@ -96,7 +96,7 @@
        type: "int",
        width: 120,
        align: "left",
        bind: { key: "taskType", data: [] },
        bind: { key: "taskTypeEnum", data: [] },
      },
      {
        field: "taskStatus",
Code/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/LocationInfoService.cs
@@ -25,6 +25,7 @@
        private readonly IRepository<Dt_Task> _taskRepository;
        private readonly IRepository<Dt_StockInfo> _stockInfoRepository;
        private readonly IRecordService _recordService;
        private readonly IRepository<Dt_Warehouse> _warehouseRepository;
        /// <summary>
        /// æž„造函数
@@ -36,6 +37,7 @@
            IRepository<Dt_LocationInfo> baseDal,
            IRepository<Dt_Task> taskRepository,
            IRepository<Dt_StockInfo> stockInfoRepository,
            IRepository<Dt_Warehouse> warehouseRepository,
            IMapper mapper,
            IRecordService recordService) : base(baseDal)
        {
@@ -43,6 +45,7 @@
            _stockInfoRepository = stockInfoRepository;
            _mapper = mapper;
            _recordService = recordService;
            _warehouseRepository = warehouseRepository;
        }
        /// <summary>
@@ -141,10 +144,10 @@
                x.LocationStatus == LocationStatusEnum.Free.GetHashCode());
            return locations?
                .OrderBy(x => x.Layer)
                .ThenByDescending(x => x.Depth)
                .ThenBy(x => x.Column)
                .ThenBy(x => x.Row)
                .OrderByDescending(x => x.Depth)  // 1. æ·±åº¦ä¼˜å…ˆï¼ˆä»Žå¤§åˆ°å°ï¼‰
                .ThenBy(x => x.Layer)             // 2. å±‚æ•°
                .ThenBy(x => x.Column)            // 3. åˆ—
                .ThenBy(x => x.Row)               // 4. è¡Œ
                .FirstOrDefault();
        }
@@ -494,11 +497,18 @@
        /// <param name="layer">层数</param>
        /// <param name="depth">深度</param>
        /// <returns>货位信息对象</returns>
        private static Dt_LocationInfo CreateLocationInfo(string roadwayNo, int row, int col, int layer, int depth)
        private Dt_LocationInfo CreateLocationInfo(string roadwayNo, int row, int col, int layer, int depth)
        {
            var warehouse = _warehouseRepository.QueryData(x => x.WarehouseCode == roadwayNo).FirstOrDefault();
            if (warehouse == null)
            {
                throw new InvalidOperationException($"未找到巷道编号为 {roadwayNo} çš„仓库信息");
            }
            return new Dt_LocationInfo
            {
                WarehouseId = 0,
                WarehouseId = warehouse.WarehouseId,
                Row = row,
                Column = col,
                Layer = layer,
@@ -507,7 +517,7 @@
                EnableStatus = EnableStatusEnum.Normal.GetHashCode(),
                LocationStatus = LocationStatusEnum.Free.GetHashCode(),
                LocationType = LocationTypeEnum.Undefined.GetHashCode(),
                LocationCode = $"{row:D3}-{col:D3}-{layer:D3}",
                LocationCode = $"{roadwayNo}-{row:D3}-{col:D3}-{layer:D3}",
                LocationName = $"{roadwayNo}巷道{row:D3}行{col:D3}列{layer:D3}层{depth:D2}æ·±"
            };
        }
Code/WMS/WIDESEA_WMSServer/WIDESEA_DTO/Task/WMSTaskDTO.cs
@@ -52,6 +52,16 @@
        public string TargetAddress { get; set; }
        /// <summary>
        /// å½“前位置
        /// </summary>
        public string CurrentAddress { get; set; }
        /// <summary>
        /// ä¸‹ä¸€åœ°å€
        /// </summary>
        public string NextAddress { get; set; }
        /// <summary>
        /// ä¼˜å…ˆçº§
        /// </summary>
        public int Grade { get; set; }
@@ -72,4 +82,4 @@
        public int PalletType { get; set; }
    }
}
}
Code/WMS/WIDESEA_WMSServer/WIDESEA_ITaskInfoService/ITaskService.cs
@@ -172,24 +172,19 @@
        public Task<WebResponseContent> OutTaskComplete(OutTaskCompleteDto outTaskCompleteDto);
        /// <summary>
        /// ä»»åŠ¡å®ŒæˆæŽ¥å£
        /// </summary>
        /// <param name="wCSTask"></param>
        /// <returns></returns>
        //public Task<WebResponseContent> TaskCompleted(WCSTaskDTO wCSTask);
        /// <summary>
        /// ä»»åŠ¡å–æ¶ˆ
        /// </summary>
        /// <param name="taskCancelDto">请求参数</param>
        /// <returns></returns>
        public Task<AGVResponse> TaskCancelAsync(TaskCancelDto taskCancelDto);
        /// <summary>
        /// å–放货完成
        /// </summary>
        /// <param name="taskCompleteDto">请求参数</param>
        /// <returns></returns>
        public Task<AGVResponse> TaskCompleteAsync(TaskCompleteDto taskCompleteDto);
        /// <summary>
        /// è¾“送线申请进入
        /// </summary>
@@ -199,4 +194,4 @@
        #endregion æžå·åº“任务模块
    }
}
}
Code/WMS/WIDESEA_WMSServer/WIDESEA_SystemService/Sys_DictionaryService.cs
@@ -204,12 +204,12 @@
                            List<object> data = new List<object>();
                            {
                                Type type = typeof(TaskTypeEnum);
                                List<int> enums = Enum.GetValues(typeof(TaskTypeEnum)).Cast<int>().ToList();
                                Type type = typeof(TaskInboundTypeEnum);
                                List<int> enums = Enum.GetValues(typeof(TaskInboundTypeEnum)).Cast<int>().ToList();
                                int index = 0;
                                foreach (var item in enums)
                                {
                                    FieldInfo? fieldInfo = typeof(TaskTypeEnum).GetField(((TaskTypeEnum)item).ToString());
                                    FieldInfo? fieldInfo = typeof(TaskInboundTypeEnum).GetField(((TaskInboundTypeEnum)item).ToString());
                                    DescriptionAttribute? description = fieldInfo.GetCustomAttribute<DescriptionAttribute>();
                                    if (description != null)
                                    {
@@ -223,6 +223,65 @@
                                }
                            }
                            {
                                Type type = typeof(TaskOutboundTypeEnum);
                                List<int> enums = Enum.GetValues(typeof(TaskOutboundTypeEnum)).Cast<int>().ToList();
                                int index = 0;
                                foreach (var item in enums)
                                {
                                    FieldInfo? fieldInfo = typeof(TaskOutboundTypeEnum).GetField(((TaskOutboundTypeEnum)item).ToString());
                                    DescriptionAttribute? description = fieldInfo.GetCustomAttribute<DescriptionAttribute>();
                                    if (description != null)
                                    {
                                        data.Add(new { key = item.ToString(), value = description.Description });
                                    }
                                    else
                                    {
                                        data.Add(new { key = item.ToString(), value = item.ToString() });
                                    }
                                    index++;
                                }
                            }
                            {
                                Type type = typeof(TaskRelocationTypeEnum);
                                List<int> enums = Enum.GetValues(typeof(TaskRelocationTypeEnum)).Cast<int>().ToList();
                                int index = 0;
                                foreach (var item in enums)
                                {
                                    FieldInfo? fieldInfo = typeof(TaskRelocationTypeEnum).GetField(((TaskRelocationTypeEnum)item).ToString());
                                    DescriptionAttribute? description = fieldInfo.GetCustomAttribute<DescriptionAttribute>();
                                    if (description != null)
                                    {
                                        data.Add(new { key = item.ToString(), value = description.Description });
                                    }
                                    else
                                    {
                                        data.Add(new { key = item.ToString(), value = item.ToString() });
                                    }
                                    index++;
                                }
                            }
                            {
                                Type type = typeof(RobotTaskTypeEnum);
                                List<int> enums = Enum.GetValues(typeof(RobotTaskTypeEnum)).Cast<int>().ToList();
                                int index = 0;
                                foreach (var item in enums)
                                {
                                    FieldInfo? fieldInfo = typeof(RobotTaskTypeEnum).GetField(((RobotTaskTypeEnum)item).ToString());
                                    DescriptionAttribute? description = fieldInfo.GetCustomAttribute<DescriptionAttribute>();
                                    if (description != null)
                                    {
                                        data.Add(new { key = item.ToString(), value = description.Description });
                                    }
                                    else
                                    {
                                        data.Add(new { key = item.ToString(), value = item.ToString() });
                                    }
                                    index++;
                                }
                            }
                            result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data };
                        }
                        break;
@@ -491,4 +550,4 @@
            }
        }
    }
}
}
Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_AGV.cs
@@ -14,13 +14,12 @@
{
    public partial class TaskService
    {
        #region æžå·åº“任务模块
        public string AGV_OutTaskComplete = WIDESEA_Core.Helper.AppSettings.Configuration["AGV_OutTaskComplete"];
        public string WCS_ReceiveTask = WIDESEA_Core.Helper.AppSettings.Configuration["WCS_ReceiveTask"];
        /// <summary>
        /// å‡ºå…¥åº“申请。
        /// æžå·åº“出入库申请
        /// </summary>
        public async Task<AGVResponse> ApplyInOutAsync(ApplyInOutDto applyInOutDto)
        {
@@ -32,7 +31,7 @@
                if (validationMessage != null)
                    return response.Error(validationMessage);
                var existingTask = await BaseDal.QueryFirstAsync(x => x.PalletCode == applyInOutDto.TrayNumber);
                var existingTask = await BaseDal.QueryFirstAsync(x => x.PalletCode == applyInOutDto.TrayNumber || x.OrderNo == applyInOutDto.TaskId);
                if (existingTask != null)
                    return response.Error($"WMS已有当前任务,不可重复下发,任务号:{applyInOutDto.TaskId}");
@@ -61,7 +60,7 @@
        }
        /// <summary>
        /// æ‰‹åŠ¨å‡ºåº“å®Œæˆåé¦ˆç»™AGV。
        /// æ‰‹åŠ¨å‡ºåº“å®Œæˆåé¦ˆç»™AGV
        /// </summary>
        public async Task<WebResponseContent> OutTaskComplete(OutTaskCompleteDto outTaskCompleteDto)
        {
@@ -83,7 +82,7 @@
                    return response.Error(httpResponse?.Msg ?? "AGV接口调用异常");
                if (!httpResponse.Code)
                    return response.Error(string.IsNullOrWhiteSpace(httpResponse.Msg) ? "AGV接口调用失败" : httpResponse.Msg);
                        return response.Error(string.IsNullOrWhiteSpace(httpResponse.Msg) ? "AGV接口调用失败" : httpResponse.Msg);
                var syncResult = await CompleteLocalOutboundAfterAgvAckAsync(task);
                return syncResult.Status ? response.OK(httpResponse.Msg) : syncResult;
@@ -96,7 +95,7 @@
        }
        /// <summary>
        /// è¾“送线申请进入。
        /// è¾“送线申请进入
        /// </summary>
        public async Task<AGVResponse> ApplyEnterAsync(ApplyEnterDto applyEnterDto)
        {
@@ -124,7 +123,7 @@
        }
        /// <summary>
        /// å–放货完成。
        /// å–放货完成
        /// </summary>
        public async Task<AGVResponse> TaskCompleteAsync(TaskCompleteDto taskCompleteDto)
        {
@@ -152,7 +151,7 @@
        }
        /// <summary>
        /// ä»»åŠ¡å–æ¶ˆã€‚
        /// ä»»åŠ¡å–æ¶ˆ
        /// </summary>
        public async Task<AGVResponse> TaskCancelAsync(TaskCancelDto taskCancelDto)
        {
@@ -183,6 +182,7 @@
            }
        }
        #region å‚数验证
        private static string? ValidateApplyInOutRequest(ApplyInOutDto dto)
        {
            if (dto == null) return "请求参数不能为空";
@@ -231,7 +231,10 @@
            if (string.IsNullOrWhiteSpace(dto.TaskId)) return "任务号不能为空";
            return null;
        }
        #endregion å‚数验证
        #region å…·ä½“实现
        // å‡ºå…¥åº“共用创建任务
        private Dt_Task BuildAgvTask(ApplyInOutDto dto)
        {
            var task = new Dt_Task
@@ -265,6 +268,7 @@
            return task;
        }
        // æž„建返回AGV出入库请求体
        private AGVDataDto BuildAgvDataDto(Dt_Task task, ApplyInOutDto dto)
        {
            return new AGVDataDto
@@ -287,6 +291,7 @@
            };
        }
        // å…¥åº“创建
        private async Task<AGVResponse?> CreateAgvInboundTaskAsync(Dt_Task task, ApplyInOutDto dto)
        {
            AGVResponse response = new AGVResponse();
@@ -302,6 +307,7 @@
            return addResult ? null : response.Error("入库任务创建失败");
        }
        // å‡ºåº“创建
        private async Task<AGVResponse?> CreateAgvOutboundTaskAsync(Dt_Task task, ApplyInOutDto dto)
        {
            AGVResponse response = new AGVResponse();
@@ -309,13 +315,13 @@
            if (stockInfo == null)
                return response.Error($"未找到托盘{dto.TrayNumber}的库存信息");
            if (stockInfo.WarehouseId != dto.YinYang)
                return response.Error($"托盘{dto.TrayNumber}不属于当前{(dto.YinYang == 1 ? "阴极" : "阳极")}");
            //if (stockInfo.WarehouseId != dto.YinYang)
            //    return response.Error($"托盘{dto.TrayNumber}不属于当前{(dto.YinYang == 1 ? "阴极" : "阳极")}");
            if (stockInfo.StockStatus != (int)StockStatusEmun.入库完成)
                return response.Error($"托盘{dto.TrayNumber}正在移动中,请稍后!");
            var locationInfo = await _locationInfoService.GetLocationInfoAsync(stockInfo.LocationCode);
            var locationInfo = await _locationInfoService.GetLocationInfo(stockInfo.LocationCode);
            if (locationInfo == null)
                return response.Error($"未找到托盘{stockInfo.LocationCode}的货位信息");
@@ -327,6 +333,14 @@
            task.SourceAddress = stockInfo.LocationCode;
            task.CurrentAddress = stockInfo.LocationCode;
            task.TargetAddress = dto.YinYang == 1 ? "D10020" : "D10090";
            var wmsTaskDto = _mapper.Map<WMSTaskDTO>(task);
            var taskList = new List<WMSTaskDTO> { wmsTaskDto };
            var requestBody = JsonSerializer.Serialize(taskList);
            var httpResponse = _httpClientHelper.Post<WebResponseContent>(WCS_ReceiveTask, requestBody);
            if (httpResponse == null || httpResponse.Data == null || !httpResponse.Data.Status)
                return response.Error(httpResponse?.Data?.Message ?? "下发WCS失败");
            stockInfo.StockStatus = (int)StockStatusEmun.出库锁定;
            locationInfo.LocationStatus = (int)LocationStatusEnum.InStockLock;
@@ -340,34 +354,22 @@
                _unitOfWorkManage.RollbackTran();
                return response.Error("出库任务创建失败");
            }
            _unitOfWorkManage.CommitTran();
            return null;
        }
        private async Task<WebResponseContent> CompleteLocalOutboundAfterAgvAckAsync(Dt_Task task)
        {
            var stockInfo = await _stockInfoService.GetStockInfoAsync(task.PalletCode);
            if (stockInfo == null)
                return WebResponseContent.Instance.Error($"未找到托盘{task.PalletCode}的库存信息");
            var locationInfo = await _locationInfoService.GetLocationInfoAsync(stockInfo.LocationCode);
            if (locationInfo == null)
                return WebResponseContent.Instance.Error($"未找到托盘{stockInfo.LocationCode}的货位信息");
            if (stockInfo.StockStatus != (int)StockStatusEmun.出库锁定 || locationInfo.LocationStatus != (int)LocationStatusEnum.InStockLock)
                return WebResponseContent.Instance.Error($"当前库存{stockInfo.StockStatus}或者货位{locationInfo.LocationStatus}状态信息错误");
            locationInfo.LocationStatus = (int)LocationStatusEnum.Free;
            task.TaskStatus = (int)TaskOutStatusEnum.Line_OutFinish;
            _unitOfWorkManage.BeginTran();
            var deleteTaskResult = BaseDal.DeleteData(task);
            var updateLocationResult = _locationInfoService.UpdateData(locationInfo);
            var deleteStockResult = _stockInfoService.DeleteData(stockInfo);
            if (!deleteTaskResult || !updateLocationResult.Status || !deleteStockResult.Status)
            var updateResult = BaseDal.UpdateData(task);
            if (!updateResult)
            {
                _unitOfWorkManage.RollbackTran();
                return WebResponseContent.Instance.Error("AGV完成回传后,本地任务/库存/货位更新失败");
                return WebResponseContent.Instance.Error("AGV完成回传后,任务更新失败");
            }
            _unitOfWorkManage.CommitTran();
@@ -376,11 +378,62 @@
        private bool CanApplyEnter(Dt_Task task, ApplyEnterDto dto)
        {
            return dto.InOut == 1
                ? task.TaskType == (int)TaskInboundTypeEnum.Inbound && task.TaskStatus == (int)TaskInStatusEnum.InNew
                : task.TaskType == (int)TaskOutboundTypeEnum.Outbound && task.TaskStatus == (int)TaskStatusEnum.Line_Finish;
            if (dto.InOut == 1)
            {
                var hasExecutingOutTask = BaseDal.QueryFirst(x => x.TaskType == (int)TaskOutboundTypeEnum.Outbound
                    && x.TargetAddress == task.SourceAddress
                    && (x.TaskStatus == (int)TaskOutStatusEnum.SC_OutExecuting
                        || x.TaskStatus == (int)TaskOutStatusEnum.Line_OutExecuting));
                // å¦‚果没有正在执行的出库任务,则允许入库
                return hasExecutingOutTask == null;
            }
            else
            {
                return task.TaskType == (int)TaskOutboundTypeEnum.Outbound
                    && task.TaskStatus == (int)TaskStatusEnum.Line_Finish;
            }
        }
        // WCS入库完成
        private async Task<WebResponseContent> CompleteAgvInboundTaskAsync(CreateTaskDto taskDto)
        {
            WebResponseContent response = new WebResponseContent();
            var task = await BaseDal.QueryFirstAsync(x => x.PalletType == taskDto.PalletType);
            if (task == null)
                return response.Error($"没有当前托盘{taskDto.PalletType}入库任务");
            var stockInfo = await _stockInfoService.GetStockInfoAsync(task.PalletCode);
            if (stockInfo == null)
                return response.Error($"未找到托盘{task.PalletCode}的库存信息");
            var locationInfo = await _locationInfoService.GetLocationInfoAsync(task.TargetAddress);
            if (locationInfo == null)
                return response.Error($"未找到货位{task.TargetAddress}的信息");
            if (locationInfo.LocationStatus == (int)LocationStatusEnum.InStock)
                return response.Error($"当前货位{locationInfo.LocationStatus}状态不是空闲状态,无法入库");
            // æ›´æ–°è´§ä½çŠ¶æ€ä¸ºå ç”¨
            locationInfo.LocationStatus = (int)LocationStatusEnum.InStock;
            task.TaskStatus = (int)TaskInStatusEnum.InFinish;
            stockInfo.StockStatus = (int)StockStatusEmun.入库完成;
            _unitOfWorkManage.BeginTran();
            var addStockResult = _stockInfoService.UpdateData(stockInfo);
            var updateLocationResult = _locationInfoService.UpdateData(locationInfo);
            BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? OperateTypeEnum.自动完成 : OperateTypeEnum.人工完成);
            if (!addStockResult.Status || !updateLocationResult.Status)
            {
                _unitOfWorkManage.RollbackTran();
                return response.Error("入库完成后,添加库存或货位更新失败");
            }
            _unitOfWorkManage.CommitTran();
            return response.OK();
        }
        // AGV出库完成
        private async Task<AGVResponse> CompleteAgvOutboundTaskAsync(Dt_Task task)
        {
            AGVResponse response = new AGVResponse();
@@ -400,9 +453,9 @@
            _unitOfWorkManage.BeginTran();
            var deleteStockResult = _stockInfoService.DeleteData(stockInfo);
            var updateLocationResult = await _locationInfoService.UpdateLocationInfoAsync(locationInfo);
            var updateLocationResult = _locationInfoService.UpdateData(locationInfo);
            BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? OperateTypeEnum.自动完成 : OperateTypeEnum.人工完成);
            if (!deleteStockResult.Status || !updateLocationResult)
            if (!deleteStockResult.Status || !updateLocationResult.Status)
            {
                _unitOfWorkManage.RollbackTran();
                return response.Error("出库完成后,本地库存或货位更新失败");
@@ -412,6 +465,7 @@
            return response.OK();
        }
        // AGV已放货,准备输送线入库
        private async Task<AGVResponse> CompleteAgvInboundTaskAsync(Dt_Task task)
        {
            AGVResponse response = new AGVResponse();
@@ -421,12 +475,15 @@
            task.TargetAddress = availableLocation.LocationCode;
            var wcsTaskDto = _mapper.Map<WCSTaskDTO>(task);
            var httpResponse = _httpClientHelper.Post<WebResponseContent>(WCS_ReceiveTask, JsonSerializer.Serialize(wcsTaskDto));
            var wmsTaskDto = _mapper.Map<WMSTaskDTO>(task);
            var taskList = new List<WMSTaskDTO> { wmsTaskDto };
            var requestBody = JsonSerializer.Serialize(taskList);
            var httpResponse = _httpClientHelper.Post<WebResponseContent>(WCS_ReceiveTask, requestBody);
            if (httpResponse == null || httpResponse.Data == null || !httpResponse.Data.Status)
                return response.Error(httpResponse?.Data?.Message ?? "下发WCS失败");
            task.TaskStatus = (int)TaskStatusEnum.Line_Executing;
            task.TaskStatus = (int)TaskInStatusEnum.Line_InExecuting;
            task.Dispatchertime = DateTime.Now;
            var locationInfo = await _locationInfoService.GetLocationInfoAsync(task.TargetAddress);
@@ -435,6 +492,10 @@
            if (locationInfo.LocationStatus != (int)LocationStatusEnum.Free)
                return response.Error($"当前货位{locationInfo.LocationStatus}状态信息错误");
            var existingStock = await _stockInfoService.GetStockInfoAsync(task.PalletCode);
            if (existingStock != null)
                return response.Error($"托盘{task.PalletCode}的库存信息已存在,请勿重复入库");
            Dt_StockInfo stockInfo = new Dt_StockInfo
            {
@@ -462,6 +523,7 @@
            return response.OK();
        }
        // AGV入库取消
        private AGVResponse CancelAgvInboundTask(Dt_Task task)
        {
            AGVResponse response = new AGVResponse();
@@ -473,6 +535,8 @@
            return response.OK();
        }
        // AGV出库取消
        private async Task<AGVResponse> CancelAgvOutboundTaskAsync(Dt_Task task)
        {
            AGVResponse response = new AGVResponse();
@@ -505,6 +569,6 @@
            return response.OK();
        }
        #endregion æžå·åº“任务模块
        #endregion å…·ä½“实现
    }
}
}
Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_WCS.cs
@@ -182,10 +182,11 @@
                if (stockInfo == null) return WebResponseContent.Instance.Error("未找到对应库存信息");
                // åˆ¤æ–­æ˜¯ä¸æ˜¯æžå·åº“任务
                //if (taskDto.WarehouseId == (int)WarehouseEnum.FJ1 || taskDto.WarehouseId == (int)WarehouseEnum.ZJ1)
                //{
                //    return WebResponseContent.Instance.OK();
                //}
                if (taskDto.WarehouseId == (int)WarehouseEnum.FJ1 || taskDto.WarehouseId == (int)WarehouseEnum.ZJ1)
                {
                    return await CompleteAgvInboundTaskAsync(taskDto);
                }
                return await ExecuteWithinTransactionAsync(async () =>
                {
@@ -809,4 +810,4 @@
        #endregion WCS逻辑处理
    }
}
}
Code/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/TaskInfo/TaskController.cs
@@ -29,7 +29,7 @@
        /// </summary>
        /// <param name="taskDto"></param>
        /// <returns></returns>
        [HttpGet, HttpPost, Route("CreateTaskInbound"),AllowAnonymous]
        [HttpGet, HttpPost, Route("CreateTaskInbound"), AllowAnonymous]
        public async Task<WebResponseContent?> CreateTaskInboundAsync([FromBody] CreateTaskDto taskDto)
        {
            return await Service.CreateTaskInboundAsync(taskDto);
@@ -212,6 +212,7 @@
        {
            return await Service.ApplyInOutAsync(applyInOutDto);
        }
        /// <summary>
        /// æ‰‹åŠ¨å‡ºåº“å®Œæˆåé¦ˆç»™AGV
        /// </summary>
@@ -222,16 +223,7 @@
        {
            return await Service.OutTaskComplete(outTaskCompleteDto);
        }
        ///// <summary>
        ///// ä»»åŠ¡å®Œæˆ
        ///// </summary>
        ///// <param name="wCSTask">请求参数</param>
        ///// <returns></returns>
        //[HttpPost, Route("TaskCompleted"), AllowAnonymous]
        //public async Task<WebResponseContent?> TaskCompleted([FromBody] WCSTaskDTO wCSTask)
        //{
        //    return await Service.TaskCompleted(wCSTask);
        //}
        /// <summary>
        /// è¾“送线申请进入
        /// </summary>
@@ -264,6 +256,7 @@
        {
            return await Service.TaskCancelAsync(taskCancelDto);
        }
        #endregion æžå·åº“任务模块
    }
}
}
Code/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/appsettings.json
@@ -34,8 +34,8 @@
  "MainDB": "DB_WIDESEA", //当前项目的主库,所对应的连接字符串的Enabled必须为true
  //连接字符串
  //"ConnectionString": "HTI6FB1H05Krd07mNm9yBCNhofW6edA5zLs9TY~MNthRYW3kn0qKbMIsGp~3yyPDF1YZUCPBQx8U0Jfk4PH~ajNFXVIwlH85M3F~v_qKYQ3CeAz3q1mLVDn8O5uWt1~3Ut2V3KRkEwYHvW2oMDN~QIDXPxDgXN0R2oTIhc9dNu7QNaLEknblqmHhjaNSSpERdDVZIgHnMKejU_SL49tralBkZmDNi0hmkbL~837j1NWe37u9fJKmv91QPb~16JsuI9uu0EvNZ06g6PuZfOSAeFH9GMMIZiketdcJG3tHelo=",
  "ConnectionString": "Data Source=.;Initial Catalog=WIDESEAWMS_ShanMei;User ID=sa;Password=P@ssw0rd;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
  //"ConnectionString": "Data Source=.;Initial Catalog=WIDESEAWMS_ShanMei;User ID=sa;Password=123456;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
  //"ConnectionString": "Data Source=.;Initial Catalog=WIDESEAWMS_ShanMei;User ID=sa;Password=P@ssw0rd;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
  "ConnectionString": "Data Source=.;Initial Catalog=WIDESEAWMS_ShanMei;User ID=sa;Password=123456;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
  //"ConnectionString": "Data Source=10.30.4.92;Initial Catalog=WMS_TC;User ID=sa;Password=duo123456;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
  //旧WMS数据库连接
  //"TeConnectionString": "Data Source=10.30.4.92;Initial Catalog=TeChuang;User ID=sa;Password=duo123456;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
ÏîÄ¿×ÊÁÏ/¼«¾í¿âAGV½Ó¿Ú/~$¼«¾í¿â³öÈë¿â.docx
Binary files differ