void threadhelper_WorkItemCompleted(object sender, WorkItemEventArgs e) { int tag = e.WorkItem.Tag; WorkItem item = e.WorkItem; string errormsg = item.Response.GetErrorMessage(); if (errormsg != string.Empty) { MessageBox.Show(item.Response.GetErrorMessage()); } else { if (tag == 1) { dmres = e.WorkItem.Response.Deserialize<dm01_res.DoorsManagement>(); string str = string.Format("{0} {1}", dmres.DoorsManagementHeader[0].DOORSKEY, dmres.DoorsManagementHeader[0].PLATENUMBER); if (str.Length > 10) { //InvokeHelper.Invoke(this, "addportlist", str); dm01_res.DoorsManagementHeader hd = dmres.DoorsManagementHeader[0]; dmreq02 = new dm02_req.DoorsManagement(); dmreq02.DoorsManagementHeader.AddWho = hd.AddWho; dmreq02.DoorsManagementHeader.DoorsKey = hd.DOORSKEY; dmreq02.DoorsManagementHeader.DriverCompany = hd.DRIVERCOMPANY; dmreq02.DoorsManagementHeader.DriverName = hd.DriverName; dmreq02.DoorsManagementHeader.DriverPhone = hd.DRIVERPHONE; dmreq02.DoorsManagementHeader.EditWho = hd.EditWho; dmreq02.DoorsManagementHeader.IOGoods = hd.IOGOODS; dmreq02.DoorsManagementHeader.ParkNum = hd.PARKNUM; dmreq02.DoorsManagementHeader.PlateNumber = hd.PLATENUMBER; dmreq02.DoorsManagementHeader.SerialKey = hd.SerialKey; dmreq02.DoorsManagementHeader.Status = hd.Status; dmreq02.DoorsManagementHeader.WhseId = hd.WhseId; foreach (dm01_res.DoorsManagementDetail detail in hd.DoorsManagementDetail) { if (detail.Status == "0") { dm02_req.DoorsManagementDetail newitem = new dm02_req.DoorsManagementDetail(); newitem.ParkNum = detail.PARKNUM; newitem.DoorsKey = detail.DOORSKEY; newitem.DoorsLineNumber = detail.DOORSLINENUMBER; newitem.Pier = detail.PIER; newitem.SerialKey = detail.SerialKey; this.portcodetxt.SetText(detail.PIER); dmreq02.DoorsManagementHeader.DoorsManagementDetail.Add(newitem); InvokeHelper.Invoke(this, "call_asnlist01", detail.PIER); break; } } } else { dmres = null; MessageBox.Show("没有找到改车的进门记录", "提示"); this.parknumtxt.SetFocus(); } } if (tag == 2) { asnlist01res = e.WorkItem.Response.Deserialize<asnlist01_res.AdvancedShipNotice>(); foreach (asnlist01_res.AdvancedShipNoticeHeader body in asnlist01res.AdvancedShipNoticeHeaders) { InvokeHelper.Invoke(this, "addasnlist", body.ReceiptKey + " " + body.StorerKey + " " + body.Status); } } if (tag == 3) { asnlist01res = e.WorkItem.Response.Deserialize<asnlist01_res.AdvancedShipNotice>(); //this.storerkeytxt.SetText(asnlist01res.AdvancedShipNoticeHeaders[0].StorerKey); //foreach (asnlist01_res.AdvancedShipNoticeHeader body in asnlist01res.AdvancedShipNoticeHeaders) // InvokeHelper.Invoke(this, "addportlist", body.ReceiptKey + " " + body.StorerKey); } if (tag == 4) { MessageBox.Show("车辆已离开码头", "提示"); } } }
private void call_dm01(string platenumber) { //this.Start(); dmreq = dm01_req.DoorsManagement.CreateByParkNum(platenumber); RequestMessage request = new RequestMessage(enumRequestType.MessageProcessor, enumMessageType.DoorsManagement, enumRequestMethod.list, this.loginuser, enumSendSysId.EXceed, dmreq); //RequestWorkItem workitem = new RequestWorkItem(request, 1); //threadhelper.AddWorkItem(workitem); ResponseMessage Response = ThreadHelper.Execute(request); string errormsg = Response.GetErrorMessage(); if (errormsg != string.Empty) { MessageBox.Show(Response.GetErrorMessage()); } else { dmres = Response.Deserialize<dm01_res.DoorsManagement>(); string str = string.Format("{0} {1}", dmres.DoorsManagementHeader[0].DOORSKEY, dmres.DoorsManagementHeader[0].PLATENUMBER); if (str.Length > 10) { //InvokeHelper.Invoke(this, "addportlist", str); this.portlist.Text = str; dm01_res.DoorsManagementHeader hd = dmres.DoorsManagementHeader[0]; dmreq02 = new dm02_req.DoorsManagement(); dmreq02.DoorsManagementHeader.AddWho = hd.AddWho; dmreq02.DoorsManagementHeader.DoorsKey = hd.DOORSKEY; dmreq02.DoorsManagementHeader.DriverCompany = hd.DRIVERCOMPANY; dmreq02.DoorsManagementHeader.DriverName = hd.DriverName; dmreq02.DoorsManagementHeader.DriverPhone = hd.DRIVERPHONE; dmreq02.DoorsManagementHeader.EditWho = hd.EditWho; dmreq02.DoorsManagementHeader.IOGoods = hd.IOGOODS; dmreq02.DoorsManagementHeader.ParkNum = hd.PARKNUM; dmreq02.DoorsManagementHeader.PlateNumber = hd.PLATENUMBER; dmreq02.DoorsManagementHeader.SerialKey = hd.SerialKey; dmreq02.DoorsManagementHeader.Status = hd.Status; dmreq02.DoorsManagementHeader.WhseId = hd.WhseId; if (hd.IOGOODS == "1") { this.chkio.Checked = true; } else { this.chkio.Checked = false; int count=hd.DoorsManagementDetail.Count; this.portcodetxt.SetText(hd.DoorsManagementDetail[count-1].PIER); foreach (dm01_res.DoorsManagementDetail detail in hd.DoorsManagementDetail) { if (detail.Status == "0") { dm02_req.DoorsManagementDetail newitem = new dm02_req.DoorsManagementDetail(); newitem.ParkNum = detail.PARKNUM; newitem.DoorsKey = detail.DOORSKEY; newitem.DoorsLineNumber = detail.DOORSLINENUMBER; newitem.Pier = detail.PIER; newitem.SerialKey = detail.SerialKey; //this.portcodetxt.SetText(detail.PIER); dmreq02.DoorsManagementHeader.DoorsManagementDetail.Add(newitem); //InvokeHelper.Invoke(this, "call_asnlist01", detail.PIER); this.call_asnlist01(detail.PIER); break; } } } } else { dmres = null; MessageBox.Show("没有找到该车的进门记录", "提示"); this.parknumtxt.SetFocus(); } } }