コード例 #1
0
        private bool CheckSFCRule(string parstrorder, string parstrmatcode, string parstrstation, string parstrChangesfc)
        {
            try
            {
                if (string.IsNullOrWhiteSpace(parstrChangesfc))
                {
                    //MessageBox.Show("替换物料代码为空,请检查","提示");
                    return(false);
                }

                ILE.LEResult result = new ILE.LEResult();
                ServiceReference.ServiceClient clien = new ServiceReference.ServiceClient();
                string json       = parstrorder + "," + parstrmatcode + "," + parstrstation + "," + parstrChangesfc;
                string ResultJson = clien.RunServerAPI("BLL.SFCConsume", "GetMaterialConsumptionManual", json);
                result = JsonConvert.DeserializeObject <ILE.LEResult>(ResultJson);
                if (result.Result == false)
                {
                    MessageBox.Show(result.ExtMessage, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                return(result.Result);
            }
            catch (Exception exp)
            {
                MessageBox.Show(exp.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return(false);
            }
        }
コード例 #2
0
        private void btn_commit_Click(object sender, EventArgs e)
        {
            try
            {
                ServiceReference.ServiceClient clien = new ServiceReference.ServiceClient();

                for (int i = 0; i < kryptonDataGridView_sublstsfc.Rows.Count; i++)
                {
                    if (!string.IsNullOrWhiteSpace(kryptonDataGridView_sublstsfc.Rows[i].Cells["subchangesfc"].Value.ToString().Trim()))    //检查是否存在替换批次,如果存在则修改原批次信息
                    {
                        //1.修改P_SFC_State表中原sfc的状态为 -1;
                        //2.修改P_SFC_ProcessData表中的绑定关系
                        //3.增加P_SFC_ProcessData_Back表(新增加表 P_FailLog.fguid, P_SFC_ProcessData.order_no,P_SFC_ProcessData.mat_code,P_SFC_ProcessData.sfc,P_SFC_ProcessData.val as oldsubsfc)数据
                        P_SFC_ProcessData_Back psfcprocessdataback = new P_SFC_ProcessData_Back();
                        psfcprocessdataback.fguid    = strfguid;
                        psfcprocessdataback.order_no = kryptonDataGridView_sublstsfc.Rows[i].Cells["subsfcorder"].Value.ToString().Trim();
                        psfcprocessdataback.SFC      = txtbox_sfc.Text.ToString().Trim();
                        psfcprocessdataback.mat_code = kryptonDataGridView_sublstsfc.Rows[i].Cells["subsfcmatCode"].Value.ToString().Trim();
                        psfcprocessdataback.val      = kryptonDataGridView_sublstsfc.Rows[i].Cells["subsfc"].Value.ToString().Trim();
                        psfcprocessdataback.New_val  = kryptonDataGridView_sublstsfc.Rows[i].Cells["subchangesfc"].Value.ToString().Trim();
                        string ResultJson = clien.RunServerAPI("BLL.SFC_ProcessData", "AddSFCprocessDataBack", JsonConvert.SerializeObject(psfcprocessdataback));

                        if (ResultJson != "OK")
                        {
                            string strMsgTmp = "替换批次[" + psfcprocessdataback.SFC + "]失败";
                            MessageBox.Show(strMsgTmp, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        }
                    }
                }
            }
            catch (Exception exp)
            {
                MessageBox.Show(exp.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
コード例 #3
0
        //降级事件
        private void btn_demoted_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(kComboBox_ProductGrade.Text.Trim()))
            {
                MessageBox.Show("请先设置级别", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            //先在P_SFC_State表中查找对应批次记录,如果不存在,说明该批次在首工序就进入维修,不存在记录,此时提示不能降级
            ServiceReference.ServiceClient client = new ServiceReference.ServiceClient();
            string str = client.RunServerAPI("BLL.Pack", "GetSfcState", textBox_sfc.Text);

            if (string.IsNullOrWhiteSpace(str))
            {
                //不存在记录
                MessageBox.Show("此批次不能降级", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);  //  如何提示不能降级原因???
                kComboBox_ProductGrade.Text = "";
                return;
            }
            List <P_SFC_State> dt = JsonConvert.DeserializeObject <List <P_SFC_State> >(str);

            if (dt.Count <= 0)
            {
                //不存在记录
                MessageBox.Show("此批次不能降级", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);  //  如何提示不能降级原因???
                kComboBox_ProductGrade.Text = "";
                return;
            }
            //如果批次被降级,该批次就不能设置为"待判","报废"
            btn_confirmed.Enabled = false;
            btn_discarde.Enabled  = false;
            iRepairProcc          = 1; //降级操作
        }
コード例 #4
0
        //获取产品待判编码
        //private void GetPendingJudgment(string strProductTypeCode)
        //{
        //    try
        //    {
        //        ServiceReference.ServiceClient client = new ServiceReference.ServiceClient();
        //        string dt = client.RunServerAPI("BLL.Product", "GetPendingJudgmentByType", strProductTypeCode);//根据产品类别代码获取待判编码
        //        if (string.IsNullOrWhiteSpace(dt))
        //        {
        //            //没有数据
        //            MessageBox.Show("获取产品待判编码失败", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
        //            return;
        //        }
        //        List<B_Judge_code> listJudecode = JsonConvert.DeserializeObject<List<B_Judge_code>>(dt);
        //        for (int i = 0; i < listJudecode.Count; i++)
        //        {
        //            string judecode = listJudecode[i].judgecode;
        //            string judename = listJudecode[i].judgename;
        //            //CheckBox com = new CheckBox();
        //            //checkedListBox1.Controls.Add(com);
        //            checkedListBox1.Items.Add(new ComboboxItem(judecode, judename));
        //        }
        //    }
        //    catch (Exception exp)
        //    {
        //        MessageBox.Show("获取待判编码失败:" + exp.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
        //    }

        //}
        //获取产品级别
        private void GetProductGrade(string parstrProductTypeCode)
        {
            try
            {
                ServiceReference.ServiceClient client = new ServiceReference.ServiceClient();
                string dt = client.RunServerAPI("BLL.Product", "GetProductGradeByType", parstrProductTypeCode);//根据产品类别代码获取产品级别
                if (string.IsNullOrWhiteSpace(dt))
                {
                    //没有数据
                    MessageBox.Show("获取产品级别失败", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                List <B_Product_Grade> lstProductGrade = new List <B_Product_Grade>();
                lstProductGrade = JsonConvert.DeserializeObject <List <B_Product_Grade> >(dt);
                for (int i = 0; i < lstProductGrade.Count; i++)
                {
                    dicProductGrade.Add(lstProductGrade[i].grade_name, lstProductGrade[i]);
                    kComboBox_ProductGrade.Items.Add(lstProductGrade[i].grade_name);
                }
            }
            catch (Exception exp)
            {
                MessageBox.Show("获取产品级别失败:" + exp.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #5
0
        private void btn_ok_Click(object sender, EventArgs e)
        {
            g_bLoginResult = false;
            if (string.IsNullOrWhiteSpace(textBox_Userid.Text.ToString().Trim()) ||
                string.IsNullOrWhiteSpace(textBox_password.ToString().Trim()))
            {
                MessageBox.Show("请输入用户编号或密码!", "提示");
                return;
            }
            if (string.IsNullOrWhiteSpace(g_strFuncCode))
            {
                MessageBox.Show("工单代码为空!", "提示");
                return;
            }
            ServiceReference.ServiceClient client = new ServiceReference.ServiceClient();
            string str = client.RunServerAPI("BLL.Employee", "CheckLogin", textBox_Userid.Text.ToString().Trim() + ";" + textBox_password.Text.ToString().Trim());

            if (str.Contains("OK"))
            {
                //登录验证成功
                str = "";

                str = client.RunServerAPI("BLL.Employee", "CheckFuncCode", textBox_Userid.Text.ToString().Trim() + ";" + g_strFuncCode);
                if (str.Contains("OK"))
                {
                    //功能检查成功
                    g_bLoginResult = true;
                    Close();
                }
                else
                {
                    g_bLoginResult = false;
                    MessageBox.Show(str, "错误");
                    return;
                }
            }
            else
            {
                g_bLoginResult = false;
                MessageBox.Show(str, "错误");
                return;
            }
        }
コード例 #6
0
        private void FrmMaterialreplacement_Load(object sender, EventArgs e)
        {
            try
            {
                if (string.IsNullOrWhiteSpace(strMainSfc))
                {
                    MessageBox.Show("批次号为空,请检查", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    this.Close();
                }
                if (string.IsNullOrWhiteSpace(strorderon))
                {
                    MessageBox.Show("工单为空,请检查", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    this.Close();
                }
                txtbox_sfc.Text       = strMainSfc;
                txtbox_shoporder.Text = strorderon;

                lstchangesubsfc.Clear();
                ServiceReference.ServiceClient clien = new ServiceReference.ServiceClient();
                string json       = strorderon;
                string ResultJson = clien.RunServerAPI("BLL.SFC", "GetLstSFCByParentorder", json);  //根据父工单获取子工单中批次列表
                if (string.IsNullOrWhiteSpace(ResultJson))
                {
                    MessageBox.Show("当前主批次号下没有子物料,请检查", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    this.Close();
                    return;
                }
                List <P_BarCodeBing> lstpbarcodebing = new List <P_BarCodeBing>();
                lstpbarcodebing = JsonConvert.DeserializeObject <List <P_BarCodeBing> >(ResultJson);
                if (lstpbarcodebing.Count <= 0)
                {
                    MessageBox.Show("当前主批次号下没有子物料,请检查", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    this.Close();
                    return;
                }
                for (int i = 0; i < lstpbarcodebing.Count; i++)
                {
                    ChangeSubSFC_Data changesubsfcdata = new ChangeSubSFC_Data();
                    changesubsfcdata.subsfc        = lstpbarcodebing[i].barcode;
                    changesubsfcdata.subsfcorder   = lstpbarcodebing[i].order;
                    changesubsfcdata.subsfcmatCode = lstpbarcodebing[i].product_code;
                    changesubsfcdata.subchangesfc  = "";
                    lstchangesubsfc.Add(changesubsfcdata);
                }

                kryptonDataGridView_sublstsfc.DataSource = lstchangesubsfc;
            }
            catch (Exception exp)
            {
                MessageBox.Show(exp.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
コード例 #7
0
ファイル: FrmRework.cs プロジェクト: moling3650/Smart.MES.POD
        private void GetSFCLVLData(string strsfc, int lvl, string strparentsfc, string strparparentsfc)
        {
            try
            {
                SFC_LVL_Data sfclvldata = new SFC_LVL_Data();
                sfclvldata.SFC          = strsfc.Trim();
                sfclvldata.LVL          = lvl + 1;
                sfclvldata.strWorkOrder = "";
                sfclvldata.strMatCode   = "";
                sfclvldata.dmaxqty      = 0;
                sfclvldata.parentSFC    = strparentsfc;
                sfclvldata.parparentSFC = strparparentsfc;
                g_lstSfclvlData.Add(sfclvldata);

                ServiceReference.ServiceClient client = new ServiceReference.ServiceClient();
                string dt = client.RunServerAPI("LEDIS.BLL.SFC_ProcessData", "GetSFCInfoLVLBySFC", sfclvldata.SFC.Trim() + "," + g_strWorkShopCode.Trim());
                if (string.IsNullOrEmpty(dt) ||
                    dt.Contains("GetSFCInfoLVLBySFC-Fail,"))
                {
                    ((FrmRepairTool)this.Owner).SendMsgShow(dt, 2);
                    return;
                }
                if (dt.Contains("GetSFCInfoLVLBySFC-OK,当前批次号没有下级批次"))
                {
                    //没有下级批次,获取当前sfc属性,工单,物料信息
                    string dtsfc = client.RunServerAPI("LEDIS.BLL.SFC_ProcessData", "GetOrderInfoBySFC", sfclvldata.SFC.Trim() + "," + g_strWorkShopCode.Trim());
                    if (string.IsNullOrEmpty(dtsfc) ||
                        dtsfc.Contains("GetOrderInfoBySFC-Fail,"))
                    {
                        ((FrmRepairTool)this.Owner).SendMsgShow(dtsfc, 2);
                        return;
                    }
                    List <UserDefineData_SFCProcessData> lstsfcpsfcprocessdata = JsonConvert.DeserializeObject <List <UserDefineData_SFCProcessData> >(dtsfc);    //获取sfc属性
                    if (lstsfcpsfcprocessdata.Count < 1)
                    {
                        //没有下级批次
                        return;
                    }

                    sfclvldata.strWorkOrder = lstsfcpsfcprocessdata[0].order_no;
                    sfclvldata.strMatCode   = lstsfcpsfcprocessdata[0].mat_code;
                    sfclvldata.dmaxqty      = decimal.Parse(lstsfcpsfcprocessdata[0].step_code.Trim());
                    return;
                }
                List <UserDefineData_SFCProcessData> lstpsfcprocessdata = JsonConvert.DeserializeObject <List <UserDefineData_SFCProcessData> >(dt);    //P_BarCodeBing中获取sfc属性
                if (lstpsfcprocessdata.Count < 1)
                {
                    //没有下级批次
                    return;
                }
                sfclvldata.strWorkOrder = lstpsfcprocessdata[0].order_no;
                sfclvldata.strMatCode   = lstpsfcprocessdata[0].mat_code;
                sfclvldata.dmaxqty      = decimal.Parse(lstpsfcprocessdata[0].step_code.Trim());

                for (int i = 0; i < lstpsfcprocessdata.Count; i++)
                {
                    if (!string.IsNullOrWhiteSpace(lstpsfcprocessdata[i].val))
                    {
                        GetSFCLVLData(lstpsfcprocessdata[i].val, lvl + 1, sfclvldata.SFC, sfclvldata.parentSFC);
                    }
                }
            }
            catch (Exception exp)
            {
                ((FrmRepairTool)this.Owner).SendMsgShow(exp.Message, 2);
            }
        }
コード例 #8
0
ファイル: FrmRework.cs プロジェクト: moling3650/Smart.MES.POD
        private void btn_commit_Click(object sender, EventArgs e)
        {
            try
            {
                for (int i = 0; i < panel1.Controls.Count; i++)
                {
                    if (panel1.Controls[i].Tag.ToString().Trim() == "listboxs")
                    {
                        //处理存在需要重测批次
                        if (((ListBox)panel1.Controls[i]).Items.Count > 0)
                        {
                            string    strlstboxname = panel1.Controls[i].Name.ToString().Trim();
                            string [] arrtmpitem    = strlstboxname.Split('-');
                            string    strComboxname = strlstboxname.Replace("listboxs-", "ComboBoxs-");
                            ComboBox  cmbx          = (ComboBox)(panel1.Controls.Find(strComboxname, true)[0]);
                            if (cmbx != null)
                            {
                                ComboBoxItem comboxitem = (ComboBoxItem)cmbx.SelectedItem;
                                if (comboxitem != null)
                                {
                                    //修改表数据
                                    //--del P_Material_WIP --删记录
                                    //--mod P_SFC_State   --- state
                                    //--mod P_SFC_Process_IOLog  --首工序不用处理,非首工序,需要把对应工序增加一条记录  ; 暂时不需要修改
                                    string strsfcs = ""; //批次号集合
                                    for (int j1 = 0; j1 < ((ListBox)panel1.Controls[i]).Items.Count; j1++)
                                    {
                                        if (string.IsNullOrWhiteSpace(strsfcs))
                                        {
                                            strsfcs = ((ListBox)panel1.Controls[i]).Items[j1].ToString().Trim();
                                        }
                                        else
                                        {
                                            strsfcs = strsfcs + "," + ((ListBox)panel1.Controls[i]).Items[j1].ToString().Trim();
                                        }
                                    }
                                    //解析物料代码
                                    string [] strTmpmatcode = arrtmpitem[1].ToString().Trim().Split('_');
                                    if (strTmpmatcode.Length <= 0)
                                    {
                                        ((FrmRepairTool)this.Owner).SendMsgShow("解析物料代码失败", 2);
                                        return;
                                    }
                                    string strmatcode = strTmpmatcode[0];

                                    //获取工单
                                    List <SFC_LVL_Data> TmplstSfclvlData = new List <SFC_LVL_Data>();
                                    TmplstSfclvlData = g_lstSfclvlData.Where(x => x.SFC == ((ListBox)panel1.Controls[i]).Items[0].ToString().Trim()).ToList();
                                    if (TmplstSfclvlData.Count <= 0 ||
                                        string.IsNullOrWhiteSpace(TmplstSfclvlData[0].strWorkOrder))
                                    {
                                        ((FrmRepairTool)this.Owner).SendMsgShow("解析工单失败", 2);
                                        return;
                                    }

                                    ServiceReference.ServiceClient client = new ServiceReference.ServiceClient();
                                    //参数解析 批次号集合多个已","隔开;重测工序代码;工序类别(首工序,中间工序...);物料代码;工单;车间代码
                                    string dt = client.RunServerAPI("BLL.JobSubmit", "CommitReTest", strsfcs.Trim() + ";"
                                                                    + comboxitem.Value.ToString().Trim() + ";"
                                                                    + strmatcode + ";"
                                                                    + TmplstSfclvlData[0].strWorkOrder + ";"
                                                                    + g_strWorkShopCode.Trim());
                                    if (string.IsNullOrEmpty(dt) ||
                                        dt.Contains("CommitReTest-Fail;"))
                                    {
                                        ((FrmRepairTool)this.Owner).SendMsgShow("提交重测数据失败:" + dt, 2);
                                        return;
                                    }

                                    //清理树上的复选框
                                    int ireworksfccount = ((ListBox)panel1.Controls[i]).Items.Count;
                                    for (int j = 0; j < ireworksfccount; j++)
                                    {
                                        string strtmpnodetext = ((ListBox)panel1.Controls[i]).Items[j].ToString().Trim() + " / " + arrtmpitem[1];
                                        foreach (TreeNode node in treeView1.Nodes)
                                        {
                                            if (node.Text.ToString().Trim() == strtmpnodetext)
                                            {
                                                //先检查根节点
                                                node.Checked   = false;
                                                node.BackColor = Color.White;
                                            }
                                            else
                                            {
                                                //再检查根节点下的子节点
                                                FindAllNode(node, strtmpnodetext, 0);
                                            }
                                        }
                                    }
                                    //删除已提交批次
                                    ((ListBox)panel1.Controls[i]).Items.Clear();
                                    //cmbx.Items.Clear(); //不能清空,因为只有增加listbox时才加载新的数据
                                    cmbx.SelectedIndex = -1;
                                    ((FrmRepairTool)this.Owner).SendMsgShow("[" + arrtmpitem[1].ToString().Trim() + "]中批次已经提交重测", 0);
                                }
                                else
                                {
                                    ((FrmRepairTool)this.Owner).SendMsgShow("请选择[" + arrtmpitem[1].ToString().Trim() + "]需要重测工序", 1);
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception exp)
            {
                ((FrmRepairTool)this.Owner).SendMsgShow(exp.Message, 2);
            }
        }
コード例 #9
0
ファイル: FrmRework.cs プロジェクト: moling3650/Smart.MES.POD
        private void AddReTestSFC(string strsfcInfo, TreeNode treeNode)
        {
            try
            {
                if (string.IsNullOrWhiteSpace(strsfcInfo))
                {
                    ((FrmRepairTool)this.Owner).SendMsgShow("批次信息为空", 1);
                    treeNode.Checked   = false;
                    treeNode.BackColor = Color.White;
                    return;
                }
                string[] arrsfcitem = strsfcInfo.Split('/');
                if (arrsfcitem.Length < 2 ||
                    string.IsNullOrWhiteSpace(arrsfcitem[0]) ||
                    string.IsNullOrWhiteSpace(arrsfcitem[1]))
                {
                    ((FrmRepairTool)this.Owner).SendMsgShow("批次信息不全", 1);
                    treeNode.Checked   = false;
                    treeNode.BackColor = Color.White;
                    return;
                }
                //根据批次对应的数量来判断是否可以重测
                List <SFC_LVL_Data> TmplstSfclvlData = new List <SFC_LVL_Data>();
                TmplstSfclvlData = g_lstSfclvlData.Where(x => x.SFC == arrsfcitem[0].Trim()).ToList();
                if (TmplstSfclvlData.Count > 0)
                {
                    decimal maxqty = TmplstSfclvlData[0].dmaxqty;
                    if (TmplstSfclvlData[0].dmaxqty > (decimal)1.0)
                    {
                        ((FrmRepairTool)this.Owner).SendMsgShow("该批次不可重测", 1);
                        treeNode.Checked   = false;
                        treeNode.BackColor = Color.White;
                        return;
                    }
                }
                else
                {
                    ((FrmRepairTool)this.Owner).SendMsgShow("批次信息有误", 1);
                    treeNode.Checked   = false;
                    treeNode.BackColor = Color.White;
                    return;
                }

                query.Clear();
                GetControls(panel1);
                if (query.Count < 1)
                {
                    ListBox lstbox = new ListBox();
                    //lstbox.Anchor = AnchorStyles.None;
                    lstbox.Name = "listboxs-" + arrsfcitem[1].Trim();
                    lstbox.Tag  = "listboxs";
                    lstbox.Items.Add(arrsfcitem[0].Trim());
                    panel1.Controls.Add(lstbox);
                    lstbox.Location = new Point(5, 15);
                    lstbox.Size     = new Size(300, 150);
                    Label labeladd = new Label();
                    //labeladd.Anchor = AnchorStyles.None;
                    labeladd.Name     = "Labels-" + arrsfcitem[1].Trim();
                    labeladd.Tag      = "Labels";
                    labeladd.Text     = arrsfcitem[1].Trim();
                    labeladd.Location = new Point(320, 15);
                    labeladd.Size     = new Size(230, 30);
                    panel1.Controls.Add(labeladd);
                    ComboBox cmbx = new ComboBox();
                    //cmbx.Anchor = AnchorStyles.None;
                    cmbx.Name     = "ComboBoxs-" + arrsfcitem[1].Trim();
                    cmbx.Tag      = "ComboBoxs";
                    cmbx.Location = new Point(320, 50);
                    cmbx.Size     = new Size(230, 30);
                    panel1.Controls.Add(cmbx);

                    ServiceReference.ServiceClient client = new ServiceReference.ServiceClient();
                    string dt = client.RunServerAPI("BLL.Process", "GetProcessFlowDetail", TmplstSfclvlData[0].strWorkOrder.Trim());
                    if (string.IsNullOrEmpty(dt))
                    {
                        ((FrmRepairTool)this.Owner).SendMsgShow("获取工艺流失败", 2);
                        return;
                    }
                    List <B_ProcessList> lstprocess = new List <B_ProcessList>();
                    lstprocess = JsonConvert.DeserializeObject <List <B_ProcessList> >(dt);
                    for (int i = 0; i < lstprocess.Count; i++)
                    {
                        ComboBoxItem comboxitem = new ComboBoxItem(lstprocess[i].process_code + ";" + lstprocess[i].route_type, lstprocess[i].process_name);
                        cmbx.Items.Add(comboxitem);   //工序列表
                    }
                }
                else
                {
                    int ifindcon = 0;
                    //for (int i = 0; i < query.Count; i++)
                    //{
                    //}
                    foreach (Control c1 in query)
                    {
                        if (c1.Name == "listboxs-" + arrsfcitem[1].Trim())
                        {
                            ifindcon = 1;
                            int index = ((ListBox)c1).FindStringExact(arrsfcitem[0].Trim());
                            if (index < 0)
                            {
                                ((ListBox)c1).Items.Add(arrsfcitem[0].Trim());
                            }
                        }
                    }
                    if (ifindcon == 0)
                    {
                        ListBox lstbox = new ListBox();
                        //lstbox.Anchor = AnchorStyles.None;
                        lstbox.Name = "listboxs-" + arrsfcitem[1].Trim();
                        lstbox.Tag  = "listboxs";
                        lstbox.Items.Add(arrsfcitem[0].Trim());
                        panel1.Controls.Add(lstbox);
                        lstbox.Location = new Point(5, 15 + 150 * query.Count);
                        lstbox.Size     = new Size(300, 150);
                        Label labeladd = new Label();
                        //labeladd.Anchor = AnchorStyles.None;
                        labeladd.Name     = "Labels-" + arrsfcitem[1].Trim();
                        labeladd.Tag      = "Labels";
                        labeladd.Text     = arrsfcitem[1].Trim();
                        labeladd.Location = new Point(320, 15 + 150 * query.Count);
                        labeladd.Size     = new Size(230, 30);
                        panel1.Controls.Add(labeladd);
                        ComboBox cmbx = new ComboBox();
                        //cmbx.Anchor = AnchorStyles.None;
                        cmbx.Name     = "ComboBoxs-" + arrsfcitem[1].Trim();
                        cmbx.Tag      = "ComboBoxs";
                        cmbx.Location = new Point(320, 50 + 150 * query.Count);
                        cmbx.Size     = new Size(230, 30);
                        panel1.Controls.Add(cmbx);

                        ServiceReference.ServiceClient client = new ServiceReference.ServiceClient();
                        string dt = client.RunServerAPI("BLL.Process", "GetProcessFlowDetail", TmplstSfclvlData[0].strWorkOrder.Trim());
                        if (string.IsNullOrEmpty(dt))
                        {
                            ((FrmRepairTool)this.Owner).SendMsgShow("获取工艺流失败", 2);
                            return;
                        }
                        List <B_ProcessList> lstprocess = new List <B_ProcessList>();
                        lstprocess = JsonConvert.DeserializeObject <List <B_ProcessList> >(dt);
                        for (int i = 0; i < lstprocess.Count; i++)
                        {
                            ComboBoxItem comboxitem = new ComboBoxItem(lstprocess[i].process_code + ";" + lstprocess[i].route_type, lstprocess[i].process_name);
                            cmbx.Items.Add(comboxitem);   //工序列表
                        }

                        panel1.Height     = groupBox2.Height - 50;
                        panel1.AutoScroll = true;
                    }
                }
                ((FrmRepairTool)this.Owner).SendMsgShow("增加[" + arrsfcitem[0].Trim() + "]重测成功", 0);
            }
            catch (Exception exp)
            {
                ((FrmRepairTool)this.Owner).SendMsgShow(exp.Message, 2);
            }
        }
コード例 #10
0
        private void FrmRepairProcess_Load(object sender, EventArgs e)
        {
            //参数检查
            if (string.IsNullOrWhiteSpace(strorderno))
            {
                MessageBox.Show("工单信息有误,请检查", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (string.IsNullOrWhiteSpace(strsfc))
            {
                MessageBox.Show("批次号信息有误,请检查", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (string.IsNullOrWhiteSpace(strqty))
            {
                MessageBox.Show("不良数量有误,请检查", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            //批次降级后"待判","报废"不能使用,所以加载页面是重置一下
            btn_confirmed.Enabled = true;
            btn_discarde.Enabled  = true;
            iRepairProcc          = 0;

            lstprocess.Clear();
            textBox_sfc.Text         = strsfc;
            textBox_sfcqty.Text      = strqty;
            textBox_fromprocess.Text = strfromprocess_name;

            //GetProcessFlowDetail(strorderno);
            ServiceReference.ServiceClient client = new ServiceReference.ServiceClient();
            string dt = client.RunServerAPI("BLL.Process", "GetProcessFlowDetail", strorderno);//根据工单,获取工艺流,根据工艺流得到工序

            if (string.IsNullOrWhiteSpace(dt))
            {
                //没有数据
                MessageBox.Show("未获取到责任工序", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            lstprocess = JsonConvert.DeserializeObject <List <B_ProcessList> >(dt);
            //lstprocess.Add();
            for (int i = 0; i < lstprocess.Count; i++)
            {
                diczrprocess.Add(lstprocess[i].process_name, lstprocess[i].process_code);
                kComboBox_Process.Items.Add(lstprocess[i].process_name);       //责任工序列表
                kComboBox_rebackprocess.Items.Add(lstprocess[i].process_name); //待返回工序列表
            }
            diczrprocess.Add("END", "END");
            kComboBox_rebackprocess.Items.Add("END");   //待返回工序列表
            kComboBox_Process.Text          = strfromprocess_name;
            kComboBox_Process.SelectedValue = strfromprocess_code;
            string strProductTypeCode = "";
            string strProductTypeName = "";

            //根据工单获取产品类型
            dt = "";
            dt = client.RunServerAPI("BLL.Product", "GetProductInfoByOrder", strorderno);
            if (string.IsNullOrWhiteSpace(dt))
            {
                MessageBox.Show("根据工单[" + strorderno + "]获取产品类型失败", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            List <V_Order_Produc_Type_Name> lstvorderProductInfo = JsonConvert.DeserializeObject <List <V_Order_Produc_Type_Name> >(dt);

            if (lstvorderProductInfo.Count > 0)
            {
                strProductTypeCode = lstvorderProductInfo[0].typecode;
                strProductTypeName = lstvorderProductInfo[0].type_name;
            }
            if (string.IsNullOrWhiteSpace(strProductTypeCode))
            {
                MessageBox.Show("根据工单[" + strorderno + "]获取产品类型失败", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            kTextBox_ProductType.Text = strProductTypeName;

            dt = "";
            dt = client.RunServerAPI("BLL.Fail_Detail", "GetNgCode", strfid + "," + strProductTypeCode);//根据不良id,在Fail_Detail中获取不良现象
            if (string.IsNullOrWhiteSpace(dt))
            {
                //没有数据
                MessageBox.Show("获取不良现象失败", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            List <V_Fail_Detail_NGName> lstvfaildetailngname = new List <V_Fail_Detail_NGName>();

            lstvfaildetailngname = JsonConvert.DeserializeObject <List <V_Fail_Detail_NGName> >(dt);
            for (int i = 0; i < lstvfaildetailngname.Count; i++)
            {
                NGCode_Reason_Data ngcodereasondata = new NGCode_Reason_Data();
                ngcodereasondata.detail_id          = lstvfaildetailngname[i].id;
                ngcodereasondata.failPhenomenoncode = lstvfaildetailngname[i].ng_code;
                ngcodereasondata.failPhenomenondesc = lstvfaildetailngname[i].ng_name;
                ngcodereasondata.failNum            = (double)lstvfaildetailngname[i].qty;
                if (string.IsNullOrWhiteSpace(strfguid))
                {
                    strfguid = lstvfaildetailngname[i].fguid;
                }
                blstNGCodeReasonData.Add(ngcodereasondata);
            }
            //获取原因代码
            dt = "";
            dt = client.RunServerAPI("BLL.NGDetect", "GetNGReason", strProductTypeCode);//获取不良原因
            if (string.IsNullOrWhiteSpace(dt))
            {
                //没有数据
                MessageBox.Show("无不良原因记录", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                List <B_NG_Reason> lstbngReason = new List <B_NG_Reason>();
                lstbngReason = JsonConvert.DeserializeObject <List <B_NG_Reason> >(dt);
                for (int i = 0; i < lstbngReason.Count; i++)
                {
                    try
                    //for (int j = 0; j < blstNGCodeReasonData.Count; j++)
                    {
                        dicReason.Add(lstbngReason[i].reason_name, lstbngReason[i].reason_code);
                        ((DataGridViewComboBoxColumn)this.dataGridView_faildetail.Columns["failReasoncode"]).Items.Add(lstbngReason[i].reason_name);
                    }
                    catch (Exception exp)
                    {
                    }
                }
            }
            //获取原因类型代码
            dt = "";
            dt = client.RunServerAPI("BLL.NGDetect", "GetBNGReasonType", "");//获取不良原因类型
            if (string.IsNullOrWhiteSpace(dt))
            {
                //没有数据
                MessageBox.Show("无不良原因记录", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                List <B_NG_ReasonType> lstbngReasonType = new List <B_NG_ReasonType>();
                lstbngReasonType = JsonConvert.DeserializeObject <List <B_NG_ReasonType> >(dt);
                for (int i = 0; i < lstbngReasonType.Count; i++)
                {
                    //for (int j = 0; j < blstNGCodeReasonData.Count; j++)
                    {
                        dicTypeReason.Add(lstbngReasonType[i].reasontype_name, lstbngReasonType[i].reasontype_code);
                        ((DataGridViewComboBoxColumn)this.dataGridView_faildetail.Columns["failtype"]).Items.Add(lstbngReasonType[i].reasontype_name);
                    }
                }
            }
            dataGridView_faildetail.DataSource = blstNGCodeReasonData;
            GetProductGrade(strProductTypeCode);
            //GetPendingJudgment(strProductTypeCode);
        }
コード例 #11
0
        //提交操作
        private void btn_reback_Click(object sender, EventArgs e)
        {
            ServiceReference.ServiceClient client = new ServiceReference.ServiceClient();
            try
            {
                if (string.IsNullOrWhiteSpace(richTextBox_faildesc.Text.Trim()))
                {
                    MessageBox.Show("请给出维修说明,在记录中填写", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                if (string.IsNullOrWhiteSpace(kComboBox_Process.Text.Trim()))
                {
                    MessageBox.Show("请选择责任工序", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                //修改数据库信息,1.P_SFC_State(如果P_SFC_State表中存在记录才修改),
                //更新P_SFC_State 当前工序和过站时间 +P_SFC_Process_IOLog 当前工序
                int    ishebeifail = 0;
                string str         = "";
                List <P_Fail_Detail> lstpFailDetail = new List <P_Fail_Detail>();
                for (int i = 0; i < dataGridView_faildetail.Rows.Count; i++)
                {
                    P_Fail_Detail onepfaildetail = new P_Fail_Detail();
                    onepfaildetail.id = int.Parse(dataGridView_faildetail.Rows[i].Cells["detail_id"].Value.ToString());
                    if ((this.dataGridView_faildetail.Rows[i].Cells["failReasoncode"] as DataGridViewComboBoxCell).Value == null)
                    {
                        MessageBox.Show("原因代码为空,请选择", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                    onepfaildetail.reason_code = dicReason[(string)(this.dataGridView_faildetail.Rows[i].Cells["failReasoncode"] as DataGridViewComboBoxCell).Value];
                    if (onepfaildetail.reason_code.Contains("EEE"))  //判断是否为设备不良原因代码
                    {
                        ishebeifail = 1;
                    }
                    if ((this.dataGridView_faildetail.Rows[i].Cells["failtype"] as DataGridViewComboBoxCell).Value == null)
                    {
                        MessageBox.Show("原因类型代码为空,请选择", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                    onepfaildetail.reasontype_code = dicTypeReason[(string)(this.dataGridView_faildetail.Rows[i].Cells["failtype"] as DataGridViewComboBoxCell).Value];
                    lstpFailDetail.Add(onepfaildetail);
                }
                //order,sfc,nowprocess,state,failtimes,pass,grade_id,grade_type,iofailtimes
                if (checkBox1.Checked == true)
                {
                    if (checkedListBox1.CheckedItems.Count > 0)
                    {
                        for (int items = 0; items < checkedListBox1.CheckedItems.Count; items++)
                        {
                            string judecode     = ((ComboboxItem)checkedListBox1.CheckedItems[items]).Value;
                            string judename     = ((ComboboxItem)checkedListBox1.CheckedItems[items]).Text;
                            string SFC          = textBox_sfc.Text.ToString();
                            string JudeCodeJson = client.RunServerAPI("BLL.SFC", "GetJudeSFC", judecode + "," + SFC);
                            if (string.IsNullOrEmpty(JudeCodeJson))
                            {
                                P_SFC_Jude sfc_jude = new P_SFC_Jude()
                                {
                                    jude_code = judecode,
                                    jude_name = judename,
                                    sfc       = SFC,
                                    state     = 0
                                };
                                string judejson = JsonToolsNet.ObjectToJson(sfc_jude);
                                client.RunServerAPI("BLL.SFC", "InsertSFCJude", judejson);
                            }
                            else
                            {
                                MessageBox.Show("该批次已存在[ " + judename + " ]的待判,不可重复", "提示");
                                return;
                            }
                        }
                    }
                    else
                    {
                        MessageBox.Show("请勾选待判名称", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }
                }
                string      strJson        = "";
                P_SFC_State clpsfcstateTmp = new P_SFC_State();
                clpsfcstateTmp.order_no   = strorderno;
                clpsfcstateTmp.SFC        = strsfc;
                clpsfcstateTmp.fail_times = 0;
                if (iRepairProcc == 1)  //降级
                {
                    if (string.IsNullOrWhiteSpace(kComboBox_ProductGrade.Text.Trim()))
                    {
                        MessageBox.Show("请先设置级别", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }
                    if (string.IsNullOrWhiteSpace(kComboBox_rebackprocess.Text.Trim()))
                    {
                        MessageBox.Show("请先设置返回工序", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }
                    clpsfcstateTmp.from_process = strfromprocess_code;
                    clpsfcstateTmp.now_process  = diczrprocess[this.kComboBox_rebackprocess.Text.ToString().Trim()];
                    if (clpsfcstateTmp.now_process == "END")
                    {
                        clpsfcstateTmp.state = 2;//该批次已完成,可以流向下一工序
                    }
                    else
                    {
                        clpsfcstateTmp.state = 1;  //设置状态为 1 ,未完成,,正常加工
                    }

                    B_Product_Grade clBProductGrade = new B_Product_Grade();
                    clBProductGrade           = dicProductGrade[kComboBox_ProductGrade.Text.Trim()];
                    clpsfcstateTmp.grade_id   = clBProductGrade.grade_id.ToString();
                    clpsfcstateTmp.grade_type = clBProductGrade.grade_type;
                    //order,sfc,nowprocess,state,failtimes,pass,grade_id,grade_type,iofailtimes
                    strJson = strorderno + "," + strsfc + "," + diczrprocess[this.kComboBox_rebackprocess.Text.ToString().Trim()]
                              + "," + "1" + "," + "0" + "," + "0" + "," + clBProductGrade.grade_id + "," + clBProductGrade.grade_type + "," + "0" + "," + strfromprocess_code;
                }
                else if (iRepairProcc == 2) //待判
                {
                    //待完善???
                }
                else if (iRepairProcc == 3)    //报废
                {
                    clpsfcstateTmp.state = -1; //设置状态为 -1 ,已报废

                    clpsfcstateTmp.now_process = "END";
                    //order,sfc,nowprocess,state,failtimes,pass,grade_id,grade_type,iofailtimes
                    strJson = strorderno + "," + strsfc + "," + "END" + "," + "-1" + "," + "0" + "," + "0" + "," + "grade_id" + "," + "grade_type" + "," + "0" + "," + strfromprocess_code;
                }
                else  //不做操作,直接返回指定工序
                {
                    if (string.IsNullOrWhiteSpace(kComboBox_rebackprocess.Text.Trim()))
                    {
                        MessageBox.Show("请先设置返回工序", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }
                    clpsfcstateTmp.state       = 1; //设置状态为 1 ,未完成,,正常加工
                    clpsfcstateTmp.now_process = diczrprocess[this.kComboBox_rebackprocess.Text.ToString().Trim()];
                    //order,sfc,nowprocess,state,failtimes,pass,grade_id,grade_type,iofailtimes
                    strJson = strorderno + "," + strsfc + "," + diczrprocess[this.kComboBox_rebackprocess.Text.ToString().Trim()]
                              + "," + "1" + "," + "0" + "," + "0" + "," + "grade_id" + "," + "grade_type" + "," + "0" + "," + strfromprocess_code;
                }

                str = client.RunServerAPI("BLL.SFC", "UpDataSFCInfoAndSFCIOLogData", strJson);
                if (!str.Contains("OK"))
                {
                    MessageBox.Show("更新P_SFC_State 失败 Or P_SFC_Process_IOLog 失败," + str, "错误", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
                //更新维修结果  P_FailLog  P_Fail_Detail
                P_FailLog clpfaillog = new P_FailLog();
                clpfaillog.fid = int.Parse(strfid);
                if (!string.IsNullOrWhiteSpace(kComboBox_Process.Text.Trim()))
                {
                    clpfaillog.process_code     = strfromprocess_code;
                    clpfaillog.Disposal_Process = strfromprocess_code;
                    #region
                    //if (diczrprocess.Keys.Contains(kComboBox_Process.Text.Trim()))
                    //{
                    //    clpfaillog.process_code = diczrprocess[kComboBox_Process.Text.Trim()];
                    //}
                    //else
                    //{
                    //    MessageBox.Show("请选择责任工序!");
                    //    return;
                    //}
                    //clpfaillog.Disposal_Process = diczrprocess[kComboBox_Process.Text.Trim()];
                    #endregion
                    //根据责任工序,找到责任人和工位
                    strJson = "";
                    strJson = strsfc + "," + clpfaillog.process_code;
                    str     = client.RunServerAPI("BLL.SFC", "GetSFCIOLogInfo", strJson);
                    if (string.IsNullOrWhiteSpace(str))
                    {
                        //
                    }
                    else
                    {
                        List <P_SFC_Process_IOLog> lstsfciolog = JsonConvert.DeserializeObject <List <P_SFC_Process_IOLog> >(str);
                        if (lstsfciolog.Count > 0)
                        {
                            clpfaillog.emp_code = lstsfciolog[0].emp_code;
                        }
                        if (ishebeifail == 1) //存在设备不良,需要根据工位代码找到设备代码
                        {
                            //根据工位,找到设备
                            str = client.RunServerAPI("BLL.Station", "GetStationEquipmentByStation", lstsfciolog[0].station_code);
                            if (string.IsNullOrWhiteSpace(str))
                            {
                                //
                            }
                            else
                            {
                                List <B_StationMachine> lststationequipment = JsonConvert.DeserializeObject <List <B_StationMachine> >(str);
                                if (lstsfciolog.Count > 0)
                                {
                                    clpfaillog.equipment_code = lststationequipment[0].machine_code;
                                }
                            }
                        }
                    }
                }
                if (iRepairProcc == 1) //降级
                {
                    clpfaillog.state = 1;
                }
                else if (iRepairProcc == 2) //待判
                {
                    //待完善???
                }
                else if (iRepairProcc == 3) //报废
                {
                    clpfaillog.state = 9;   //报废状态
                }
                else
                {
                    clpfaillog.state = 1;
                }
                if (!string.IsNullOrWhiteSpace(richTextBox_faildesc.Text.Trim()))
                {
                    clpfaillog.repair_remark = richTextBox_faildesc.Text.Trim();
                }
                str = "";
                str = client.RunServerAPI("BLL.Faillog", "UpdateFailLog", JsonConvert.SerializeObject(clpfaillog));
                if (!str.Contains("1"))
                {
                    MessageBox.Show("更新P_FailLog 失败" + str, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                str = "";
                str = client.RunServerAPI("BLL.Fail_Detail", "UpdateFail_Detail", JsonConvert.SerializeObject(lstpFailDetail));
                if (!str.Contains("1"))
                {
                    MessageBox.Show("更新P_Fail_Detail 失败" + str, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }
            catch (Exception exp)
            {
                MessageBox.Show("提交失败:" + exp.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            //提交完成
            MessageBox.Show("维修完成", "OK", MessageBoxButtons.OK, MessageBoxIcon.None);
            this.Close();
        }