| | |
| | | using static FreeSql.Internal.GlobalFilter; |
| | | using static System.Collections.Specialized.BitVector32; |
| | | |
| | | namespace WIDESEA_WCS.JobsPart.Common.æ°æä»¶å¤¹ |
| | | namespace WIDESEA_WCS.JobsPart.Common |
| | | { |
| | | public class OutboundTask_a |
| | | { |
| | |
| | | Idt_inventoryRepository inventoryRepository = new dt_inventoryRepository(context); |
| | | Idt_agvtaskRepository agvtaskRepository = new dt_agvtaskRepository(context); |
| | | |
| | | var mes_heads = mes_HeadRepository.Find(x => x.processCode == "28").OrderBy(x => x.expectedStartTime).ToList(); |
| | | var mes_heads = mes_HeadRepository.Find(x => x.processCode == "28").OrderByDescending(x => x.CreateTime).ToList(); |
| | | foreach (var mes_head in mes_heads) |
| | | { |
| | | #region æ ¹æ®å·¥ååè¡¨æ¥æ¾åºå |
| | |
| | | var Station = stationinfoRepository.Find(x => x.stationCode == inventory.stationCode).FirstOrDefault(); |
| | | if (Station != null) |
| | | { |
| | | var stationinfos = stationinfoRepository.Find(x => x.line == Station.line && x.area == Station.area && x.quantity > 0 && x.enable && x.location_state == LocationStateEnum.Stroge.ToString()).OrderByDescending(x => x.column).ToList(); |
| | | foreach (var stationinfo in stationinfos) |
| | | var stationinfo = stationinfoRepository.Find(x => x.line == Station.line && x.area == Station.area && x.enable && x.quantity > 0).OrderByDescending(x => x.column).FirstOrDefault(); |
| | | |
| | | if (stationinfo != null) |
| | | { |
| | | if (stationinfo.location_state == LocationStateEnum.OutBusy.ToString() || stationinfo.location_state != LocationStateEnum.Stroge.ToString()) continue; |
| | | |
| | | if (string.IsNullOrEmpty(stationinfo.bindSN)) |
| | | { |
| | | stationinfo.remark = "车轮SNå·ä¿¡æ¯å¼å¸¸"; |
| | |
| | | } |
| | | |
| | | #region è´§ä½è½¦è½®å
¨é¨å
å«å¨å·¥åå
åä¸åä»»å¡ |
| | | bool OK = false; |
| | | //bool OK = false; |
| | | foreach (var SN in lists) |
| | | { |
| | | OK = mes_DetailRepository.Find(x => x.jobID == mes_head.jobID && x.SN == SN).Any(); |
| | | } |
| | | if (OK) |
| | | { |
| | | dt_agvtask agvtask = new dt_agvtask() |
| | | { |
| | | agv_fromaddress = stationinfo.stationCode, |
| | | agv_id = Guid.NewGuid(), |
| | | agv_tasknum = IdenxManager.GetTaskNo("KH-", "WMS"), |
| | | agv_grade = 1, |
| | | agv_createtime = DateTime.Now, |
| | | agv_taskstate = "Queue", |
| | | agv_materielid = stationinfo.stationType, |
| | | agv_qty = stationinfo.quantity, |
| | | agv_tasktype = "TaskType_Outbound", |
| | | agv_toaddress = "", |
| | | agv_userid = "ç³»ç»", |
| | | bindSN = stationinfo.bindSN, |
| | | jobID = mes_head.jobID, |
| | | agv_worktype = Convert.ToInt32(mes_head.processCode), |
| | | agv_materbarcode = mes_head.materialCode, |
| | | agv_Traytype = stationinfo.tray_type, |
| | | agv_TrayStatus = stationinfo.tray_status |
| | | }; |
| | | stationinfo.location_state = LocationStateEnum.OutBusy.ToString(); |
| | | stationinfoRepository.Update(stationinfo, true); |
| | | agvtaskRepository.Add(agvtask, true); |
| | | WriteDBLog.Success("å建åºåºä»»å¡", $"ä»»å¡ç¼å·ï¼{agvtask.agv_tasknum}", "PCS"); |
| | | continue; |
| | | } |
| | | #endregion |
| | | if (!mes_DetailRepository.Find(x => x.jobID == mes_head.jobID && x.SN.Contains(SN)).Any()) return; |
| | | |
| | | #region è´§ä½è½¦è½®æä¸ä¸ªå
å«å¨å·¥åå
åä¸åä»»å¡ |
| | | //foreach (var SN in lists) |
| | | //{ |
| | | // if (mes_DetailRepository.Find(x => x.jobID == mes_head.jobID && x.SN == SN).Any()) |
| | | // { |
| | | // dt_agvtask agvtask = new dt_agvtask() |
| | | // { |
| | | // agv_fromaddress = stationinfo.stationCode, |
| | | // agv_id = Guid.NewGuid(), |
| | | // agv_tasknum = IdenxManager.GetTaskNo("KH-", "WMS"), |
| | | // agv_grade = 2, |
| | | // agv_createtime = DateTime.Now, |
| | | // agv_taskstate = "Queue", |
| | | // agv_materielid = stationinfo.stationType, |
| | | // agv_qty = stationinfo.quantity, |
| | | // agv_tasktype = "TaskType_Outbound", |
| | | // agv_toaddress = "", |
| | | // agv_userid = "ç³»ç»", |
| | | // bindSN = stationinfo.bindSN, |
| | | // jobID = mes_head.jobID, |
| | | // agv_worktype = Convert.ToInt32(mes_head.processCode), |
| | | // agv_materbarcode = mes_head.materialCode, |
| | | // agv_Traytype = stationinfo.tray_type, |
| | | // agv_TrayStatus = stationinfo.tray_status |
| | | // }; |
| | | // stationinfo.location_state = LocationStateEnum.OutBusy.ToString(); |
| | | // stationinfoRepository.Update(stationinfo, true); |
| | | // agvtaskRepository.Add(agvtask, true); |
| | | // WriteDBLog.Success("å建åºåºä»»å¡", $"ä»»å¡ç¼å·ï¼{agvtask.agv_tasknum}", "PCS"); |
| | | // continue; |
| | | // } |
| | | //} |
| | | } |
| | | dt_agvtask agvtask = new dt_agvtask() |
| | | { |
| | | agv_fromaddress = stationinfo.stationCode, |
| | | agv_id = Guid.NewGuid(), |
| | | agv_tasknum = IdenxManager.GetTaskNo("KH-", "WMS"), |
| | | agv_grade = 1, |
| | | agv_createtime = DateTime.Now, |
| | | agv_taskstate = "Queue", |
| | | agv_materielid = stationinfo.stationType, |
| | | agv_qty = stationinfo.quantity, |
| | | agv_tasktype = "TaskType_Outbound", |
| | | agv_toaddress = "", |
| | | agv_userid = "ç³»ç»", |
| | | bindSN = stationinfo.bindSN, |
| | | jobID = mes_head.jobID, |
| | | agv_worktype = Convert.ToInt32(mes_head.processCode), |
| | | agv_materbarcode = mes_head.materialCode, |
| | | agv_Traytype = stationinfo.tray_type, |
| | | agv_TrayStatus = stationinfo.tray_status |
| | | }; |
| | | stationinfo.location_state = LocationStateEnum.OutBusy.ToString(); |
| | | stationinfoRepository.Update(stationinfo, true); |
| | | agvtaskRepository.Add(agvtask, true); |
| | | WriteDBLog.Success("å建åºåºä»»å¡", $"ä»»å¡ç¼å·ï¼{agvtask.agv_tasknum}", "PCS"); |
| | | continue; |
| | | #endregion |
| | | } |
| | | |
| | | #region è´§ä½è½¦è½®æä¸ä¸ªå
å«å¨å·¥åå
åä¸åä»»å¡ |
| | | //foreach (var SN in lists) |
| | | //{ |
| | | // if (mes_DetailRepository.Find(x => x.jobID == mes_head.jobID && x.SN == SN).Any()) |
| | | // { |
| | | // dt_agvtask agvtask = new dt_agvtask() |
| | | // { |
| | | // agv_fromaddress = stationinfo.stationCode, |
| | | // agv_id = Guid.NewGuid(), |
| | | // agv_tasknum = IdenxManager.GetTaskNo("KH-", "WMS"), |
| | | // agv_grade = 2, |
| | | // agv_createtime = DateTime.Now, |
| | | // agv_taskstate = "Queue", |
| | | // agv_materielid = stationinfo.stationType, |
| | | // agv_qty = stationinfo.quantity, |
| | | // agv_tasktype = "TaskType_Outbound", |
| | | // agv_toaddress = "", |
| | | // agv_userid = "ç³»ç»", |
| | | // bindSN = stationinfo.bindSN, |
| | | // jobID = mes_head.jobID, |
| | | // agv_worktype = Convert.ToInt32(mes_head.processCode), |
| | | // agv_materbarcode = mes_head.materialCode, |
| | | // agv_Traytype = stationinfo.tray_type, |
| | | // agv_TrayStatus = stationinfo.tray_status |
| | | // }; |
| | | // stationinfo.location_state = LocationStateEnum.OutBusy.ToString(); |
| | | // stationinfoRepository.Update(stationinfo, true); |
| | | // agvtaskRepository.Add(agvtask, true); |
| | | // WriteDBLog.Success("å建åºåºä»»å¡", $"ä»»å¡ç¼å·ï¼{agvtask.agv_tasknum}", "PCS"); |
| | | // continue; |
| | | // } |
| | | //} |
| | | #endregion |
| | | } |
| | | } |
| | | } |