Пример #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (Convert.ToInt32(numericUpDown1.Value) < 1)
            {
                ShowMeg(q(Msg_Type.msgprintnoempty));//"打印分数必须大于0"
                return;
            }
            if (List.Count == 0)
            {
                ShowMeg(q(Msg_Type.msgnowlpzclickinvalid));//"没有物料凭证数据点击无效"
                return;
            }
            ChoiceList = new List <ZSL_BCS303_BS>();
            List <ZSL_BCS303_BS> nodes1 = (List <ZSL_BCS303_BS>)JLdataGridView.DataSource;

            for (int i = 0; i < JLdataGridView.Rows.Count; i++)
            {
                if (this.JLdataGridView.Rows[i].Cells[0].EditedFormattedValue.ToString() == "True") //checkbox的是否勾选
                {
                    //count++;
                    //nodes1[i].JLR = Convert.ToInt32(getUserInfo("staffid"));
                    //nodes1[i].TMSX = (int)Print_Type.wlrk;
                    //nodes1[i].TMLB = 1;

                    ChoiceList.Add(nodes1[i]);
                }
            }
            if (ChoiceList.Count == 0)
            {
                ShowMeg(q(Msg_Type.msgatleastone));//"请至少选择一条数据"
                return;
            }

            for (int i = 0; i < ChoiceList.Count; i++)
            {
                ChoiceList[i].JLR  = Convert.ToInt32(getUserInfo("staffid"));
                ChoiceList[i].TMSX = (int)Print_Type.wlrkLot;
                ChoiceList[i].TMLB = 1;
                ChoiceList[i].MAC  = DeviceInfo.GetNetCardMAC().Substring(0, 17);
                bool b = judge.IsNo(ChoiceList[i].MTSL);
                if (!judge.IsNumber(ChoiceList[i].MTSL) && !string.IsNullOrEmpty(ChoiceList[i].MTSL))
                {
                    if (!judge.IsNo(ChoiceList[i].MTSL))
                    {
                        ShowMeg(string.Format(q(Msg_Type.msgmtslnodigital)));//ChoiceList[i].TM + "每托数量不是数字,请校验"
                        return;
                    }
                }
                if (string.IsNullOrEmpty(ChoiceList[i].TM))
                {
                    ShowMeg(string.Format(q(Msg_Type.msgfirstcreate), ChoiceList[i].MBLNR, ChoiceList[i].ZEILE));//"请首先生成" + ChoiceList[i].MBLNR + "-" + ChoiceList[i].ZEILE  + "的条码"
                    return;
                }
                else
                {
                    Sonluk.UI.Model.MES.TM_TMINFOService.SELECT_MES_TM_TMINFO_PRINT tmInfo = ServicModel.TM_TMINFO.SELECT_BYID_CHILD(ChoiceList[i].WERKS, ChoiceList[i].TM, getToken());
                    if (!tmInfo.MES_RETURN.TYPE.Equals("S"))
                    {
                        ShowMeg(ChoiceList[i].MBLNR + "-" + ChoiceList[i].ZEILE + q(Msg_Type.msgcreatetmexpect) + tmInfo.MES_RETURN.MESSAGE);//"生成的条码异常,"
                        return;
                    }
                    if (string.IsNullOrEmpty(ChoiceList[i].TS.ToString()) || ChoiceList[i].TS == 0)
                    {
                        ShowMeg(string.Format(q(Msg_Type.msgcctmtsnoempty), ChoiceList[i].TM));//"条码" + ChoiceList[i].TM + "托数不能为0"
                        return;
                    }
                    else
                    {
                        if (ChoiceList[i].QSTH == null)
                        {
                            ShowMeg(q(Msg_Type.msgqsthqtone));//"起始托号必须大于1"
                            return;
                        }
                    }
                }
            }



            ZBCFUN_PURBS_READ res = ServicModel.MES_WLKCBS.INSERT_TM_WLPZ(ChoiceList.ToArray(), 2, getToken());

            if (res.MES_RETURN.TYPE.Equals("S"))
            {
                PrintWLKCLot(res.ET_PURBS.ToList(), Convert.ToInt32(numericUpDown1.Value), Print_Type.wlrkLot);
            }
            else
            {
                ShowMeg(res.MES_RETURN.MESSAGE);
            }
        }
Пример #2
0
        private void dybutton_Click(object sender, EventArgs e)
        {
            if (Convert.ToInt32(numericUpDown1.Value) < 1)
            {
                ShowMeg("打印分数必须大于0");
                return;
            }
            if (List.Count == 0)
            {
                ShowMeg("没有物料凭证数据点击无效");
                return;
            }
            ChoiceList = new List <ZSL_BCS303_BS>();
            List <ZSL_BCS303_BS> nodes1 = (List <ZSL_BCS303_BS>)JLdataGridView.DataSource;
            int count = 0;

            for (int i = 0; i < JLdataGridView.Rows.Count; i++)
            {
                if (this.JLdataGridView.Rows[i].Cells[0].EditedFormattedValue.ToString() == "True") //checkbox的是否勾选
                {
                    count++;
                    nodes1[i].JLR  = Convert.ToInt32(getUserInfo("staffid"));
                    nodes1[i].TMSX = (int)Print_Type.wlrk;
                    nodes1[i].TMLB = 1;
                    nodes1[i].MAC  = DeviceInfo.GetNetCardMAC().Substring(0, 17);
                    ChoiceList.Add(nodes1[i]);
                }
            }
            bool isPass = true;

            for (int i = 0; i < ChoiceList.Count; i++)
            {
                if (ChoiceList[i].XCBS.Equals("Y") && string.IsNullOrEmpty(ChoiceList[i].XCZJTM))
                {
                    ShowMeg(ChoiceList[i].MBLNR + "-" + ChoiceList[i].ZEILE + "需要绑定下层码信息");
                    isPass = false;
                    break;
                }
            }


            if (isPass)
            {
                if (count == 0)
                {
                    ShowMeg("请至少选择一条数据");
                    return;
                }
                else
                {
                    ZBCFUN_PURBS_READ res = ServicModel.MES_WLKCBS.INSERT_TM_WLPZ(ChoiceList.ToArray(), 1, getToken());
                    if (res.MES_RETURN.TYPE.Equals("S"))
                    {
                        //model.MBLNR = list.MBLNR;
                        //model.XCBS = list.XCBS;
                        //model.MJAHR = list.MJAHR;
                        //model.LINE_ID = list.LINE_ID;
                        //model.LIFNR = list.LIFNR;
                        if (res.ET_PURBS.Length > 0)
                        {
                            for (int i = 0; i < res.ET_PURBS.Length; i++)
                            {
                                for (int j = 0; j < List.Count; j++)
                                {
                                    if (res.ET_PURBS[i].MBLNR == List[j].MBLNR && res.ET_PURBS[i].MJAHR == List[j].MJAHR && res.ET_PURBS[i].LINE_ID == List[j].LINE_ID)
                                    {
                                        List[j].TM = res.ET_PURBS[i].TM;
                                    }
                                }
                            }
                        }
                        JLdataGridView.DataSource = new List <ZSL_BCS303_BS>();
                        JLdataGridView.DataSource = List;
                        JLdataGridView.ClearSelection();
                        Type         type = JLdataGridView.GetType();
                        PropertyInfo pi   = type.GetProperty("DoubleBuffered", BindingFlags.Instance | BindingFlags.NonPublic);
                        pi.SetValue(JLdataGridView, true, null);
                        for (int i = 0; i < ChoiceList.Count; i++)
                        {
                            //PrintInfoByTM(ChoiceList[i].TM, ChoiceList[i].WERKS, 1, Rigth_Type.wlrkdy, Print_Type.wlrk);
                            Sonluk.UI.Model.MES.TM_TMINFOService.SELECT_MES_TM_TMINFO_PRINT res2 = ServicModel.TM_TMINFO.SELECT_BYID_CHILD(ChoiceList[i].WERKS, ChoiceList[i].TM, getToken());
                            if (res2.MES_RETURN.TYPE.Equals("S"))
                            {
                                List <Sonluk.UI.Model.MES.TM_TMINFOService.SELECT_MES_TM_TMINFO_PRINT> nodes = new List <Sonluk.UI.Model.MES.TM_TMINFOService.SELECT_MES_TM_TMINFO_PRINT>();
                                nodes.Add(res2);

                                PrintInfo(Convert.ToInt32(numericUpDown1.Value), ChoiceList[i].XS.ToString(), ChoiceList[i].TS.ToString(), nodes.ToArray(), Rigth_Type.wlrkdy, Print_Type.wlrk);
                            }
                            else
                            {
                                ShowMeg(res2.MES_RETURN.MESSAGE);
                            }
                        }
                    }
                    else
                    {
                        ShowMeg(res.MES_RETURN.MESSAGE);
                    }
                }
            }
        }