更新多个文件,优化逻辑与配置
主要改动包括:
- 更新 HTTP.js 中生产环境的 baseURL。
- 修改 Staticlibrary.vue 的设备名称检测逻辑,使其更通用。
- 新增和删除 CateGoryConst.cs 与 SysConfigKeyConst.cs 中的常量定义。
- 在 TaskService.cs 中添加了站台地址的读取逻辑,改善任务源地址处理。
- 优化 CommonConveyorLineJob.cs 的构造函数,增加了新参数。
- 增强设备异步处理错误捕获的逻辑。
- 改进任务完成日志输出的可读性。
- 更新 RequestInbound.cs 的任务查询逻辑。
- 修改 CommonStackerCraneJob.cs 中的常量配置与处理逻辑。
- 提升代码注释质量,增加可读性与可维护性。
- 改善 UI 组件 Dt_BillGroupStock.jsx 的事件处理和显示效果。
- 更新 SQL 操作相关文件中的数据库连接字符串。
- 在 LocationInfoService.cs 与 Dt_TaskService.cs 中更新了数据库操作指向,确保指向 WMS 数据库。
- 改进区域代码查询逻辑,处理未找到区域的情况并记录错误信息。
- 更新 appsettings.json 中的连接字符串配置。
- 在 WIDESEA_WMSServer.MvcApplicationPartsAssemblyInfo.cs 中增加代码生成的注释说明。
- 对 Dt_BillGroupStock.jsx 文件进行了重构或清理。
| | |
| | | } |
| | | |
| | | else if (process.env.NODE_ENV == 'production') { |
| | | axios.defaults.baseURL = 'http://192.168.20.251:9291/'; |
| | | axios.defaults.baseURL = 'http://192.168.5.251:9291/'; |
| | | } |
| | | if (!axios.defaults.baseURL.endsWith('/')) { |
| | | axios.defaults.baseURL+="/"; |
| | |
| | | } |
| | | }); |
| | | eventBus.on('stackerData', eventData => { |
| | | if (eventData.deviceName == "静置1号堆垛机") { |
| | | if (eventData.deviceName.indexOf("静置") != -1) { |
| | | if (Stackers.length == 0) { |
| | | Stackers.push({ deviceName: eventData.deviceName, data: eventData.data }); |
| | | } |
| | |
| | | /// IP接口地址 |
| | | /// </summary> |
| | | public const string CONFIG_SYS_IPAddress = "SYS_IPAddress"; |
| | | |
| | | /// <summary> |
| | | /// 入库站台 |
| | | /// </summary> |
| | | public const string CONFIG_SYS_InStation = "SYS_InStation"; |
| | | } |
| | | } |
| | |
| | | /// </summary> |
| | | public const string RequestTrayOutTask = "RequestTrayOutTask"; |
| | | |
| | | |
| | | public const string RequestInTask = "RequestInTask"; |
| | | |
| | | |
| | | public const string RequestFlow = "RequestFlow"; |
| | | |
| | |
| | | /// 静置NG入库 |
| | | /// </summary> |
| | | public const string RequestInBoundTaskNG = "RequestInBoundTaskNG"; |
| | | |
| | | /// <summary> |
| | | /// 静置NG入库站台 |
| | | /// </summary> |
| | | public const string JZNGInBoundStation = "JZNGInBoundStation"; |
| | | } |
| | | } |
| | |
| | | // 判断任务类型是否为入库任务 |
| | | else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup) |
| | | { |
| | | var value = _sys_ConfigService.GetByConfigKey(CateGoryConst.CONFIG_SYS_InStation, SysConfigKeyConst.JZNGInBoundStation).ConfigValue; |
| | | var valueList = value.Split(',').ToList(); |
| | | // 判断源地址是否不等于"1359-4" |
| | | if (task.SourceAddress != "1359-4") |
| | | //if (task.SourceAddress != "1359-4" && task.SourceAddress != "1357-4") |
| | | if (!valueList.Contains(task.SourceAddress)) |
| | | { |
| | | // 查询从源地址到目标地址的路由 |
| | | List<Dt_Router> routers = _routerService.QueryNextRoutes(item.SourceAddress, item.TargetAddress); |
| | |
| | | } |
| | | else |
| | | { |
| | | task.CurrentAddress = string.Empty; |
| | | if (task.SourceAddress == "1325-6") |
| | | // 设置当前地址为"001-021-001" |
| | | task.CurrentAddress = "001-021-001"; |
| | | else |
| | | // 设置当前地址为"002-021-001" |
| | | task.CurrentAddress = "002-021-001"; |
| | | // 设置下一个地址为目标地址 |
| | |
| | | private static List<string>? userTokenIds; |
| | | private static List<int>? userIds; |
| | | |
| | | |
| | | public CommonConveyorLineJob(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, IRouterService routerService, IMapper mapper, ITaskRepository taskRepository, IPlatFormRepository platFormRepository, ISys_ConfigService sys_ConfigService, IDt_StationManagerService stationManagerService, IDt_StationManagerRepository stationManagerRepository, ICacheService cacheService, INoticeService noticeService, IDeviceInfoRepository deviceInfoRepository,ITask_HtyRepository task_HtyRepository) |
| | | { |
| | | _taskService = taskService; |
| | |
| | | // 并行处理每个子设备 |
| | | var tasks = childDeviceCodes.Select(childDeviceCode => ProcessDeviceAsync(conveyorLine, childDeviceCode)).ToList(); |
| | | await Task.WhenAll(tasks); |
| | | |
| | | |
| | | // 获取所有站点管理器 |
| | | List<Dt_StationManager> stationManagers = _stationManagerService.GetAllStationByDeviceCode(conveyorLine.DeviceCode); |
| | |
| | | { |
| | | try |
| | | { |
| | | |
| | | // 读取任务命令和设备命令 |
| | | ConveyorLineTaskCommand command = conveyorLine.ReadCustomer<ConveyorLineTaskCommand>(childDeviceCode); |
| | | ConveyorLineTaskCommandWrite commandWrite = conveyorLine.ReadCustomer<ConveyorLineTaskCommandWrite>(childDeviceCode, "DeviceCommand"); |
| | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | |
| | | } |
| | | return Task.CompletedTask; |
| | | } |
| | |
| | | { |
| | | try |
| | | { |
| | | |
| | | ConsoleHelper.WriteWarningLine($"【{conveyorLine._deviceName}】任务号:【{command.TaskNum}】,托盘条码:【{command.Barcode}】已到达【{childDeviceCode}】输送线入库完成"); |
| | | var task = _taskService.QueryExecutingConveyorLineTask(command.TaskNum, childDeviceCode); |
| | | if (task != null && task.TaskState != (int)TaskInStatusEnum.Line_InFinish) |
| | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | |
| | | } |
| | | } |
| | | |
| | |
| | | { |
| | | try |
| | | { |
| | | |
| | | // 查询输送线任务,根据输送线设备和子设备代码获取任务信息 |
| | | var task = _taskService.QueryConveyorLineTask(conveyorLine.DeviceCode, childDeviceCode); |
| | | |
| | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | |
| | | } |
| | | } |
| | | |
| | |
| | | { |
| | | try |
| | | { |
| | | |
| | | // 打印成功信息,表示托盘已到达指定输送线并完成出库 |
| | | ConsoleHelper.WriteSuccessLine($"【{conveyorLine.DeviceName}】任务号:【{command.TaskNum}】,托盘条码:【{command.Barcode}】已到达【{childDeviceCode}】输送线出库完成"); |
| | | |
| | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | |
| | | } |
| | | } |
| | | |
| | |
| | | EquipmentCode = stationManager.stationEquipMOM, |
| | | SessionId = Guid.NewGuid().ToString(), |
| | | EmployeeNo = "MITest", |
| | | SceneType = "2", |
| | | SceneType = "4", |
| | | RequestTime = TimeZoneInfo.ConvertTimeToUtc(DateTime.Now).ToString("yyyy-MM-ddTHH:mm:ss.fffZ") |
| | | }; |
| | | |
| | |
| | | ConsoleHelper.WriteWarningLine("1000"); |
| | | conveyorLine.SetValue(ConveyorLineDBName.WriteConveyorLineTaskNum, 5, stationManager.stationChildCode); |
| | | conveyorLine.SetValue(ConveyorLineDBName.WriteConveyorLineTargetAddress, 1000, stationManager.stationChildCode); |
| | | |
| | | ConveyorLineSendFinish(conveyorLine, stationManager.stationChildCode, ProtocalDetailValue, true); |
| | | } |
| | | else |
| | | { |
| | | ConsoleHelper.WriteWarningLine("2"); |
| | | ConsoleHelper.WriteWarningLine(stationManager.stationLocation); |
| | | conveyorLine.SetValue(ConveyorLineDBName.WriteConveyorLineTaskNum, 5, stationManager.stationChildCode); |
| | | conveyorLine.SetValue(ConveyorLineDBName.WriteConveyorLineTargetAddress, stationManager.stationLocation, stationManager.stationChildCode); |
| | | } |
| | | ConveyorLineSendFinish(conveyorLine, stationManager.stationChildCode, ProtocalDetailValue, true); |
| | | } |
| | | else |
| | | { |
| | | if (result1.SerialNos.Count <= 0) |
| | | { |
| | | |
| | | ConsoleHelper.WriteWarningLine("2"); |
| | | ConsoleHelper.WriteWarningLine(stationManager.stationLocation); |
| | | conveyorLine.SetValue(ConveyorLineDBName.WriteConveyorLineTaskNum, 5, stationManager.stationChildCode); |
| | | conveyorLine.SetValue(ConveyorLineDBName.WriteConveyorLineTargetAddress, stationManager.stationLocation, stationManager.stationChildCode); |
| | | |
| | | } |
| | | else |
| | | { |
| | | ConsoleHelper.WriteWarningLine("1000"); |
| | | conveyorLine.SetValue(ConveyorLineDBName.WriteConveyorLineTaskNum, 5, stationManager.stationChildCode); |
| | | conveyorLine.SetValue(ConveyorLineDBName.WriteConveyorLineTargetAddress, 1000, stationManager.stationChildCode); |
| | | |
| | | ConveyorLineSendFinish(conveyorLine, stationManager.stationChildCode, ProtocalDetailValue, true); |
| | | } |
| | | ConveyorLineSendFinish(conveyorLine, stationManager.stationChildCode, ProtocalDetailValue, true); |
| | | } |
| | | } |
| | | else |
| | |
| | | } |
| | | } |
| | | |
| | | #endregion 化成NG口入库 |
| | | #endregion 设备NG口入库 |
| | | } |
| | | } |
| | |
| | | var task = _taskService.QueryBarCodeConveyorLineTask(command.Barcode, childDeviceCode); |
| | | if (task != null) |
| | | { |
| | | if (task.SourceAddress == "1059-4") |
| | | var value = _sys_ConfigService.GetByConfigKey(CateGoryConst.CONFIG_SYS_InStation, SysConfigKeyConst.JZNGInBoundStation).ConfigValue; |
| | | var valueList = value.Split(',').ToList(); |
| | | if (valueList.Contains(task.SourceAddress)) |
| | | { |
| | | conveyorLine.SetValue(ConveyorLineDBName.WriteConveyorLineTargetAddress, "1000", childDeviceCode); |
| | | |
| | |
| | | MethodInfo? method = GetType().GetMethod(platform.ExecutionMethod); |
| | | if (method != null) |
| | | { |
| | | int count = string.IsNullOrEmpty(platform.Location) ? 0 + 1 : platform.Location.Split(',').Count() + 1; |
| | | //var strings = platform.Location.Split(',').ToList(); |
| | | int count = 1; |
| | | method.Invoke(this, new object[] { conveyorLine, command, childDeviceCode, count, platform }); |
| | | } |
| | | } |
| | |
| | | case 9: |
| | | case 11: |
| | | case 12: |
| | | var task = _taskService.QueryExecutingConveyorLineTask(command.ConveyorLineTaskNum, childDeviceCode); |
| | | var task = _taskService.QueryExecutingTaskByBarcode(command.ConveyorLineBarcode, childDeviceCode); |
| | | if (task != null) |
| | | { |
| | | ExecuteStationAction(stationManager, conveyorLine, command, childDeviceCode); |
| | |
| | | using System.Diagnostics.CodeAnalysis; |
| | | using System.Text; |
| | | using WIDESEAWCS_BasicInfoRepository; |
| | | using WIDESEAWCS_Common; |
| | | using WIDESEAWCS_Common.TaskEnum; |
| | | using WIDESEAWCS_Core.Caches; |
| | | using WIDESEAWCS_Core.Helper; |
| | | using WIDESEAWCS_Core.HttpContextUser; |
| | | using WIDESEAWCS_IProcessRepository; |
| | | using WIDESEAWCS_ISystemServices; |
| | | using WIDESEAWCS_ITaskInfo_HtyRepository; |
| | | using WIDESEAWCS_ITaskInfoRepository; |
| | | using WIDESEAWCS_ITaskInfoService; |
| | |
| | | private readonly INoticeService _noticeService; |
| | | private readonly IDt_StationManagerRepository _stationManagerRepository; |
| | | private readonly ITask_HtyRepository _htyRepository; |
| | | private readonly ISys_ConfigService _sys_ConfigService; |
| | | |
| | | public CommonStackerCraneJob(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, ITaskRepository taskRepository, IRouterService routerService, IProcessRepository processRepository, ICacheService cacheService, INoticeService noticeService, IDt_StationManagerRepository stationManagerRepository, ITask_HtyRepository htyRepository) |
| | | public CommonStackerCraneJob(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, ITaskRepository taskRepository, IRouterService routerService, IProcessRepository processRepository, ICacheService cacheService, INoticeService noticeService, IDt_StationManagerRepository stationManagerRepository, ITask_HtyRepository htyRepository, ISys_ConfigService sys_ConfigService) |
| | | { |
| | | _taskService = taskService; |
| | | _taskExecuteDetailService = taskExecuteDetailService; |
| | |
| | | _noticeService = noticeService; |
| | | _stationManagerRepository = stationManagerRepository; |
| | | _htyRepository = htyRepository; |
| | | _sys_ConfigService = sys_ConfigService; |
| | | } |
| | | |
| | | public Task Execute(IJobExecutionContext context) |
| | |
| | | stackerCraneTaskCommand.StartCommand = 1; |
| | | if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup)//判断是否是入库任务 |
| | | { |
| | | if (task.SourceAddress == "1359-4" && task.Roadway.Contains("JZ")) |
| | | var value = _sys_ConfigService.GetByConfigKey(CateGoryConst.CONFIG_SYS_InStation, SysConfigKeyConst.JZNGInBoundStation).ConfigValue; |
| | | var valueList = value.Split(',').ToList(); |
| | | if ((valueList.Contains(task.SourceAddress)) && task.Roadway.Contains("JZ")) |
| | | { |
| | | string[] souredCodes = task.CurrentAddress.Split("-"); |
| | | if (souredCodes.Length == 3) |
| | |
| | | } |
| | | else if (process.env.NODE_ENV == 'production') { |
| | | // axios.defaults.baseURL = 'http://127.0.0.1:5000/'; |
| | | axios.defaults.baseURL = 'http://192.168.20.251:5000/'; |
| | | axios.defaults.baseURL = 'http://192.168.5.251:5000/'; |
| | | } |
| | | |
| | | //axios.defaults.baseURL = 'http://api.volcore.xyz/'; |
| | |
| | | //下面这些方法可以保留也可以删除 |
| | | onInit() { |
| | | //框架初始化配置前, |
| | | let OutBoundBtn=this.buttons.find(x=>x.value=='OutBound'); |
| | | let OutBoundBtn = this.buttons.find((x) => x.value == 'OutBound') |
| | | if(OutBoundBtn){ |
| | | OutBoundBtn.onClick=function(){ |
| | | this.$Message.success('点击了按钮') |
| | |
| | | } |
| | | let locationCode = row[0].locationCode |
| | | let palletCode = row[0].palletCode |
| | | this.http.get(`/api/Task/CreateAndSendOutboundTask?locationCode=${locationCode}&palletCode=${palletCode}`, {}, "正在创建任务").then((res) => { |
| | | this.http |
| | | .get( |
| | | `/api/Task/CreateAndSendOutboundTask?locationCode=${locationCode}&palletCode=${palletCode}`, |
| | | {}, |
| | | '正在创建任务' |
| | | ) |
| | | .then((res) => { |
| | | //示例:调用后台接口 |
| | | if (res.status) { |
| | | this.$Message.success('创建任务成功') |
| | |
| | | // ); |
| | | // }, |
| | | // }); |
| | | |
| | | this.columns.forEach((column) => { |
| | | //修改颜色 |
| | | if (column.field == 'roadwayNo') { |
| | | column.formatter = (row) => { |
| | | return '<span style="color: #2d8cf0;">' + row.locationInfo.roadwayNo + '</span>' |
| | | } |
| | | } |
| | | //格式化日期 |
| | | // 检查当前列的字段是否为 'locationStatus' |
| | | if (column.field == 'locationStatus') { |
| | | // 使用对象字面量来映射 'locationStatus' 的值和对应的文本 |
| | | const statusMap = { |
| | | '-1': '全部', |
| | | '0': '空闲', |
| | | '1': '锁定', |
| | | '2': '有货', |
| | | '3': '有货禁用', |
| | | '4': '无货禁用' |
| | | }; |
| | | // 定义一个格式化函数,根据 'locationStatus' 的值返回相应的文本 |
| | | column.formatter = (row) => { |
| | | // 使用 statusMap 对象来获取对应的文本,如果没有匹配则返回 '未知状态' |
| | | return statusMap[row.locationInfo.locationStatus] || '未知状态'; |
| | | } |
| | | } |
| | | }) |
| | | }, |
| | | onInited() { |
| | | //框架初始化配置后 |
| | |
| | | ]); |
| | | const columns = ref( |
| | | [{ field: 'id', title: '库存ID', type: 'int', width: 110, hidden: true, readonly: true, require: true, align: 'left' }, |
| | | { field: 'locationCode', title: '库位', type: 'string', width: 110, align: 'left', }, |
| | | { field: 'locationCode', title: '库位', type: 'string', width: 100, align: 'left', }, |
| | | { field: 'palletCode', title: '托盘条码', type: 'string', width: 110, align: 'left', }, |
| | | { field: 'isFull', title: '库存类型', type: 'bool', width: 110, align: 'left', bind: { key: "isFull", data: [{ key: false, value: '空盘'},{ key: true, value: '实盘'}] }, }, |
| | | { field: 'isFull', title: '库存类型', type: 'bool', width: 80, align: 'left', bind: { key: "isFull", data: [{ key: false, value: '空盘'},{ key: true, value: '实盘'}] }, }, |
| | | { field: 'linedProcessFeedbackTime', title: '工艺开始时间', type: 'string', width: 110, align: 'left',}, |
| | | { field: 'specialParameterDuration', title: '工艺时长', type: 'string', width: 110, align: 'left', sort: true }, |
| | | { field: 'roadwayNo', title: '巷道', type: 'string', width: 60, align: 'left', sort: true }, |
| | | { field: 'locationStatus', title: '货位状态', type: 'int', width: 60, align: 'left', bind: { key: "LocationState", data: [] } }, |
| | | { field: 'specialParameterDuration', title: '工艺时长', type: 'string', width: 60, align: 'left', sort: true }, |
| | | { field: 'outboundTime', title: '应出库时间', type: 'string', width: 110, align: 'left', sort: true }, |
| | | { field: 'productionLine', title: '生产产线', type: 'string', width: 110, align: 'left', }, |
| | | { field: 'areaCode', title: '库区', type: 'string', width: 110, align: 'left', bind: { key: "AreaType", data: [] } }, |
| | | { field: 'remark', title: '电芯数量', type: 'string', width: 120, align: 'left', }, |
| | | { field: 'productionLine', title: '生产产线', type: 'string', width: 60, align: 'left', }, |
| | | { field: 'areaCode', title: '库区', type: 'string', width: 60, align: 'left', bind: { key: "AreaType", data: [] } }, |
| | | { field: 'remark', title: '电芯数量', type: 'string', width: 60, align: 'left', }, |
| | | { field: 'creater', title: '创建人', type: 'string', sort: true, width: 110, align: 'left', hidden: true }, |
| | | { field: 'createDate', title: '创建时间', type: 'datetime', sort: true, width: 150, align: 'left', }, |
| | | { field: 'modifier', title: '最后修改人', type: 'string', sort: true, width: 100, hidden: true, align: 'left' }, |
| | |
| | | { |
| | | public const string CurrentDbConnId = "WIDESEA"; |
| | | public const string ConnectionString = "ConnectionString"; |
| | | public const string ConnectionStringWCS = "ConnectionStringWCS"; |
| | | public const string TenantTableName = "Sys_Tenant"; |
| | | public const string TenantStatus = "Status"; |
| | | public const string TenantId = "TenantId"; |
| | |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Core.DB; |
| | | using WIDESEA_Core.Seed; |
| | | |
| | | namespace WIDESEA_Core.Helper |
| | |
| | | //如果是固定多库可以传 new SqlSugarScope(List<ConnectionConfig>,db=>{}) 文档:多租户 |
| | | //如果是不固定多库 可以看文档Saas分库 |
| | | //用单例模式 |
| | | public static SqlSugarScope Db = new SqlSugarScope(new ConnectionConfig() |
| | | public static SqlSugarScope DbWCS = new SqlSugarScope(new ConnectionConfig() |
| | | { |
| | | //ConnectionString = DBContext.GetMainConnectionDb().Connection, |
| | | ConnectionString = AppSettings.app(MainDb.ConnectionStringWCS), |
| | | DbType = DbType.SqlServer,//数据库类型 |
| | | IsAutoCloseConnection = true //不设成true要手动close |
| | | }, |
| | | db => |
| | | { |
| | | }); |
| | | |
| | | public static SqlSugarScope DbWMS = new SqlSugarScope(new ConnectionConfig() |
| | | { |
| | | ConnectionString = DBContext.GetMainConnectionDb().Connection, |
| | | //ConnectionString = AppSettings.app(MainDb.ConnectionStringWCS), |
| | | DbType = DbType.SqlServer,//数据库类型 |
| | | IsAutoCloseConnection = true //不设成true要手动close |
| | | }, |
| | |
| | | { |
| | | // 使用 myScopedService 执行任务 |
| | | |
| | | await DBSeed.SeedAsync(_dbContext, _webRootPath); |
| | | //await DBSeed.SeedAsync(_dbContext, _webRootPath); |
| | | |
| | | //多租户 同步 |
| | | //await DBSeed.TenantSeedAsync(_dbContext); |
| | |
| | | var result = JsonConvert.DeserializeObject<ResultTrayCellsStatus>(content.Data.ToString()); |
| | | if (result.SerialNos.Count > 0) |
| | | { |
| | | var stockHty = await SqlSugarHelper.Db.Queryable<DtStockInfo>().IncludesAllFirstLayer().FirstAsync(); |
| | | var stockHty = await SqlSugarHelper.DbWMS.Queryable<DtStockInfo>().IncludesAllFirstLayer().FirstAsync(); |
| | | if (stockHty != null) |
| | | { |
| | | var parameterInfo = JsonConvert.DeserializeObject<List<ParameterInfo>>(stockHty.ParameterInfos).FirstOrDefault(y => y.Description.Contains("时间")); |
| | |
| | | |
| | | private async Task AddStockInfoHtyAsync(DtStockInfo_Hty dtStock) |
| | | { |
| | | var isStockAdd = await SqlSugarHelper.Db.InsertNav(dtStock).IncludesAllFirstLayer().ExecuteCommandAsync(); |
| | | var isStockAdd = await SqlSugarHelper.DbWMS.InsertNav(dtStock).IncludesAllFirstLayer().ExecuteCommandAsync(); |
| | | if (!isStockAdd) |
| | | { |
| | | throw new Exception("库存历史信息添加失败"); |
| | |
| | | private void AddStockInfoDetailHty(List<DtStockInfoDetail_Hty> details) |
| | | { |
| | | |
| | | var isStockAdd = SqlSugarHelper.Db.Insertable(details).ExecuteCommand(); |
| | | var isStockAdd = SqlSugarHelper.DbWMS.Insertable(details).ExecuteCommand(); |
| | | if (isStockAdd==0) |
| | | { |
| | | throw new Exception("库存明细历史信息添加失败"); |
| | |
| | | using WIDESEA_StorageBasicRepository; |
| | | using WIDESEA_StoragIntegrationServices; |
| | | using WIDESEAWCS_BasicInfoRepository; |
| | | using WIDESEAWCS_QuartzJob.Models; |
| | | |
| | | namespace WIDESEA_StorageTaskServices; |
| | | |
| | |
| | | |
| | | private async Task AddStockInfoHtyAsync(DtStockInfo_Hty dtStock) |
| | | { |
| | | var isStockAdd = await SqlSugarHelper.Db.InsertNav(dtStock).IncludesAllFirstLayer().ExecuteCommandAsync(); |
| | | var isStockAdd = await SqlSugarHelper.DbWMS.InsertNav(dtStock).IncludesAllFirstLayer().ExecuteCommandAsync(); |
| | | if (!isStockAdd) |
| | | { |
| | | throw new Exception("库存历史信息添加失败"); |
| | |
| | | /// </summary> |
| | | private async Task<DtStockInfo> QueryStockInfoForRealTrayCWAsync(List<string> areaCodes, string productionLine) |
| | | { |
| | | var area = await _areaInfoRepository.QueryFirstAsync(x => x.AreaCode == "CWSC1"); |
| | | var areaId = (await _areaInfoRepository.QueryDataAsync(x => areaCodes.Contains(x.AreaCode))).Select(x => x.AreaID).ToList(); |
| | | if (areaId.Count == 0) |
| | | { |
| | | ConsoleHelper.WriteErrorLine($"查询常温实盘库存信息时,未找到区域代码为{JsonConvert.SerializeObject(areaCodes)}的数据"); |
| | | return null; |
| | | } |
| | | |
| | | var result = await _stockInfoRepository.Db.Queryable<DtStockInfo>() |
| | | .Includes(x => x.LocationInfo) // 预加载LocationInfo |
| | | .Includes(x => x.StockInfoDetails) // 预加载StockInfoDetails |
| | | .Where(x => areaCodes.Contains(x.AreaCode) && x.OutboundTime < DateTime.Now && x.IsFull == true) // 过滤条件 |
| | | .WhereIF(!productionLine.IsNullOrEmpty(), x => x.ProductionLine == productionLine) |
| | | .Where(x => x.LocationInfo.LocationStatus == (int)LocationEnum.InStock && x.LocationInfo.AreaId == area.AreaID && x.LocationInfo.EnalbeStatus == (int)EnableEnum.Enable) // 过滤条件 |
| | | .Where(x => x.LocationInfo.LocationStatus == (int)LocationEnum.InStock && areaId.Contains(x.LocationInfo.AreaId) && x.LocationInfo.EnalbeStatus == (int)EnableEnum.Enable) // 过滤条件 |
| | | .OrderBy(x => x.OutboundTime) // 排序 |
| | | .FirstAsync(); // 获取第一个元素 |
| | | |
| | |
| | | content.OK(data: taskDTO); |
| | | } |
| | | else |
| | | content.Error(result.MOMMessage); |
| | | { |
| | | var location = await GetLocationDistributeAsync(station.Roadway); |
| | | var task = new Dt_Task |
| | | { |
| | | CurrentAddress = station.stationLocation, |
| | | Grade = 1, |
| | | Roadway = station.Roadway, |
| | | TargetAddress = location.LocationCode, |
| | | Dispatchertime = DateTime.Now, |
| | | MaterialNo = "", |
| | | NextAddress = location.LocationCode, |
| | | OrderNo = null, |
| | | PalletCode = palletCode, |
| | | SourceAddress = position, |
| | | TaskState = (int)TaskInStatusEnum.Line_InFinish, |
| | | TaskType = (int)TaskInboundTypeEnum.InTray, |
| | | TaskNum = await BaseDal.GetTaskNo(), |
| | | Creater = "Systeam" |
| | | }; |
| | | // 创建WMS任务 |
| | | WMSTaskDTO taskDTO = CreateWMSTaskDTO(task); |
| | | |
| | | await _unitOfWorkManage.UseTranAsync(async () => |
| | | { |
| | | // 添加任务到数据库 |
| | | await BaseDal.AddDataAsync(task); |
| | | // 更新库存位置状态为不可用 |
| | | location.LocationStatus = (int)LocationEnum.Lock; |
| | | await _locationRepository.UpdateDataAsync(location); |
| | | }); |
| | | |
| | | content.OK(data: taskDTO); |
| | | } |
| | | } |
| | | else |
| | | { |
| | |
| | | Grade = 1, |
| | | PalletCode = taskOld.PalletCode, |
| | | RoadWay = taskOld.Roadway, |
| | | SourceAddress = taskOld.CurrentAddress, |
| | | SourceAddress = taskOld.SourceAddress, |
| | | TargetAddress = taskOld.TargetAddress, |
| | | TaskState = taskOld.TaskState.Value, |
| | | Id = 0, |
| | |
| | | /// <returns></returns> |
| | | public async Task<string> GetRoadWayAsync(List<string> process) |
| | | { |
| | | var minGroup = _locationRepository.QueryData(x => process.Contains(x.RoadwayNo) && x.LocationStatus == (int)LocationEnum.Free) |
| | | var deviceCode = await SqlSugarHelper.DbWCS.Queryable<Dt_DeviceInfo>() |
| | | .Where(x => x.DeviceStatus == 1.ToString() && process.Contains(x.DeviceCode)) |
| | | .Select(x => x.DeviceCode).ToListAsync(); |
| | | |
| | | var minGroup = _locationRepository.QueryData(x => deviceCode.Contains(x.RoadwayNo) && x.LocationStatus == (int)LocationEnum.Free) |
| | | .GroupBy(x => x.RoadwayNo) |
| | | .OrderByDescending(g => g.Count()) // 根据每个组的元素数量排序 |
| | | .ToList(); // 取出数量最多的组 |
| | |
| | | "MainDB": "DB_WIDESEA", //当前项目的主库,所对应的连接字符串的Enabled必须为true |
| | | //连接字符串 |
| | | //"ConnectionString": "HTI6FB1H05Krd07mNm9yBCNhofW6edA5zLs9TY~MNthRYW3kn0qKbMIsGp~3yyPDF1YZUCPBQx8U0Jfk4PH~ajNFXVIwlH85M3F~v_qKYQ3CeAz3q1mLVDn8O5uWt1~3Ut2V3KRkEwYHvW2oMDN~QIDXPxDgXN0R2oTIhc9dNu7QNaLEknblqmHhjaNSSpERdDVZIgHnMKejU_SL49tralBkZmDNi0hmkbL~837j1NWe37u9fJKmv91QPb~16JsuI9uu0EvNZ06g6PuZfOSAeFH9GMMIZiketdcJG3tHelo=", |
| | | //"ConnectionString": "Data Source=192.168.5.251;Initial Catalog=WIDESEA_WMSDB_BBMain;User ID=sa;Password=P@ssw0rd;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False", |
| | | "ConnectionString": "Data Source=192.168.5.251;Initial Catalog=WIDESEA_WMSDB_BBMain;User ID=sa;Password=P@ssw0rd;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False", |
| | | //"ConnectionString": "Data Source=127.0.0.1;Initial Catalog=WIDESEA_WMS2F08;User ID=sa;Password=P@ssw0rd;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False", |
| | | "ConnectionString": "Data Source=.\\LIULEI;Initial Catalog=WIDESEA_WMSDB_BBMain;User ID=sa;Password=123456;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False", |
| | | //"ConnectionString": "Data Source=.\\LIULEI;Initial Catalog=WIDESEA_WMSDB_BBMain;User ID=sa;Password=123456;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False", |
| | | //"ConnectionString": "Data Source=192.168.20.251;Initial Catalog=WIDESEA_WMSDB;User ID=sa;Password=123456@gy;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False", |
| | | |
| | | "ConnectionStringWCS": "Data Source=192.168.5.251;Initial Catalog=WIDESEAWCS_TEST;User ID=sa;Password=P@ssw0rd;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False", |
| | | //跨域 |
| | | "Cors": { |
| | | "PolicyName": "CorsIpAccess", //策略名称 |
| | |
| | | //------------------------------------------------------------------------------ |
| | | // <auto-generated> |
| | | // This code was generated by a tool. |
| | | // 此代码由工具生成。 |
| | | // 运行时版本:4.0.30319.42000 |
| | | // |
| | | // Changes to this file may cause incorrect behavior and will be lost if |
| | | // the code is regenerated. |
| | | // 对此文件的更改可能会导致不正确的行为,并且如果 |
| | | // 重新生成代码,这些更改将会丢失。 |
| | | // </auto-generated> |
| | | //------------------------------------------------------------------------------ |
| | | |