chengsc
2025-04-29 9a7c4fea85f85824dddeac9e6ce6ebb75ccee679
Admin.NET/WCS.Application/OpenApi/OpenApi.cs
@@ -1,23 +1,7 @@
using DocumentFormat.OpenXml.Presentation;
using Elastic.Clients.Elasticsearch;
using Admin.NET.Core.Service;
using Furion.DatabaseAccessor;
using Furion.Logging;
using NewLife.Serialization;
using Newtonsoft.Json;
using System;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Text;
using WCS.Application.Entity;
using Microsoft.AspNetCore.Mvc;
using Admin.NET.Core.Service;
using DocumentFormat.OpenXml.Bibliography;
using AngleSharp.Common;
using AngleSharp.Text;
using Newtonsoft.Json.Linq;
using SqlSugar;
using NewLife.Reflection;
using static SKIT.FlurlHttpClient.Wechat.Api.Models.CustomServiceKfSessionGetWaitCaseResponse.Types;
using WCS.Application.Util;
namespace WCS.Application;
@@ -58,38 +42,38 @@
        {
            throw Oops.Bah("任务:" + models.TaskNo + ";不存在!");
        }
        var data1 = FourWayCarUtil.GetCarPath("090601", "080401");
        var data1 = FourWayCarUtil.GetCarPath("091501", "091601","0");
        if (data1 == null) //|| data1.Count == 0
        {
            throw Oops.Bah("分配路径不存在!");
        }
        // 根据任务状态 补充起始结束节点状态
        var data2 = FourWayCarUtil.GetCarPathUp(data1, 1);
        var data2 = FourWayCarUtil.GetCarPathUp(data1, 0);
        var path = "";
        var executionPath1 = "";
        foreach (var item in data1)
        {
            //路径节点
            var pathXYZ = item.X.ToString().PadLeft(2, '0') + item.Y.ToString().PadLeft(2, '0') + item.Z.ToString().PadLeft(2, '0') + item.NodeCom.ToString();
            path += pathXYZ + ";";
            if (item.IsSendPlc)
            {
                executionPath1 += pathXYZ + ";";
            }
        }
        // 插入四向车任务表
        var carTask1 = new WcsCarTasks()
        {
            TaskNo = taskInfo.TaskNo,
            PreId = "",
            ExecutionPath = executionPath1,
            Path = path,
            CarNo = "",
            Status = TaskStatusEnum.Wait
        };
        var i = _db.Insertable(carTask1).ExecuteCommand();
        Console.WriteLine(""+i);
        //foreach (var item in data1)
        //{
        //    //路径节点
        //    var pathXYZ = item.X.ToString().PadLeft(2, '0') + item.Y.ToString().PadLeft(2, '0') + item.Z.ToString().PadLeft(2, '0') + item.NodeCom.ToString();
        //    path += pathXYZ + ";";
        //    if (item.IsSendPlc)
        //    {
        //        executionPath1 += pathXYZ + ";";
        //    }
        //}
        //// 插入四向车任务表
        //var carTask1 = new WcsCarTasks()
        //{
        //    TaskNo = taskInfo.TaskNo,
        //    PreId = "",
        //    ExecutionPath = executionPath1,
        //    Path = path,
        //    CarNo = "",
        //    Status = TaskStatusEnum.Wait
        //};
        //var i = _db.Insertable(carTask1).ExecuteCommand();
        //Console.WriteLine(""+i);
    }
    /// WCS接受WMS下发的任务(多
@@ -122,7 +106,7 @@
            //新增任务
            var taskAdd = new WcsTask()
            {
                TaskNo = models.TaskNo,
                TaskNo = models.TaskNo,
                TaskType = (TaskTypeEnum)Convert.ToInt32(models.TaskType),
                Type = models.Type,
                Status = TaskStatusEnum.Wait,
@@ -134,6 +118,13 @@
                EndRoadway = models.EndRoadway,
                PalletNo = models.PalletNo,
            };
            // 若非AGV任务增加任务ID
            if (models.Type != PLCTypeEnum.AGV)
            {
                taskAdd.TaskId = FourWayCarUtil.GetTaskId();
            }
            listTask.Add(taskAdd);
        }
        await _db.Insertable(listTask).ExecuteCommandAsync();
@@ -175,6 +166,13 @@
            EndRoadway = models.EndRoadway,
            PalletNo = models.PalletNo,
        };
        // 若非AGV任务增加任务ID
        if (models.Type != PLCTypeEnum.AGV)
        {
            taskAdd.TaskId = FourWayCarUtil.GetTaskId();
        }
        await _db.Insertable(taskAdd).ExecuteCommandAsync();
    }