public static Utility CreateInstance(string area, string taskcode)
 {
     Utility item=new Utility();
     item.UtilityHeader.area01=area;
     item.UtilityHeader.lasttask=taskcode;
     return item;
 }
        public void NSPRFTM01(string area, string taskcode)
        {
            //this.Start();
            this.task_req1 = task_req.Utility.CreateInstance(area, taskcode);
            this.task_req1.UtilityHeader.userid = this.loginuser.UserName;
            //UserInfo admin = new UserInfo();
            //admin.UserName = "******";
            //admin.Password = "******";
            RequestMessage requestmessage = new RequestMessage(enumRequestType.MessageProcessor,
                  enumMessageType.Utility,
                  enumRequestMethod.functionOperation, this.loginuser,
                  enumSendSysId.EXceed,
                  this.task_req1);
            //RequestWorkItem workitem = new RequestWorkItem(requestmessage, 1);
            //threadhelper.AddWorkItem(workitem);
            ResponseMessage Response = ThreadHelper.Execute(requestmessage);
               string errormsg = Response.GetErrorMessage();
               if (errormsg != string.Empty)
               {
               this.submitbtn.SetEnabled(true);

               MessageBox.Show(errormsg);
               this.area01txt.SetFocus();
               this.task_req1 = null;

               }
               else
               {

                   this.task_res1 = Response.Deserialize<task_res.Utility>();
                   //Console.WriteLine(task_res1);
                   //6上架4拣货
                   if (task_res1.UtilityHeader.rectype == "6")
                   {

                       this.OpenRFTPA00Frm(this.loginuser, this.task_res1);
                   }
                   else if (task_res1.UtilityHeader.rectype == "4")
                   {
                        this.OpenRFTPK01C( this.loginuser, this.task_res1);
                   }
                   else
                   {

                   }

               }
        }
 public void call_NSPRFTM01(string area, string taskcode)
 {
     this.Start();
     this.task_req1 = task_req.Utility.CreateInstance(area, taskcode);
     this.task_req1.UtilityHeader.userid =   this.loginuser.UserName;
     //UserInfo admin = new UserInfo();
     //admin.UserName = "******";
     //admin.Password = "******";
     RequestMessage requestmessage = new RequestMessage(enumRequestType.MessageProcessor,
           enumMessageType.Utility,
           enumRequestMethod.functionOperation, this.loginuser,
           enumSendSysId.EXceed,
           this.task_req1);
     RequestWorkItem workitem = new RequestWorkItem(requestmessage, 1);
     threadhelper.AddWorkItem(workitem);
 }
        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)
            {
                this.submitbtn.SetEnabled(true);
                this.Stop();
                MessageBox.Show(errormsg);
                this.area01txt.SetFocus();
                this.task_req1 = null;

            }
            else
            {
                if (tag == 1)
                {
                    this.Stop();
                    this.task_res1 = e.WorkItem.Response.Deserialize<task_res.Utility>();
                    //Console.WriteLine(task_res1);
                    //6上架4拣货
                    if (task_res1.UtilityHeader.rectype == "6")
                    {

                        InvokeHelper.Invoke(this, "OpenRFTPA00Frm", this.loginuser, this.task_res1);
                    }
                    else if (task_res1.UtilityHeader.rectype == "4")
                    {
                        InvokeHelper.Invoke(this, "OpenRFTPK01C", this.loginuser, this.task_res1);
                    }
                    else
                    {

                    }
                }
            }
        }