分支自 SuZhouGuanHong/TaiYuanTaiZhong

dengjunjie
2024-04-27 25724888bc329401891bf1600a8a83d8aae338b3
叠盘入库功能开发,空托入库逻辑优化
已修改12个文件
已添加2个文件
1594 ■■■■■ 文件已修改
代码管理/PCS/WCS_Server/WIDESEA_Entity/DomainModels/ToAGV/AGVRequestin.cs 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/PCS/WCS_Server/WIDESEA_WCS/Common/AGVandPipeline.cs 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/PCS/WCS_Server/WIDESEA_WCS/Common/Gantry.cs 438 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/PCS/WCS_Server/WIDESEA_WCS/Common/Pipeline.cs 268 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/PCS/WCS_Server/WIDESEA_WCS/Jobs/Task/AutoTaskJob.cs 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/PCS/WCS_Server/WIDESEA_WCS/Jobs/equipment/PipelineJob.cs 536 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/EmptyTrayIn.cs 84 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/GetStation/EmptyPalletStation.cs 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/ReplaceTray.cs 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/RestockHCJ.cs 187 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/新文件夹/GetLocation.cs 18 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/PCS/WCS_Server/WIDESEA_WebApi/appsettings.json 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WMS_Server/WIDESEA_WebApi/Controllers/ToWms/ToWMSController.cs 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目资料/通信协议/PCS跟AGV和桁架防呆交互协议/PCS和桁架协议.xlsx 补丁 | 查看 | 原始文档 | blame | 历史
´úÂë¹ÜÀí/PCS/WCS_Server/WIDESEA_Entity/DomainModels/ToAGV/AGVRequestin.cs
@@ -24,6 +24,11 @@
    public class AGVGteaddress
    {
        /// <summary>
        /// ä½œä¸šä»»åŠ¡å·
        /// </summary>
        public string TASK_NO { get; set; }
        /// <summary>
        /// è´§ä½å·
        /// </summary>
´úÂë¹ÜÀí/PCS/WCS_Server/WIDESEA_WCS/Common/AGVandPipeline.cs
@@ -22,12 +22,12 @@
        public static Signal GetSignal(string address)
        {
            Signal signal = new Signal();
            AGVGteaddress gteaddress=new AGVGteaddress();
            AGVGteaddress gteaddress = new AGVGteaddress();
            try
            {
                if (string.IsNullOrEmpty(address) || address == "null")
                    throw new Exception("未获取到请求参数数据");
                 gteaddress = JsonConvert.DeserializeObject<AGVGteaddress>(address);
                gteaddress = JsonConvert.DeserializeObject<AGVGteaddress>(address);
                var Pipeline_client = PLCClient.Clients.FirstOrDefault(t => t.PLCName == "链条机");
                if (Pipeline_client == null) throw new Exception("链条机调度服务未开启!");
@@ -40,7 +40,7 @@
            {
                signal.Message = ex.Message;
            }
            WritePCSLog.LogAdd(address, signal.success == 1 ? "成功 " : "失败", "PCS", "AGV", address, JsonConvert.SerializeObject(signal), $"AGV获取{gteaddress.address}光电信号", "GetSignal", signal.Message);
            WritePCSLog.LogAdd(address, signal.success == 1 ? "成功 " : "失败", "PCS", "AGV", address, JsonConvert.SerializeObject(signal), $"{gteaddress.TASK_NO}的AGV获取{gteaddress.address}光电信号", "GetSignal", signal.Message);
            return signal;
        }
    }
´úÂë¹ÜÀí/PCS/WCS_Server/WIDESEA_WCS/Common/Gantry.cs
@@ -388,43 +388,21 @@
                        var NGStation = "X01001003";
                        if (name == "2单元下料区") NGStation = "X02001003";
                        if (name == "3单元下料区") NGStation = "X03001002";
                        #region MyRegion
                        //var Wheel_Type = DBExtension.Read(details.Where(x => x.plcdetail_name == "R_Wheel_Type").First(), client);//车轮类型
                        //var Wheel_id = client.ReadByOrder<string>("R_Wheel_id", name);//车轮SN号
                        //if (string.IsNullOrEmpty(Wheel_id)) continue;
                        ////var Wheel_id = DBExtension.Read(details.Where(x => x.plcdetail_name == "R_Wheel_id").First(), client).ToString();
                        //var mes_Detail = mes_DetailRepository.FindFirst(x => x.SN == Wheel_id);
                        //if (mes_Detail == null)
                        //{
                        //    #region æ—¥å¿—记录
                        //    WriteDBLog.Error(name, $"读取桁架信息:\n车轮SN:{Wheel_id}\n\n未查询到工单详情", "PCS");
                        //    #endregion
                        //    continue;
                        //}
                        //var mes_Head = mes_HeadRepository.FindFirst(x => x.jobID == mes_Detail.jobID);
                        //if (mes_Head == null)
                        //{
                        //    #region æ—¥å¿—记录
                        //    WriteDBLog.Error(name, $"读取桁架信息:\n车轮SN:{Wheel_id}\n\n未查询到工单头表", "PCS");
                        //    #endregion
                        //    continue;
                        //}
                        #endregion
                        var finished = (bool)DBExtension.Read(details.Where(x => x.plcdetail_name == "R_load_finished").First(), client);//放料完成
                        var updatefinished = (bool)DBExtension.Read(details.Where(x => x.plcdetail_name == "W_Storage_update").First(), client);//货位状态更新
                        #region è´§ä½çŠ¶æ€æ›´æ–°å¤ä½
                        //if (!finished && updatefinished)
                        //{
                        //    client.WriteByOrder("W_Storage_update", false, name);//货位状态更新
                        //    #region æ—¥å¿—记录
                        //    WriteDBLog.Success(name + "货位状态更新复位", $"读取桁架信息:\nR_load_finished:{finished}\n\n写入桁架信息:\nW_Storage_update:false", "PCS");
                        //    #endregion
                        //}
                        if (!finished && updatefinished)
                        {
                            client.WriteByOrder("W_Storage_update", false, name);//货位状态更新
                            #region æ—¥å¿—记录
                            //WriteDBLog.Success(name + "货位状态更新复位", $"读取桁架信息:\nR_load_finished:{finished}\n\n写入桁架信息:\nW_Storage_update:{false}", "PCS");
                            WriteLog.Write_Log(name + "放料完成", name + "货位状态更新信号复位", "成功!",
                                $"读取桁架信息:\n放料完成信号:{finished}\n\n写入桁架信息:\n货位状态更新信号:{false}");
                            #endregion
                        }
                        #endregion
                        if (finished && !updatefinished)
                        {
@@ -450,24 +428,6 @@
                                #endregion
                                continue;
                            }
                            #region MyRegion
                            //var Detail = mes_DetailRepository.FindFirst(x => x.SN == Wheel_SN);
                            //if (Detail == null)
                            //{
                            //    #region æ—¥å¿—记录
                            //    WriteDBLog.Error(name, $"读取桁架信息:\n车轮SN号:{Wheel_SN}\n\n未查询到工单详情", "PCS");
                            //    #endregion
                            //    continue;
                            //}
                            //var Head = mes_HeadRepository.FindFirst(x => x.jobID == Detail.jobID && x.processCode == "17");
                            //if (Head == null)
                            //{
                            //    #region æ—¥å¿—记录
                            //    WriteDBLog.Error(name, $"读取桁架信息:\n车轮SN号:{Wheel_SN}\n\n未查询到工单头表{Detail.jobID}", "PCS");
                            //    #endregion
                            //    continue;
                            //}
                            #endregion
                            #endregion
@@ -478,88 +438,90 @@
                                continue;
                            }
                            #region åˆ¤æ–­åŒºåŸŸå·æ˜¯å¦ä¸€è‡´
                            var area = client.ReadByOrder<Int16>("place_prog", name);//放料完成的区域号
                            if (AreaNr != area)
                            {
                                Pipeline_client.WriteByOrder("W_AlarmSignal", (Int16)2, name);//报警
                                //WriteDBLog.Error(name + "报警", $"PCS区域号:{AreaNr};桁架区域号:{area}错误信息:PCS区域号与桁架区域号不一致!", "PCS");
                                WriteLog.Write_Log(name + "放料完成出错", Wheel_SN, "判断区域号是否一致", $"PCS区域号:{AreaNr};\n桁架区域号:{area}\n错误信息:PCS区域号与桁架区域号不一致!");
                                continue;
                            }
                            #endregion
                            var areaCode = PipelineJob.area_code(name);   //根据下料口单元名获取区域代码
                            var station = stationinfoRepository.FindFirst(x => x.area == areaCode && x.stationCode.Substring(x.stationCode.Length - 1, 1) == AreaNr.ToString());
                            if (station.quantity >= 5)
                                throw new Exception($"下料位信息更新失败!下料位车轮数量大于5:{station.stationCode}");
                            //station.bindSN = station.bindSN == string.Empty ? Wheel_id : station.bindSN + "," + Wheel_id;
                            if (!string.IsNullOrEmpty(station.bindSN))
                            var station = stationinfoRepository.Find(x => x.area == areaCode && x.stationCode.Substring(x.stationCode.Length - 1, 1) == AreaNr.ToString()).FirstOrDefault();
                            if (station != null)
                            {
                                if (station.bindSN.Contains(Wheel_SN))
                                    throw new Exception($"{station.stationCode}已存在车轮SN号:{Wheel_SN}");
                                if (station.quantity >= 5)
                                {
                                    Pipeline_client.WriteByOrder("W_AlarmSignal", (Int16)2, name);//报警
                                    WriteLog.Write_Log(name + "放料完成出错", Wheel_SN, "车轮数量已满!", $"区域号:{AreaNr};\n车轮数:{station.quantity}\n错误信息:区域号车轮数量已满!");
                                }
                                #region åˆ¤æ–­è½¦è½®æ•°é‡æ˜¯å¦ä¸€è‡´
                                var quantity = client.ReadByOrder<Int16>("pos_prog", name);//桁架记录的车轮数量
                                if (quantity != station.quantity + 1)
                                {
                                    Pipeline_client.WriteByOrder("W_AlarmSignal", (Int16)2, name);//报警
                                    WriteLog.Write_Log(name + "放料完成出错", Wheel_SN, "判断车轮数量是否一致", $"区域号:{AreaNr};\n桁架车轮数:{quantity}\nPCS车轮数:{station.quantity + 1}\n错误信息:PCS区域号与桁架区域号不一致!");
                                    continue;
                                }
                                #endregion
                                if (!string.IsNullOrEmpty(station.bindSN))
                                {
                                    if (station.bindSN.Contains(Wheel_SN))
                                        throw new Exception($"{station.stationCode}已存在车轮SN号:{Wheel_SN}");
                                }
                                station.bindSN = string.IsNullOrEmpty(station.bindSN) ? Wheel_SN : station.bindSN + "," + Wheel_SN;
                                station.billetID = string.IsNullOrEmpty(station.billetID) ? Mes_Work.billetID.ToString() : station.billetID + "," + Mes_Work.billetID;
                                station.quantity++;
                                if (station.quantity == 1)
                                {
                                    station.stationType = Mes_Work.drawingNo;
                                    station.Number = Mes_Work.workOrder;
                                    station.heatNumber = Mes_Work.heatID;
                                    station.tray_status = "StrogeTray";
                                }
                                var count = stationinfoRepository.Update(station, true);
                                if (count < 1)
                                    throw new Exception($"下料位信息更新失败!下料位编号:{station.stationCode}");
                                #region æ¸…空给桁架的下料信息
                                client.WriteByOrder("W_IndexNr", (Int16)0, name);//托盘上的第几个车轮
                                client.WriteByOrder("W_Storage_Type", (Int16)0, name);//托盘类型1-横放;2-竖放(暂时只有横放托盘)
                                client.WriteByOrder("W_AreaNr", (Int16)0, name);//区域货位号
                                client.WriteByOrder("W_Storage_update", true, name);//货位状态更新
                                WriteLog.Write_Log(name + "放料完成", Wheel_SN, "成功!",
                                    $"读取桁架信息:\n放料完成信号:{finished}\n车轮SN:{Wheel_SN}\n轮型ID:{WheelType}\n下料位号:{AreaNr}\n\n" +
                                    $"处理写入桁架信息:\n区域货位号:{0}\n托盘上的第几个车轮:{0}\n托盘类型:{0}\n\n" +
                                    $"写入桁架信息:\n货位状态更新信号:{true}\n是否允许下料:{false}");
                                //WriteDBLog.Success(name + "桁架下料完成",
                                //    $"读取桁架信息:\nR_load_finished:{finished}\n车轮SN:{Wheel_SN}\n轮型ID:{WheelType}\n下料位号:{AreaNr}\n\n" +
                                //    $"处理写入桁架信息:\nW_AreaNr:{0}\nW_IndexNr:{0}\nW_Storage_Type:{0}\n\n" +
                                //    $"写入桁架信息:\nW_Storage_update:{true}\nW_Enabl_Load:{false}", "PCS");
                                #endregion
                                #region ä¿®æ”¹å·¥å•状态
                                var Detail = mes_DetailRepository.FindFirst(x => x.jobID == Mes_Work.jobID && x.SN == Mes_Work.SN);
                                Detail.Status = "下线";
                                Detail.FinishTime = DateTime.Now;
                                count = mes_DetailRepository.Update(Detail, true);
                                if (count < 1)
                                    throw new Exception($"工单子表信息更新失败!车轮SN号:{Detail.SN}");
                                var Head = mes_HeadRepository.FindFirst(x => x.jobID == Detail.jobID);
                                Head.finishNum = Head.finishNum + 1;
                                count = mes_HeadRepository.Update(Head, true);
                                if (count < 1)
                                    throw new Exception($"工单头表信息更新失败!工单号:{Head.jobID}");
                                #endregion
                            }
                            station.bindSN = string.IsNullOrEmpty(station.bindSN) ? Wheel_SN : station.bindSN + "," + Wheel_SN;
                            station.billetID = string.IsNullOrEmpty(station.billetID) ? Mes_Work.billetID.ToString() : station.billetID + "," + Mes_Work.billetID;
                            station.quantity++;
                            if (station.quantity == 1)
                            {
                                station.stationType = Mes_Work.drawingNo;
                                station.Number = Mes_Work.workOrder;
                                station.heatNumber = Mes_Work.heatID;
                                station.tray_status = "StrogeTray";
                            }
                            //else if (station.stationCode == NGStation)
                            //{
                            //    station.heatNumber = string.IsNullOrEmpty(station.heatNumber) ? Mes_Work.heatID : station.heatNumber + "," + Mes_Work.heatID;
                            //}
                            var count = stationinfoRepository.Update(station, true);
                            if (count < 1)
                                throw new Exception($"下料位信息更新失败!下料位编号:{station.stationCode}");
                            #region æ¸…空给桁架的下料信息
                            client.WriteByOrder("W_AreaNr", (Int16)0, name);//区域货位号
                            client.WriteByOrder("W_IndexNr", (Int16)0, name);//托盘上的第几个车轮
                            client.WriteByOrder("W_Storage_Type", (Int16)0, name);//托盘类型1-横放;2-竖放(暂时只有横放托盘)
                            client.WriteByOrder("W_Storage_update", true, name);//货位状态更新
                            WriteLog.Write_Log(name + "放料完成", Wheel_SN, "成功!",
                                $"读取桁架信息:\n放料完成信号:{finished}\n车轮SN:{Wheel_SN}\n轮型ID:{WheelType}\n下料位号:{AreaNr}\n\n" +
                                $"处理写入桁架信息:\n区域货位号:{0}\n托盘上的第几个车轮:{0}\n托盘类型:{0}\n\n" +
                                $"写入桁架信息:\n货位状态更新信号:{true}\n是否允许下料:{false}");
                            //WriteDBLog.Success(name + "桁架下料完成",
                            //    $"读取桁架信息:\nR_load_finished:{finished}\n车轮SN:{Wheel_SN}\n轮型ID:{WheelType}\n下料位号:{AreaNr}\n\n" +
                            //    $"处理写入桁架信息:\nW_AreaNr:{0}\nW_IndexNr:{0}\nW_Storage_Type:{0}\n\n" +
                            //    $"写入桁架信息:\nW_Storage_update:{true}\nW_Enabl_Load:{false}", "PCS");
                            #endregion
                            //client.WriteByOrder("W_Enabl_Load", false, name);//是否允许
                            #region ä¿®æ”¹å·¥å•状态
                            var Detail = mes_DetailRepository.FindFirst(x => x.jobID == Mes_Work.jobID && x.SN == Mes_Work.SN);
                            Detail.Status = "下线";
                            Detail.FinishTime = DateTime.Now;
                            count = mes_DetailRepository.Update(Detail, true);
                            if (count < 1)
                                throw new Exception($"工单子表信息更新失败!车轮SN号:{Detail.SN}");
                            var Head = mes_HeadRepository.FindFirst(x => x.jobID == Detail.jobID);
                            Head.finishNum = Head.finishNum + 1;
                            count = mes_HeadRepository.Update(Head, true);
                            if (count < 1)
                                throw new Exception($"工单头表信息更新失败!工单号:{Head.jobID}");
                            #endregion
                            #region æ—¥å¿—记录
                            //WriteDBLog.Success(name + "放料完成", $"读取桁架信息:\n车轮SN:{Wheel_id}\n轮型ID:{Wheel_Type}\n下料位号:{AreaNr}" +
                            //    $"\n\n写入桁架信息:\nW_Storage_update:true" + $"\nW_Enabl_Load:false", "PCS");
                            #endregion
                        }
                        #region è´§ä½çŠ¶æ€æ›´æ–°å¤ä½
                        finished = (bool)DBExtension.Read(details.Where(x => x.plcdetail_name == "R_load_finished").First(), client);//放料完成
                        updatefinished = (bool)DBExtension.Read(details.Where(x => x.plcdetail_name == "W_Storage_update").First(), client);//货位状态更新
                        if (!finished && updatefinished)
                        {
                            client.WriteByOrder("W_Storage_update", false, name);//货位状态更新
                            #region æ—¥å¿—记录
                            //WriteDBLog.Success(name + "货位状态更新复位", $"读取桁架信息:\nR_load_finished:{finished}\n\n写入桁架信息:\nW_Storage_update:{false}", "PCS");
                            WriteLog.Write_Log(name + "放料完成", name + "货位状态更新信号复位", "成功!",
                                $"读取桁架信息:\n放料完成信号:{finished}\n\n写入桁架信息:\n货位状态更新信号:{false}");
                            #endregion
                        }
                        #endregion
                        var Request = (bool)DBExtension.Read(details.Where(x => x.plcdetail_name == "R_Request_Load").First(), client);
                        if (!Request) continue;
@@ -585,39 +547,18 @@
                            WriteLog.Write_Log(name + "申请放料异常", Wheel_id, "查询机加工工单", $"读取桁架信息:\n车轮SN号:{Wheel_id}未查询到工单信息\n写入桁架信息:\n是否允许下料:{false}");
                        }
                        #region MyRegion
                        //var mes_Detail = mes_DetailRepository.FindFirst(x => x.SN == Wheel_id);
                        //if (mes_Detail == null)
                        //{
                        //    #region æ—¥å¿—记录
                        //    client.WriteByOrder("W_Enabl_Load", false, name);//信号为false桁架停止进入
                        //    WriteDBLog.Error(name, $"读取桁架信息:\n车轮SN:{Wheel_id}\n\n未查询到工单详情", "PCS");
                        //    #endregion
                        //    continue;
                        //}
                        //var mes_Head = mes_HeadRepository.FindFirst(x => x.jobID == mes_Detail.jobID);
                        //if (mes_Head == null)
                        //{
                        //    #region æ—¥å¿—记录
                        //    client.WriteByOrder("W_Enabl_Load", false, name);//信号为false桁架停止进入
                        //    WriteDBLog.Error(name, $"读取桁架信息:\n车轮SN:{Wheel_id}\n\n未查询到工单头表", "PCS");
                        //    #endregion
                        //    continue;
                        //}
                        #endregion
                        #endregion
                        var Stations = stationinfoRepository.Find(x => x.area == PipelineJob.area_code(name)).OrderBy(x => x.lastUpdateTime).ToList();
                        //foreach (var station in Stations)     //任何一个下料位为空或禁用时,都会停止桁架
                        //{
                        //    if (!station.enable || station.location_state == LocationStateEnum.Empty.ToString())
                        //        client.WriteByOrder("W_Enabl_Load", false, name);//信号为false桁架停止进入
                        //}
                        #region ä¸‹æ–™ä½æ˜¯å¦ä¸ºç©ºçŠ¶æ€åŒæ­¥ç»™æ¡æž¶
                        foreach (var station in Stations)
                        {
                            client.WriteByOrder(station.stationCode, station.location_state != LocationStateEnum.Stroge.ToString(), name);
                        }
                        #endregion
                        #region MyRegion
                        //var currentAreaNr = (Int16)DBExtension.Read(details.Where(x => x.plcdetail_name == "W_Are00aNr").First(), client);
@@ -648,6 +589,8 @@
                        WriteLog.Write_Log(name + "申请放料", Wheel_id, "申请放料", $"读取桁架信息:\n车轮SN:{Wheel_id}\n轮型ID:{Wheel_Type}\n车轮状态:{PartStatus}\n是否进入下料区:{load_zone}");
                        if (load_zone) continue;
                        #endregion
                        #region åˆæ ¼
                        if ((Int16)PartStatus == 1)
                        {
                            dt_stationinfo Stationinfo = null;
@@ -659,7 +602,6 @@
                           && x.location_state == LocationStateEnum.Stroge.ToString()
                           && x.quantity < 5
                           && x.stationType == Work.drawingNo
                           //&& x.tray_type == ((wheel == null ? wheel1.e : wheel.e) < 1100 ? "SmallTray" : "LargeTray")
                           && x.Number == Work.workOrder
                           && x.heatNumber == Work.heatID)
                           .OrderByDescending(x => x.quantity)
@@ -673,7 +615,6 @@
                           && x.location_state == LocationStateEnum.Stroge.ToString()
                           && x.quantity < 5
                           && x.stationType == Work.drawingNo
                           //&& x.tray_type == ((wheel == null ? wheel1.e : wheel.e) < 1100 ? "SmallTray" : "LargeTray")
                           && x.Number == Work.workOrder)
                           .OrderByDescending(x => x.quantity)
                           .FirstOrDefault();
@@ -681,16 +622,6 @@
                            if (Stationinfo == null)
                            {
                                #region ä¸‹æ–™ä½æ¡ä»¶ä¸åŒ¹é…ç›´æŽ¥è§¦å‘入库任务
                                //var stationinfos = Stations.Where(x => x.enable && x.stationCode != NGStation && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity > 0).ToList();
                                //foreach (var stationinfo in stationinfos)
                                //{
                                //    agvtask(stationinfoRepository, stationinfo, (wheel == null ? wheel1.e : wheel.e), name == "3单元下料区" ? "TaskType_OutsourceInbound" : "TaskType_Inbound");
                                //}
                                #endregion
                                #region è§¦å‘NG任务
                                var NG = Stations.Where(x => x.enable && x.stationCode == NGStation && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity > 0).FirstOrDefault();
                                if (NG != null)
@@ -702,13 +633,6 @@
                                Stationinfo = Stations.Where(x => x.enable && x.stationCode != NGStation && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity == 0).FirstOrDefault();
                                #region MyRegion
                                //var stationinfo = Stations.Where(x => x.enable && x.stationCode != NGStation && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity > 0).FirstOrDefault();
                                //if (stationinfo != null)
                                //{
                                //    agvtask(stationinfoRepository, mes_Head, stationinfo, (wheel == null ? wheel1.e : wheel.e), name == "3单元下料区" ? "TaskType_OutsourceInbound" : "TaskType_Inbound");
                                //}
                                #endregion
                            }
                            if (Stationinfo != null)
@@ -731,7 +655,6 @@
                                #endregion
                                #region æ‰˜ç›˜ç±»åž‹ä¸ä¸€è‡´éœ€æ›´æ¢æ‰˜ç›˜
                                //if (Stationinfo.tray_type != ((wheel == null ? wheel1.e : wheel.e) < 1100 ? "SmallTray" : "LargeTray"))
                                if (Stationinfo.tray_type != "LargeTray" && (wheel == null ? wheel1.e : wheel.e) > 1100)
                                {
                                    client.WriteByOrder("W_Enabl_Load", false, name);//信号为false桁架停止进入
@@ -748,7 +671,6 @@
                                var MaterialSignal = (Int16)DBExtension.Read(Pipelinedetails.Where(x => x.plcdetail_name == "R_MaterialSignal").First(), Pipeline_client);//读取货物信号:1:有,2无
                                //var Wheel_id = client.ReadByOrder<string>("R_Wheel_id", name);
                                if (PalletSignal == 1)
                                {
                                    List<string> list = new List<string>();
@@ -763,25 +685,26 @@
                                    }
                                    #region è´§ä½æ•°é‡ä¸Žå…‰ç”µä¸åŒ¹é…ï¼ŒæŠ¥è­¦
                                    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");
                                    }
                                    //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");
                                    //    continue;
                                    //}
                                    //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");
                                    //    continue;
                                    //}
                                    #endregion
@@ -819,44 +742,20 @@
                                    var station = Stations.Where(x => x.enable && x.stationCode != NGStation).OrderBy(x => x.lastUpdateTime).FirstOrDefault();
                                    agvtask(stationinfoRepository, station, Work, name == "3单元下料区" ? "TaskType_OutsourceInbound" : "TaskType_Inbound");
                                }
                                //var stationinfos = Stations.Where(x => x.enable && x.Number != Work.workOrder && x.stationCode != NGStation && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity > 0).ToList();
                                //foreach (var stationinfo in stationinfos)
                                //{
                                //    agvtask(stationinfoRepository, stationinfo, Work, name == "3单元下料区" ? "TaskType_OutsourceInbound" : "TaskType_Inbound");
                                //}
                                #endregion
                            }
                        }
                        #endregion
                        #region ä¸åˆæ ¼
                        else if ((Int16)PartStatus == 2)
                        {
                            dt_stationinfo Stationinfo = null;
                            //if (mes_Detail.heatID != null)
                            //{
                            //    Stationinfo = Stations
                            //.Where(x => x.enable
                            //&& x.stationCode == NGStation
                            //&& x.location_state == LocationStateEnum.Stroge.ToString()
                            //&& x.quantity < 5
                            //&& x.stationType == mes_Head.drawingNo
                            //&& x.tray_type == ((wheel == null ? wheel1.e : wheel.e) < 1100 ? "SmallTray" : "LargeTray")
                            //&& x.Number == mes_Detail.jobID
                            //&& x.heatNumber == mes_Detail.heatID).FirstOrDefault();
                            //}
                            //else
                            //{
                            //var tray_type = "SmallTray";
                            //if ((wheel == null ? wheel1.e : wheel.e) > 1100) tray_type = "LargeTray";
                            Stationinfo = Stations
                        .Where(x => x.enable
                        && x.stationCode == NGStation
                        && x.location_state == LocationStateEnum.Stroge.ToString()
                        && x.quantity < 5
                        && x.stationType == Work.drawingNo
                        //&& x.tray_type == ((wheel == null ? wheel1.e : wheel.e) < 1100 ? "SmallTray" : "LargeTray")
                        /*&& x.Number == mes_Detail.jobID*/).FirstOrDefault();
                            //}
                            dt_stationinfo Stationinfo = Stations.Where(x => x.enable
                            && x.stationCode == NGStation
                            && x.location_state == LocationStateEnum.Stroge.ToString()
                            && x.quantity < 5
                            && x.stationType == Work.drawingNo).FirstOrDefault();
                            if (Stationinfo == null)
                            {
@@ -901,31 +800,25 @@
                                    }
                                    #region è´§ä½æ•°é‡ä¸Žå…‰ç”µä¸åŒ¹é…ï¼ŒæŠ¥è­¦
                                    //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");
                                    //}
                                    //else if (list.Count < 1 && MaterialSignal == 1)
                                    //{
                                    //    client.WriteByOrder("W_Enabl_Load", false, name);//信号为false桁架停止进入
                                    //    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");
                                    }
                                    //    Stationinfo.location_state = LocationStateEnum.Abnormal.ToString();
                                    //    Stationinfo.remark = "车轮数量与光电不匹配";
                                    //    stationinfoRepository.Update(Stationinfo, true);
                                    //    WriteDBLog.Error(name + "报警", $"货位编号:{Stationinfo.stationCode};错误信息:{Stationinfo.remark}", "PCS");
                                    //}
                                    #endregion
                                    //缓存架上车轮数量与SN号数量不一致
@@ -935,8 +828,6 @@
                                        Stationinfo.remark = "车轮数量与SN号数量不一致";
                                        stationinfoRepository.Update(Stationinfo, true);
                                        continue;
                                        //写入桁架报警信号
                                        //throw new Exception("下料位车轮数量与SN号数量不一致,下料位编号:" + Stationinfo.stationCode);
                                    }
                                    var area = Convert.ToInt16(Stationinfo.stationCode.Substring(Stationinfo.stationCode.Length - 1, 1));
                                    client.WriteByOrder("W_AreaNr", (Int16)area, name);//区域货位号
@@ -955,59 +846,8 @@
                                }
                            }
                        }
                        #region
                        //var Stationinfo = Stations
                        //    .Where(x => x.enable
                        //    && x.location_state == LocationStateEnum.Stroge.ToString()
                        //    && x.quantity < 5
                        //    && x.stationType == PipelineJob.QueryMateriel(Wheel_Type)
                        //    && x.Number == mes_Detail.jobID
                        //    && x.heatNumber == mes_Detail.heatID).FirstOrDefault();
                        //if (Stationinfo == null)
                        //    Stationinfo = Stations.Where(x => x.enable && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity == 0).FirstOrDefault();
                        //if (Stationinfo != null)
                        //{
                        //}
                        //List<string> StationCodes = new List<string>() { "X01001001", "X01001002", "X01001003" };
                        //if (name == "2单元下料区")
                        //    StationCodes = new List<string>() { "X02001001", "X02001002", "X02001003" };
                        //if (name == "3单元下料区")
                        //    StationCodes = new List<string>() { "X03001001", "X03001002" };
                        #endregion
                        #region
                        //for (int i = 0; i < StationCodes.Count - 1; i++)
                        //{
                        //    var PartStatus = (Int32)DBExtension.Read(details.Where(x => x.plcdetail_name == "R_PartStatus").First(), client);//1:ok;2:nok
                        //    string NG = StationCodes[StationCodes.Count - 1];//NG货位
                        //    var station = stationinfoRepository.FindFirst(x => x.stationCode == StationCodes[i] && x.enable && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity < 5);
                        //    if (station == null) continue;
                        //    var Pipelinedetails = plcRepository.Find(x => x.plcdetail_iotype == Pipelineplc.plcinfo_iotyep && x.plcdetail_number == StationCodes[i]).ToList();
                        //    var PalletSignal = (Int16)DBExtension.Read(Pipelinedetails.Where(x => x.plcdetail_name == "R_PalletSignal").First(), client);//读取托盘信号:1:有,2无
                        //    if (PalletSignal == 1)
                        //    {
                        //        if (PartStatus == 1 && NG != station.stationCode)
                        //        {
                        //            client.WriteByOrder("W_AreaNr", (Int16)i + 1, name);//区域货位号
                        //            client.WriteByOrder("W_IndexNr", (Int16)station.quantity + 1, name);//托盘上的第几个车轮
                        //            client.WriteByOrder("W_Storage_Type", (Int16)1, name);//托盘类型1-横放;2-竖放(暂时只有横放托盘)
                        //            client.WriteByOrder("W_Enabl_Load", true, name);//是否允许
                        //            return;
                        //        }
                        //        else if (PartStatus == 2 && NG == station.stationCode)
                        //        {
                        //            client.WriteByOrder("W_AreaNr", (Int16)i + 1, name);//区域货位号
                        //            client.WriteByOrder("W_IndexNr", (Int16)station.quantity + 1, name);//托盘上的第几个车轮
                        //            client.WriteByOrder("W_Storage_Type", (Int16)1, name);//托盘类型1-横放;2-竖放(暂时只有横放托盘)
                        //            client.WriteByOrder("W_Enabl_Load", true, name);//是否允许
                        //            return;
                        //        }
                        //    }
                        //}
                        #endregion
                    }
                    catch (Exception ex)
                    {
´úÂë¹ÜÀí/PCS/WCS_Server/WIDESEA_WCS/Common/Pipeline.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,268 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WIDESEA_Comm.LogInfo;
using WIDESEA_Comm;
using WIDESEA_Core.EFDbContext;
using WIDESEA_WCS.IRepositories;
using WIDESEA_WCS.Repositories;
using WIDESEA_WCS.WCSClient;
using WIDESEA_WMS.IRepositories;
using WIDESEA_WMS.Repositories;
using HslCommunication;
using WIDESEA_Entity.DomainModels;
namespace WIDESEA_WCS
{
    public class Pipeline
    {
        /// <summary>
        /// ä¸Šæ–™åŒº
        /// </summary>
        /// <param name="client"></param>
        /// <param name="number"></param>
        public void Loadinglevel(PLCClient client, string number = "上料区")
        {
            try
            {
                VOLContext Context = new VOLContext();
                Idt_plcinfoheadRepository repository = new dt_plcinfoheadRepository(Context);
                Idt_plcinfodetailRepository plcRepository = new dt_plcinfodetailRepository(Context);
                Idt_geometry_dataRepository dataRepository = new dt_geometry_dataRepository(Context);
                Idt_stationinfoRepository stationinfoRepository = new dt_stationinfoRepository(Context);
                var plc = repository.FindFirst(x => x.plcinfo_name == client.PLCName);
                var Gantry_client = PLCClient.Clients.FirstOrDefault(t => t.PLCName == "桁架");
                if (Gantry_client == null) throw new Exception("桁架调度服务未开启!");
                if (!Gantry_client.IsConnected) throw new Exception("与桁架连接超时!");
                var Gantryplc = repository.FindFirst(x => x.plcinfo_name == Gantry_client.PLCName);
                ///查找上料区的货位
                var Stations = stationinfoRepository.Find(x => x.area == area_code(number)).OrderBy(x => x.lastUpdateTime);//根据时间先后排序
                var Station = Stations?.Where(x => x.enable && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity > 0).OrderBy(x => x.quantity).FirstOrDefault();
                if (Station != null)
                {
                    var SNS = Station.bindSN.Split(",");
                    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无
                    #region ä¸Šæ–™å®Œæˆ
                    var Gantrydetails = plcRepository.Find(x => x.plcdetail_iotype == Gantryplc.plcinfo_iotyep && x.plcdetail_number == number).ToList();
                    var Gantry_Out_of_Area = (bool)DBExtension.Read(Gantrydetails.Where(x => x.plcdetail_name == "R_Gantry_Out_of_Area").First(), Gantry_client);//桁架是否在区域内
                    var QueryDate = (bool)DBExtension.Read(Gantrydetails.Where(x => x.plcdetail_name == "R_QueryDate").First(), Gantry_client);//信息查询
                    if (QueryDate)
                    {
                        var Date_Vaild = (bool)DBExtension.Read(Gantrydetails.Where(x => x.plcdetail_name == "R_Date_Vaild").First(), Gantry_client);//信息确认
                        if (!Date_Vaild)//信息有误,记录日志
                        {
                            Gantry_client.WriteByOrder("W_RequestUnload", false, number);//信号为false桁架停止进入
                            Station.location_state = LocationStateEnum.Abnormal.ToString();
                            Station.remark = $"未查询到SN号:{SNS[SNS.Length - 1]}的订单";
                            stationinfoRepository.Update(Station, true);
                            WriteDBLog.Error("上料区信息查询", $"写入桁架信息:\nW_RequestUnload:false\n\n{Station.stationCode}未查询到SN号:{SNS[SNS.Length - 1]}的订单", "PCS");
                            return;
                        }
                    }
                    var finished = (bool)DBExtension.Read(Gantrydetails.Where(x => x.plcdetail_name == "R_Unlod_finished").First(), Gantry_client);//夹取完成
                    var updatefinished = (bool)DBExtension.Read(Gantrydetails.Where(x => x.plcdetail_name == "W_Storage_update").First(), Gantry_client);//货位状态更新
                    if (!finished && updatefinished)
                        Gantry_client.WriteByOrder("W_Storage_update", false, number);//货位状态更新
                    if (finished && !updatefinished)
                    {
                        Gantry_client.WriteByOrder("W_RequestUnload", false, number);//信号为false桁架停止进入
                        Updatemes(SNS[SNS.Length - 1]);
                        Station.quantity = Station.quantity - 1;
                        Station.bindSN = OperStr(SNS);
                        if (Station.quantity <= 0)
                        {
                            Station.stationType = string.Empty;
                            Station.Number = string.Empty;
                            Station.heatNumber = string.Empty;
                            Station.tray_status = "EmptyTray";
                        }
                        var count = stationinfoRepository.Update(Station, true);
                        if (count < 1)
                        {
                            WriteDBLog.Error("取料完成", $"上料位信息更新失败!上料位编号:{Station.stationCode}", "PCS");
                            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);//车轮类型
                        #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))
                        {
                            Station.location_state = LocationStateEnum.Abnormal.ToString();
                            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)
                        {
                            Station.location_state = LocationStateEnum.Abnormal.ToString();
                            Station.remark = "车轮数量小于0,光电检测有车轮";
                            stationinfoRepository.Update(Station, true);
                            client.WriteByOrder("W_AlarmSignal", (Int16)2, number);//报警
                            WriteDBLog.Error(number + "报警", $"货位编号:{Station.stationCode};错误信息:{Station.remark}", "PCS");
                        }
                    }
                    #endregion
                    #region ç”³è¯·ä¸Šæ–™
                    //var SNS = Station.bindSN.Split(",");
                    if (Gantry_client.ReadByOrder<bool>("W_RequestUnload", number)) return;
                    Station = stationinfoRepository.Find(x => x.stationCode == Station.stationCode).FirstOrDefault();
                    if (Station.quantity < 1) return;
                    List<string> list = new List<string>();
                    SNS = Station.bindSN.Split(",");
                    foreach (var SN in SNS)
                    {
                        if (!string.IsNullOrEmpty(SN))
                            list.Add(SN);
                    }
                    //缓存架上车轮数量与SN号数量不一致
                    if (list.Count != Station.quantity)
                    {
                        Station.location_state = LocationStateEnum.Abnormal.ToString();
                        Station.remark = "车轮数量与SN号数量不一致";
                        stationinfoRepository.Update(Station, true);
                        Gantry_client.WriteByOrder("W_RequestUnload", false, number);//信号为false桁架停止进入
                        #region æ—¥å¿—记录
                        WriteDBLog.Error("上料区", $"写入桁架信息:\nW_RequestUnload:false\n\n{Station.stationCode}车轮数量与SN号数量不一致", "PCS");
                        #endregion
                        return;
                    }
                    //var details = plcRepository.Find(x => x.plcdetail_iotype == plc.plcinfo_iotyep && x.plcdetail_number == Station.stationCode).ToList();
                    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无
                    var AreaNr = Gantry_client.ReadByOrder<Int16>("W_AreaNr", number);//读取货位号信息
                    if (PalletSignal == 1 && MaterialSignal == 1)
                    {
                        if (AreaNr == 0)
                        {
                            Gantry_client.WriteByOrder("W_Wheel_Type", (Int16)Convert.ToInt16(QueryMateriel(Station.stationType) == null ? QueryMateriel1(Station.stationType).TypeId : QueryMateriel(Station.stationType).TypeId), number);//车轮类型
                            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_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
                    {
                        Gantry_client.WriteByOrder("W_RequestUnload", false, number);
                    }
                    #endregion
                    #region æ›´æ–°ä¸€ä¸ªæ£€æµ‹ä¸Šæ–™ä»»åŠ¡
                    Idt_agvtaskRepository agvtaskService = new dt_agvtaskRepository(Context);
                    if (!agvtaskService.Find(x => x.agv_toaddress == Station.stationCode).Any())
                    {
                        var task = agvtaskService.Find(x => x.agv_taskstate == "Queue" && (x.agv_tasktype == "TaskType_OutsourceOutbound" || x.agv_tasktype == "TaskType_Outbound") && x.agv_toaddress == "").OrderByDescending(x => x.agv_grade).ThenBy(x => x.agv_createtime).FirstOrDefault();
                        if (task != null)
                        {
                            task.agv_taskstate = "Create";
                            task.agv_toaddress = Station.stationCode;
                            agvtaskService.Update(task, true);
                            WriteDBLog.Success("更新一个检测上料任务", $"任务编号:{task.agv_tasknum}", "PCS");
                        }
                    }
                    #endregion
                }
                else
                    Gantry_client.WriteByOrder("W_RequestUnload", false, number);//信号为false桁架停止进入
            }
            catch (Exception ex)
            {
                WriteDBLog.Error("上料区", $"错误信息:{ex.Message}", "PCS");
            }
        }
        private string OperStr(string[] strArrty)
        {
            string[] newstr = strArrty.RemoveLast(1);
            string Newsn = string.Join(",", newstr);
            return Newsn;
        }
        public static dt_geometry_data QueryMateriel(string type)
        {
            VOLContext Context = new VOLContext();
            Idt_geometry_dataRepository dataRepository = new dt_geometry_dataRepository(Context);
            var materielinfo = dataRepository.Find(x => x.Description == type).OrderBy(x => x.TypeId).FirstOrDefault();
            return materielinfo;
        }
        public static dt_geometry_data_detectionline QueryMateriel1(string type)
        {
            VOLContext Context = new VOLContext();
            Idt_geometry_data_detectionlineRepository detectionlineRepository = new dt_geometry_data_detectionlineRepository(Context);
            var materielinfo1 = detectionlineRepository.Find(x => x.Description == type).OrderBy(x => x.TypeId).FirstOrDefault();
            return materielinfo1;
        }
        public static string area_code(string area_name)
        {
            VOLContext Context = new VOLContext();
            Idt_areainfoRepository areainfoRepository = new dt_areainfoRepository(Context);
            var areainfo = areainfoRepository.Find(x => x.area_name == area_name).FirstOrDefault();
            return areainfo.area_code.ToString();
        }
        /// <summary>
        /// æ›´æ”¹å·¥å•状态
        /// </summary>
        /// <param name="SN"></param>
        public static void Updatemes(string SN)
        {
            VOLContext Context = new VOLContext();
            Idt_mes_detailRepository mes_DetailRepository = new dt_mes_detailRepository(Context);
            Idt_mes_headRepository mes_HeadRepository = new dt_mes_headRepository(Context);
            IVV_Mes_WorkinfoRepository workinfoRepository = new VV_Mes_WorkinfoRepository(Context);
            //var mes_Detail = freeDB.Select<dt_mes_detail>().Where(x => x.SN == SN).First();
            var Mes_Work = workinfoRepository.Find(x => x.SN == SN && x.processCode == "28").FirstOrDefault();
            var mes_Detail = mes_DetailRepository.Find(x => x.SN == SN && x.jobID == Mes_Work.jobID).FirstOrDefault();
            if (mes_Detail != null)
            {
                mes_Detail.Status = "上线";
                mes_Detail.FinishTime = DateTime.Now;
                //freeDB.DataBase.Update<dt_mes_detail>().SetSource(mes_Detail).UpdateColumns(x => new { x.Status, x.FinishTime }).ExecuteAffrows();
                mes_DetailRepository.Update(mes_Detail, true);
                //var mes_Head = freeDB.Select<dt_mes_head>().Where(x => x.jobID == mes_Detail.jobID).First();
                var mes_Head = mes_HeadRepository.Find(x => x.jobID == mes_Detail.jobID).FirstOrDefault();
                if (mes_Head != null)
                {
                    mes_Head.finishNum = mes_Head.finishNum + 1;
                    //freeDB.DataBase.Update<dt_mes_head>().SetSource(mes_Head).UpdateColumns(x => new { x.finishNum }).ExecuteAffrows();
                    mes_HeadRepository.Update(mes_Head, true);
                }
            }
        }
    }
}
´úÂë¹ÜÀí/PCS/WCS_Server/WIDESEA_WCS/Jobs/Task/AutoTaskJob.cs
@@ -30,12 +30,13 @@
        private void DoAction(IJobExecutionContext context)
        {
            StationTask.CreateTask();
            OutboundTask.CreateOutboundTask();//优化后出库逻辑
            ReplaceTray.ReplaceTrayTask();
            RestockHCJ.HCJGetBarcode();
            EmptyTrayTask.CreateEmptyTrayTask();
            AutoUpdateWork.FinishMesWork();
            EmptyTray.EmptyTrayIn();//空托叠盘入库
            StationTask.CreateTask();//入库
            OutboundTask.CreateOutboundTask();//出库
            ReplaceTray.ReplaceTrayTask();//更换托盘
            RestockHCJ.HCJGetBarcode();//更新队列
            EmptyTrayTask.CreateEmptyTrayTask();//创建补空托
            AutoUpdateWork.FinishMesWork();//处理工单
        }
    }
}
´úÂë¹ÜÀí/PCS/WCS_Server/WIDESEA_WCS/Jobs/equipment/PipelineJob.cs
@@ -5,6 +5,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
@@ -68,7 +69,6 @@
                VOLContext Context = new VOLContext();
                Idt_plcinfoheadRepository repository = new dt_plcinfoheadRepository(Context);
                Idt_plcinfodetailRepository plcRepository = new dt_plcinfodetailRepository(Context);
                Idt_geometry_dataRepository dataRepository = new dt_geometry_dataRepository(Context);
                Idt_stationinfoRepository stationinfoRepository = new dt_stationinfoRepository(Context);
                var plc = repository.FindFirst(x => x.plcinfo_name == client.PLCName);
                var Gantry_client = PLCClient.Clients.FirstOrDefault(t => t.PLCName == "桁架");
@@ -77,39 +77,141 @@
                var Gantryplc = repository.FindFirst(x => x.plcinfo_name == Gantry_client.PLCName);
                ///查找上料区的货位
                var Stations = stationinfoRepository.Find(x => x.area == area_code(number)).OrderBy(x => x.lastUpdateTime);//根据时间先后排序
                #region ä¸Šæ–™å®Œæˆ
                var Station = Stations?.Where(x => x.enable && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity > 0).OrderBy(x => x.quantity).FirstOrDefault();
                if (Station != null)
                var AreaNr = Gantry_client.ReadByOrder<Int16>("W_AreaNr", number);//读取货位号信息
                if (AreaNr != 0)
                {
                    var SNS = Station.bindSN.Split(",");
                    List<string> list = new List<string>();
                    foreach (var SN in SNS)
                    var station = stationinfoRepository.Find(x => x.area == area_code(number) && x.stationCode.Substring(x.stationCode.Length - 1, 1) == AreaNr.ToString()).FirstOrDefault();
                    if (station != null)
                    {
                        if (!string.IsNullOrEmpty(SN))
                            list.Add(SN);
                    }
                    //缓存架上车轮数量与SN号数量不一致
                    if (list.Count != Station.quantity)
                    {
                        Station.location_state = LocationStateEnum.Abnormal.ToString();
                        Station.remark = "车轮数量与SN号数量不一致";
                        stationinfoRepository.Update(Station, true);
                        Gantry_client.WriteByOrder("W_RequestUnload", false, number);//信号为false桁架停止进入
                        #region æ—¥å¿—记录
                        WriteDBLog.Error("上料区", $"写入桁架信息:\nW_RequestUnload:false\n\n{Station.stationCode}车轮数量与SN号数量不一致", "PCS");
                        #endregion
                        return;
                    }
                    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 bindSNS = station.bindSN.Split(",");
                        var Gantrydetails = plcRepository.Find(x => x.plcdetail_iotype == Gantryplc.plcinfo_iotyep && x.plcdetail_number == number).ToList();
                    var AreaNr = Gantry_client.ReadByOrder<Int16>("W_AreaNr", number);//读取货位号信息
                    if (PalletSignal == 1 && MaterialSignal == 1)
                        #region ä¿¡æ¯æŸ¥è¯¢ç¡®è®¤
                        var QueryDate = (bool)DBExtension.Read(Gantrydetails.Where(x => x.plcdetail_name == "R_QueryDate").First(), Gantry_client);//信息查询
                        if (QueryDate)
                        {
                            var Date_Vaild = (bool)DBExtension.Read(Gantrydetails.Where(x => x.plcdetail_name == "R_Date_Vaild").First(), Gantry_client);//信息确认
                            if (!Date_Vaild)//信息有误,记录日志
                            {
                                Gantry_client.WriteByOrder("W_RequestUnload", false, number);//信号为false桁架停止进入
                                station.location_state = LocationStateEnum.Abnormal.ToString();
                                station.remark = $"未查询到SN号:{bindSNS[bindSNS.Length - 1]}的订单";
                                stationinfoRepository.Update(station, true);
                                WriteDBLog.Error("上料区信息查询", $"写入桁架信息:\nW_RequestUnload:false\n\n{station.stationCode}未查询到SN号:{bindSNS[bindSNS.Length - 1]}的订单", "PCS");
                                return;
                            }
                        }
                        #endregion
                        #region è´§ä½çŠ¶æ€æ›´æ–°å¤ä½
                        var finished = (bool)DBExtension.Read(Gantrydetails.Where(x => x.plcdetail_name == "R_Unlod_finished").First(), Gantry_client);//夹取完成
                        var updatefinished = (bool)DBExtension.Read(Gantrydetails.Where(x => x.plcdetail_name == "W_Storage_update").First(), Gantry_client);//货位状态更新
                        if (!finished && updatefinished)
                        {
                            Gantry_client.WriteByOrder("W_Storage_update", false, number);//货位状态更新
                            WriteLog.Write_Log(number + "上料完成", number + "货位状态更新信号复位", "成功!",
                                        $"读取桁架信息:\n上料完成信号:{finished}\n\n写入桁架信息:\n货位状态更新信号:{false}");
                        }
                        #endregion
                        if (finished && !updatefinished)
                        {
                            #region åˆ¤æ–­åŒºåŸŸå·æ˜¯å¦ä¸€è‡´
                            var area = Gantry_client.ReadByOrder<Int16>("place_prog", number);//放料完成的区域号
                            WriteLog.Write_Log(number + "取料完成出错", bindSNS[bindSNS.Length - 1], "判断区域号是否一致", $"PCS区域号:{AreaNr};\n桁架区域号:{area}\n错误信息:PCS区域号与桁架区域号不一致!");
                            //if (AreaNr != area)
                            //{
                            //    client.WriteByOrder("W_AlarmSignal", (Int16)2, number);//报警
                            //    //WriteDBLog.Error(name + "报警", $"PCS区域号:{AreaNr};桁架区域号:{area}错误信息:PCS区域号与桁架区域号不一致!", "PCS");
                            //    WriteLog.Write_Log(number + "取料完成出错", bindSNS[bindSNS.Length - 1], "判断区域号是否一致", $"PCS区域号:{AreaNr};\n桁架区域号:{area}\n错误信息:PCS区域号与桁架区域号不一致!");
                            //    return;
                            //}
                            #endregion
                            #region åˆ¤æ–­è½¦è½®æ•°é‡æ˜¯å¦ä¸€è‡´
                            var quantity = Gantry_client.ReadByOrder<Int16>("pos_prog", number);//桁架记录的车轮数量
                            WriteLog.Write_Log(number + "取料完成出错", bindSNS[bindSNS.Length - 1], "判断车轮数量是否一致", $"区域号:{AreaNr};\n桁架车轮数:{quantity}\nPCS车轮数:{station.quantity}\n错误信息:PCS区域号与桁架区域号不一致!");
                            //if (quantity != station.quantity)
                            //{
                            //    client.WriteByOrder("W_AlarmSignal", (Int16)2, number);//报警
                            //    WriteLog.Write_Log(number + "取料完成出错", bindSNS[bindSNS.Length - 1], "判断车轮数量是否一致", $"区域号:{AreaNr};\n桁架车轮数:{quantity}\nPCS车轮数:{station.quantity}\n错误信息:PCS区域号与桁架区域号不一致!");
                            //    return;
                            //}
                            #endregion
                            Updatemes(bindSNS[bindSNS.Length - 1]);
                            station.quantity = station.quantity - 1;
                            station.bindSN = OperStr(bindSNS);
                            if (station.quantity <= 0)
                            {
                                station.stationType = string.Empty;
                                station.Number = string.Empty;
                                station.heatNumber = string.Empty;
                                station.tray_status = "EmptyTray";
                            }
                            var count = stationinfoRepository.Update(station, true);
                            if (count < 1)
                            {
                                WriteDBLog.Error("取料完成", $"上料位信息更新失败!上料位编号:{station.stationCode}", "PCS");
                                return;
                            }
                            Gantry_client.WriteByOrder("W_Storage_update", true, number);//货位状态更新
                            Gantry_client.WriteByOrder("W_RequestUnload", false, number);//信号为false桁架停止进入
                            #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);//车轮类型
                            #endregion
                            #region æ—¥å¿—记录
                            WriteDBLog.Success("取料完成", $"写入桁架信息:\n货位状态更新:{true}\nW_RequestUnload:{false}", "PCS");
                            #endregion
                        }
                    }
                }
                #endregion
                #region ç”³è¯·ä¸Šæ–™
                if (!Gantry_client.ReadByOrder<bool>("W_RequestUnload", number))
                {
                    var Station = stationinfoRepository.Find(x => x.area == area_code(number) && x.enable && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity > 0).OrderBy(x => x.lastUpdateTime).FirstOrDefault();
                    if (Station != null)
                    {
                        if (AreaNr == 0)
                        var SNS = Station.bindSN.Split(",");
                        List<string> list = new List<string>();
                        foreach (var SN in SNS)
                        {
                            if (!string.IsNullOrEmpty(SN))
                                list.Add(SN);
                        }
                        //缓存架上车轮数量与SN号数量不一致
                        if (list.Count != Station.quantity)
                        {
                            Station.location_state = LocationStateEnum.Abnormal.ToString();
                            Station.remark = "车轮数量与SN号数量不一致";
                            stationinfoRepository.Update(Station, true);
                            Gantry_client.WriteByOrder("W_RequestUnload", false, number);//信号为false桁架停止进入
                            #region æ—¥å¿—记录
                            WriteDBLog.Error("上料区", $"写入桁架信息:\nW_RequestUnload:false\n\n{Station.stationCode}车轮数量与SN号数量不一致", "PCS");
                            #endregion
                            return;
                        }
                        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无
                        if (PalletSignal == 1 && MaterialSignal == 1)
                        {
                            Gantry_client.WriteByOrder("W_Wheel_Type", (Int16)Convert.ToInt16(QueryMateriel(Station.stationType) == null ? QueryMateriel1(Station.stationType).TypeId : QueryMateriel(Station.stationType).TypeId), number);//车轮类型
                            var area = Convert.ToInt16(Station.stationCode.Substring(Station.stationCode.Length - 1, 1));
@@ -120,91 +222,171 @@
                            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区域货位号:{area}\n托盘上的第几个车轮:{SNS.Length}\n托盘类型:{1}\n车轮类型:{(QueryMateriel(Station.stationType) == null ? QueryMateriel1(Station.stationType).TypeId : QueryMateriel(Station.stationType).TypeId)}" +
                                $"\n车轮SN号:{SNS[SNS.Length - 1]}\nW_RequestUnload:true", "PCS");
                            #endregion
                        }
                    }
                    else
                    {
                        Gantry_client.WriteByOrder("W_RequestUnload", false, number);
                    }
                    var Gantrydetails = plcRepository.Find(x => x.plcdetail_iotype == Gantryplc.plcinfo_iotyep && x.plcdetail_number == number).ToList();
                    var Gantry_Out_of_Area = (bool)DBExtension.Read(Gantrydetails.Where(x => x.plcdetail_name == "R_Gantry_Out_of_Area").First(), Gantry_client);//桁架是否在区域内
                    var QueryDate = (bool)DBExtension.Read(Gantrydetails.Where(x => x.plcdetail_name == "R_QueryDate").First(), Gantry_client);//信息查询
                    if (QueryDate)
                    {
                        var Date_Vaild = (bool)DBExtension.Read(Gantrydetails.Where(x => x.plcdetail_name == "R_Date_Vaild").First(), Gantry_client);//信息确认
                        if (!Date_Vaild)//信息有误,记录日志
                        else
                        {
                            Gantry_client.WriteByOrder("W_RequestUnload", false, number);//信号为false桁架停止进入
                            Station.location_state = LocationStateEnum.Abnormal.ToString();
                            Station.remark = $"未查询到SN号:{SNS[SNS.Length - 1]}的订单";
                            stationinfoRepository.Update(Station, true);
                            WriteDBLog.Error("上料区信息查询", $"写入桁架信息:\nW_RequestUnload:false\n\n{Station.stationCode}未查询到SN号:{SNS[SNS.Length - 1]}的订单", "PCS");
                            return;
                        }
                    }
                    var finished = (bool)DBExtension.Read(Gantrydetails.Where(x => x.plcdetail_name == "R_Unlod_finished").First(), Gantry_client);//夹取完成
                    var updatefinished = (bool)DBExtension.Read(Gantrydetails.Where(x => x.plcdetail_name == "W_Storage_update").First(), Gantry_client);//货位状态更新
                    if (!finished && updatefinished)
                        Gantry_client.WriteByOrder("W_Storage_update", false, number);//货位状态更新
                    if (finished && !updatefinished)
                    {
                        Gantry_client.WriteByOrder("W_RequestUnload", false, number);//信号为false桁架停止进入
                        Updatemes(SNS[SNS.Length - 1]);
                        Station.quantity = Station.quantity - 1;
                        Station.bindSN = OperStr(SNS);
                        if (Station.quantity <= 0)
                        {
                            Station.stationType = string.Empty;
                            Station.Number = string.Empty;
                            Station.heatNumber = string.Empty;
                            Station.tray_status = "EmptyTray";
                        }
                        var count = stationinfoRepository.Update(Station, true);
                        if (count < 1)
                        {
                            WriteDBLog.Error("取料完成", $"上料位信息更新失败!上料位编号:{Station.stationCode}", "PCS");
                            return;
                            Gantry_client.WriteByOrder("W_RequestUnload", false, number);
                        }
                        #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);//车轮类型
                        #region æ›´æ–°ä¸€ä¸ªæ£€æµ‹ä¸Šæ–™ä»»åŠ¡
                        Idt_agvtaskRepository agvtaskService = new dt_agvtaskRepository(Context);
                        if (!agvtaskService.Find(x => x.agv_toaddress == Station.stationCode).Any())
                        {
                            var task = agvtaskService.Find(x => x.agv_taskstate == "Queue" && (x.agv_tasktype == "TaskType_OutsourceOutbound" || x.agv_tasktype == "TaskType_Outbound") && x.agv_toaddress == "").OrderByDescending(x => x.agv_grade).ThenBy(x => x.agv_createtime).FirstOrDefault();
                            if (task != null)
                            {
                                task.agv_taskstate = "Create";
                                task.agv_toaddress = Station.stationCode;
                                agvtaskService.Update(task, true);
                                WriteDBLog.Success("更新一个检测上料任务", $"任务编号:{task.agv_tasknum}", "PCS");
                            }
                        }
                        #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))
                        {
                            Station.location_state = LocationStateEnum.Abnormal.ToString();
                            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)
                        {
                            Station.location_state = LocationStateEnum.Abnormal.ToString();
                            Station.remark = "车轮数量小于0,光电检测有车轮";
                            stationinfoRepository.Update(Station, true);
                            client.WriteByOrder("W_AlarmSignal", (Int16)2, number);//报警
                            WriteDBLog.Error(number + "报警", $"货位编号:{Station.stationCode};错误信息:{Station.remark}", "PCS");
                        }
                    }
                }
                else
                    Gantry_client.WriteByOrder("W_RequestUnload", false, number);//信号为false桁架停止进入
                #endregion
                #region MyRegion
                /////查找上料区的货位
                //var Stations = stationinfoRepository.Find(x => x.area == area_code(number)).OrderBy(x => x.lastUpdateTime);//根据时间先后排序
                //                                                                                                           //需测试一下
                //var Station = Stations?.Where(x => x.enable && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity > 0).OrderBy(x => x.quantity).FirstOrDefault();
                //if (Station != null)
                //{
                //    var SNS = Station.bindSN.Split(",");
                //    List<string> list = new List<string>();
                //    foreach (var SN in SNS)
                //    {
                //        if (!string.IsNullOrEmpty(SN))
                //            list.Add(SN);
                //    }
                //    //缓存架上车轮数量与SN号数量不一致
                //    if (list.Count != Station.quantity)
                //    {
                //        Station.location_state = LocationStateEnum.Abnormal.ToString();
                //        Station.remark = "车轮数量与SN号数量不一致";
                //        stationinfoRepository.Update(Station, true);
                //        Gantry_client.WriteByOrder("W_RequestUnload", false, number);//信号为false桁架停止进入
                //        #region æ—¥å¿—记录
                //        WriteDBLog.Error("上料区", $"写入桁架信息:\nW_RequestUnload:false\n\n{Station.stationCode}车轮数量与SN号数量不一致", "PCS");
                //        #endregion
                //        return;
                //    }
                //    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)
                //    {
                //        if (AreaNr == 0)
                //        {
                //            Gantry_client.WriteByOrder("W_Wheel_Type", (Int16)Convert.ToInt16(QueryMateriel(Station.stationType) == null ? QueryMateriel1(Station.stationType).TypeId : QueryMateriel(Station.stationType).TypeId), number);//车轮类型
                //            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_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
                //    {
                //        Gantry_client.WriteByOrder("W_RequestUnload", false, number);
                //    }
                //    var Gantrydetails = plcRepository.Find(x => x.plcdetail_iotype == Gantryplc.plcinfo_iotyep && x.plcdetail_number == number).ToList();
                //    var Gantry_Out_of_Area = (bool)DBExtension.Read(Gantrydetails.Where(x => x.plcdetail_name == "R_Gantry_Out_of_Area").First(), Gantry_client);//桁架是否在区域内
                //    var QueryDate = (bool)DBExtension.Read(Gantrydetails.Where(x => x.plcdetail_name == "R_QueryDate").First(), Gantry_client);//信息查询
                //    if (QueryDate)
                //    {
                //        var Date_Vaild = (bool)DBExtension.Read(Gantrydetails.Where(x => x.plcdetail_name == "R_Date_Vaild").First(), Gantry_client);//信息确认
                //        if (!Date_Vaild)//信息有误,记录日志
                //        {
                //            Gantry_client.WriteByOrder("W_RequestUnload", false, number);//信号为false桁架停止进入
                //            Station.location_state = LocationStateEnum.Abnormal.ToString();
                //            Station.remark = $"未查询到SN号:{SNS[SNS.Length - 1]}的订单";
                //            stationinfoRepository.Update(Station, true);
                //            WriteDBLog.Error("上料区信息查询", $"写入桁架信息:\nW_RequestUnload:false\n\n{Station.stationCode}未查询到SN号:{SNS[SNS.Length - 1]}的订单", "PCS");
                //            return;
                //        }
                //    }
                //    var finished = (bool)DBExtension.Read(Gantrydetails.Where(x => x.plcdetail_name == "R_Unlod_finished").First(), Gantry_client);//夹取完成
                //    var updatefinished = (bool)DBExtension.Read(Gantrydetails.Where(x => x.plcdetail_name == "W_Storage_update").First(), Gantry_client);//货位状态更新
                //    if (!finished && updatefinished)
                //        Gantry_client.WriteByOrder("W_Storage_update", false, number);//货位状态更新
                //    if (finished && !updatefinished)
                //    {
                //        Gantry_client.WriteByOrder("W_RequestUnload", false, number);//信号为false桁架停止进入
                //        Updatemes(SNS[SNS.Length - 1]);
                //        Station.quantity = Station.quantity - 1;
                //        Station.bindSN = OperStr(SNS);
                //        if (Station.quantity <= 0)
                //        {
                //            Station.stationType = string.Empty;
                //            Station.Number = string.Empty;
                //            Station.heatNumber = string.Empty;
                //            Station.tray_status = "EmptyTray";
                //        }
                //        var count = stationinfoRepository.Update(Station, true);
                //        if (count < 1)
                //        {
                //            WriteDBLog.Error("取料完成", $"上料位信息更新失败!上料位编号:{Station.stationCode}", "PCS");
                //            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);//车轮类型
                //        #endregion
                //        Gantry_client.WriteByOrder("W_Storage_update", true, number);//货位状态更新
                //        #region æ—¥å¿—记录
                //        WriteDBLog.Success("取料完成", $"写入桁架信息:\n货位状态更新:{true}\nW_RequestUnload:{false}", "PCS");
                //        #endregion
                //        #region æŠ¥è­¦
                //        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))
                //        {
                //            Station.location_state = LocationStateEnum.Abnormal.ToString();
                //            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)
                //        {
                //            Station.location_state = LocationStateEnum.Abnormal.ToString();
                //            Station.remark = "车轮数量小于0,光电检测有车轮";
                //            stationinfoRepository.Update(Station, true);
                //            client.WriteByOrder("W_AlarmSignal", (Int16)2, number);//报警
                //            WriteDBLog.Error(number + "报警", $"货位编号:{Station.stationCode};错误信息:{Station.remark}", "PCS");
                //        }
                //        #endregion
                //    }
                //}
                //else
                //    Gantry_client.WriteByOrder("W_RequestUnload", false, number);//信号为false桁架停止进入
                #endregion
            }
            catch (Exception ex)
            {
@@ -226,76 +408,88 @@
                Idt_stationinfoRepository stationinfoRepository = new dt_stationinfoRepository(Context);
                var plc = repository.FindFirst(x => x.plcinfo_name == client.PLCName);
                List<string> stationCodes = new List<string>() { "S01001001", "S01001002", "W01001001", "W01001002", "W01001003" };
                string remark = "";
                foreach (var stationCode in stationCodes)
                {
                    if (agvtaskService.Find(x => x.agv_fromaddress == stationCode /*|| x.agv_toaddress == stationCode*/).Any())
                        continue;
                    var station = stationinfoRepository.Find(x => x.stationCode == stationCode && x.enable).FirstOrDefault();
                    if (station == null) continue;
                    var details = plcRepository.Find(x => x.plcdetail_iotype == plc.plcinfo_iotyep && x.plcdetail_number == 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无
                    if (PalletSignal == 1 && MaterialSignal == 2 && (station.stationCode.Contains("S0100100") ? station.tray_status == "EmptyTray" : true))
                    try
                    {
                        var area = station.tray_type == "SmallTray" ? "11" : "10";
                        var task = agvtaskService.Find(x => (x.agv_toaddress.Contains("W") || x.agv_toaddress.Contains("X")) && x.agv_taskstate == "Queue" /*&& x.agv_tasktype == "TaskType_EmptyPallet" */ && x.agv_Traytype == station.tray_type).OrderByDescending(x => x.agv_grade).ThenBy(x => x.agv_createtime).FirstOrDefault();
                        if (task != null)
                        {
                            task.agv_fromaddress = station.stationCode;
                            task.StarQuantity = 0;
                            task.agv_taskstate = "Create";
                            if (station.stationCode.Contains("S0100100"))
                                task.agv_grade = 3;
                            agvtaskService.Update(task, true);
                            station.location_state = LocationStateEnum.Busy.ToString();
                            stationinfoRepository.Update(station, true);
                        remark = "查询站台";
                        var station = stationinfoRepository.Find(x => x.stationCode == stationCode && x.enable).FirstOrDefault();
                        if (station == null) continue;
                        remark = "查询起点是否存在任务";
                        if (agvtaskService.Find(x => x.agv_fromaddress == stationCode /*|| x.agv_toaddress == stationCode*/).Any())
                            continue;
                        }
                        #region ç©ºæ‰˜å ç›˜
                        var EmptyStations = stationinfoRepository.Find(x => x.stationCode.Contains("DD") && x.quantity < 5 && x.enable).ToList();
                        var EmptyStation = EmptyStations.Where(x => x.tray_type == station.tray_type && x.location_state == LocationStateEnum.Stroge.ToString()).FirstOrDefault();
                        if (EmptyStation == null)
                            EmptyStation = EmptyStations.Where(x => x.location_state == LocationStateEnum.Empty.ToString()).FirstOrDefault();
                        #endregion
                        if (EmptyStation == null)//查找库内空托盘
                            EmptyStation = GetStation.EmptyPalletStation(area);
                        if (EmptyStation != null)
                        remark = "读取光电信号";
                        var details = plcRepository.Find(x => x.plcdetail_iotype == plc.plcinfo_iotyep && x.plcdetail_number == 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无
                        if (PalletSignal == 1 && MaterialSignal == 2 && (station.stationCode.Contains("S0100100") ? station.tray_status == "EmptyTray" : true))
                        {
                            #region åŒä¸€ä¸ªç©ºæ‰˜ä½åªèƒ½åŒæ—¶ç”Ÿæˆä¸€ä¸ªç©ºæ‰˜ä»»åŠ¡
                            if (agvtaskService.Find(x => x.agv_fromaddress == EmptyStation.stationCode || x.agv_toaddress == EmptyStation.stationCode).Any())
                                return;
                            #endregion
                            dt_agvtask agvtask = new dt_agvtask()
                            var area = station.tray_type == "SmallTray" ? "11" : "10";
                            remark = "查询是否存在补空托队列任务";
                            var task = agvtaskService.Find(x => (x.agv_toaddress.Contains("W") || x.agv_toaddress.Contains("X")) && x.agv_taskstate == "Queue" && x.agv_tasktype == "TaskType_EmptyPallet" && x.agv_Traytype == station.tray_type).OrderByDescending(x => x.agv_grade).ThenBy(x => x.agv_createtime).FirstOrDefault();
                            if (task != null)
                            {
                                agv_fromaddress = station.stationCode,
                                agv_id = Guid.NewGuid(),
                                agv_tasknum = IdenxManager.GetTaskNo("KH-", "WMS"),
                                agv_grade = station.stationCode.Contains("S0100100") ? 3 : 1,
                                agv_createtime = DateTime.Now,
                                agv_taskstate = "Create",
                                //agv_materielid = station.stationType,
                                agv_qty = 1,
                                StarQuantity = 0,
                                EndQuantity = EmptyStation.quantity,
                                agv_tasktype = "TaskType_EmptyPallet",
                                agv_toaddress = EmptyStation.stationCode,
                                agv_userid = "系统",
                                agv_TrayStatus = "EmptyTray",//station.tray_status,
                                agv_Traytype = station.tray_type,
                            };
                            agvtaskService.Add(agvtask, true);
                            station.location_state = LocationStateEnum.Busy.ToString();
                            stationinfoRepository.Update(station, true);
                            EmptyStation.location_state = LocationStateEnum.Busy.ToString();
                            stationinfoRepository.Update(EmptyStation, true);
                            WriteDBLog.Success("创建自动取空托任务", $"任务编号:{agvtask.agv_tasknum}", "PCS");
                            return;
                                task.agv_fromaddress = station.stationCode;
                                task.StarQuantity = 0;
                                task.agv_taskstate = "Create";
                                if (station.stationCode.Contains("S0100100"))
                                    task.agv_grade = 3;
                                agvtaskService.Update(task, true);
                                station.location_state = LocationStateEnum.Busy.ToString();
                                stationinfoRepository.Update(station, true);
                                WriteDBLog.Success("更新空托队列任务", $"任务编号:{task.agv_tasknum},托盘信号:{PalletSignal},货物信号:{MaterialSignal}", "PCS");
                                continue;
                            }
                            remark = "查询空托叠盘位";
                            #region ç©ºæ‰˜å ç›˜
                            var EmptyStations = stationinfoRepository.Find(x => x.stationCode.Contains("DD") && x.quantity < 5 && x.enable).ToList();
                            var EmptyStation = EmptyStations.Where(x => x.tray_type == station.tray_type && x.location_state == LocationStateEnum.Stroge.ToString()).FirstOrDefault();
                            if (EmptyStation == null)
                                EmptyStation = EmptyStations.Where(x => x.location_state == LocationStateEnum.Empty.ToString() && x.quantity == 0).FirstOrDefault();
                            #endregion
                            remark = "查找库内空托位";
                            if (EmptyStation == null)//查找库内空托盘
                                EmptyStation = GetStation.EmptyPalletStation(area);
                            if (EmptyStation != null)
                            {
                                #region åŒä¸€ä¸ªç©ºæ‰˜ä½åªèƒ½åŒæ—¶ç”Ÿæˆä¸€ä¸ªç©ºæ‰˜ä»»åŠ¡
                                remark = "查询空托位是否存在任务";
                                if (agvtaskService.Find(x => x.agv_fromaddress == EmptyStation.stationCode || x.agv_toaddress == EmptyStation.stationCode).Any())
                                    return;
                                #endregion
                                dt_agvtask agvtask = new dt_agvtask()
                                {
                                    agv_fromaddress = station.stationCode,
                                    agv_id = Guid.NewGuid(),
                                    agv_tasknum = IdenxManager.GetTaskNo("KH-", "WMS"),
                                    agv_grade = station.stationCode.Contains("S0100100") ? 3 : 1,
                                    agv_createtime = DateTime.Now,
                                    agv_taskstate = "Create",
                                    //agv_materielid = station.stationType,
                                    agv_qty = 1,
                                    StarQuantity = 0,
                                    EndQuantity = EmptyStation.quantity,
                                    agv_tasktype = "TaskType_EmptyPallet",
                                    agv_toaddress = EmptyStation.stationCode,
                                    agv_userid = "系统",
                                    agv_TrayStatus = "EmptyTray",//station.tray_status,
                                    agv_Traytype = station.tray_type,
                                };
                                agvtaskService.Add(agvtask, true);
                                station.location_state = LocationStateEnum.Busy.ToString();
                                stationinfoRepository.Update(station, true);
                                EmptyStation.location_state = LocationStateEnum.Busy.ToString();
                                stationinfoRepository.Update(EmptyStation, true);
                                WriteDBLog.Success("创建自动取空托任务", $"任务编号:{agvtask.agv_tasknum},托盘信号:{PalletSignal},货物信号:{MaterialSignal}", "PCS");
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        WriteDBLog.Error("创建自动取空托任务", $"{stationCode}:{remark}错误信息:{ex.Message}", "PCS");
                    }
                }
            }
@@ -326,7 +520,7 @@
                        if (Station.quantity > 0 && (PalletSignal != 1 || MaterialSignal != 1))//系统货位有车轮,光电检测无车轮
                        {
                            Station.location_state = LocationStateEnum.Abnormal.ToString();
                            Station.remark = "车轮数量大于0,光电检测无托盘或无车轮";
                            Station.remark = $"车轮数量大于0,托盘光电信号为:{PalletSignal},货物光电信号为:{MaterialSignal}";
                            stationinfoRepository.Update(Station, true);
                            client.WriteByOrder("W_AlarmSignal", (Int16)2, name);//报警
                            WriteDBLog.Error(name + "报警", $"货位编号:{Station.stationCode};错误信息:{Station.remark}", "PCS");
@@ -335,7 +529,7 @@
                        if (Station.location_state == LocationStateEnum.Stroge.ToString() && PalletSignal != 1)
                        {
                            Station.location_state = LocationStateEnum.Abnormal.ToString();
                            Station.remark = "光电检测无托盘";
                            Station.remark = $"货位状态为有货,托盘光电信号为:{PalletSignal},货物光电信号为:{MaterialSignal}";
                            stationinfoRepository.Update(Station, true);
                            client.WriteByOrder("W_AlarmSignal", (Int16)2, name);//报警
                            WriteDBLog.Error(name + "报警", $"货位编号:{Station.stationCode};错误信息:{Station.remark}", "PCS");
@@ -344,7 +538,7 @@
                        if (Station.location_state == LocationStateEnum.Empty.ToString() && (PalletSignal == 1 || MaterialSignal == 1))//系统货位为空,光电检测有料
                        {
                            Station.location_state = LocationStateEnum.Abnormal.ToString();
                            Station.remark = "光电检测有料";
                            Station.remark = $"货位状态为空货位,托盘光电信号为:{PalletSignal},货物光电信号为:{MaterialSignal}";
                            stationinfoRepository.Update(Station, true);
                            client.WriteByOrder("W_AlarmSignal", (Int16)2, name);//报警
                            WriteDBLog.Error(name + "报警", $"货位编号:{Station.stationCode};错误信息:{Station.remark}", "PCS");
´úÂë¹ÜÀí/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/EmptyTrayIn.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,84 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WIDESEA_Comm.LogInfo;
using WIDESEA_Comm.TaskNo;
using WIDESEA_Comm;
using WIDESEA_Core.EFDbContext;
using WIDESEA_Entity.DomainModels;
using WIDESEA_WCS.IRepositories;
using WIDESEA_WCS.Repositories;
using static System.Collections.Specialized.BitVector32;
using WIDESEA_WMS.IRepositories;
using WIDESEA_WMS.Repositories;
namespace WIDESEA_WCS.JobsPart.Common
{
    public class EmptyTray
    {
        /// <summary>
        /// ç©ºæ‰˜å ç›˜å…¥åº“
        /// </summary>
        public static void EmptyTrayIn()
        {
            try
            {
                VOLContext Context = new VOLContext();
                Idt_stationinfoRepository stationinfoRepository = new dt_stationinfoRepository(Context);
                Idt_agvtaskRepository agvtaskRepository = new dt_agvtaskRepository(Context);
                var EmptyStations = stationinfoRepository.Find(x => x.stationCode.Contains("DD") && x.quantity == 5 && x.enable).ToList();
                foreach (var EmptyStation in EmptyStations)
                {
                    try
                    {
                        if (agvtaskRepository.Find(x => x.agv_fromaddress == EmptyStation.stationCode || x.agv_toaddress == EmptyStation.stationCode).Any()) continue;
                        var area = EmptyStation.tray_type == "SmallTray" ? "11" : "10";
                        var toEmptyStation = GetStation.EmptyPalletStation(area);
                        if (toEmptyStation != null)
                        {
                            #region åŒä¸€ä¸ªç©ºæ‰˜ä½åªèƒ½åŒæ—¶ç”Ÿæˆä¸€ä¸ªç©ºæ‰˜ä»»åŠ¡
                            if (agvtaskRepository.Find(x => x.agv_fromaddress == toEmptyStation.stationCode || x.agv_toaddress == toEmptyStation.stationCode).Any()) continue;
                            #endregion
                            dt_agvtask agvtask = new dt_agvtask()
                            {
                                agv_fromaddress = EmptyStation.stationCode,
                                agv_id = Guid.NewGuid(),
                                agv_tasknum = IdenxManager.GetTaskNo("KH-", "WMS"),
                                agv_grade = 3,
                                agv_createtime = DateTime.Now,
                                agv_taskstate = "Create",
                                //agv_materielid = station.stationType,
                                agv_qty = EmptyStation.quantity - toEmptyStation.quantity,
                                StarQuantity = toEmptyStation.quantity,
                                EndQuantity = toEmptyStation.quantity,
                                agv_tasktype = "TaskType_EmptyPallet",
                                agv_toaddress = toEmptyStation.stationCode,
                                agv_userid = "系统",
                                agv_TrayStatus = "EmptyTray",//station.tray_status,
                                agv_Traytype = EmptyStation.tray_type,
                            };
                            agvtaskRepository.Add(agvtask, true);
                            EmptyStation.location_state = LocationStateEnum.Busy.ToString();
                            stationinfoRepository.Update(EmptyStation, true);
                            toEmptyStation.location_state = LocationStateEnum.Busy.ToString();
                            stationinfoRepository.Update(toEmptyStation, true);
                            WriteDBLog.Success("创建叠盘位空托入库任务", $"任务编号:{agvtask.agv_tasknum}", "PCS");
                        }
                    }
                    catch (Exception ex)
                    {
                        WriteDBLog.Success("创建叠盘位空托入库任务", $"错误信息:{ex.Message}", "PCS");
                    }
                }
            }
            catch (Exception ex)
            {
                WriteDBLog.Success("创建叠盘位空托入库任务", $"错误信息:{ex.Message}", "PCS");
            }
        }
    }
}
´úÂë¹ÜÀí/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/GetStation/EmptyPalletStation.cs
@@ -105,7 +105,7 @@
            dt_stationinfo stationinfo = null;
            try
            {
                if (stationinfoRepository.Find(x => x.area == EmptyStation.area && x.line == EmptyStation.line && x.location_state.Contains("Busy")).Any()) return null;
                if (stationinfoRepository.Find(x => x.area == EmptyStation.area && x.line == EmptyStation.line && x.location_state.Contains("Busy")).Any()) return stationinfo;
                stationinfo = stationinfoRepository.Find(x => x.area == EmptyStation.area && x.line == EmptyStation.line && x.quantity > 0 && x.enable).OrderByDescending(x => x.column).FirstOrDefault();
@@ -115,8 +115,12 @@
                    else
                        stationinfo = stationinfoRepository.Find(x => x.area == EmptyStation.area && x.line == EmptyStation.line && x.location_state == LocationStateEnum.Empty.ToString() && x.enable).OrderBy(x => x.column).FirstOrDefault();
                }
                else
                {
                    stationinfo = stationinfoRepository.Find(x => x.area == EmptyStation.area && x.line == EmptyStation.line && x.location_state == LocationStateEnum.Empty.ToString() && x.enable).OrderBy(x => x.column).FirstOrDefault();
                }
                //if (stationinfo == null)
                //    stationinfo = stationinfoRepository.Find(x => x.area == EmptyStation.area && x.line == EmptyStation.line && x.quantity < 5 && x.location_state == LocationStateEnum.Empty.ToString() && x.enable).OrderBy(x => x.column).FirstOrDefault();
            }
            catch (Exception ex)
            {
@@ -171,12 +175,16 @@
                }
                else
                {
                    stationinfo = stationinfoRepository.Find(x => x.area == area && x.quantity > 0 /*&& x.location_state == LocationStateEnum.Stroge.ToString()*/ && x.enable).OrderBy(x => x.column).FirstOrDefault();
                    stationinfo = stationinfoRepository.Find(x => x.area == area && x.quantity > 0 && x.enable).OrderBy(x => x.column).FirstOrDefault();
                    if (stationinfo != null)
                    {
                        if (stationinfo.quantity < 5) return stationinfo;
                        else
                            stationinfo = stationinfoRepository.Find(x => x.area == area && x.quantity < 5 && x.location_state == LocationStateEnum.Empty.ToString() && x.enable).OrderByDescending(x => x.column).FirstOrDefault();
                            stationinfo = stationinfoRepository.Find(x => x.area == area && x.location_state == LocationStateEnum.Empty.ToString() && x.enable).OrderByDescending(x => x.column).FirstOrDefault();
                    }
                    else
                    {
                        stationinfo = stationinfoRepository.Find(x => x.area == area && x.location_state == LocationStateEnum.Empty.ToString() && x.enable).OrderByDescending(x => x.column).FirstOrDefault();
                    }
                }
´úÂë¹ÜÀí/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/ReplaceTray.cs
@@ -54,10 +54,10 @@
        {
            try
            {
                VOLContext context = new VOLContext();
                VOLContext context = new VOLContext();
                Idt_stationinfoRepository stationinfoRepository = new dt_stationinfoRepository(context);
                Idt_agvtaskRepository agvtaskRepository = new dt_agvtaskRepository(context);
                var stations = stationinfoRepository.Find(x => (x.stationCode.Contains("X")|| x.stationCode.Contains("W01001004") || x.stationCode.Contains("W01001005")) && x.location_state == "Abnormal" /*LocationStateEnum.Abnormal.ToString()*/ && (x.tray_type == "SmallTray/LargeTray" || x.tray_type == "LargeTray/SmallTray") && x.enable).ToList();
                Idt_agvtaskRepository agvtaskRepository = new dt_agvtaskRepository(context);//"Abnormal"
                var stations = stationinfoRepository.Find(x => (x.stationCode.Contains("X") || x.stationCode.Contains("W01001004") || x.stationCode.Contains("W01001005")) && x.location_state == LocationStateEnum.Abnormal.ToString() && (x.tray_type == "SmallTray/LargeTray" || x.tray_type == "LargeTray/SmallTray") && x.enable).ToList();
                foreach (var station in stations)
                {
                    if (agvtaskRepository.Find(x => x.agv_fromaddress == station.stationCode || x.agv_toaddress == station.stationCode).Any()) continue;
@@ -99,7 +99,8 @@
                        EmptyStation.location_state = LocationStateEnum.Busy.ToString();
                        stationinfoRepository.Update(EmptyStation, true);
                        WriteDBLog.Success("创建更换空盘任务", $"任务编号:{agvtask.agv_tasknum}", "PCS");
                        CreatePartQueue(agvtaskRepository, agvtask, types[1]);
                        CreatePartQueue(agvtaskRepository, agvtask, agvtask.agv_Traytype == "SmallTray" ? "LargeTray" : "SmallTray");
                        //CreatePartQueue(agvtaskRepository, agvtask, types[1]);
                    }
                }
            }
@@ -129,7 +130,7 @@
                agv_toaddress = agvtask.agv_fromaddress,
                agv_userid = "系统",
                agv_TrayStatus = agvtask.agv_TrayStatus,
                agv_Traytype = type == "" ? agvtask.agv_Traytype : type,
                agv_Traytype = type,
            };
            agvtaskRepository.Add(taskPart, true);
            WriteDBLog.Success("创建更换空盘任务", $"任务编号:{taskPart.agv_tasknum}", "PCS");
´úÂë¹ÜÀí/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/RestockHCJ.cs
@@ -37,131 +37,92 @@
                var tasks = agvtaskService.Find(x => x.agv_taskstate == "Queue").OrderByDescending(x => x.agv_grade).ThenBy(x => x.agv_createtime).ToList();
                foreach (var task in tasks)
                {
                    if (task.agv_tasktype == "TaskType_EmptyPallet")//空托任务
                    try
                    {
                        if (task.agv_fromaddress == "" && DateTime.Now - task.agv_createtime >= TimeSpan.FromMinutes(2))
                        if (task.agv_tasktype == "TaskType_EmptyPallet")//空托任务
                        {
                            if (task.agv_tasknum.Contains("_"))
                            if (task.agv_fromaddress == "" && DateTime.Now - task.agv_createtime >= TimeSpan.FromMinutes(2))
                            {
                                string mainTaskNum = task.agv_tasknum.Split('_')[0];
                                if (agvtaskService.Find(x => x.agv_tasknum == mainTaskNum && task.agv_taskstate != "Executing" && task.agv_taskstate != "Create").Any() || !agvtaskService.Find(x => x.agv_tasknum == mainTaskNum).Any())
                                if (task.agv_tasknum.Contains("_"))
                                {
                                    string mainTaskNum = task.agv_tasknum.Split('_')[0];
                                    if (agvtaskService.Find(x => x.agv_tasknum == mainTaskNum && task.agv_taskstate != "Executing" && task.agv_taskstate != "Create").Any() || !agvtaskService.Find(x => x.agv_tasknum == mainTaskNum).Any())
                                        GetStation.EmptyPalletStation(task);
                                }
                                else
                                    GetStation.EmptyPalletStation(task);
                                WriteDBLog.Success("更新空托队列任务", $"任务编号:{task.agv_tasknum}", "PCS");
                                continue;
                            }
                            else
                                GetStation.EmptyPalletStation(task);
                            #region
                            //var Pipeline_client = PLCClient.Clients.FirstOrDefault(t => t.PLCName == "链条机");
                            //if (Pipeline_client == null) throw new Exception("链条机调度服务未开启!");
                            //if (!Pipeline_client.IsConnected) throw new Exception("与链条机连接超时!");
                            //var area = task.agv_Traytype == "SmallTray" ? "11" : "10";
                            ////找1库区的空托位
                            //var EmptyStation = stationinfoRepository.Find(x => x.area == area && x.quantity > 0 && x.stationCode.Contains("A") /*&& x.location_state == "Stroge"*//*LocationStateEnum.Stroge.ToString()*/ && x.enable).OrderBy(x => x.column).ThenBy(x => x.line).FirstOrDefault();
                            //if (EmptyStation != null)
                            //    if (EmptyStation.location_state == LocationStateEnum.Busy.ToString()) EmptyStation = null;
                            //#region ä¸€ä¸ªåŒºåŸŸåªèƒ½æœ‰ä¸€ä¸ªç©ºæ‰˜ä»»åŠ¡
                            ////bool ok = false;
                            ////if (EmptyStation != null)
                            ////    ok = agvtaskService.Find(x => x.agv_fromaddress == EmptyStation.stationCode || x.agv_toaddress == EmptyStation.stationCode).Any();
                            ////if (EmptyStation == null || ok)
                            ////    EmptyStation = stationinfoRepository.Find(x => x.area == area && x.quantity > 0 && x.stationCode.Contains(area == "10" ? "D" : "C") && x.location_state == "Stroge" /*LocationStateEnum.Stroge.ToString()*/ && x.enable)
                            ////    .OrderBy(x => x.line).OrderByDescending(x => x.column).FirstOrDefault();
                            //#endregion
                            //if (EmptyStation == null)
                            //    EmptyStation = stationinfoRepository.Find(x => x.area == area && x.quantity > 0 && x.stationCode.Contains(area == "10" ? "D" : "C") && x.enable).OrderByDescending(x => x.column).FirstOrDefault();
                            //if (EmptyStation == null) continue;
                            //#region åº“内存在任务占用
                            //if (EmptyStation.location_state == LocationStateEnum.Busy.ToString())
                            //    continue;
                            //#endregion
                            //if (EmptyStation == null)
                            //    EmptyStation = stationinfoRepository.Find(x => x.area == area && x.quantity > 0 && x.stationCode.Contains(area == "10" ? "D" : "C") && x.location_state == "Stroge" && x.enable).OrderByDescending(x => x.column).FirstOrDefault();
                            //if (EmptyStation != null)
                            //{
                            //    #region åº“内存在任务占用
                            //    //if (EmptyStation.location_state == LocationStateEnum.Busy.ToString())
                            //    //    continue;
                            //    #endregion
                            //    //if (agvtaskService.Find(x => x.agv_fromaddress == EmptyStation.stationCode || x.agv_toaddress == EmptyStation.stationCode).Any())
                            //    //    return;
                            //    #region è¡¥åº“内空托盘,不需要光电判断
                            //    var PalletSignal = Pipeline_client.ReadByOrder<Int16>("R_PalletSignal", task.agv_toaddress);//读取托盘信号:1:有,2无
                            //    var MaterialSignal = Pipeline_client.ReadByOrder<Int16>("R_MaterialSignal", task.agv_toaddress);//读取货物信号:1:有,2无
                            //    if (PalletSignal == 2 && MaterialSignal == 2)
                            //    {
                            //        task.agv_fromaddress = EmptyStation.stationCode;
                            //        task.StarQuantity = EmptyStation.quantity - 1;
                            //        task.agv_taskstate = "Create";
                            //        agvtaskService.Update(task, true);
                            //        EmptyStation.location_state = LocationStateEnum.Busy.ToString();
                            //        stationinfoRepository.Update(EmptyStation, true);
                            //        WriteDBLog.Success("更新空盘队列任务", $"任务编号:{task.agv_tasknum}", "PCS");
                            //    }
                            //    #endregion
                            //}
                            #endregion
                        }
                    }
                    else if (task.agv_tasktype == "TaskType_OutsourceInbound" || task.agv_tasktype == "TaskType_Inbound")//外协库入库/AB库入库
                    {
                        if (task.agv_toaddress == "")
                        else if (task.agv_tasktype == "TaskType_OutsourceInbound" || task.agv_tasktype == "TaskType_Inbound")//外协库入库/AB库入库
                        {
                            var stationinfo = stationinfoRepository.Find(x => x.stationCode == task.agv_fromaddress).FirstOrDefault();
                            var work = workinfoRepository.Find(x => x.workOrder == stationinfo.Number && x.drawingNo == stationinfo.stationType && x.heatID == stationinfo.heatNumber && x.processCode == "17").FirstOrDefault();
                            var TargetLocation = task.agv_tasktype == "TaskType_Inbound" ? GetLocation.GetEmptyLocation(stationinfoRepository, work, stationinfo) : StationTask.GetEmptyLocation(stationinfoRepository);
                            if (TargetLocation != null)
                            if (task.agv_toaddress == "")
                            {
                                if (agvtaskService.Find(x => x.agv_toaddress == TargetLocation.stationCode).Any()) continue;
                                task.agv_taskstate = "Create";
                                task.agv_toaddress = TargetLocation.stationCode;
                                TargetLocation.location_state = LocationStateEnum.InBusy.ToString();
                                TargetLocation.billetID = stationinfo.billetID;
                                TargetLocation.stationType = task.agv_materielid;
                                TargetLocation.heatNumber = stationinfo.heatNumber;
                                TargetLocation.Number = task.jobID;
                                stationinfoRepository.Update(TargetLocation, true);
                                agvtaskService.Update(task, true);
                                var stationinfo = stationinfoRepository.Find(x => x.stationCode == task.agv_fromaddress).FirstOrDefault();
                                var work = workinfoRepository.Find(x => x.workOrder == stationinfo.Number && x.drawingNo == stationinfo.stationType && x.heatID == stationinfo.heatNumber && x.processCode == "17").FirstOrDefault();
                                var TargetLocation = task.agv_tasktype == "TaskType_Inbound" ? GetLocation.GetEmptyLocation(stationinfoRepository, work, task) : StationTask.GetEmptyLocation(stationinfoRepository);
                                if (TargetLocation != null)
                                {
                                    if (agvtaskService.Find(x => x.agv_toaddress == TargetLocation.stationCode).Any()) continue;
                                    task.agv_taskstate = "Create";
                                    task.agv_toaddress = TargetLocation.stationCode;
                                    TargetLocation.location_state = LocationStateEnum.InBusy.ToString();
                                    TargetLocation.billetID = stationinfo.billetID;
                                    TargetLocation.stationType = task.agv_materielid;
                                    TargetLocation.heatNumber = stationinfo.heatNumber;
                                    TargetLocation.Number = task.jobID;
                                    stationinfoRepository.Update(TargetLocation, true);
                                    agvtaskService.Update(task, true);
                                    WriteDBLog.Success("更新入库队列任务", $"任务编号:{task.agv_tasknum}", "PCS");
                                    continue;
                                }
                            }
                        }
                        else if (task.agv_tasktype == "TaskType_OutsourceOutbound" || task.agv_tasktype == "TaskType_Outbound")//外协库出库/AB库出库
                        {
                            if (task.agv_toaddress == "")
                            {
                                var EmptyStations = stationinfoRepository.Find(x => x.stationCode.Contains("S01001") && (x.tray_status == "EmptyTray" || x.location_state == "Empty") && x.enable).ToList();
                                foreach (var EmptyStation in EmptyStations)
                                {
                                    if (agvtaskService.Find(x => x.agv_toaddress == EmptyStation.stationCode).Any()) continue;
                                    task.agv_taskstate = "Create";
                                    task.agv_toaddress = EmptyStation.stationCode;
                                    EmptyStation.location_state = LocationStateEnum.Busy.ToString();
                                    stationinfoRepository.Update(EmptyStation, true);
                                    agvtaskService.Update(task, true);
                                    WriteDBLog.Success("更新出库队列任务", $"任务编号:{task.agv_tasknum}", "PCS");
                                    return;
                                }
                            }
                        }
                        else if (task.agv_tasktype == "TaskType_OutsourceCarry")//移库外协
                        {
                            if (task.agv_toaddress == "")
                            {
                                var TargetLocation = StationTask.GetEmptyLocation(stationinfoRepository);
                                if (TargetLocation != null)
                                {
                                    if (agvtaskService.Find(x => x.agv_toaddress == TargetLocation.stationCode).Any()) continue;
                                    task.agv_taskstate = "Create";
                                    task.agv_toaddress = TargetLocation.stationCode;
                                    TargetLocation.location_state = LocationStateEnum.OutBusy.ToString();
                                    TargetLocation.stationType = task.agv_materielid;
                                    stationinfoRepository.Update(TargetLocation, true);
                                    agvtaskService.Update(task, true);
                                    WriteDBLog.Success("更新移库外协队列任务", $"任务编号:{task.agv_tasknum}", "PCS");
                                    continue;
                                }
                            }
                        }
                    }
                    else if (task.agv_tasktype == "TaskType_OutsourceOutbound" || task.agv_tasktype == "TaskType_Outbound")//外协库出库/AB库出库
                    catch (Exception ex)
                    {
                        if (task.agv_toaddress == "")
                        {
                            var EmptyStations = stationinfoRepository.Find(x => x.stationCode.Contains("S01001") && x.tray_status == "EmptyTray" /*x.location_state == "Empty"*/ && x.enable).ToList();
                            foreach (var EmptyStation in EmptyStations)
                            {
                                if (agvtaskService.Find(x => x.agv_toaddress == EmptyStation.stationCode).Any()) continue;
                                task.agv_taskstate = "Create";
                                task.agv_toaddress = EmptyStation.stationCode;
                                EmptyStation.location_state = LocationStateEnum.Busy.ToString();
                                stationinfoRepository.Update(EmptyStation, true);
                                agvtaskService.Update(task, true);
                                WriteDBLog.Success("更新出库队列任务", $"任务编号:{task.agv_tasknum}", "PCS");
                                return;
                            }
                        }
                    }
                    else if (task.agv_tasktype == "TaskType_OutsourceCarry")//移库外协
                    {
                        if (task.agv_toaddress == "")
                        {
                            var TargetLocation = StationTask.GetEmptyLocation(stationinfoRepository);
                            if (TargetLocation != null)
                            {
                                if (agvtaskService.Find(x => x.agv_toaddress == TargetLocation.stationCode).Any()) continue;
                                task.agv_taskstate = "Create";
                                task.agv_toaddress = TargetLocation.stationCode;
                                TargetLocation.location_state = LocationStateEnum.OutBusy.ToString();
                                TargetLocation.stationType = task.agv_materielid;
                                stationinfoRepository.Update(TargetLocation, true);
                                agvtaskService.Update(task, true);
                                WriteDBLog.Success("更新出库队列任务", $"任务编号:{task.agv_tasknum}", "PCS");
                                return;
                            }
                        }
                        //WriteDBLog.Error("更新队列任务", $"错误信息:{ex.Message}", "PCS");
                        WriteLog.Write_Log("更新队列任务","更新失败", "", $"错误信息:{ex.Message}");
                    }
                }
            }
´úÂë¹ÜÀí/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/ÐÂÎļþ¼Ð/GetLocation.cs
@@ -24,7 +24,7 @@
        /// <param name="mesinfo"></param>
        /// <param name="stationinfo"></param>
        /// <returns></returns>
        public static dt_stationinfo GetEmptyLocation(Idt_stationinfoRepository stationinfoRepository, VV_Mes_Workinfo mesinfo, dt_stationinfo stationinfo)
        public static dt_stationinfo GetEmptyLocation(Idt_stationinfoRepository stationinfoRepository, VV_Mes_Workinfo mesinfo, dt_agvtask agvtask)
        {
            lock (GetEmptyLocationobj)
            {
@@ -33,12 +33,12 @@
                    VOLContext context = new VOLContext();
                    Idt_inventoryRepository inventoryRepository = new dt_inventoryRepository(context);
                    string area1 = "";
                    if (stationinfo.tray_type == "LargeTray")
                    if (agvtask.agv_Traytype == "LargeTray")
                        area1 = "4";
                    #region æŸ¥æ‰¾åº“å­˜
                    dt_inventory inventory = null;
                    inventory = inventoryRepository.Find(x => x.FigureNumber == stationinfo.stationType).OrderByDescending(x => x.OnlineTime).FirstOrDefault();
                    inventory = inventoryRepository.Find(x => x.FigureNumber == agvtask.agv_materielid).OrderByDescending(x => x.OnlineTime).FirstOrDefault();
                    #endregion
                    dt_stationinfo TargetLocation = null;
@@ -50,7 +50,7 @@
                        if (!string.IsNullOrEmpty(area1) && station.area != area1)//入大托盘库区
                        {
                            #region å¯»æ‰¾å·²åˆ†é…åŒå›¾å·å…¥åº“任务库位
                            TargetLocation = stationinfoRepository.Find(x => x.stationType == stationinfo.stationType && x.location_state == LocationStateEnum.InBusy.ToString() && x.area == area1).FirstOrDefault();
                            TargetLocation = stationinfoRepository.Find(x => x.stationType == agvtask.agv_materielid && x.location_state == LocationStateEnum.InBusy.ToString() && x.area == area1).FirstOrDefault();
                            if (TargetLocation != null)
                            {
                                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();
@@ -66,7 +66,7 @@
                            var TargetLocations1 = stationinfoRepository.Find(x => x.location_state == LocationStateEnum.Empty.ToString() && x.enable && x.area == area1).OrderBy(x => x.line).ThenBy(x => x.column).ToList();
                            foreach (var Location in TargetLocations1)
                            {
                                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 (!stationinfoRepository.Find(x => x.line == Location.line && x.area == Location.area && x.stationType == agvtask.agv_materielid && x.location_state == LocationStateEnum.OutBusy.ToString()).Any()) return Location;
                            }
                            #endregion
@@ -95,7 +95,7 @@
                    #endregion
                    #region å¯»æ‰¾å·²åˆ†é…åŒå›¾å·å…¥åº“任务库位
                    TargetLocation = stationinfoRepository.Find(x => x.stationType == stationinfo.stationType && x.location_state == LocationStateEnum.InBusy.ToString() && (x.area == "1" || x.area == "2" || x.area == "3" || x.area == "4")).FirstOrDefault();
                    TargetLocation = stationinfoRepository.Find(x => x.stationType == agvtask.agv_materielid && x.location_state == LocationStateEnum.InBusy.ToString() && (x.area == "1" || x.area == "2" || x.area == "3" || x.area == "4")).FirstOrDefault();
                    if (TargetLocation != null)
                    {
                        if (TargetLocation.area == "1")
@@ -126,17 +126,17 @@
                    {
                        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;
                            if (stationinfoRepository.Find(x => x.column == Location.column && x.area == Location.area && x.stationType == agvtask.agv_materielid && 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 (!stationinfoRepository.Find(x => x.line == Location.line && x.area == Location.area && x.stationType == agvtask.agv_materielid && x.location_state == LocationStateEnum.OutBusy.ToString()).Any()) return Location;
                        }
                    }
                    #endregion
                    #region æœªæ‰¾åˆ°åº“存或当前库存行已满,寻找新的一行
                    var area = GetArea(mesinfo.quantity, stationinfo.tray_type);
                    var area = GetArea(mesinfo.quantity, agvtask.agv_Traytype);
                    TargetLocation = stationinfoRepository.Find(x => x.column == 1 && x.area == area && x.location_state == LocationStateEnum.Empty.ToString() && x.enable).OrderBy(x => x.line).ThenBy(x => x.column).FirstOrDefault();
                    if (TargetLocation == null && area != "4")
                    {
´úÂë¹ÜÀí/PCS/WCS_Server/WIDESEA_WebApi/appsettings.json
@@ -16,6 +16,7 @@
  "Connection": {
    "DBType": "MsSql", //MySql/MsSql/PgSql  //数据库类型,如果使用的是sqlserver此处应设置为MsSql
    //sqlserver连接字符串P@ssw0rd
    //"DbConnectionString": "Data Source=192.168.12.101;Initial Catalog=WIDESEA_DB;Persist Security Info=True;User ID=sa;Password=123456;Connect Timeout=500;",
    "DbConnectionString": "Data Source=.;Initial Catalog=WIDESEA_DB;Persist Security Info=True;User ID=sa;Password=P@ssw0rd;Connect Timeout=500;",
    //mysql连接字符串(升级EFCore3.1到时已将mysql连接字符串修改,2019-12-20)
´úÂë¹ÜÀí/WMS/WMS_Server/WIDESEA_WebApi/Controllers/ToWms/ToWMSController.cs
@@ -41,6 +41,17 @@
        }
        /// <summary>
        /// å¤–协货位扫码确认物料已被取走
        /// </summary>
        /// <param name="saveModel"></param>
        /// <returns></returns>
        [HttpPost, Route("Confirmedcut")]
        public WebResponseContent Confirmedcut([FromBody] SaveModel saveModel)
        {
            return new ToMesServer().Confirmedcut(saveModel);
        }
        /// <summary>
        /// èŽ·å–è´§ä½
        /// </summary>
        /// <param name="request"></param>
ÏîÄ¿×ÊÁÏ/ͨÐÅЭÒé/PCS¸úAGVºÍèì¼Ü·À´ô½»»¥Ð­Òé/PCSºÍèì¼ÜЭÒé.xlsx
Binary files differ