分支自 SuZhouGuanHong/TaiYuanTaiZhong

dengjunjie
2024-04-03 2e2b2a3efe2a5def011834daa43d71da9b3b5d00
优化逻辑
已修改9个文件
459 ■■■■ 文件已修改
代码管理/PCS/WCS_Client/src/api/http.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/PCS/WCS_Server/WIDESEA_Entity/DomainModels/ToMES/VV_Mes_Workinfo.cs 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/PCS/WCS_Server/WIDESEA_WCS/Common/Gantry.cs 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/PCS/WCS_Server/WIDESEA_WCS/Jobs/Task/AutoTaskJob.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/PCS/WCS_Server/WIDESEA_WCS/Jobs/equipment/PipelineJob.cs 46 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/OutboundTask.cs 295 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/新文件夹/GetLocation.cs 45 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WMS_Client/src/api/http.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/HandleTask.cs 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
´úÂë¹ÜÀí/PCS/WCS_Client/src/api/http.js
@@ -12,7 +12,7 @@
let loadingInstance;
let loadingStatus = false;
if (process.env.NODE_ENV == 'development') {
    axios.defaults.baseURL = 'http://192.168.12.101:8099/';
    axios.defaults.baseURL = 'http://127.0.0.1:8099/';
}
else if (process.env.NODE_ENV == 'debug') {
    axios.defaults.baseURL = 'http://192.168.12.101:8099/';
´úÂë¹ÜÀí/PCS/WCS_Server/WIDESEA_Entity/DomainModels/ToMES/VV_Mes_Workinfo.cs
@@ -159,6 +159,36 @@
       [Editable(true)]
       public string processCode { get; set; }
        /// <summary>
        ///完成数量
        /// </summary>
        [Display(Name = "完成数量")]
        [Column(TypeName = "int")]
        [Editable(true)]
        public int? finishNum { get; set; }
        /// <summary>
        ///创建时间
        /// </summary>
        [Display(Name = "创建时间")]
        [Column(TypeName = "datetime")]
        public DateTime CreateTime { get; set; }
        /// <summary>
        ///完成时间
        /// </summary>
        [Display(Name = "完成时间")]
        [Column(TypeName = "datetime")]
        [Editable(true)]
        public DateTime? FinishTime { get; set; }
        /// <summary>
        ///工单状态
        /// </summary>
        [Display(Name = "工单状态")]
        [MaxLength(20)]
        [Column(TypeName = "nvarchar(20)")]
        [Editable(true)]
        public string Status { get; set; }
    }
}
´úÂë¹ÜÀí/PCS/WCS_Server/WIDESEA_WCS/Common/Gantry.cs
@@ -467,7 +467,11 @@
                            var AreaNr = (Int16)DBExtension.Read(details.Where(x => x.plcdetail_name == "W_AreaNr").First(), client);
                            if (AreaNr == 0)
                            {
                                client.WriteByOrder("W_Storage_update", true, name);//货位状态更新
                                continue;
                            }
                            var areaCode = PipelineJob.area_code(name);   //根据下料口单元名获取区域代码
                            var station = stationinfoRepository.FindFirst(x => x.area == areaCode && x.stationCode.Substring(x.stationCode.Length - 1, 1) == AreaNr.ToString());
@@ -543,6 +547,9 @@
                        var Request = (bool)DBExtension.Read(details.Where(x => x.plcdetail_name == "R_Request_Load").First(), client);
                        if (!Request) continue;
                        var Area = client.ReadByOrder<Int16>("W_AreaNr", name);//读取货位号信息
                        if (Area != 0) continue;
                        var load_zone = (bool)DBExtension.Read(details.Where(x => x.plcdetail_name == "R_load_zone").First(), client);
                        #region è¯»å–桁架信息
                        var Wheel_Type = DBExtension.Read(details.Where(x => x.plcdetail_name == "R_Wheel_Type").First(), client);//车轮类型
@@ -580,7 +587,7 @@
                        #endregion
                        var Stations = stationinfoRepository.Find(x => x.area == PipelineJob.area_code(name));
                        var Stations = stationinfoRepository.Find(x => x.area == PipelineJob.area_code(name)).OrderBy(x => x.lastUpdateTime).ToList();
                        var NGStation = "X01001003";
                        if (name == "2单元下料区") NGStation = "X02001003";
@@ -720,6 +727,7 @@
                                        Stationinfo.location_state = LocationStateEnum.Abnormal.ToString();
                                        Stationinfo.remark = "车轮数量与光电不匹配";
                                        stationinfoRepository.Update(Stationinfo, true);
                                        WriteDBLog.Error(name + "报警", $"货位编号:{Stationinfo.stationCode};错误信息:{Stationinfo.remark}", "PCS");
                                        //WriteDBLog.Error(name+"申请下料",$"{Stationinfo.stationCode}的货位","PCS");
                                    }
                                    else if (list.Count < 1 && MaterialSignal == 1)
@@ -729,6 +737,7 @@
                                        Stationinfo.location_state = LocationStateEnum.Abnormal.ToString();
                                        Stationinfo.remark = "车轮数量与光电不匹配";
                                        stationinfoRepository.Update(Stationinfo, true);
                                        WriteDBLog.Error(name + "报警", $"货位编号:{Stationinfo.stationCode};错误信息:{Stationinfo.remark}", "PCS");
                                    }
                                    #endregion
@@ -834,10 +843,30 @@
                                    }
                                    #region è´§ä½æ•°é‡ä¸Žå…‰ç”µä¸åŒ¹é…ï¼ŒæŠ¥è­¦
                                    //if (list.Count > 0 && MaterialSignal != 1)
                                    //    Pipeline_client.WriteByOrder("W_AlarmSignal", (Int16)2, name);//报警
                                    //else if (list.Count < 1 && MaterialSignal == 1)
                                    //    Pipeline_client.WriteByOrder("W_AlarmSignal", (Int16)2, name);//报警
                                    if (list.Count > 0 && MaterialSignal != 1)
                                    {
                                        client.WriteByOrder("W_Enabl_Load", false, name);//信号为false桁架停止进入
                                        Pipeline_client.WriteByOrder("W_AlarmSignal", (Int16)2, name);//报警
                                        Stationinfo.location_state = LocationStateEnum.Abnormal.ToString();
                                        Stationinfo.remark = "车轮数量与光电不匹配";
                                        stationinfoRepository.Update(Stationinfo, true);
                                        WriteDBLog.Error(name + "报警", $"货位编号:{Stationinfo.stationCode};错误信息:{Stationinfo.remark}", "PCS");
                                        //WriteDBLog.Error(name+"申请下料",$"{Stationinfo.stationCode}的货位","PCS");
                                    }
                                    else if (list.Count < 1 && MaterialSignal == 1)
                                    {
                                        client.WriteByOrder("W_Enabl_Load", false, name);//信号为false桁架停止进入
                                        Pipeline_client.WriteByOrder("W_AlarmSignal", (Int16)2, name);//报警
                                        Stationinfo.location_state = LocationStateEnum.Abnormal.ToString();
                                        Stationinfo.remark = "车轮数量与光电不匹配";
                                        stationinfoRepository.Update(Stationinfo, true);
                                        WriteDBLog.Error(name + "报警", $"货位编号:{Stationinfo.stationCode};错误信息:{Stationinfo.remark}", "PCS");
                                    }
                                    #endregion
                                    //缓存架上车轮数量与SN号数量不一致
´úÂë¹ÜÀí/PCS/WCS_Server/WIDESEA_WCS/Jobs/Task/AutoTaskJob.cs
@@ -37,8 +37,8 @@
            //EmptyTrayTask.task();
            StationTask.CreateTask();
            //OutboundTask.CreateOutboundTask();
            OutboundTask_a.CreateOutboundTask();
            OutboundTask.CreateOutboundTask();//优化后出库逻辑
            //OutboundTask_a.CreateOutboundTask();
            ReplaceTray.ReplaceTrayTask();
            RestockHCJ.HCJGetBarcode();
            EmptyTrayTask.CreateEmptyTrayTask();
´úÂë¹ÜÀí/PCS/WCS_Server/WIDESEA_WCS/Jobs/equipment/PipelineJob.cs
@@ -77,7 +77,7 @@
                ///查找上料区的货位
                var Stations = stationinfoRepository.Find(x => x.area == area_code(number));
                var Stations = stationinfoRepository.Find(x => x.area == area_code(number)).OrderBy(x => x.lastUpdateTime);//根据时间先后排序
                //缓存架未启用禁止桁架进入
                //foreach (var station in Stations)
                //{
@@ -111,20 +111,25 @@
                    var details = plcRepository.Find(x => x.plcdetail_iotype == plc.plcinfo_iotyep && x.plcdetail_number == Station.stationCode).ToList();
                    var PalletSignal = (Int16)DBExtension.Read(details.Where(x => x.plcdetail_name == "R_PalletSignal").First(), client);//读取托盘信号:1:有,2无
                    var MaterialSignal = (Int16)DBExtension.Read(details.Where(x => x.plcdetail_name == "R_MaterialSignal").First(), client);//读取货物信号:1:有,2无
                    var AreaNr = Gantry_client.ReadByOrder<Int16>("W_AreaNr", number);//读取货位号信息
                    if (PalletSignal == 1 && MaterialSignal == 1)
                    {
                        var area = Convert.ToInt16(Station.stationCode.Substring(Station.stationCode.Length - 1, 1));
                        Gantry_client.WriteByOrder("W_AreaNr", (Int16)area, number);//区域货位号
                        Gantry_client.WriteByOrder("W_IndexNr", (Int16)SNS.Length, number);//托盘上的第几个车轮
                        Gantry_client.WriteByOrder("W_Storage_Type", (Int16)1, number); //托盘类型1-横放;2-竖放
                        Gantry_client.WriteByOrder("W_Wheel_Type", (Int16)Convert.ToInt16(QueryMateriel(Station.stationType) == null ? QueryMateriel1(Station.stationType).TypeId : QueryMateriel(Station.stationType).TypeId), number);//车轮类型
                        Gantry_client.WriteByOrder("W_Wheel_id", SNS[SNS.Length - 1], number);//车轮SN号
                        Gantry_client.WriteByOrder("W_RequestUnload", true, number);
                        #region æ—¥å¿—记录
                        WriteDBLog.Success("上料区申请", $"读取托盘光电信号:{PalletSignal}\n读取第一个车轮光电信号:{MaterialSignal}\n\n" +
                            $"写入桁架信息:\n区域货位号:{area}\n托盘上的第几个车轮:{SNS.Length}\n托盘类型:{1}\n车轮类型:{(QueryMateriel(Station.stationType).TypeId == null ? QueryMateriel1(Station.stationType).TypeId : QueryMateriel(Station.stationType).TypeId)}" +
                            $"\n车轮SN号:{SNS[SNS.Length - 1]}\nW_RequestUnload:true", "PCS");
                        #endregion
                        if (AreaNr == 0)
                        {
                            var area = Convert.ToInt16(Station.stationCode.Substring(Station.stationCode.Length - 1, 1));
                            Gantry_client.WriteByOrder("W_AreaNr", (Int16)area, number);//区域货位号
                            Gantry_client.WriteByOrder("W_IndexNr", (Int16)SNS.Length, number);//托盘上的第几个车轮
                            Gantry_client.WriteByOrder("W_Storage_Type", (Int16)1, number); //托盘类型1-横放;2-竖放
                            Gantry_client.WriteByOrder("W_Wheel_Type", (Int16)Convert.ToInt16(QueryMateriel(Station.stationType) == null ? QueryMateriel1(Station.stationType).TypeId : QueryMateriel(Station.stationType).TypeId), number);//车轮类型
                            Gantry_client.WriteByOrder("W_Wheel_id", SNS[SNS.Length - 1], number);//车轮SN号
                            Gantry_client.WriteByOrder("W_RequestUnload", true, number);
                            #region æ—¥å¿—记录
                            WriteDBLog.Success("上料区申请", $"读取托盘光电信号:{PalletSignal}\n读取第一个车轮光电信号:{MaterialSignal}\n\n" +
                                $"写入桁架信息:\n区域货位号:{area}\n托盘上的第几个车轮:{SNS.Length}\n托盘类型:{1}\n车轮类型:{(QueryMateriel(Station.stationType).TypeId == null ? QueryMateriel1(Station.stationType).TypeId : QueryMateriel(Station.stationType).TypeId)}" +
                                $"\n车轮SN号:{SNS[SNS.Length - 1]}\nW_RequestUnload:true", "PCS");
                            #endregion
                        }
                    }
                    else
                    {
@@ -174,10 +179,20 @@
                            //throw new Exception($"上料位信息更新失败!上料位编号:{Station.stationCode}");
                            return;
                        }
                        #region æ¸…空信息
                        Gantry_client.WriteByOrder("W_AreaNr", (Int16)0, number);//区域货位号
                        Gantry_client.WriteByOrder("W_IndexNr", (Int16)0, number);//托盘上的第几个车轮
                        Gantry_client.WriteByOrder("W_Storage_Type", (Int16)0, number); //托盘类型1-横放;2-竖放
                        Gantry_client.WriteByOrder("W_Wheel_Type", (Int16)0, number);//车轮类型
                        //Gantry_client.WriteByOrder("W_Wheel_id", SNS[SNS.Length - 1], number);//车轮SN号
                        #endregion
                        Gantry_client.WriteByOrder("W_Storage_update", true, number);//货位状态更新
                        #region æ—¥å¿—记录
                        WriteDBLog.Success("取料完成", $"写入桁架信息:\n货位状态更新:{true}\nW_RequestUnload:{false}", "PCS");
                        #endregion
                        PalletSignal = (Int16)DBExtension.Read(details.Where(x => x.plcdetail_name == "R_PalletSignal").First(), client);//读取托盘信号:1:有,2无
                        MaterialSignal = (Int16)DBExtension.Read(details.Where(x => x.plcdetail_name == "R_MaterialSignal").First(), client);//读取货物信号:1:有,2无
                        if (Station.quantity > 0 && (PalletSignal != 1 || MaterialSignal != 1))
@@ -186,6 +201,7 @@
                            Station.remark = "车轮数量大于0,光电检测无托盘或无车轮";
                            stationinfoRepository.Update(Station, true);
                            client.WriteByOrder("W_AlarmSignal", (Int16)2, number);//报警
                            WriteDBLog.Error(number + "报警", $"货位编号:{Station.stationCode};错误信息:{Station.remark}", "PCS");
                        }
                        else if (Station.quantity < 1 && MaterialSignal == 1)
                        {
@@ -193,6 +209,7 @@
                            Station.remark = "车轮数量小于0,光电检测有车轮";
                            stationinfoRepository.Update(Station, true);
                            client.WriteByOrder("W_AlarmSignal", (Int16)2, number);//报警
                            WriteDBLog.Error(number + "报警", $"货位编号:{Station.stationCode};错误信息:{Station.remark}", "PCS");
                        }
                    }
                }
@@ -336,6 +353,7 @@
                            Station.remark = "车轮数量大于0,光电检测无托盘或无车轮";
                            stationinfoRepository.Update(Station, true);
                            client.WriteByOrder("W_AlarmSignal", (Int16)2, name);//报警
                            WriteDBLog.Error(name + "报警", $"货位编号:{Station.stationCode};错误信息:{Station.remark}", "PCS");
                            continue;
                        }
                        if (Station.location_state == LocationStateEnum.Stroge.ToString() && PalletSignal != 1)
@@ -344,6 +362,7 @@
                            Station.remark = "货位有货,光电检测无托盘";
                            stationinfoRepository.Update(Station, true);
                            client.WriteByOrder("W_AlarmSignal", (Int16)2, name);//报警
                            WriteDBLog.Error(name + "报警", $"货位编号:{Station.stationCode};错误信息:{Station.remark}", "PCS");
                            continue;
                        }
                        if (Station.location_state == LocationStateEnum.Empty.ToString() && (PalletSignal == 1 || MaterialSignal == 1))//系统货位为空,光电检测有料
@@ -352,6 +371,7 @@
                            Station.remark = "货位无货,光电检测有料";
                            stationinfoRepository.Update(Station, true);
                            client.WriteByOrder("W_AlarmSignal", (Int16)2, name);//报警
                            WriteDBLog.Error(name + "报警", $"货位编号:{Station.stationCode};错误信息:{Station.remark}", "PCS");
                            continue;
                        }
                        //if (Station.quantity < 1 && MaterialSignal == 1)//系统货位无车轮,光电检测有车轮
´úÂë¹ÜÀí/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/OutboundTask.cs
@@ -30,27 +30,38 @@
            {
                VOLContext context = new VOLContext();
                Idt_stationinfoRepository stationinfoRepository = new dt_stationinfoRepository(context);
                Idt_mes_headRepository mes_HeadRepository = new dt_mes_headRepository(context);
                Idt_mes_detailRepository mes_DetailRepository = new dt_mes_detailRepository(context);
                Idt_inventoryRepository inventoryRepository = new dt_inventoryRepository(context);
                Idt_agvtaskRepository agvtaskRepository = new dt_agvtaskRepository(context);
                IVV_Mes_WorkinfoRepository workinfoRepository = new VV_Mes_WorkinfoRepository(context);
                var mes_heads = mes_HeadRepository.Find(x => x.processCode == "28").OrderBy(x => x.expectedStartTime).ToList();
                //var mes_heads = mes_HeadRepository.Find(x => x.processCode == "28").OrderByDescending(x => x.CreateTime).ToList();
                foreach (var mes_head in mes_heads)
                var Mes_Works = workinfoRepository.Find(x => x.processCode == "28").OrderBy(x => x.CreateTime).ToList();
                foreach (var Mes_Work in Mes_Works)
                {
                    #region æ ¹æ®åº“存入库时间最晚查询
                    var inventory = inventoryRepository.Find(x => x.FigureNumber == mes_head.drawingNo).OrderByDescending(x => x.OnlineTime).FirstOrDefault();
                    var inventory = inventoryRepository.Find(x => x.SN == Mes_Work.SN).FirstOrDefault();
                    if (inventory != null)
                    {
                        var Station = stationinfoRepository.Find(x => x.stationCode == inventory.stationCode).FirstOrDefault();
                        var Station = stationinfoRepository.Find(x => x.stationCode == inventory.stationCode).FirstOrDefault();//查找库存货位
                        if (Station != null)
                        {
                            #region å­˜åœ¨å…¥åº“任务不能出库
                            var InTask = stationinfoRepository.Find(x => x.line == Station.line && x.area == Station.area && x.location_state == LocationStateEnum.InBusy.ToString()).Any();
                            if (InTask) continue;
                            dt_stationinfo stationinfo = null;
                            #region åº“区一
                            if (Station.area == "1")
                            {
                                //查找当前货位同列是否存在入库任务
                                if (stationinfoRepository.Find(x => x.column == Station.column && x.area == "1" && x.location_state == LocationStateEnum.InBusy.ToString()).Any()) continue;
                                stationinfo = stationinfoRepository.Find(x => x.column == Station.column && x.enable && x.area == "1" && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity > 0).OrderBy(x => x.line).FirstOrDefault();
                            }
                            #endregion
                            var stationinfo = stationinfoRepository.Find(x => x.line == Station.line && x.area == Station.area && x.enable && x.location_state == LocationStateEnum.Stroge.ToString()).OrderByDescending(x => x.column).FirstOrDefault();
                            else
                            {
                                //查找当前货位同列是否存在入库任务
                                if (stationinfoRepository.Find(x => x.line == Station.line && x.area == Station.area && x.location_state == LocationStateEnum.InBusy.ToString()).Any()) continue;
                                stationinfo = stationinfoRepository.Find(x => x.line == Station.line && x.area == Station.area && x.enable && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity > 0).OrderByDescending(x => x.column).FirstOrDefault();
                            }
                            if (stationinfo != null)
                            {
                                if (string.IsNullOrEmpty(stationinfo.bindSN))
@@ -59,10 +70,10 @@
                                    stationinfo.location_state = "Abnormal";
                                    stationinfoRepository.Update(stationinfo, true);
                                    continue;
                                    //throw new Exception(stationinfo.stationCode + "车轮SN号信息异常!");
                                }
                                if (agvtaskRepository.Find(x => x.agv_fromaddress == stationinfo.stationCode).Any())
                                    continue;
                                if (agvtaskRepository.Find(x => x.agv_fromaddress == stationinfo.stationCode).Any()) continue;
                                List<string> lists = new List<string>();
                                var SNS = stationinfo.bindSN.Split(",");
                                foreach (var SN in SNS)
@@ -70,196 +81,80 @@
                                    if (!string.IsNullOrEmpty(SN))
                                        lists.Add(SN);
                                }
                                foreach (var item in lists)
                                {
                                    //var a = mes_DetailRepository.Find(x => x.jobID == mes_head.jobID /*&& x.SN == item*/).ToList();
                                    //var b = a.Where(x => x.SN == item).FirstOrDefault();
                                    if (mes_DetailRepository.Find(x => x.jobID == mes_head.jobID && x.SN == item).Any())
                                    {
                                        dt_agvtask agvtask = new dt_agvtask()
                                        {
                                            agv_fromaddress = stationinfo.stationCode,
                                            agv_id = Guid.NewGuid(),
                                            agv_tasknum = IdenxManager.GetTaskNo("KH-", "WMS"),
                                            agv_grade = 2,
                                            agv_createtime = DateTime.Now,
                                            agv_taskstate = "Queue",
                                            agv_materielid = stationinfo.stationType,
                                            agv_qty = stationinfo.quantity,
                                            agv_tasktype = "TaskType_Outbound",
                                            agv_toaddress = "",
                                            agv_userid = "系统",
                                            bindSN = stationinfo.bindSN,
                                            jobID = mes_head.jobID,
                                            agv_worktype = Convert.ToInt32(mes_head.processCode),
                                            agv_materbarcode = mes_head.materialCode,
                                            agv_Traytype = stationinfo.tray_type,
                                            agv_TrayStatus = stationinfo.tray_status
                                        };
                                        stationinfo.location_state = LocationStateEnum.OutBusy.ToString();
                                        stationinfoRepository.Update(stationinfo, true);
                                        agvtaskRepository.Add(agvtask, true);
                                        WriteDBLog.Success("创建出库任务", $"任务编号:{agvtask.agv_tasknum}", "PCS");
                                        return;
                                    }
                                }
                            }
                            var stationinfos = stationinfoRepository.Find(x => x.stationType == mes_head.drawingNo && x.line != Station.line && x.area == Station.area && x.location_state == "Stroge").OrderBy(x => x.line).ThenByDescending(x => x.column).ToList();
                            foreach (var item in stationinfos)
                            {
                                if (item != null && stationinfo.enable)
                                #region è´§ä½è½¦è½®å…¨éƒ¨åŒ…含在工单内则下发任务
                                var count = 0;
                                foreach (var SN in lists)
                                {
                                    if (item.bindSN == null)
                                    {
                                        stationinfo.remark = "车轮SN号信息异常";
                                        stationinfo.location_state = "Abnormal";
                                        stationinfoRepository.Update(stationinfo, true);
                                        continue;
                                    }
                                    if (agvtaskRepository.Find(x => x.agv_fromaddress == stationinfo.stationCode).Any())
                                        continue;
                                    List<string> lists = new List<string>();
                                    var SNS = stationinfo.bindSN.Split(",");
                                    foreach (var SN in SNS)
                                    {
                                        if (!string.IsNullOrEmpty(SN))
                                            lists.Add(SN);
                                    }
                                    foreach (var list in lists)
                                    {
                                        if (mes_DetailRepository.Find(x => x.jobID == mes_head.jobID && x.SN == list).Any())
                                        {
                                            dt_agvtask agvtask = new dt_agvtask()
                                            {
                                                agv_fromaddress = stationinfo.stationCode,
                                                agv_id = Guid.NewGuid(),
                                                agv_tasknum = IdenxManager.GetTaskNo("KH-", "WMS"),
                                                agv_grade = 1,
                                                agv_createtime = DateTime.Now,
                                                agv_taskstate = "Queue",
                                                agv_materielid = stationinfo.stationType,
                                                agv_qty = stationinfo.quantity,
                                                jobID = mes_head.jobID,
                                                agv_tasktype = "TaskType_Outbound",
                                                agv_toaddress = "",
                                                agv_userid = "系统",
                                                bindSN = stationinfo.bindSN,
                                                agv_worktype = Convert.ToInt32(mes_head.processCode),
                                                agv_materbarcode = mes_head.materialCode,
                                                agv_Traytype = stationinfo.tray_type,
                                                agv_TrayStatus = stationinfo.tray_status
                                            };
                                            WriteDBLog.Success("创建出库任务", $"任务编号:{agvtask.agv_tasknum}", "PCS");
                                            agvtaskRepository.Add(agvtask, true);
                                            return;
                                        }
                                    }
                                }
                            }
                                    //if (!workinfoRepository.Find(x => x.processCode == "28" && x.SN.Contains(SN)).Any()) return;
                                    if (workinfoRepository.Find(x => x.processCode == "28" && x.SN.Contains(SN)).Any()) count++;
                            #region MyRegion
                            //if (stationinfo != null && stationinfo.enable)
                            //{
                            //    if (stationinfo.bindSN == null)
                            //        throw new Exception(stationinfo.stationCode + "车轮SN号信息异常!");
                            //    List<string> lists = new List<string>();
                            //    var SNS = stationinfo.bindSN.Split(",");
                            //    foreach (var SN in SNS)
                            //    {
                            //        if (!string.IsNullOrEmpty(SN))
                            //            lists.Add(SN);
                            //    }
                            //    foreach (var item in lists)
                            //    {
                            //        if (freeDB.Select<dt_mes_detail>().Where(x => x.jobID == mes_head.jobID && x.SN == item).Any())
                            //        {
                            //            dt_agvtask agvtask = new dt_agvtask()
                            //            {
                            //                agv_fromaddress = stationinfo.stationCode,
                            //                agv_id = Guid.NewGuid(),
                            //                agv_tasknum = IdenxManager.GetTaskNo("KH-", "WMS"),
                            //                agv_grade = 1,
                            //                agv_createtime = DateTime.Now,
                            //                agv_taskstate = "Queue",
                            //                agv_materielid = stationinfo.stationType,
                            //                agv_qty = stationinfo.quantity,
                            //                agv_tasktype = "TaskType_Outbound",
                            //                agv_toaddress = "",
                            //                agv_userid = "系统",
                            //                bindSN = stationinfo.bindSN,
                            //                agv_worktype = Convert.ToInt32(mes_head.processCode),
                            //                agv_materbarcode = mes_head.materialCode,
                            //                agv_Traytype = stationinfo.tray_type,
                            //                agv_TrayStatus = stationinfo.tray_status
                            //            };
                            //            dt_stationinfo TargetLocation = GetEmptyLocation(stationinfoRepository);
                            //            if (TargetLocation != null)
                            //            {
                            //                agvtask.agv_taskstate = "Create";
                            //                agvtask.agv_toaddress = TargetLocation.stationCode;
                            //                TargetLocation.location_state = LocationStateEnum.Busy.ToString();
                            //                freeDB.Update(TargetLocation);
                            //            }
                            //            freeDB.Add(agvtask);
                            //            return;
                            //        }
                            //    }
                            //}
                            #endregion
                                }
                                if (count != lists.Count) continue;
                                dt_agvtask agvtask = new dt_agvtask()
                                {
                                    agv_fromaddress = stationinfo.stationCode,
                                    agv_id = Guid.NewGuid(),
                                    agv_tasknum = IdenxManager.GetTaskNo("KH-", "WMS"),
                                    agv_grade = 2,
                                    agv_createtime = DateTime.Now,
                                    agv_taskstate = "Queue",
                                    agv_materielid = stationinfo.stationType,
                                    agv_qty = stationinfo.quantity,
                                    agv_tasktype = "TaskType_Outbound",
                                    agv_toaddress = "",
                                    agv_userid = "系统",
                                    bindSN = stationinfo.bindSN,
                                    jobID = Mes_Work.jobID,
                                    agv_worktype = Convert.ToInt32(Mes_Work.processCode),
                                    agv_materbarcode = Mes_Work.materialCode,
                                    agv_Traytype = stationinfo.tray_type,
                                    agv_TrayStatus = stationinfo.tray_status
                                };
                                stationinfo.location_state = LocationStateEnum.OutBusy.ToString();
                                stationinfoRepository.Update(stationinfo, true);
                                agvtaskRepository.Add(agvtask, true);
                                WriteDBLog.Success("创建出库任务", $"任务编号:{agvtask.agv_tasknum}", "PCS");
                                continue;
                                #endregion
                                #region è´§ä½è½¦è½®æœ‰ä¸€ä¸ªåŒ…含在工单内则下发任务
                                //foreach (var SN in lists)
                                //{
                                //    if (mes_DetailRepository.Find(x => x.jobID == mes_head.jobID && x.SN == SN).Any())
                                //    {
                                //        dt_agvtask agvtask = new dt_agvtask()
                                //        {
                                //            agv_fromaddress = stationinfo.stationCode,
                                //            agv_id = Guid.NewGuid(),
                                //            agv_tasknum = IdenxManager.GetTaskNo("KH-", "WMS"),
                                //            agv_grade = 2,
                                //            agv_createtime = DateTime.Now,
                                //            agv_taskstate = "Queue",
                                //            agv_materielid = stationinfo.stationType,
                                //            agv_qty = stationinfo.quantity,
                                //            agv_tasktype = "TaskType_Outbound",
                                //            agv_toaddress = "",
                                //            agv_userid = "系统",
                                //            bindSN = stationinfo.bindSN,
                                //            jobID = mes_head.jobID,
                                //            agv_worktype = Convert.ToInt32(mes_head.processCode),
                                //            agv_materbarcode = mes_head.materialCode,
                                //            agv_Traytype = stationinfo.tray_type,
                                //            agv_TrayStatus = stationinfo.tray_status
                                //        };
                                //        stationinfo.location_state = LocationStateEnum.OutBusy.ToString();
                                //        stationinfoRepository.Update(stationinfo, true);
                                //        agvtaskRepository.Add(agvtask, true);
                                //        WriteDBLog.Success("创建出库任务", $"任务编号:{agvtask.agv_tasknum}", "PCS");
                                //        continue;
                                //    }
                                //}
                                #endregion
                            }
                        }
                    }
                    #endregion
                    #region MyRegion
                    //var station = stationinfoRepository.Find(x => x.stationType == mes_head.drawingNo && x.line != x.line).OrderBy(x => x.line).ThenByDescending(x => x.column).FirstOrDefault();
                    //bool ok = false;
                    //List<string> list = new List<string>();
                    //if (station != null && station.location_state == LocationStateEnum.Stroge.ToString() && station.enable)
                    //{
                    //    var SNS = station.bindSN.Split(",");
                    //    foreach (var SN in SNS)
                    //    {
                    //        if (!string.IsNullOrEmpty(SN))
                    //            list.Add(SN);
                    //    }
                    //}
                    //foreach (var SN in list)
                    //{
                    //    if (ok = freeDB.Select<dt_mes_detail>().Where(x => x.jobID == mes_head.jobID && x.SN == SN).Any()) continue;
                    //}
                    //if (ok)
                    //{
                    //    dt_agvtask agvtask = new dt_agvtask()
                    //    {
                    //        agv_fromaddress = station.stationCode,
                    //        agv_id = Guid.NewGuid(),
                    //        agv_tasknum = IdenxManager.GetTaskNo("KH-", "WMS"),
                    //        agv_grade = 1,
                    //        agv_createtime = DateTime.Now,
                    //        agv_taskstate = "Queue",
                    //        agv_materielid = station.stationType,
                    //        agv_qty = station.quantity,
                    //        agv_tasktype = "TaskType_Outbound",
                    //        agv_toaddress = "",
                    //        agv_userid = "系统",
                    //        bindSN = station.bindSN,
                    //        agv_worktype = Convert.ToInt32(mes_head.processCode),
                    //        agv_materbarcode = mes_head.materialCode,
                    //        agv_barcode = station.tray_type
                    //    };
                    //    dt_stationinfo TargetLocation = GetEmptyLocation(stationinfoRepository);
                    //    if (TargetLocation != null)
                    //    {
                    //        agvtask.agv_taskstate = "Create";
                    //        agvtask.agv_toaddress = TargetLocation.stationCode;
                    //        TargetLocation.location_state = LocationStateEnum.Busy.ToString();
                    //        freeDB.Update(TargetLocation);
                    //    }
                    //    freeDB.Add(agvtask);
                    //}
                    #endregion
                }
            }
            catch (Exception ex)
´úÂë¹ÜÀí/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/ÐÂÎļþ¼Ð/GetLocation.cs
@@ -66,7 +66,10 @@
                        var station = stationinfoRepository.FindFirst(x => x.stationCode == inventory.stationCode);
                        if (station.area == "1")
                        {
                            TargetLocation = stationinfoRepository.Find(x => x.column == station.column && x.location_state == LocationStateEnum.Empty.ToString() && x.enable && x.area == inventory.area).OrderByDescending(x => x.line).FirstOrDefault();
                            //TargetLocation = stationinfoRepository.Find(x => x.column == station.column && x.location_state == LocationStateEnum.Empty.ToString() && x.enable && x.area == inventory.area).OrderByDescending(x => x.line).FirstOrDefault();
                            TargetLocation = stationinfoRepository.Find(x => x.line == station.line && x.location_state == LocationStateEnum.Empty.ToString() && x.enable && x.area == station.area).OrderBy(x => x.column).FirstOrDefault();//按行存放
                            if (TargetLocation != null)
                            {
                                if (!stationinfoRepository.Find(x => x.column == TargetLocation.column && x.area == TargetLocation.area /*&& x.enable*/ && x.location_state == LocationStateEnum.OutBusy.ToString()).Any())
@@ -92,7 +95,10 @@
                    {
                        if (TargetLocation.area == "1")
                        {
                            TargetLocation = stationinfoRepository.Find(x => x.column == TargetLocation.column && x.location_state == LocationStateEnum.Empty.ToString() && x.enable && x.area == TargetLocation.area).OrderByDescending(x => x.line).FirstOrDefault();
                            //TargetLocation = stationinfoRepository.Find(x => x.column == TargetLocation.column && x.location_state == LocationStateEnum.Empty.ToString() && x.enable && x.area == TargetLocation.area).OrderByDescending(x => x.line).FirstOrDefault();
                            TargetLocation = stationinfoRepository.Find(x => x.line == TargetLocation.line && x.location_state == LocationStateEnum.Empty.ToString() && x.enable && x.area == TargetLocation.area).OrderBy(x => x.column).FirstOrDefault();//按行存放
                            if (TargetLocation != null)
                            {
                                if (!stationinfoRepository.Find(x => x.column == TargetLocation.column && x.area == TargetLocation.area /*&& x.enable*/ && x.location_state == LocationStateEnum.OutBusy.ToString()).Any())
@@ -111,6 +117,25 @@
                    }
                    #endregion
                    #region å¯»æ‰¾ç©ºè´§ä½
                    var TargetLocations = stationinfoRepository.Find(x => x.location_state == LocationStateEnum.Empty.ToString() && x.enable && (x.area == "1" || x.area == "2" || x.area == "3" || x.area == "4")).OrderBy(x => x.line).ThenBy(x => x.column).ToList();
                    foreach (var Location in TargetLocations)
                    {
                        if (Location.area == "1")
                        {
                            if (stationinfoRepository.Find(x => x.column == Location.column && x.area == Location.area && x.stationType == stationinfo.stationType && x.location_state != LocationStateEnum.OutBusy.ToString()).Any()) return Location;
                        }
                        else
                        {
                            if (stationinfoRepository.Find(x => x.line == Location.line && x.area == Location.area && x.stationType == stationinfo.stationType && x.location_state != LocationStateEnum.OutBusy.ToString()).Any()) return Location;
                        }
                    }
                    //if (TargetLocation != null)
                    //{
                    //    if (stationinfoRepository.Find(x => x.line == TargetLocation.line && x.column == 1 && x.stationType == stationinfo.stationType).Any()) return TargetLocation;
                    //}
                    #endregion
                    #region æœªæ‰¾åˆ°åº“存或当前库存行已满,寻找新的一行
                    //var area1 = string.IsNullOrEmpty(mesinfo.area) ? GetArea(mesinfo.quantity, e) : mesinfo.area;
                    //var area = string.IsNullOrEmpty(mesinfo.area) ? GetArea(mesinfo.quantity, stationinfo.tray_type) : mesinfo.area;
@@ -126,6 +151,22 @@
                        if (TargetLocation == null)
                            TargetLocation = stationinfoRepository.Find(x => x.line == 2 && x.location_state == LocationStateEnum.Empty.ToString() && x.enable && x.area == "1").OrderBy(x => x.column).FirstOrDefault();
                    }
                    #region æŸ¥çœ‹å½“前空货位后是否存在有料
                    if (TargetLocation != null)
                    {
                        if (TargetLocation.area == "1")
                        {
                            //第一行不为空货位则不能放置第二行
                            if (stationinfoRepository.Find(x => x.column == TargetLocation.column && x.area == TargetLocation.area && x.location_state != LocationStateEnum.Empty.ToString() && x.line == 1).Any()) TargetLocation = null;
                        }
                        else
                        {
                            if (stationinfoRepository.Find(x => x.line == TargetLocation.line && x.area == TargetLocation.area && x.location_state != LocationStateEnum.Empty.ToString()).Any()) TargetLocation = null;
                        }
                    }
                    #endregion
                    #endregion
                    if (TargetLocation == null) throw new Exception("库位已满");
´úÂë¹ÜÀí/WMS/WMS_Client/src/api/http.js
@@ -12,7 +12,7 @@
let loadingInstance;
let loadingStatus = false;
if (process.env.NODE_ENV == 'development') {
    axios.defaults.baseURL = 'http://192.168.12.101:8098/';
    axios.defaults.baseURL = 'http://127.0.0.1:8098/';
}
else if (process.env.NODE_ENV == 'debug') {
    axios.defaults.baseURL = 'http://192.168.12.101:8098/';
´úÂë¹ÜÀí/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/HandleTask.cs
@@ -171,6 +171,7 @@
                station2.stationType = task.agv_materielid;
                station2.tray_status = task.agv_TrayStatus;//横放/竖放
                station2.tray_type = task.agv_Traytype;
                station2.lastUpdateTime=DateTime.Now;
                stationinfoRepository.Update(station2, true);
            }
            else if (task.agv_taskstate == AGVTaskStateEnum.Complete.ToString())
@@ -207,6 +208,7 @@
                    //if (!station1.stationCode.Contains("X") && !station1.stationCode.Contains("S") && !station1.stationCode.Contains("W01001004") && !station1.stationCode.Contains("W01001005"))
                    //    station1.tray_type = string.Empty;
                }
                station1.lastUpdateTime = DateTime.Now;
                stationinfoRepository.Update(station1, true);
            }
        }