Beispiel #1
0
        public IResult DoWork(IJob job)
        {
            ILE.IResult res = new ILE.LEResult();
            client = new ServiceReference.ServiceClient();

            string ResDispatching = client.RunServerAPI("BLL.Machine", "GetMachineInfo", job.StationCode);

            if (ResDispatching == "")
            {
                res.Result     = false;
                res.ExtMessage = "该工位未绑定设备,无法使用模具";
                return(res);
            }

            B_Machine produc = JsonConvert.DeserializeObject <B_Machine>(ResDispatching);

            SelectionForm sf = new SelectionForm(produc, job.StationCode, job.EmpCode);

            sf.ShowDialog();
            res.Result       = sf.res.Result;
            res.ExtMessage   = sf.res.ExtMessage;
            job.reload_code += "mould/";
            return(res);
        }
Beispiel #2
0
        private void SelectionForm_Load(object sender, EventArgs e)
        {
            ///检查设备是否需要模具
            this.treeView1.ExpandAll();
            string mouldkinds = client.RunServerAPI("BLL.Machine", "GetMachineMouldKinds", this._machine.machine_code);

            ////////

            if (mouldkinds == "")
            {
                this.label1.Text    = "当前设备不需要模具";
                this.res.Result     = true;
                this.res.ExtMessage = "当前设备不需要模具";
                return;
            }

            List <dynamic> kinds = JsonConvert.DeserializeObject <List <dynamic> >(mouldkinds);

            //获取设备下已安装的模具
            string         ists      = client.RunServerAPI("BLL.Machine", "GetMachineInstallMoulds", this._machine.machine_code);
            List <dynamic> istMoulds = JsonConvert.DeserializeObject <List <dynamic> >(ists);

            foreach (dynamic kind in kinds)
            {
                TreeNode nod = new TreeNode();
                nod.Name = kind.mould_kind_id.ToString();
                nod.Tag  = kind.qty;
                nod.Text = kind.manufacturer + "-" + kind.model_code;

                //var res = context.B_Process_Flow_Detail.Where(x => x.pid == intpid).Select(c => c.strict).ToList();
                if (istMoulds != null)
                {
                    var res = istMoulds.Where(x => x.kind_id == kind.mould_kind_id);

                    foreach (dynamic a in res)
                    {
                        TreeNode snode = new TreeNode();
                        snode.Name = a.mould_code;
                        snode.Text = a.mould_code + "[" + a.mould_name + "]";

                        nod.Nodes.Add(snode);
                    }
                    nod.Text = nod.Text + "(" + res.Count().ToString() + "/" + kind.qty + ")";
                }
                else
                {
                    nod.Text = nod.Text + "(0/" + kind.qty + ")";
                }

                this.treeView1.Nodes.Add(nod);
            }

            this.llb_machine.Text = "【" + this._machine.machine_name + "】";
            string ResDispatching = client.RunServerAPI("BLL.Machine", "GetMachinePPT_Detail", this._machine.machine_code);
            List <V_Machine_PPT_Detail> produc = JsonConvert.DeserializeObject <List <V_Machine_PPT_Detail> >(ResDispatching);

            foreach (V_Machine_PPT_Detail bmp in produc)
            {
                ListViewItem lvi = new ListViewItem();
                lvi.Text = bmp.ppt_name;

                string cdt = null;
                if (bmp.ppt_condition == "between")
                {
                    cdt = bmp.ppt_min.ToString() + "<=" + bmp.ppt_name + "<=" + bmp.ppt_max.ToString();
                }
                else
                {
                    cdt = bmp.ppt_condition + bmp.ppt_val;
                }
                lvi.SubItems.Add(cdt);

                lvBind.Items.Add(lvi);
            }
            //if (produc.Count < 1)
            //{
            //    res.Result = false;
            //    res.ExtMessage = "该工位未绑定设备,无法使用模具";
            //    return res;
            //}
        }