コード例 #1
0
        private void cxbutton_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(slrqfromdateTimePicker.Text.Trim()))
            {
                //ShowMeg("输入开始时间不能为空");
                ShowMeg(q(Msg_Type.msgslkssjnoempty));
                return;
            }
            if (string.IsNullOrEmpty(slrqtodateTimePicker.Text.Trim()))
            {
                //ShowMeg("输入结束时间不能为空");
                ShowMeg(q(Msg_Type.msgsljssjnoempty));
                return;
            }
            TimeSpan slrqtspan = Convert.ToDateTime(slrqfromdateTimePicker.Text.Trim()) - Convert.ToDateTime(slrqtodateTimePicker.Text.Trim());

            if (slrqtspan.Minutes > 0)
            {
                //ShowMeg("输入开始日期不能大于输入结束日期");
                ShowMeg(q(Msg_Type.msgslksqtjs));
                return;
            }

            ZSL_BCS303_CT zModel = new ZSL_BCS303_CT();

            if (!string.IsNullOrEmpty(gzrqfromtextBox.Text.Trim()))
            {
                if (judge.IsDate(gzrqfromtextBox.Text.Trim()) == false)
                {
                    //ShowMeg("过账开始日期不是正确的日期格式");
                    ShowMeg(q(Msg_Type.msggzksformat));
                    return;
                }
                ;
                zModel.BUDAT_ST = Convert.ToDateTime(gzrqfromtextBox.Text.Trim()).ToString("yyyyMMdd");
            }
            if (!string.IsNullOrEmpty(gzrqtotextBox.Text.Trim()))
            {
                if (judge.IsDate(gzrqtotextBox.Text.Trim()) == false)
                {
                    //ShowMeg("过账结束日期不是正确的日期格式");
                    ShowMeg(q(Msg_Type.msggzjsformat));
                    return;
                }
                zModel.BUDAT_ED = Convert.ToDateTime(gzrqtotextBox.Text.Trim()).ToString("yyyyMMdd");
            }
            if (!string.IsNullOrEmpty(gzrqtotextBox.Text.Trim()) && !string.IsNullOrEmpty(gzrqtotextBox.Text.Trim()))
            {
                TimeSpan tspan = Convert.ToDateTime(gzrqtotextBox.Text.Trim()) - Convert.ToDateTime(gzrqfromtextBox.Text.Trim());
                if (tspan.Days < 0)
                {
                    //ShowMeg("过账开始日期不能大于过账结束日期");
                    ShowMeg(q(Msg_Type.msggzksqtjs));
                    return;
                }
            }
            //if (!string.IsNullOrEmpty(gzrqfromtextBox.Text.Trim()))
            //{
            //    if (judge.IsDate(gzrqfromtextBox.Text.Trim()) == false)
            //    {
            //        ShowMeg("过账开始日期不是正确的日期格式");
            //        return;
            //    };
            //    zModel.BUDAT_ST = Convert.ToDateTime(gzrqfromtextBox.Text.Trim()).ToString("yyyyMMdd");
            //}
            //if (!string.IsNullOrEmpty(gzrqtotextBox.Text.Trim()))
            //{
            //    if (judge.IsDate(gzrqtotextBox.Text.Trim()) == false)
            //    {
            //        ShowMeg("过账结束日期不是正确的日期格式");
            //        return;
            //    }
            //    zModel.BUDAT_ED = Convert.ToDateTime(gzrqtotextBox.Text.Trim()).ToString("yyyyMMdd");
            //}

            //if (!Convert.ToDateTime(gzrqfromdateTimePicker.Text.Trim()).ToString("yyyy-MM-dd").Equals("1900-01-01"))
            //{
            //    zModel.BUDAT_ST = Convert.ToDateTime(gzrqfromdateTimePicker.Text.Trim()).ToString("yyyyMMdd");
            //}
            //if (!Convert.ToDateTime(gzrqtodateTimePicker.Text.Trim()).ToString("yyyy-MM-dd").Equals("9998-12-31"))
            //{
            //    zModel.BUDAT_ED = Convert.ToDateTime(gzrqtodateTimePicker.Text.Trim()).ToString("yyyyMMdd");
            //}
            if (!string.IsNullOrEmpty(wlpztextBox.Text.Trim()))
            {
                if (judge.IsNumber(wlpztextBox.Text.Trim()) && wlpztextBox.Text.Trim().Length == 10)
                {
                    zModel.MBLNR = wlpztextBox.Text.Trim();
                }
                else
                {
                    ShowMeg(q(Msg_Type.msgwlpzlengthtendigital));//"物料凭证是10位数的数字"
                    return;
                }
            }
            if (!string.IsNullOrEmpty(tmtextBox.Text.Trim()))
            {
                if (tmtextBox.Text.Length != 12)
                {
                    ShowMeg(q(Msg_Type.msgtmlengthtwelve));//"条码长度不正确,正确的条码长度是12位"
                    return;
                }
                else
                {
                    zModel.TM = tmtextBox.Text.Trim().ToUpper();
                }
            }
            if (!Convert.ToString(gccomboBox.SelectedValue).Equals("0"))
            {
                zModel.WERKS = Convert.ToString(gccomboBox.SelectedValue);
            }
            else
            {
                ShowMeg(q(Msg_Type.msggcnoempty));//"工厂信息不能为空"
                return;
            }
            if (!string.IsNullOrEmpty(pctextBox.Text.Trim()))
            {
                zModel.CHARG = pctextBox.Text.Trim();
            }
            if (!string.IsNullOrEmpty(wlbmtextBox.Text.Trim()))
            {
                zModel.MATNR = wlbmtextBox.Text.Trim();
            }
            if (!string.IsNullOrEmpty(cgddtextBox.Text.Trim()))
            {
                zModel.EBELN = cgddtextBox.Text.Trim();
            }
            if (!string.IsNullOrEmpty(gystextBox.Text.Trim()))
            {
                zModel.LIFNR = gystextBox.Text.Trim();
            }

            //if (!string.IsNullOrEmpty(gzrqfromtextBox.Text.Trim()) && !string.IsNullOrEmpty(gzrqtotextBox.Text.Trim()))
            //{
            //    if (Convert.ToDateTime(gzrqfromtextBox.Text.Trim()) > Convert.ToDateTime(gzrqtotextBox.Text.Trim()))
            //    {
            //        ShowMeg("过账开始日期不能大于结束日期");
            //        return;
            //    }
            //}


            zModel.ISNOTPRINT = wdycheckBox.Checked;
            zModel.CPUDT_ST   = Convert.ToDateTime(slrqfromdateTimePicker.Text).ToString("yyyyMMdd");
            zModel.CPUDT_ED   = Convert.ToDateTime(slrqtodateTimePicker.Text).ToString("yyyyMMdd");
            zModel.CPUTM_ST   = Convert.ToDateTime(slrqfromdateTimePicker.Text).ToString("HHmmss");
            zModel.CPUTM_ED   = Convert.ToDateTime(slrqtodateTimePicker.Text).ToString("HHmmss");
            zModel.STAFFID    = Convert.ToInt32(getUserInfo("staffid"));
            if (dbpzcheckBox.Checked)
            {
                zModel.DBBS = "Y";
                if (Convert.ToString(kcdfcomboBox.SelectedValue).Equals("0"))
                {
                    ShowMeg(q(Msg_Type.msgdbpzneedkcdf));//"调拨凭证必须输入库存地点"
                    return;
                }
            }
            else
            {
                zModel.DBBS = "";
            }
            if (!Convert.ToString(kcdfcomboBox.SelectedValue).Equals("0"))
            {
                zModel.LGORT = Convert.ToString(kcdfcomboBox.SelectedValue);
            }
            ZBCFUN_PURBS_READ res = ServicModel.MES_WLKCBS.GET_WLPZ(zModel, getToken());

            if (res.MES_RETURN.TYPE.Equals("S"))
            {
                if (res.ET_PURBS.Length == 0)
                {
                    List = new List <ZSL_BCS303_BS>();
                    JLdataGridView.DataSource = List;
                    Type         type = JLdataGridView.GetType();
                    PropertyInfo pi   = type.GetProperty("DoubleBuffered", BindingFlags.Instance | BindingFlags.NonPublic);
                    pi.SetValue(JLdataGridView, true, null);
                    ShowMeg(q(Msg_Type.msgnodata));//"未查询到数据"
                }
                else
                {
                    List = res.ET_PURBS.ToList();
                    //for (int i = 0; i < List.Count; i++)
                    //{
                    //    List[i].QSTH = "1";
                    //}
                    JLdataGridView.DataSource = res.ET_PURBS.ToList();
                    JLdataGridView.ClearSelection();

                    Type         type = JLdataGridView.GetType();
                    PropertyInfo pi   = type.GetProperty("DoubleBuffered", BindingFlags.Instance | BindingFlags.NonPublic);
                    pi.SetValue(JLdataGridView, true, null);
                }
            }
            else
            {
                List = new List <ZSL_BCS303_BS>();
                JLdataGridView.DataSource = List;
                Type         type = JLdataGridView.GetType();
                PropertyInfo pi   = type.GetProperty("DoubleBuffered", BindingFlags.Instance | BindingFlags.NonPublic);
                pi.SetValue(JLdataGridView, true, null);
                ShowMeg(res.MES_RETURN.MESSAGE);
            }
        }
コード例 #2
0
        private void smbutton_Click(object sender, EventArgs e)
        {
            //if (Convert.ToInt32(numericUpDown1.Value) < 1)
            //{
            //    ShowMeg("打印分数必须大于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;

            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]);
                }
            }

            int existCount = ChoiceList.Count(p => p.TM.Length == 12);

            if (existCount == ChoiceList.Count)
            {
                ShowMeg(q(Msg_Type.msgchoicerowalreadytm));//"选择的数据行都已存在条码"
                return;
            }


            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 + q(Msg_Type.msgneedxcm));//"需要绑定下层码信息"
                    isPass = false;
                    break;
                }
            }


            if (isPass)
            {
                if (count == 0)
                {
                    ShowMeg(q(Msg_Type.msgatleastone));//"请至少选择一条数据"
                    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);
                        //PrintWLKC(ChoiceList, Convert.ToInt32(numericUpDown1.Value), Print_Type.wlrk);
                        ShowMeg(q(Msg_Type.msgcreatetmsuccess), 1500);//"生码成功"
                    }
                    else
                    {
                        ShowMeg(res.MES_RETURN.MESSAGE);
                    }
                }
            }
        }
コード例 #3
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);
            }
        }
コード例 #4
0
        public frmBindXCM(ZSL_BCS303_BS list, int rowindex)
        {
            InitializeComponent();
            BomdataGridView.AutoGenerateColumns = false;
            dataGridView2.AutoGenerateColumns   = false;
            RowIndex      = rowindex;
            XCList        = new List <UI.Model.MES.MES_WLKCBSService.ZSL_BCS303_BS>();
            BindList      = new List <MES_TM_TMINFO_LIST>();
            ZSL_BCS303_BS = list;



            wlpzlabel.Text = q(Msg_Type.titlewlpzxmnd) + list.MBLNR + "/" + list.ZEILE + "/" + list.MJAHR; //"物料凭证/项目/年度:"
            wlxxlabel.Text = q(Msg_Type.titlewlxx) + list.MATNR + "/" + list.MAKTX;                        //"物料信息:"
            gyslabel.Text  = q(Msg_Type.titlegysxx) + list.LIFNR + "/" + list.SORTL;                       //"供应商信息:"
            cglabel.Text   = q(Msg_Type.titlepo) + list.EBELN + "/" + list.EBELP;                          //"采购订单/项目:"

            ZSL_BCS303_BS model = new UI.Model.MES.MES_WLKCBSService.ZSL_BCS303_BS();

            model.MBLNR   = list.MBLNR;
            model.XCBS    = list.XCBS;
            model.MJAHR   = list.MJAHR;
            model.LINE_ID = list.LINE_ID;
            model.LIFNR   = list.LIFNR;
            ZBCFUN_PURBS_READ res1 = ServicModel.MES_WLKCBS.GET_WLPZ_ZJ(model, getToken());;

            if (res1.MES_RETURN.TYPE.Equals("S"))
            {
                XCList = res1.ET_PURBS.ToList();
                for (int i = 0; i < res1.ET_PURBS.Length; i++)
                {
                    res1.ET_PURBS[i].MATNR = res1.ET_PURBS[i].MATNR + "/" + res1.ET_PURBS[i].MAKTX;
                }
                BomdataGridView.DataSource = res1.ET_PURBS;
            }
            else
            {
                ShowMeg(res1.MES_RETURN.MESSAGE);
            }


            MES_TM_TMINFO tmmodel = new MES_TM_TMINFO();

            string[] xcmArr = list.XCZJTM.Split(',');
            for (int j = 0; j < xcmArr.Length; j++)
            {
                tmmodel.TM = xcmArr[j];
                SELECT_MES_TM_TMINFO_BYTM res = ServicModel.TM_TMINFO.SELECT_BYTM(tmmodel, 0, getToken());
                if (res.MES_RETURN.TYPE.Equals("S"))
                {
                    for (int i = 0; i < res.MES_TM_TMINFO_LIST.Length; i++)
                    {
                        BindList.Add(res.MES_TM_TMINFO_LIST[i]);
                    }
                    for (int i = 0; i < BindList.Count; i++)
                    {
                        BindList[i].XH   = i + 1;
                        BindList[i].WLMS = BindList[i].WLH + "/" + BindList[i].WLMS;
                    }
                    dataGridView2.DataSource = new List <MES_TM_TMINFO_LIST>();
                    dataGridView2.DataSource = BindList;
                    dataGridView2.ClearSelection();
                }
            }
        }
コード例 #5
0
        private void cxbutton_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(slrqfromdateTimePicker.Text.Trim()))
            {
                ShowMeg("输入开始时间不能为空");
                return;
            }
            if (string.IsNullOrEmpty(slrqtodateTimePicker.Text.Trim()))
            {
                ShowMeg("输入开始时间不能为空");
                return;
            }



            ZSL_BCS303_CT zModel = new ZSL_BCS303_CT();

            if (!string.IsNullOrEmpty(gzrqfromtextBox.Text.Trim()))
            {
                if (judge.IsDate(gzrqfromtextBox.Text.Trim()) == false)
                {
                    ShowMeg("过账开始日期不是正确的日期格式");
                    return;
                }
                ;
                zModel.BUDAT_ST = Convert.ToDateTime(gzrqfromtextBox.Text.Trim()).ToString("yyyyMMdd");
            }
            if (!string.IsNullOrEmpty(gzrqtotextBox.Text.Trim()))
            {
                if (judge.IsDate(gzrqtotextBox.Text.Trim()) == false)
                {
                    ShowMeg("过账结束日期不是正确的日期格式");
                    return;
                }
                zModel.BUDAT_ED = Convert.ToDateTime(gzrqtotextBox.Text.Trim()).ToString("yyyyMMdd");
            }
            if (!string.IsNullOrEmpty(gzrqtotextBox.Text.Trim()) && !string.IsNullOrEmpty(gzrqtotextBox.Text.Trim()))
            {
                TimeSpan tspan = Convert.ToDateTime(gzrqtotextBox.Text.Trim()) - Convert.ToDateTime(gzrqfromtextBox.Text.Trim());
                if (tspan.Days < 0)
                {
                    ShowMeg("过账开始日期不能大于过账结束日期");
                    return;
                }
            }
            //if (!string.IsNullOrEmpty(gzrqfromtextBox.Text.Trim()))
            //{
            //    if (judge.IsDate(gzrqfromtextBox.Text.Trim()) == false)
            //    {
            //        ShowMeg("过账开始日期不是正确的日期格式");
            //        return;
            //    };
            //    zModel.BUDAT_ST = Convert.ToDateTime(gzrqfromtextBox.Text.Trim()).ToString("yyyyMMdd");
            //}
            //if (!string.IsNullOrEmpty(gzrqtotextBox.Text.Trim()))
            //{
            //    if (judge.IsDate(gzrqtotextBox.Text.Trim()) == false)
            //    {
            //        ShowMeg("过账结束日期不是正确的日期格式");
            //        return;
            //    }
            //    zModel.BUDAT_ED = Convert.ToDateTime(gzrqtotextBox.Text.Trim()).ToString("yyyyMMdd");
            //}

            //if (!Convert.ToDateTime(gzrqfromdateTimePicker.Text.Trim()).ToString("yyyy-MM-dd").Equals("1900-01-01"))
            //{
            //    zModel.BUDAT_ST = Convert.ToDateTime(gzrqfromdateTimePicker.Text.Trim()).ToString("yyyyMMdd");
            //}
            //if (!Convert.ToDateTime(gzrqtodateTimePicker.Text.Trim()).ToString("yyyy-MM-dd").Equals("9998-12-31"))
            //{
            //    zModel.BUDAT_ED = Convert.ToDateTime(gzrqtodateTimePicker.Text.Trim()).ToString("yyyyMMdd");
            //}
            if (!string.IsNullOrEmpty(wlpztextBox.Text.Trim()))
            {
                zModel.MBLNR = wlpztextBox.Text.Trim();
            }
            if (!string.IsNullOrEmpty(tmtextBox.Text.Trim()))
            {
                if (tmtextBox.Text.Length != 12)
                {
                    ShowMeg("条码长度不正确,正确的条码长度是12位");
                    return;
                }
                else
                {
                    zModel.TM = tmtextBox.Text.Trim().ToUpper();
                }
            }
            if (!string.IsNullOrEmpty(pctextBox.Text.Trim()))
            {
                zModel.CHARG = pctextBox.Text.Trim();
            }
            if (!string.IsNullOrEmpty(wlbmtextBox.Text.Trim()))
            {
                zModel.MATNR = wlbmtextBox.Text.Trim();
            }
            if (!string.IsNullOrEmpty(cgddtextBox.Text.Trim()))
            {
                zModel.EBELN = cgddtextBox.Text.Trim();
            }
            if (!string.IsNullOrEmpty(gystextBox.Text.Trim()))
            {
                zModel.LIFNR = gystextBox.Text.Trim();
            }

            //if (!string.IsNullOrEmpty(gzrqfromtextBox.Text.Trim()) && !string.IsNullOrEmpty(gzrqtotextBox.Text.Trim()))
            //{
            //    if (Convert.ToDateTime(gzrqfromtextBox.Text.Trim()) > Convert.ToDateTime(gzrqtotextBox.Text.Trim()))
            //    {
            //        ShowMeg("过账开始日期不能大于结束日期");
            //        return;
            //    }
            //}



            zModel.WERKS = Convert.ToString(gccomboBox.SelectedValue);
            zModel.LGORT = Convert.ToString(kcdfcomboBox.SelectedValue);


            zModel.ISNOTPRINT = wdycheckBox.Checked;
            zModel.CPUDT_ST   = Convert.ToDateTime(slrqfromdateTimePicker.Text).ToString("yyyyMMdd");
            zModel.CPUDT_ED   = Convert.ToDateTime(slrqtodateTimePicker.Text).ToString("yyyyMMdd");
            zModel.CPUTM_ST   = Convert.ToDateTime(slrqfromdateTimePicker.Text).ToString("HHmmss");
            zModel.CPUTM_ED   = Convert.ToDateTime(slrqtodateTimePicker.Text).ToString("HHmmss");
            ZBCFUN_PURBS_READ res = ServicModel.MES_WLKCBS.GET_WLPZ(zModel, getToken());

            if (res.MES_RETURN.TYPE.Equals("S"))
            {
                if (res.ET_PURBS.Length == 0)
                {
                    List = new List <ZSL_BCS303_BS>();
                    JLdataGridView.DataSource = List;
                    Type         type = JLdataGridView.GetType();
                    PropertyInfo pi   = type.GetProperty("DoubleBuffered", BindingFlags.Instance | BindingFlags.NonPublic);
                    pi.SetValue(JLdataGridView, true, null);
                    ShowMeg("未查询到数据");
                }
                else
                {
                    List = res.ET_PURBS.ToList();
                    JLdataGridView.DataSource = res.ET_PURBS.ToList();
                    JLdataGridView.ClearSelection();

                    Type         type = JLdataGridView.GetType();
                    PropertyInfo pi   = type.GetProperty("DoubleBuffered", BindingFlags.Instance | BindingFlags.NonPublic);
                    pi.SetValue(JLdataGridView, true, null);
                }
            }
            else
            {
                List = new List <ZSL_BCS303_BS>();
                JLdataGridView.DataSource = List;
                Type         type = JLdataGridView.GetType();
                PropertyInfo pi   = type.GetProperty("DoubleBuffered", BindingFlags.Instance | BindingFlags.NonPublic);
                pi.SetValue(JLdataGridView, true, null);
                ShowMeg(res.MES_RETURN.MESSAGE);
            }
        }
コード例 #6
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);
                    }
                }
            }
        }