Ejemplo n.º 1
0
        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.Stop();
                MessageBox.Show(errormsg);
                this.tpa00res = null;
                this.tpa01res = null;
            }
            else
            {
                if (tag == 1)
                {
                    this.tpa00res = item.Response.Deserialize<tpa00_res.Utility>();
                    idx=0;
                    packkeylist = new Dictionary<string, string>();
                    foreach (tpa00_res.UtilityHeader header in this.tpa00res.UtilityHeaders)
                    {
                        if (header != null)
                        {
                            //Console.WriteLine(header.Qty);
                            InvokeHelper.Invoke(this, "call_NSPRFTPA01", header.TaskDetailKey, header.FromLoc, header.FromId, idx++);
                        }
                    }
                    //DialogResult result = MessageBox.Show("拣货完成,是否获取新任务?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);
                    //InvokeHelper.Invoke(this, "CloseWindow", result);
                }
                if (tag >= 2 && tag < 2+idx)
                {

                    this.tpa01res=item.Response.Deserialize<tpa01_res.Utility>();
                    if (tag == 2)
                    {
                        toloc = this.tpa01res.UtilityHeader.ToLoc;
                    }
                    string packkey = this.tpa01res.UtilityHeader.PackKey;
                    string fromid=this.tpa01res.UtilityHeader.FromId;
                    packkeylist.Add(fromid, packkey);
                    //Console.WriteLine(toloc);
                    //InvokeHelper.Invoke(this, "OpenRFTPA02", this.loginuser, this.tpa00res,toloc);
                    if (tag == 2 + idx - 1)
                    {
                        InvokeHelper.Invoke(this, "OpenRFTPA02", this.loginuser, this.tpa00res, toloc);
                    }
                }
                else
                {
                    if (tag == 200 + callcount - 1)
                    {
                        this.submitbtn.SetEnabled(true);
                        this.Stop();
                        isclose = true;
                        DialogResult result = MessageBox.Show(string.Format("[{0}]个板上架完成,是否获取新任务?", callcount), "提示",MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);
                        InvokeHelper.Invoke(this, "CloseWindow", result);
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public void call_NSPRFTPA00()
        {
            string errortxt = this.Vaildate();
            if (errortxt != string.Empty)
            {
                MessageBox.Show(errortxt);
                this.focusControl.Focus();
                return;
            }
            //this.Start();
            //UserInfo admin = new UserInfo();
            //admin.Password = "******";
            //admin.UserName = "******";
            this.tpa00req = tpa00_req.Utility.Create(this.taskdetailkey,
                this.fromloc.Text, this.fromid1.Text, "", "",
                "", "");
            this.tpa00req.UtilityHeader.userid = this.loginuser.UserName;// "sceadmin";
            RequestMessage requestmessage = new RequestMessage(enumRequestType.MessageProcessor,
                  enumMessageType.Utility,
                  enumRequestMethod.functionOperation, this.loginuser,
                  enumSendSysId.EXceed,
                  this.tpa00req);
            //RequestWorkItem workitem = new RequestWorkItem(requestmessage, 1);
            //threadhelper.AddWorkItem(workitem);
            ResponseMessage Response = ThreadHelper.Execute(requestmessage);
             string errormsg = Response.GetErrorMessage();
             if (errormsg != string.Empty)
             {
                 //this.Stop();
                 MessageBox.Show(errormsg);
                 this.tpa00res = null;
                 this.tpa01res = null;
             }
             else
             {

                     this.tpa00res = Response.Deserialize<tpa00_res.Utility>();
                     idx = 0;
                     packkeylist = new Dictionary<string, string>();
                     string taskdetailkeystring = "";
                     string formlocstring = ""; ;
                     string formidstring = "";
                     foreach (tpa00_res.UtilityHeader header in this.tpa00res.UtilityHeaders)
                     {

                         idx++;
                         if (header != null)
                         {
                             //taskdetailkeystring = taskdetailkeystring + header.TaskDetailKey + ";";
                             //formlocstring = formlocstring + header.FromLoc + ";";
                             //formidstring = formidstring + header.FromId + ";";
                             //Console.WriteLine(header.Qty);
                             //InvokeHelper.Invoke(this, "call_NSPRFTPA01", header.TaskDetailKey, header.FromLoc, header.FromId, idx++);

                         //   if (idx == 1){

                                 call_NSPRFTPA01(header.TaskDetailKey, header.FromLoc, header.FromId);

                         //   }else{
                         //       call_TaskStore(header.TaskDetailKey,toloc);
                         //       packkeylist.Add(header.FromId, packkey);
                         //       //call_NSPRFTPA01(header.TaskDetailKey, header.FromLoc, header.FromId);

                         //}

                         }
                     }
                        //call_NSPRFTPA01(taskdetailkeystring, formlocstring, formidstring);
                     //foreach (tpa00_res.UtilityHeader header in this.tpa00res.UtilityHeaders)
                     //{

                     //    if (header != null)
                     //    {
                     //        if (!packkeylist.ContainsKey(header.FromId))
                     //            packkeylist.Add(header.FromId, packkey);
                     //    }
                     //}
                     this.OpenRFTPA02(this.loginuser, this.tpa00res, toloc);
                     //InvokeHelper.Invoke(this, "OpenRFTPA02", this.loginuser, this.tpa00res, toloc);
                     //this.OpenRFTPA02(this.loginuser, this.tpa00res, toloc);
                     //DialogResult result = MessageBox.Show("拣货完成,是否获取新任务?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);
                     //InvokeHelper.Invoke(this, "CloseWindow", result);

             }
        }
Ejemplo n.º 3
0
        public void call_NSPRFTPA01(string taskkey,string fromloc,string fromid)
        {
            this.tpa01req = tpa01_req.Utility.Create(taskkey,fromloc,fromid);
            this.tpa01req.UtilityHeader.userid = this.loginuser.UserName;
            RequestMessage requestmessage = new RequestMessage(enumRequestType.MessageProcessor,
                  enumMessageType.Utility,
                  enumRequestMethod.functionOperation, this.loginuser,
                  enumSendSysId.EXceed,
                  this.tpa01req);
            //RequestWorkItem workitem = new RequestWorkItem(requestmessage, 2+ix);
            //threadhelper.AddWorkItem(workitem);
            ResponseMessage Response = ThreadHelper.Execute(requestmessage);

             string errormsg = Response.GetErrorMessage();
             if (errormsg != string.Empty)
             {
                 //this.Stop();
                 MessageBox.Show(errormsg);
                 //this.tpa00res = null;
                 //this.tpa01res = null;
             }
             else
             {
                 this.tpa01res = Response.Deserialize<tpa01_res.Utility>();
                 toloc = this.tpa01res.UtilityHeader.ToLoc;

                 packkey = this.tpa01res.UtilityHeader.PackKey;
                 //string fromid = this.tpa01res.UtilityHeader.FromId;
                 if (!packkeylist.ContainsKey(fromid))
                 packkeylist.Add(fromid, packkey);
             }
        }