Example #1
0
        public void UpdateXCM(string xcmStr, int rowIndex)
        {
            JLdataGridView.DataSource = List;
            List[rowIndex].XCZJTM     = xcmStr;
            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);
        }
Example #2
0
        public void configgridviewData(string rbbh)
        {
            Gridview = new List <gridview>();
            SELECT_MES_PD_SCRW_ZX_LIST res = ServicModel.PD_SCRW.SELECT_ZX_LIST(rbbh, getToken());

            if (res.MES_RETURN.TYPE.Equals("S"))
            {
                for (int i = 0; i < res.MES_TM_TMINFO_LIST.Length; i++)
                {
                    Sonluk.UI.Model.MES.PD_SCRWService.MES_TM_TMINFO_LIST data = res.MES_TM_TMINFO_LIST[i];
                    gridview node = new gridview();
                    node.Zh = data.TH;
                    //node.Ksrq = Convert.ToDateTime(data.KSTIME).ToString("yyyy-MM-dd");
                    //node.Kssj = Convert.ToDateTime(data.KSTIME).ToString("HH:mm");
                    //node.Jsrq = Convert.ToDateTime(data.JSTIME).ToString("yyyy-MM-dd");
                    //node.Jssj = Convert.ToDateTime(data.JSTIME).ToString("HH:mm");

                    if (!string.IsNullOrEmpty(data.KSTIME))
                    {
                        node.Kstime = Convert.ToDateTime(data.KSTIME).ToString("yyyy-MM-dd HH:mm:ss");
                    }
                    else
                    {
                        node.Kstime = "";
                    }
                    if (!string.IsNullOrEmpty(data.JSTIME))
                    {
                        node.Jstime = Convert.ToDateTime(data.JSTIME).ToString("yyyy-MM-dd HH:mm:ss");
                    }
                    else
                    {
                        node.Jstime = "";
                    }

                    node.Tm   = data.TM;
                    node.Dcxh = data.DCXHMS;
                    node.Dcdj = data.DCDJMS;
                    node.Jlsj = data.JLTIME;
                    Gridview.Add(node);
                }
                Gridview = (from o in Gridview orderby o.Zh select o).ToList();
                JLdataGridView.DataSource = Gridview;
                JLdataGridView.ClearSelection();
            }
            else
            {
                ShowMeg(res.MES_RETURN.MESSAGE);
            }
        }
Example #3
0
        public void ConfigTable(bool ISrwd)
        {
            MES_TM_TMINFO model = new MES_TM_TMINFO();

            model.MAC = DeviceInfo.GetNetCardMAC().Substring(0, 17);
            if (ISrwd)
            {
                model.RWBH = Rwbh;
            }
            model.WLLB = Wllb;
            DateTime sy_dt = Convert.ToDateTime(ServicModel.PUBLIC_FUNC.GET_TIME(getToken())).AddHours(-4);

            model.JLJSTIME = sy_dt.ToString("yyyy-MM-dd");
            model.JLKSTIME = sy_dt.ToString("yyyy-MM-dd");
            if (RigthType == Rigth_Type.zhengjicc)
            {
                model.GZZXBH = SBHID;
            }
            else
            {
                model.SBBH = SBHID;
            }

            SELECT_MES_TM_TMINFO_BYTM res = ServicModel.TM_TMINFO.SELECT(model, getToken());

            if (res.MES_RETURN.TYPE.Equals("S"))
            {
                TM_list = res.MES_TM_TMINFO_LIST.ToList();
                if (res.MES_TM_TMINFO_LIST.Length == 0)
                {
                    ShowMeg(q(Msg_Type.msgtodaynodata));//"当天没有对应的数据"
                }
                else
                {
                    JLdataGridView.DataSource = TM_list;

                    Type         type = JLdataGridView.GetType();
                    PropertyInfo pi   = type.GetProperty("DoubleBuffered", BindingFlags.Instance | BindingFlags.NonPublic);
                    pi.SetValue(JLdataGridView, true, null);
                    JLdataGridView.ClearSelection();
                }
            }
            else
            {
                ShowMeg(res.MES_RETURN.MESSAGE);
            }
            dybutton.Select();
        }
Example #4
0
        private void cxbutton_Click(object sender, EventArgs e)
        {
            //MES_SY_TYPEMXLIST[] wllbArr = ServicModel.SY_TYPEMX.SELECT(typeModel, getToken());
            //List<MES_SY_TYPEMXLIST> wllblist = wllbArr.ToList();
            //MES_SY_TYPEMXLIST choicwllb = new MES_SY_TYPEMXLIST();
            //choicwllb.ID = 0;
            //choicwllb.MXNAME = "==请选择==";
            //wllblist.Insert(0, choicwllb);
            MES_TM_TMINFO model = new MES_TM_TMINFO();

            if (!Convert.ToString(gccomboBox.SelectedValue).Equals("0"))
            {
                model.GC = Convert.ToString(gccomboBox.SelectedValue);
            }
            if (gzzxcomboBox.SelectedValue != null)
            {
                if (!Convert.ToString(gzzxcomboBox.SelectedValue).Equals("0"))
                {
                    model.GZZXBH = Convert.ToString(gzzxcomboBox.SelectedValue);
                }
            }
            if (!Convert.ToString(sbhcomboBox.SelectedValue).Equals("0"))
            {
                model.SBBH = Convert.ToString(sbhcomboBox.SelectedValue);
            }
            if (!string.IsNullOrEmpty(tmtextBox.Text.Trim()))
            {
                if (tmtextBox.Text.Trim().Length == 12)// && tmtextBox.Text.Trim().ToUpper().StartsWith("P"))
                {
                    model.TM = tmtextBox.Text.Trim();
                }
                else
                {
                    //ShowMeg("条码格式是P开头的12位信息,请核对");
                    ShowMeg(q(Msg_Type.msgtmstartwithP));
                    return;
                }
            }
            if (!string.IsNullOrEmpty(wlbmtextBox.Text.Trim()))
            {
                model.WLH = wlbmtextBox.Text.Trim();
            }
            if (!string.IsNullOrEmpty(xsddtextBox.Text.Trim()))
            {
                model.NOBILL = xsddtextBox.Text.Trim();
            }

            if (!string.IsNullOrEmpty(thtextBox.Text.Trim()))
            {
                if (judge.IsNumber(thtextBox.Text.Trim()))
                {
                    model.TH = Convert.ToInt32(thtextBox.Text.Trim());
                }
                else
                {
                    //ShowMeg("桶号必须是数字");
                    ShowMeg(q(Msg_Type.msgthisdigital));
                    return;
                }
            }
            if (!string.IsNullOrEmpty(erptextBox.Text.Trim()))
            {
                if (erptextBox.Text.Trim().Length == 8)
                {
                    model.ERPNO = erptextBox.Text.Trim();
                }
                else
                {
                    //ShowMeg("ERP工单是有效的8位信息");
                    ShowMeg(q(Msg_Type.msgerpdglengtheigth));
                    return;
                }
            }
            if (!string.IsNullOrEmpty(rwdtextBox.Text.Trim()))
            {
                if (rwdtextBox.Text.Trim().Length == 11)
                {
                    model.RWBH = rwdtextBox.Text.Trim().ToUpper();
                }
                else
                {
                    //ShowMeg("任务单是有效的11位信息");
                    ShowMeg(q(Msg_Type.msgrwdlengtheleven));
                    return;
                }
            }
            if (!string.IsNullOrEmpty(pctextBox.Text.Trim()))
            {
                model.PC = Convert.ToString(pctextBox.Text.Trim());
            }
            //if (!string.IsNullOrEmpty(scrqtextBox.Text.Trim()))
            //{
            //    if (judge.IsDate(scrqtextBox.Text.Trim()))
            //    {
            //        model.SCDATE = scrqtextBox.Text.Trim();
            //    }
            //    else
            //    {
            //        ShowMeg("生产日期不是有效的时间格式");
            //        return;
            //    }
            //}
            //if (!string.IsNullOrEmpty(jlrqfromtextBox.Text.Trim()))
            //{
            //      if (judge.IsDate(jlrqfromtextBox.Text.Trim()))
            //    {
            //        model.JLKSTIME = Convert.ToDateTime(jlrqfromtextBox.Text.Trim()).ToString("yyyy-MM-dd");
            //    }
            //    else
            //    {
            //        ShowMeg("记录开始日期不是有效的时间格式");
            //        return;
            //    }
            //}
            //if (!string.IsNullOrEmpty(jlrqtotextBox.Text.Trim()))
            //{
            //    if (judge.IsDate(jlrqtotextBox.Text.Trim()))
            //    {
            //        model.JLJSTIME = Convert.ToDateTime(jlrqtotextBox.Text.Trim()).ToString("yyyy-MM-dd");
            //    }
            //    else
            //    {
            //        ShowMeg("记录结束日期不是有效的时间格式");
            //        return;
            //    }
            //}

            if (!string.IsNullOrEmpty(scrqtextBox.Text.Trim()))
            {
                if (judge.IsDate(scrqtextBox.Text.Trim()))
                {
                    model.SCDATE = scrqtextBox.Text.Trim();
                }
                else
                {
                    //ShowMeg("生产日期不是正确的日期格式");
                    ShowMeg(q(Msg_Type.msgscrqformat));
                }
            }
            if (!string.IsNullOrEmpty(jlrqfromtextBox.Text.Trim()))
            {
                if (judge.IsDate(jlrqfromtextBox.Text.Trim()))
                {
                    model.JLKSTIME = jlrqfromtextBox.Text.Trim();
                }
                else
                {
                    //ShowMeg("记录开始日期不是正确的日期格式");
                    ShowMeg(q(Msg_Type.msgjlksrqformat));
                }
            }
            if (!string.IsNullOrEmpty(jlrqtotextBox.Text.Trim()))
            {
                if (judge.IsDate(jlrqtotextBox.Text.Trim()))
                {
                    model.JLJSTIME = jlrqtotextBox.Text.Trim();
                }
                else
                {
                    //ShowMeg("记录结束日期不是正确的日期格式");
                    ShowMeg(q(Msg_Type.msgjljsrqformat));
                }
            }
            if (!string.IsNullOrEmpty(jlrqfromtextBox.Text.Trim()) && !string.IsNullOrEmpty(jlrqtotextBox.Text.Trim()))
            {
                TimeSpan midtine = DateTime.Parse(jlrqfromtextBox.Text.Trim()) - DateTime.Parse(jlrqtotextBox.Text.Trim());
                if (midtine.Days > 0)
                {
                    //ShowMeg("记录开始日期不能大于记录结束日期");
                    ShowMeg(q(Msg_Type.msgksgtjs));
                }
            }
            if (MaccheckBox.Checked)
            {
                model.MAC = DeviceInfo.GetNetCardMAC().Substring(0, 17);
            }
            //model.WLLBNAME = "素电";
            model.WLLB = Convert.ToInt32(wllbcomboBox1.SelectedValue);
            SELECT_MES_TM_TMINFO_BYTM res = ServicModel.TM_TMINFO.SELECT(model, getToken());

            if (res.MES_RETURN.TYPE.Equals("S"))
            {
                JLdataGridView.DataSource = res.MES_TM_TMINFO_LIST.ToList();
                List = res.MES_TM_TMINFO_LIST.ToList();
                JLdataGridView.ClearSelection();
                Type         type = JLdataGridView.GetType();
                PropertyInfo pi   = type.GetProperty("DoubleBuffered", BindingFlags.Instance | BindingFlags.NonPublic);
                pi.SetValue(JLdataGridView, true, null);
            }
            else
            {
                ShowMeg(res.MES_RETURN.MESSAGE);
            }
        }
Example #5
0
 private void frmZX_CC_Shown(object sender, EventArgs e)
 {
     JLdataGridView.ClearSelection();
     SMtextBox.Select();
 }
Example #6
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);
            }
        }
Example #7
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);
                    }
                }
            }
        }
Example #8
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);
            }
        }
Example #9
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);
                    }
                }
            }
        }