From 5662395113163ac87425f23aa0bff8853be92462 Mon Sep 17 00:00:00 2001 From: dengjunjie <dengjunjie@hnkhzn.com> Date: 星期三, 06 三月 2024 10:46:27 +0800 Subject: [PATCH] 优化逻辑 --- 代码管理/WMS/WMS_Server/WIDESEA_Entity/DomainModels/System/dt_stationinfo.cs | 8 + 代码管理/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/OutboundTask.cs | 106 +++++++++++++++++ 代码管理/PCS/WCS_Server/WIDESEA_Entity/DomainModels/System/dt_stationinfo.cs | 7 + 代码管理/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/StationTask.cs | 147 ++++++++++++++++-------- 代码管理/PCS/WCS_Server/WIDESEA_WCS/Jobs/Task/AutoTaskJob.cs | 3 项目资料/通信协议/新增设备协议/太重交互-库口状态_V1.xlsx | 0 代码管理/PCS/WCS_Server/WIDESEA_WCS/Common/Gantry.cs | 46 ++++--- 代码管理/PCS/WCS_Server/WIDESEA_WCS/Jobs/equipment/PipelineJob.cs | 8 代码管理/WMS/WMS_Server/WIDESEA_WMS/Common/Gantry/QueryData.cs | 2 代码管理/WMS/WMS_Client/src/views/widesea_wms/system/dt_stationinfo.vue | 5 代码管理/WMS/WMS_Client/src/views/widesea_wms/system/dt_inventory.vue | 2 代码管理/WMS/WMS_Server/WIDESEA_WMS/Services/system/Partial/dt_stationinfoService.cs | 20 +++ 12 files changed, 275 insertions(+), 79 deletions(-) diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_Entity/DomainModels/System/dt_stationinfo.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_Entity/DomainModels/System/dt_stationinfo.cs" index 3c02acd..607e5ac 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_Entity/DomainModels/System/dt_stationinfo.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_Entity/DomainModels/System/dt_stationinfo.cs" @@ -144,5 +144,12 @@ [Column(TypeName = "nvarchar(50)")] public string heatNumber { get; set; } + /// <summary> + ///鎵樼洏绫诲瀷 + /// </summary> + [Display(Name = "鎵樼洏绫诲瀷")] + [MaxLength(100)] + [Column(TypeName = "nvarchar(100)")] + public string tray_type { get; set; } } } \ No newline at end of file diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Common/Gantry.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Common/Gantry.cs" index 54e0f69..7b6af49 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Common/Gantry.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Common/Gantry.cs" @@ -221,37 +221,44 @@ if (!Request) continue; var Stations = stationinfoRepository.Find(x => x.area == PipelineJob.area_code(name)); - foreach (var station in Stations) - { - if (!station.enable) - client.WriteByOrder("W_Enabl_Load", false, name);//淇″彿涓篺alse妗佹灦鍋滄杩涘叆 - } + var NGStation = "X01001003"; if (name == "2鍗曞厓涓嬫枡鍖�") NGStation = "X02001003"; if (name == "3鍗曞厓涓嬫枡鍖�") NGStation = "X03001002"; - var Wheel_Type = (Int32)DBExtension.Read(details.Where(x => x.plcdetail_name == "R_Wheel_Type").First(), client);//杞﹁疆绫诲瀷 - var Wheel_id = DBExtension.Read(details.Where(x => x.plcdetail_name == "R_Wheel_id").First(), client).ToString();//杞﹁疆SN鍙� + foreach (var station in Stations) + { + if (!station.enable || station.location_state == LocationStateEnum.Empty.ToString()) + client.WriteByOrder("W_Enabl_Load", false, name);//淇″彿涓篺alse妗佹灦鍋滄杩涘叆 + } + 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鍙� + //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); var mes_Head = mes_HeadRepository.FindFirst(x => x.jobID == mes_Detail.jobID); + var wheel = PipelineJob.QueryMateriel(mes_Head.drawingNo); - var PartStatus = (Int32)DBExtension.Read(details.Where(x => x.plcdetail_name == "R_PartStatus").First(), client);//1:ok;2:nok - if (PartStatus == 1) + var PartStatus = DBExtension.Read(details.Where(x => x.plcdetail_name == "R_PartStatus").First(), client);//1:ok;2:nok + if ((Int16)PartStatus == 1) { var Stationinfo = Stations .Where(x => x.enable && x.stationCode != NGStation && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity < 5 - && x.stationType == PipelineJob.QueryMateriel(Wheel_Type) + && x.stationType == mes_Head.drawingNo + && x.tray_type == (wheel.e < 1100 ? "SmallTray" : "LargeTray") && x.Number == mes_Detail.jobID - && x.heatNumber == mes_Detail.heatID).FirstOrDefault(); + && x.heatNumber == mes_Detail.heatID) + .OrderByDescending(x => x.quantity) + .FirstOrDefault(); if (Stationinfo == null) Stationinfo = Stations.Where(x => x.enable && x.stationCode != NGStation && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity == 0).FirstOrDefault(); if (Stationinfo != null) { var Pipelinedetails = plcRepository.Find(x => x.plcdetail_iotype == Pipelineplc.plcinfo_iotyep && x.plcdetail_number == Stationinfo.stationCode).ToList(); - var PalletSignal = (Int16)DBExtension.Read(Pipelinedetails.Where(x => x.plcdetail_name == "R_PalletSignal").First(), client);//璇诲彇鎵樼洏淇″彿:1:鏈�,2鏃� + var PalletSignal = (Int16)DBExtension.Read(Pipelinedetails.Where(x => x.plcdetail_name == "R_PalletSignal").First(), Pipeline_client);//璇诲彇鎵樼洏淇″彿:1:鏈�,2鏃� + //var Wheel_id = client.ReadByOrder<string>("R_Wheel_id", name); if (PalletSignal == 1) { var SNS = Stationinfo.bindSN.Split(","); @@ -271,21 +278,22 @@ } var area = Convert.ToInt16(Stationinfo.stationCode.Substring(Stationinfo.stationCode.Length - 1, 1)); client.WriteByOrder("W_AreaNr", (Int16)area, name);//鍖哄煙璐т綅鍙� - client.WriteByOrder("W_IndexNr", (Int16)Stationinfo.quantity + 1, name);//鎵樼洏涓婄殑绗嚑涓溅杞� + client.WriteByOrder("W_IndexNr", (Int16)(Stationinfo.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) + else if ((Int16)PartStatus == 2) { var Stationinfo = Stations .Where(x => x.enable && x.stationCode == NGStation && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity < 5 - && x.stationType == PipelineJob.QueryMateriel(Wheel_Type) + && x.stationType == mes_Head.drawingNo + && x.tray_type == (wheel.e < 1100 ? "SmallTray" : "LargeTray") && x.Number == mes_Detail.jobID && x.heatNumber == mes_Detail.heatID).FirstOrDefault(); if (Stationinfo != null) @@ -311,7 +319,7 @@ } var area = Convert.ToInt16(Stationinfo.stationCode.Substring(Stationinfo.stationCode.Length - 1, 1)); client.WriteByOrder("W_AreaNr", (Int16)area, name);//鍖哄煙璐т綅鍙� - client.WriteByOrder("W_IndexNr", (Int16)Stationinfo.quantity + 1, name);//鎵樼洏涓婄殑绗嚑涓溅杞� + client.WriteByOrder("W_IndexNr", (Int16)(Stationinfo.quantity + 1), name);//鎵樼洏涓婄殑绗嚑涓溅杞� client.WriteByOrder("W_Storage_Type", (Int16)1, name);//鎵樼洏绫诲瀷1-妯斁;2-绔栨斁(鏆傛椂鍙湁妯斁鎵樼洏) client.WriteByOrder("W_Enabl_Load", true, name);//鏄惁鍏佽 return; @@ -352,9 +360,9 @@ station.bindSN = station.bindSN == string.Empty ? Wheel_id : station.bindSN + "," + Wheel_id; if (station.quantity == 0) { - station.stationType = Wheel_id; - station.Number = Wheel_id; - station.heatNumber = Wheel_id; + station.stationType = mes_Head.drawingNo; + station.Number = mes_Head.jobID; + station.heatNumber = mes_Detail.heatID; } var count = stationinfoRepository.Update(station); if (count < 1) diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Jobs/Task/AutoTaskJob.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Jobs/Task/AutoTaskJob.cs" index fe04fe0..3fa6f0b 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Jobs/Task/AutoTaskJob.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Jobs/Task/AutoTaskJob.cs" @@ -34,7 +34,8 @@ //Creation.HCJCreation(); //Creation.PLCinfodetail(); - StationTask.CreateTask(); + //StationTask.CreateTask(); + //OutboundTask.CreateOutboundTask(); } } diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Jobs/equipment/PipelineJob.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Jobs/equipment/PipelineJob.cs" index 788360d..3323394 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Jobs/equipment/PipelineJob.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Jobs/equipment/PipelineJob.cs" @@ -121,7 +121,7 @@ Gantry_client.WriteByOrder("W_AreaNr", (Int16)area, number);//鍖哄煙璐т綅鍙� Gantry_client.WriteByOrder("W_IndexNr", (Int16)SNS.Length, number);//鎵樼洏涓婄殑绗嚑涓溅杞� Gantry_client.WriteByOrder("W_Storage_Type", (Int16)1, number); //鎵樼洏绫诲瀷1-妯斁;2-绔栨斁 - Gantry_client.WriteByOrder("W_Wheel_Type", (Int16)Convert.ToInt16(QueryMateriel(Station.stationType)), number);//杞﹁疆绫诲瀷 + Gantry_client.WriteByOrder("W_Wheel_Type", (Int16)Convert.ToInt16(QueryMateriel(Station.stationType).TypeId), number);//杞﹁疆绫诲瀷 Gantry_client.WriteByOrder("W_Wheel_id", SNS[SNS.Length - 1], number);//杞﹁疆SN鍙� Gantry_client.WriteByOrder("W_RequestUnload", true, number); } @@ -196,12 +196,12 @@ return Newsn; } - private int QueryMateriel(string type) - { + public static dt_geometry_data QueryMateriel(string type) + { VOLContext Context = new VOLContext(); Idt_geometry_dataRepository dataRepository = new dt_geometry_dataRepository(Context); var materielinfo = dataRepository.FindFirst(x => x.Description == type); - return materielinfo.TypeId; + return materielinfo; } public static string QueryMateriel(int typeId) { diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/OutboundTask.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/OutboundTask.cs" new file mode 100644 index 0000000..63bafd4 --- /dev/null +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/OutboundTask.cs" @@ -0,0 +1,106 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; +using System.Security.Cryptography.Xml; +using System.Text; +using System.Threading.Tasks; +using WIDESEA_Comm; +using WIDESEA_Comm.TaskNo; +using WIDESEA_Core.EFDbContext; +using WIDESEA_Core.FreeDB; +using WIDESEA_Entity.DomainModels; +using WIDESEA_WCS.IRepositories; +using WIDESEA_WCS.Repositories; +using static FreeSql.Internal.GlobalFilter; +using static System.Collections.Specialized.BitVector32; + +namespace WIDESEA_WCS.JobsPart.Common +{ + public class OutboundTask + { + static FreeDB freeDB = new FreeDB(); + /// <summary> + /// 鍒涘缓鍑哄簱浠诲姟 + /// </summary> + public static void CreateOutboundTask() + { + try + { + VOLContext context = new VOLContext(); + Idt_stationinfoRepository stationinfoRepository = new dt_stationinfoRepository(context); + var mes_heads = freeDB.Select<dt_mes_head>().Where(x => x.processCode == "28").OrderBy(x => x.expectedStartTime).ToList(); + foreach (var mes_head in mes_heads) + { + //var inventorys = freeDB.Select<dt_inventory>().Where(x => x.FigureNumber == mes_head.drawingNo).OrderBy.ToList(); + var station = stationinfoRepository.Find(x => x.stationType == mes_head.drawingNo && x.line != x.line).OrderBy(x => x.line).ThenByDescending(x => x.column).FirstOrDefault(); + bool ok = false; + List<string> list = new List<string>(); + if (station != null && station.location_state == LocationStateEnum.Stroge.ToString() && station.enable) + { + var SNS = station.bindSN.Split(","); + foreach (var SN in SNS) + { + if (!string.IsNullOrEmpty(SN)) + list.Add(SN); + } + } + foreach (var SN in list) + { + if (ok = freeDB.Select<dt_mes_detail>().Where(x => x.jobID == mes_head.jobID && x.SN == SN).Any()) continue; + } + if (ok) + { + dt_agvtask agvtask = new dt_agvtask() + { + agv_fromaddress = station.stationCode, + agv_id = Guid.NewGuid(), + agv_tasknum = IdenxManager.GetTaskNo("KH-", "WMS"), + agv_grade = 1, + agv_createtime = DateTime.Now, + agv_taskstate = "Queue", + agv_materielid = station.stationType, + agv_qty = station.quantity, + agv_tasktype = "TaskType_Outbound", + agv_toaddress = "", + agv_userid = "绯荤粺", + bindSN = station.bindSN, + agv_worktype = Convert.ToInt32(mes_head.processCode), + agv_materbarcode = mes_head.materialCode, + agv_barcode = station.tray_type + }; + dt_stationinfo TargetLocation = GetEmptyLocation(stationinfoRepository); + if (TargetLocation != null) + { + agvtask.agv_taskstate = "Create"; + agvtask.agv_toaddress = TargetLocation.stationCode; + TargetLocation.location_state = LocationStateEnum.Busy.ToString(); + freeDB.Update(TargetLocation); + } + freeDB.Add(agvtask); + } + } + } + catch (Exception) + { + + throw; + } + } + private static dt_stationinfo GetEmptyLocation(Idt_stationinfoRepository stationinfoRepository) + { + dt_stationinfo TargetLocation = null; + var stations = stationinfoRepository.Find(x => x.stationCode.Contains("S01001")); + foreach (var station in stations) + { + TargetLocation = stationinfoRepository.FindFirst(x => x.stationCode == station.stationCode && x.location_state == LocationStateEnum.Empty.ToString() && x.enable); + if (TargetLocation != null) continue; + } + + if (TargetLocation == null) + { + throw new Exception("妫�娴嬬嚎涓婃枡浣嶅凡婊�"); + } + return TargetLocation; + } + } +} diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/StationTask.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/StationTask.cs" index 33de533..5159d0f 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/StationTask.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/StationTask.cs" @@ -10,6 +10,7 @@ using WIDESEA_Entity.DomainModels; using WIDESEA_Comm; using static System.Collections.Specialized.BitVector32; +using WIDESEA_Comm.TaskNo; namespace WIDESEA_WCS.JobsPart.Common { @@ -17,73 +18,105 @@ { static FreeDB freeDB = new FreeDB(); + /// <summary> + /// 鍒涘缓鍏ュ簱浠诲姟 + /// </summary> public static void CreateTask() { - VOLContext context = new VOLContext(); - Idt_stationinfoRepository stationinfoRepository = new dt_stationinfoRepository(context); - Idt_WorkinfoRepository workinfoRepository = new dt_WorkinfoRepository(context); - - List<dt_stationinfo> stationinfos = stationinfoRepository.Find(x => x.stationCode.Contains('X')); - - foreach (var item in stationinfos) + try { - //鏍规嵁涓嬫枡鍙g殑缁戝畾淇℃伅鏌ヨ瀵瑰簲宸ュ崟锛屾娴嬫宸ュ崟鏄惁宸插畬鎴� 瀹屾垚鍗冲彲灏嗗叾閫佸叆搴� + VOLContext context = new VOLContext(); + Idt_stationinfoRepository stationinfoRepository = new dt_stationinfoRepository(context); + Idt_WorkinfoRepository workinfoRepository = new dt_WorkinfoRepository(context); - dt_mes_head mesinfo = freeDB.Select<dt_mes_head>().Where(x => x.jobID == item.Number).First(); - dt_geometry_data dt_Geometry_Data = freeDB.Select<dt_geometry_data>().Where(x => x.Description == mesinfo.drawingNo).First(); - int CompeletedNum = Convert.ToInt32(mesinfo.quantity) - Convert.ToInt32(mesinfo.finishNum); + List<dt_stationinfo> stationinfos = stationinfoRepository.Find(x => x.stationCode.Contains('X')); - - //鍒ゅ畾浠诲姟鏄惁宸插垱寤�//濡傚凡瀛樺湪 - if (freeDB.Select<dt_agvtask>().Where(x => x.agv_fromaddress == item.stationCode).Count() > 0) - continue; - - if (item.quantity == 5 || CompeletedNum == 0) //寰幆璇诲彇杞﹁疆鏁颁负5鎴栬�呰鍗曞凡瀹屾垚鏁伴噺鐨勪笅鏂欏彛 鈫掑伐鍗曚汉宸ュ叧闂殑宸ュ崟 + foreach (var item in stationinfos) { + //鏍规嵁涓嬫枡鍙g殑缁戝畾淇℃伅鏌ヨ瀵瑰簲宸ュ崟锛屾娴嬫宸ュ崟鏄惁宸插畬鎴� 瀹屾垚鍗冲彲灏嗗叾閫佸叆搴� + + dt_mes_head mesinfo = freeDB.Select<dt_mes_head>().Where(x => x.jobID == item.Number).First(); + dt_geometry_data dt_Geometry_Data = freeDB.Select<dt_geometry_data>().Where(x => x.Description == mesinfo.drawingNo).First(); + int CompeletedNum = Convert.ToInt32(mesinfo.quantity) - Convert.ToInt32(mesinfo.finishNum); - if (mesinfo.quantity <= 50 || item.stationCode.Contains("3")) //灏忎簬50浠剁洿鎺ュ嚭搴� + //鍒ゅ畾浠诲姟鏄惁宸插垱寤�//濡傚凡瀛樺湪 + if (freeDB.Select<dt_agvtask>().Where(x => x.agv_fromaddress == item.stationCode).Count() > 0) + continue; + + if (item.quantity == 5 || CompeletedNum == 0) //寰幆璇诲彇杞﹁疆鏁颁负5鎴栬�呰鍗曞凡瀹屾垚鏁伴噺鐨勪笅鏂欏彛 鈫掑伐鍗曚汉宸ュ叧闂殑宸ュ崟 { - //var station = - //todo 瀵绘壘鍙斁璐у鍗忔斁璐у彴 - dt_agvtask agvtask = new dt_agvtask() - { - agv_fromaddress = item.stationCode, - agv_id = Guid.NewGuid(), - agv_grade = 0, - agv_barcode = "", - agv_createtime = DateTime.Now, - agv_taskstate = TaskStatus.Created.ToString(), - //agv_toaddress = , - }; - freeDB.Add(agvtask); - } - else - { - dt_stationinfo TargetLocation = GetEmptyLocation(stationinfoRepository, mesinfo, item, CompeletedNum, dt_Geometry_Data.e); - if (TargetLocation != null) + if (mesinfo.quantity <= 50 || item.stationCode.Contains("3")) //灏忎簬50浠剁洿鎺ュ嚭搴� { - //todo: 璋冪敤WMS鎺ュ彛鍒涘缓浠诲姟 - dt_agvtask agvtask = new dt_agvtask() + dt_stationinfo TargetLocation = GetEmptyLocation(stationinfoRepository); + //todo 瀵绘壘鍙斁璐у鍗忔斁璐у彴 + if (TargetLocation != null) { - agv_fromaddress = item.stationCode, - agv_id = Guid.NewGuid(), - agv_grade = 0, - agv_barcode = "", - agv_createtime = DateTime.Now, - agv_taskstate = TaskStatus.Created.ToString(), - agv_toaddress = TargetLocation.stationCode, - }; + dt_agvtask agvtask = new dt_agvtask() + { + agv_fromaddress = item.stationCode, + agv_id = Guid.NewGuid(), + agv_tasknum = IdenxManager.GetTaskNo("KH-", "WMS"), + agv_grade = 1, + agv_createtime = DateTime.Now, + agv_taskstate = "Create", + agv_materielid = item.stationType, + agv_qty = item.quantity, + agv_tasktype = "TaskType_OutsourceInbound", + agv_toaddress = TargetLocation.stationCode, + agv_userid = "绯荤粺", + bindSN = item.bindSN, + agv_worktype = Convert.ToInt32(mesinfo.processCode), + agv_materbarcode = mesinfo.materialCode, + agv_barcode=item.tray_type + }; - freeDB.Add(agvtask); - TargetLocation.location_state = LocationStateEnum.Busy.ToString(); - freeDB.Update(TargetLocation); + freeDB.Add(agvtask); + TargetLocation.location_state = LocationStateEnum.Busy.ToString(); + freeDB.Update(TargetLocation); + } + } + else + { + dt_stationinfo TargetLocation = GetEmptyLocation(stationinfoRepository, mesinfo, item, CompeletedNum, dt_Geometry_Data.e); + + if (TargetLocation != null) + { + //todo: 璋冪敤WMS鎺ュ彛鍒涘缓浠诲姟 + dt_agvtask agvtask = new dt_agvtask() + { + agv_fromaddress = item.stationCode, + agv_id = Guid.NewGuid(), + agv_tasknum = IdenxManager.GetTaskNo("KH-", "WMS"), + agv_grade = 1, + agv_createtime = DateTime.Now, + agv_taskstate = "Create", + agv_materielid = item.stationType, + agv_qty = item.quantity, + agv_tasktype = "TaskType_Inbound", + agv_toaddress = TargetLocation.stationCode, + agv_userid = "绯荤粺", + bindSN = item.bindSN, + agv_worktype = Convert.ToInt32(mesinfo.processCode), + agv_materbarcode = mesinfo.materialCode, + agv_barcode=item.tray_type + }; + + freeDB.Add(agvtask); + TargetLocation.location_state = LocationStateEnum.Busy.ToString(); + freeDB.Update(TargetLocation); + } } } } } + catch (Exception ex) + { + + } + } /// <summary> @@ -248,6 +281,22 @@ return TargetLocation; } + private static dt_stationinfo GetEmptyLocation(Idt_stationinfoRepository stationinfoRepository) + { + dt_stationinfo TargetLocation = null; + List<string> target = new List<string>() { "W01001001", "W01001002", "W01001003" }; + foreach (var item in target) + { + TargetLocation = stationinfoRepository.FindFirst(x => x.stationCode == item && x.location_state == LocationStateEnum.Empty.ToString() && x.enable); + if (TargetLocation != null) continue; + } + + if (TargetLocation == null) + { + throw new Exception("澶栧崗鍏ュ簱鍙e凡婊�"); + } + return TargetLocation; + } /// <summary> /// 鏍规嵁璁㈠崟鏁伴噺杩斿洖搴撳尯(鏆傛椂寮冪敤) //鏇存崲涓哄簱浣嶇被鍨嬪尮閰� /// </summary> diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Client/src/views/widesea_wms/system/dt_inventory.vue" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Client/src/views/widesea_wms/system/dt_inventory.vue" index 17d002c..fd653eb 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Client/src/views/widesea_wms/system/dt_inventory.vue" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Client/src/views/widesea_wms/system/dt_inventory.vue" @@ -36,7 +36,7 @@ const columns = ref([{field:'SN',title:'杞﹁疆SN鍙�',type:'string',width:220,align:'left',sort:true}, {field:'Name',title:'浜у搧鍚嶇О',type:'string',width:220,align:'left'}, {field:'FigureNumber',title:'浜у搧鍥惧彿',type:'string',width:220,align:'left'}, - {field:'HearthNumber',title:'鐔旂偧鐐夊彿',type:'string',width:220,align:'left'}, + {field:'area',title:'鍖哄煙浠g爜',type:'string',width:220,align:'left'}, {field:'HeatNumber',title:'鐐変唬鍙�',type:'string',width:110,align:'left'}, {field:'BilletNumber',title:'閽㈠澂鍙�',type:'int',width:110,align:'left'}, {field:'OnlineTime',title:'鍏ュ簱鏃堕棿',type:'datetime',width:150,align:'left',sort:true}, diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Client/src/views/widesea_wms/system/dt_stationinfo.vue" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Client/src/views/widesea_wms/system/dt_stationinfo.vue" index 29a767b..a496c7b 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Client/src/views/widesea_wms/system/dt_stationinfo.vue" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Client/src/views/widesea_wms/system/dt_stationinfo.vue" @@ -34,7 +34,7 @@ [{"title":"鍥惧彿","field":"stationType"}], [{"dataKey":"location_states","data":[],"title":"璐т綅鐘舵��","field":"location_state","type":"select"}], [{"title":"杞﹁疆SN鍙�","field":"bindSN"}], - [{"dataKey":"tray_status","data":[],"title":"鎵樼洏鐘舵��","field":"tray_status","type":"select"}], + [{"dataKey":"tray_types","data":[],"title":"鎵樼洏绫诲瀷","field":"tray_type","type":"select"}], [{"title":"宸ュ崟缂栧彿","field":"Number"}], [{"title":"鐐夊彿","field":"heatNumber","type":"text"}], [{"title":"澶囨敞","field":"remark"}]]); @@ -49,7 +49,8 @@ // {field:'lastUpdateTime',title:'鏈�鍚庣姸鎬佹敼鍙樻椂闂�',type:'datetime',width:150,align:'left',sort:true}, {field:'quantity',title:'杞﹁疆鏁伴噺',type:'int',width:80,align:'left'}, {field:'bindSN',title:'杞﹁疆SN鍙�',type:'string',width:220,align:'left'}, - {field:'tray_status',title:'鎵樼洏绫诲瀷',type:'string',bind:{ key:'tray_status',data:[]},width:110,align:'left'}, + {field:'tray_status',title:'鎵樼洏鐘舵��',type:'string',bind:{ key:'tray_status',data:[]},width:110,align:'left'}, + {field:'tray_type',title:'鎵樼洏绫诲瀷',type:'string',bind:{ key:'tray_types',data:[]},width:110,align:'left'}, // {field:'line',title:'琛�',type:'int',width:80,align:'left'}, // {field:'column',title:'鍒�',type:'int',width:80,align:'left'}, {field:'heatNumber',title:'鐐夊彿',type:'int',width:80,align:'left'}, diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_Entity/DomainModels/System/dt_stationinfo.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_Entity/DomainModels/System/dt_stationinfo.cs" index 01f083e..82ff0c0 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_Entity/DomainModels/System/dt_stationinfo.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_Entity/DomainModels/System/dt_stationinfo.cs" @@ -143,6 +143,12 @@ [Column(TypeName = "nvarchar(50)")] public string heatNumber { get; set; } - + /// <summary> + ///鎵樼洏绫诲瀷 + /// </summary> + [Display(Name = "鎵樼洏绫诲瀷")] + [MaxLength(100)] + [Column(TypeName = "nvarchar(100)")] + public string tray_type { get; set; } } } \ No newline at end of file diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/Gantry/QueryData.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/Gantry/QueryData.cs" index 5ab2751..b31c90b 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/Gantry/QueryData.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/Gantry/QueryData.cs" @@ -18,7 +18,7 @@ /// <returns></returns> public static dt_geometry_data QueryMateriel(string type) { - var materielinfo = freeDB.Select<dt_geometry_data>().Where(x => x.Description.ToString() == type).First(); + var materielinfo = freeDB.Select<dt_geometry_data>().Where(x => x.Description == type).First(); return materielinfo; } /// <summary> diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Services/system/Partial/dt_stationinfoService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Services/system/Partial/dt_stationinfoService.cs" index c7891fa..cb05024 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Services/system/Partial/dt_stationinfoService.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Services/system/Partial/dt_stationinfoService.cs" @@ -120,7 +120,25 @@ station.heatNumber = saveModel.MainData["heatNumber"].ToString(); station.Number = saveModel.MainData["Number"].ToString(); station.remark = saveModel.MainData["remark"].ToString(); - station.tray_status= saveModel.MainData["tray_status"].ToString(); + station.tray_type = saveModel.MainData["tray_type"].ToString(); + if (list.Count == 0) + { + //station.tray_status = "EmptyTray"; + station.stationType = string.Empty; + station.heatNumber = string.Empty; + station.Number = string.Empty; + } + station.tray_status = list.Count == 0 ? "EmptyTray" : "StrogeTray"; + if (station.location_state == "Empty") + { + station.stationType = string.Empty; + station.heatNumber = string.Empty; + station.Number = string.Empty; + station.tray_status = string.Empty; + station.bindSN = string.Empty; + station.quantity = 0; + station.tray_type=string.Empty; + } var count = _repository.Update(station, true); if (count > 0) webResponse.OK(); diff --git "a/\351\241\271\347\233\256\350\265\204\346\226\231/\351\200\232\344\277\241\345\215\217\350\256\256/\346\226\260\345\242\236\350\256\276\345\244\207\345\215\217\350\256\256/\345\244\252\351\207\215\344\272\244\344\272\222-\345\272\223\345\217\243\347\212\266\346\200\201_V1.xlsx" "b/\351\241\271\347\233\256\350\265\204\346\226\231/\351\200\232\344\277\241\345\215\217\350\256\256/\346\226\260\345\242\236\350\256\276\345\244\207\345\215\217\350\256\256/\345\244\252\351\207\215\344\272\244\344\272\222-\345\272\223\345\217\243\347\212\266\346\200\201_V1.xlsx" index 28d7d14..516b02b 100644 --- "a/\351\241\271\347\233\256\350\265\204\346\226\231/\351\200\232\344\277\241\345\215\217\350\256\256/\346\226\260\345\242\236\350\256\276\345\244\207\345\215\217\350\256\256/\345\244\252\351\207\215\344\272\244\344\272\222-\345\272\223\345\217\243\347\212\266\346\200\201_V1.xlsx" +++ "b/\351\241\271\347\233\256\350\265\204\346\226\231/\351\200\232\344\277\241\345\215\217\350\256\256/\346\226\260\345\242\236\350\256\276\345\244\207\345\215\217\350\256\256/\345\244\252\351\207\215\344\272\244\344\272\222-\345\272\223\345\217\243\347\212\266\346\200\201_V1.xlsx" Binary files differ -- Gitblit v1.9.3