/// <summary> /// 构造函数 /// </summary> public NDCDataHelper() : base() { redirectItemList = new List <int>(); loadItemList = new List <int>(); unloadItemList = new List <int>(); _sqlControl = new NDCSQLControl(); DoReadSQL(); new Thread(CheckItemTask) { IsBackground = true }.Start(); }
/// <summary> /// 关闭任务前保存数据 /// </summary> public void Close() { DoDisConnectNDC(); ControlRunning = false; if (Ikey >= 99) { Ikey = 1; } NDCSQLControl control = new NDCSQLControl(); control.UpdateIkeyValue(Ikey); control.SaveUnFinishTask(Items, TempList); }
/// <summary> /// 重新读取装货点,卸货点对应NDC实际使用信息 /// </summary> public void DoReadSQL() { try { NDCSQLControl control = new NDCSQLControl(); control.ReadWcsNdcSite(out loadStaDic, out unLoadStaDic); control.ReadNDCServerAndIKEY(out IPaddress, out Port, out Ikey); if (control.ReadUnFinishTask(out List <WCS_NDC_TASK> list)) { foreach (var i in list) { if (i.ORDERINDEX == 0) { TempItem item = TempList.Find(c => { return(c.TaskID == i.TASKID || c.IKey == i.IKEY); }); if (item == null) { TempList.Add(new TempItem() { TaskID = i.TASKID, IKey = i.IKEY, LoadSite = i.LOADSITE, UnloadSite = i.UNLOADSITE, RedirectSite = i.REDIRECTSITE, NdcLoadSite = i.NDCLOADSITE, NdcUnloadSite = i.NDCUNLOADSITE, NdcRedirectSite = i.NDCREDIRECTSITE }); } } else { NDCItem item = Items.Find(c => { return(c._mTask.IKEY == i.IKEY || c._mTask.TASKID == i.TASKID || c._mTask.ORDERINDEX == i.ORDERINDEX); }); if (item != null) { item._mTask = i; } else { NDCItem it = new NDCItem() { _mTask = i }; Items.Add(it); CheckCanUpdateTaskList(it); } } } control.DelectUnFinishTaskAfter(); } }catch (Exception e) { Console.WriteLine(e.Message); } }