public static Utility Create(string so, string fromid, string sku)
 {
     Utility data = new Utility();
     data.UtilityHeader.SO = so;
     data.UtilityHeader.fromid = fromid;
     data.UtilityHeader.ALTSKU = sku;
     return data;
 }
        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(errormsg);
                this.sotxt.SetFocus();
                this.pick_req1 = null;
                //this.pick_req2 = null;
                this.pick_res1 = null;
                this.pick_res2 = null;
            }
            else
            {
                if (tag == 1)
                {
                    this.pick_res1 = e.WorkItem.Response.Deserialize<pick1_res.Utility>();
                    this.pick_req2.UtilityHeader.toloc = this.pick_res1.UtilityHeader.ToLoc;
                    this.pick_req2.UtilityHeader.pickdetailkey = this.pick_res1.UtilityHeader.PickDetailKey;
                    this.pick_req2.UtilityHeader.shiplabel = this.pick_res1.UtilityHeader.shiplabel;
                    this.pick_req2.UtilityHeader.storerkey = this.pick_res1.UtilityHeader.StorerKey;
                    this.pick_req2.UtilityHeader.lot = this.pick_res1.UtilityHeader.Lot;
                    this.pick_req2.UtilityHeader.fromloc = this.pick_res1.UtilityHeader.FromLoc;
                    this.pick_req2.UtilityHeader.qty = this.pick_res1.UtilityHeader.nothadpicked;
                    this.qtytxt.SetText(this.pick_res1.UtilityHeader.nothadpicked);
                    InvokeHelper.Invoke(this, "SetLabel", this.pick_res1);
                    this.qtytxt.SetFocus();
                }
                if (tag == 2)
                {
                    this.pick_res2 = e.WorkItem.Response.Deserialize<pick2_res.Utility>();
                    if (this.pick_res2.UtilityHeader.rectype == "3")
                    {
                        pick_req2 = new pick2_req.Utility();
                        this.pick_req2.UtilityHeader.userid = this.loginuser.UserName;
                        this.pick_req2.UtilityHeader.toloc = this.pick_res1.UtilityHeader.ToLoc;
                        this.pick_req2.UtilityHeader.pickdetailkey = this.pick_res1.UtilityHeader.PickDetailKey;
                        this.pick_req2.UtilityHeader.shiplabel = this.pick_res1.UtilityHeader.shiplabel;
                        this.pick_req2.UtilityHeader.storerkey = this.pick_res1.UtilityHeader.StorerKey;
                        this.pick_req2.UtilityHeader.lot = this.pick_res1.UtilityHeader.Lot;
                        this.pick_req2.UtilityHeader.fromloc = this.pick_res1.UtilityHeader.FromLoc;
                        this.pick_req2.UtilityHeader.qty = this.pick_res1.UtilityHeader.nothadpicked;
                        this.pick_req2.UtilityHeader.fromid = this.fromidtxt.GetText();
                        this.pick_req2.UtilityHeader.sku = this.skutxt.GetText();
                        this.pick_req2.UtilityHeader.dropid = this.dropidtxt.GetText();
                        this.pick_req2.UtilityHeader.loadcase = this.loadcasetxt.GetText();

                        InvokeHelper.Invoke(this, "dataBinding", null);
                        call_NSPRFFLREMQTY(this.sotxt.GetText(), this.fromidtxt.GetText(), this.skutxt.GetText());

                    }
                    else
                    {
                        MessageBox.Show("拣货完成");
                        this.pick_req2 = new pick2_req.Utility();
                        this.pick_req2.UtilityHeader.userid = this.loginuser.UserName;
                        this.sotxt.SetText("");
                        InvokeHelper.Invoke(this, "dataBinding", null);
                        this.sotxt.SetFocus();
                        InvokeHelper.Invoke(this, "RestLabel", 0);

                    }
                }
            }
        }
        public void call_NSPRFFLOP01()
        {
            string errortxt = this.Vaildate();
            if (errortxt != string.Empty)
            {
                MessageBox.Show(errortxt);
                this.focusControl.Focus();
                return;
            }
            //this.Start();

            if (this.isrequiredid && this.dropidtxt.Text.Substring(0, 1).ToUpper() == "P")
            {
                this.pick_req2.UtilityHeader.cartontype = "PALLET";
            };
            RequestMessage requestmessage = new RequestMessage(enumRequestType.MessageProcessor,
                  enumMessageType.Utility,
                  enumRequestMethod.functionOperation, this.loginuser,
                  enumSendSysId.EXceed,
                  this.pick_req2);
            //RequestWorkItem workitem = new RequestWorkItem(requestmessage, 2);
            //threadhelper.AddWorkItem(workitem);
            ResponseMessage Response = ThreadHelper.Execute(requestmessage);
            string errormsg = Response.GetErrorMessage();
            if (errormsg != string.Empty)
            {
                MessageBox.Show(errormsg);
                this.sotxt.SetFocus();
                this.pick_req1 = null;
                //this.pick_req2 = null;
                this.pick_res1 = null;
                this.pick_res2 = null;
            }
            else
            {
                this.pick_res2 = Response.Deserialize<pick2_res.Utility>();
                if (this.pick_res2.UtilityHeader.rectype == "3")
                {
                    pick_req2 = new pick2_req.Utility();
                    this.pick_req2.UtilityHeader.userid = this.loginuser.UserName;
                    this.pick_req2.UtilityHeader.toloc = this.pick_res1.UtilityHeader.ToLoc;
                    this.pick_req2.UtilityHeader.pickdetailkey = this.pick_res1.UtilityHeader.PickDetailKey;
                    this.pick_req2.UtilityHeader.shiplabel = this.pick_res1.UtilityHeader.shiplabel;
                    this.pick_req2.UtilityHeader.storerkey = this.pick_res1.UtilityHeader.StorerKey;
                    this.pick_req2.UtilityHeader.lot = this.pick_res1.UtilityHeader.Lot;
                    this.pick_req2.UtilityHeader.fromloc = this.pick_res1.UtilityHeader.FromLoc;
                    this.pick_req2.UtilityHeader.qty = this.pick_res1.UtilityHeader.nothadpicked;
                    this.pick_req2.UtilityHeader.fromid = this.fromidtxt.GetText();
                    this.pick_req2.UtilityHeader.sku = this.skutxt.GetText();
                    this.pick_req2.UtilityHeader.dropid = this.dropidtxt.GetText();
                    this.pick_req2.UtilityHeader.loadcase = this.loadcasetxt.GetText();

                    //InvokeHelper.Invoke(this, "dataBinding", null);
                    this.dataBinding();
                    call_NSPRFFLREMQTY(this.sotxt.GetText(), this.fromidtxt.GetText(), this.skutxt.GetText());

                }
                else
                {
                    MessageBox.Show("拣货完成");
                    this.pick_req2 = new pick2_req.Utility();
                    this.pick_req2.UtilityHeader.userid = this.loginuser.UserName;
                    this.sotxt.SetText("");
                    InvokeHelper.Invoke(this, "dataBinding", null);
                    this.sotxt.SetFocus();
                    InvokeHelper.Invoke(this, "RestLabel", 0);

                }
            }
        }
        public void call_NSPRFFLREMQTY(string so,string fromid,string sku)
        {
            //this.Start();
            pick_req1 = pick1_req.Utility.Create(so, fromid, sku);
            RequestMessage requestmessage = new RequestMessage(enumRequestType.MessageProcessor,
                  enumMessageType.Utility,
                  enumRequestMethod.functionOperation, this.loginuser,
                  enumSendSysId.EXceed,
                  this.pick_req1);
            //RequestWorkItem workitem = new RequestWorkItem(requestmessage, 1);
            //threadhelper.AddWorkItem(workitem);
            ResponseMessage Response = ThreadHelper.Execute(requestmessage);
            string errormsg = Response.GetErrorMessage();
            if (errormsg != string.Empty)
            {
                MessageBox.Show(errormsg);
                this.sotxt.SetFocus();
                this.pick_req1 = null;
                //this.pick_req2 = null;
                this.pick_res1 = null;
                this.pick_res2 = null;
            }
            else
            {

                this.pick_res1 = Response.Deserialize<pick1_res.Utility>();
                this.pick_req2.UtilityHeader.toloc = this.pick_res1.UtilityHeader.ToLoc;
                this.pick_req2.UtilityHeader.pickdetailkey = this.pick_res1.UtilityHeader.PickDetailKey;
                this.pick_req2.UtilityHeader.shiplabel = this.pick_res1.UtilityHeader.shiplabel;
                this.pick_req2.UtilityHeader.storerkey = this.pick_res1.UtilityHeader.StorerKey;
                this.pick_req2.UtilityHeader.lot = this.pick_res1.UtilityHeader.Lot;
                this.pick_req2.UtilityHeader.fromloc = this.pick_res1.UtilityHeader.FromLoc;
                this.pick_req2.UtilityHeader.qty = this.pick_res1.UtilityHeader.nothadpicked;
                this.qtytxt.SetText(this.pick_res1.UtilityHeader.nothadpicked);
                //InvokeHelper.Invoke(this, "SetLabel", this.pick_res1);
                this.SetLabel(this.pick_res1);
                this.qtytxt.SetFocus();
            }
        }