コード例 #1
0
        public string POST_PRINT_ZFDC_SINGEL(string datastring)
        {
            MES_RETURN_UI      rst   = new MES_RETURN_UI();
            MES_TM_TMINFO_LIST model = Newtonsoft.Json.JsonConvert.DeserializeObject <MES_TM_TMINFO_LIST>(datastring);

            MES_TM_TMINFO_LIST[] model_MES_TM_TMINFO_LIST = new MES_TM_TMINFO_LIST[1];
            model_MES_TM_TMINFO_LIST[0] = model;
            AppClass.SetSession("MES_TM_TMINFO_LIST", model_MES_TM_TMINFO_LIST);
            rst.TYPE = "S";
            return(Newtonsoft.Json.JsonConvert.SerializeObject(rst));
        }
コード例 #2
0
ファイル: frmTM_bd.cs プロジェクト: shenqingying/CodeTest
        public void PrintExcel(List <MES_TM_TMINFO_LIST> list)
        {
            //FileStream file = new FileStream( @"../../EXCEL/查询打印导出模版.xlsx", FileMode.Open, FileAccess.Read);
            IWorkbook excel = new XSSFWorkbook();       //创建.xls文件

            ISheet sheet = excel.CreateSheet("sheet1"); //创建sheet
            //IWorkbook workbook = new XSSFWorkbook(file);
            //ISheet sheet = workbook.GetSheetAt(0);
            IRow row = sheet.CreateRow(0);//创建行对象,填充表头

            //string[] headStr = { "条码", "工厂", "工作中心", "工作中心描述", "设备号", "物料编码", "物料描述", "批次", "销售订单", "项目", "桶(幢)号", "配方号", "配料单号", "供应商编码", "简称", "材料厂家", "工艺路线", "电池型号", "电池等级", "日期唛", "商标产地", "生产日期", "班次", "开始日期", "结束日期", "记录日期", "记录人", "备注" };
            string[] headStr = q(Msg_Type.fieldtmInfoArr).Split(',');//{"工厂","条码","生产日期","班次","工作中心","工作中心描述","设备号","任务编号","物料号","物料描述","批次","材料厂家","工艺路线","供应商","供应商描述","供应商批次","产品状态","配方单号","配料单号","桶号","数量",	"开始时间","结束时间","锌粉产地","电池等级","电池型号","托盘码","商标产地","备注","记录人","记录时间","销售订单编号","销售订单明细","物料类别","物料组","物料组描述","视比重","规格","适用生产线","适用产品规格","ERP单号","单位","电池板数","每板数量","余数","日期唛","下道工序","暂放电池类别","库存地点","库存地点名称","采购订单号","采购订单明细","存放天数"};


            for (int i = 0; i < headStr.Length; i++)
            {
                row.CreateCell(i).SetCellValue(headStr[i]);
            }


            //填充内容,j从1开始,屏蔽掉第一列,循环读取
            for (int i = 0; i < ChoiceList.Count; i++)
            {
                //IRow row = sheet.CreateRow(i+1);
                row = sheet.CreateRow(i + 1);
                MES_TM_TMINFO_LIST node = ChoiceList[i];

                //string[] contentStr = { node.TM, node.GC, node.GZZXBH, node.GZZXMS, node.SBHMS, node.WLH, node.WLMS, node.PC, node.NOBILL, node.NOBILLMX, node.TH.ToString(), node.PFDH, node.PLDH, node.GYS, node.GYSMS, node.CLCJ, node.GYLX, node.DCXHMS, node.DCDJMS, node.RQM, node.SBCDMS, node.SCDATE, node.BCMS, node.KSTIME, node.JSTIME, node.JLTIME, node.JLRMS, node.REMARK };
                string[] contentStr = { node.GC, node.TM, node.SCDATE, node.BCMS, node.GZZXBH, node.GZZXMS, node.SBHMS, node.RWBH, node.WLH, node.WLMS, node.PC, node.CLCJ, node.GYLX, node.GYS, node.GYSMS, node.GYSPC, node.CPZTNAME, node.PFDH, node.PLDH, Convert.ToString(node.TH), Convert.ToString(node.SL), node.KSTIME, node.JSTIME, node.XFCDNAME, node.DCDJMS, node.DCXHMS, node.TPM, node.SBCDMS, node.REMARK, node.JLRMS, node.JLTIME, node.NOBILL, node.NOBILLMX, node.WLLBNAME, node.WLGROUP, node.WLGROUPNAME, node.SBZ, node.SIZENAME, node.SYSCX, node.SYCPGG, node.ERPNO, node.UNITSNAME, Convert.ToString(node.DCSLBS), Convert.ToString(node.DCSLMBSL), Convert.ToString(node.DCSLYS), node.RQM, node.XDGXNAME, node.ZFDCLBNAME, node.KCDD, node.KCDDNAME, node.CGBILL, node.CGBILLMX, Convert.ToString(node.CFTS) };
                //int a = contentStr.Length;
                //int b = headStr.Length;
                for (int j = 0; j < contentStr.Length; j++)
                {
                    if (j == 20)//数量字段 数值类型
                    {
                        row.CreateCell(j).SetCellValue(Convert.ToDouble(contentStr[j]));
                    }
                    else
                    {
                        row.CreateCell(j).SetCellValue(contentStr[j]);
                    }
                }
            }

            ////写入文件
            //string DesktopPath = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
            //string path = DesktopPath + @"\委外库存标识信息Excel" + DateTime.Now.ToString("yyyyMMdd") + ".xls";
            ////string path = DesktopPath + @"\委外库存标识" + DateTime.Now.ToShortDateString() + ".xls";
            ////string path = DesktopPath + @"\1.xls";
            //FileStream xlsfile = new FileStream(path, FileMode.OpenOrCreate);
            //excel.Write(xlsfile);
            //xlsfile.Close();


            SaveFileDialog Sfd = new SaveFileDialog();

            Sfd.Filter   = "Excel文件(*.xlsx)|*.xlsx";
            Sfd.FileName = q(Msg_Type.titletmxx) + DateTime.Now.ToString("yyyyMMddHHmmss");//"条码信息"
            if (Sfd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                FileStream file3 = new FileStream(Sfd.FileName, FileMode.Create);
                excel.Write(file3);
                file3.Close();
                //MessageBox.Show(q(Msg_Type.msgexportsuccess));//"成功导出为Excel!"
                ShowMeg(q(Msg_Type.msgexportsuccess));
            }



            //MessageBox.Show("Excel文件已导出到桌面", "提示");
        }
コード例 #3
0
        private void tmtextBox_KeyDown(object sender, KeyEventArgs e)
        {
            if (tmtextBox.ReadOnly == false)
            {
                if (e.KeyCode == Keys.Enter)
                {
                    if (Convert.ToInt32(fsnumericUpDown.Value) > 0)
                    {
                        string tm = tmtextBox.Text.Trim().ToUpper();
                        if (tm.Length == 12 && tm.StartsWith("P"))
                        {
                            MES_TM_TMINFO TMINFOmodel = new MES_TM_TMINFO();
                            TMINFOmodel.TM = tm;
                            SELECT_MES_TM_TMINFO_BYTM tminfiRes = ServicModel.TM_TMINFO.SELECT(TMINFOmodel, getToken());
                            if (tminfiRes.MES_RETURN.TYPE.Equals("S"))
                            {
                                if (tminfiRes.MES_TM_TMINFO_LIST.Length == 1)
                                {
                                    MES_TM_TMINFO_LIST tmINFO = tminfiRes.MES_TM_TMINFO_LIST[0];
                                    Print_Type         ptype  = (Print_Type)tmINFO.TMSX;
                                    PrintType = ptype;
                                    bool isNormal = true;
                                    switch (ptype)
                                    {
                                    case Print_Type.none:
                                        isNormal = false;
                                        break;

                                    case Print_Type.rk:
                                        RigthType = Rigth_Type.gangketl_cc;
                                        break;

                                    case Print_Type.lot:
                                        RigthType = Rigth_Type.gangketl_cc;
                                        break;

                                    case Print_Type.zjlot:
                                        RigthType = Rigth_Type.zhengjicc;
                                        break;

                                    case Print_Type.fujilot:
                                        RigthType = Rigth_Type.fujitl;
                                        break;

                                    case Print_Type.zxlot:
                                        RigthType = Rigth_Type.zhuxiancc;
                                        break;

                                    case Print_Type.bblot:
                                        RigthType = Rigth_Type.baobiaocc;
                                        break;

                                    case Print_Type.zfsd:
                                        RigthType = Rigth_Type.zhuxiancc;
                                        break;

                                    case Print_Type.wlrk:
                                        RigthType = Rigth_Type.wlrkdy;
                                        break;

                                    case Print_Type.wlrkLot:
                                        RigthType = Rigth_Type.wlrkdy;
                                        break;

                                    case Print_Type.zswllot:
                                        RigthType = Rigth_Type.zswllotdy;
                                        break;

                                    case Print_Type.zswlbsk:
                                        RigthType = Rigth_Type.none;
                                        break;

                                    default:
                                        isNormal = false;
                                        break;
                                    }
                                    if (isNormal == false)
                                    {
                                        //ShowMeg("条码属性读取异常,请联系管理员");
                                        ShowMeg(q(Msg_Type.msgtmsxecpect));
                                        return;
                                    }
                                    tmtextBox.Text = tmINFO.TM;
                                    PrintInfoByTM(tmINFO.TM, tmINFO.GC, Convert.ToInt32(fsnumericUpDown.Value), RigthType, ptype);
                                    tmtextBox.Clear();
                                }
                                else
                                {
                                    //ShowMeg("读取扫描条码信息失败");
                                    ShowMeg(q(Msg_Type.msgloadtmfail));
                                }
                            }
                            else
                            {
                                ShowMeg(tminfiRes.MES_RETURN.MESSAGE);
                            }
                        }
                        else
                        {
                            //ShowMeg("你扫描的是无效的条码");
                            ShowMeg(q(Msg_Type.msgscantminvalid));
                        }
                    }
                    else
                    {
                        //ShowMeg("打印份数必须大于0");
                        ShowMeg(q(Msg_Type.msgprintnoempty));
                    }
                }
            }
        }
コード例 #4
0
        private void ConfigUI(string tm)
        {
            ClearUI();
            CancleTextboxzswllot();
            CancleTextboxzswlbsk();
            MES_TM_TMINFO_SELECT_BY_UPDATEROLE_IN model = new MES_TM_TMINFO_SELECT_BY_UPDATEROLE_IN();

            model.STAFFID = Convert.ToInt32(getUserInfo("staffid"));
            model.TM      = tm;
            SELECT_MES_TM_TMINFO_BYTM res = ServicModel.TM_TMINFO.SELECT_BY_UPDATEROLE(model, getToken());

            if (res.MES_RETURN.TYPE.Equals("S"))
            {
                if (res.MES_TM_TMINFO_LIST.Length == 1)
                {
                    MES_SY_TYPEMXLIST zfsdnode = new MES_SY_TYPEMXLIST();
                    zfsdnode.ID        = 0;
                    zfsdnode.MXNAME    = q(Msg_Type.titlechoice);//"==请选择==";
                    MES_TM_TMINFO_LIST = res.MES_TM_TMINFO_LIST[0];
                    string gc = MES_TM_TMINFO_LIST.GC;
                    //MES_TM_TMINFO_LIST.MOULD
                    cpztcomboBox.DataSource    = GetDictionaryMX(9, gc);
                    cpztcomboBox.DisplayMember = "MXNAME";
                    cpztcomboBox.ValueMember   = "ID";

                    List <MES_SY_TYPEMXLIST> dcxhlist = GetDictionaryMX(6, gc).ToList();
                    dcxhlist.Insert(0, zfsdnode);
                    dcxhcomboBox.DataSource    = dcxhlist;
                    dcxhcomboBox.DisplayMember = "MXNAME";
                    dcxhcomboBox.ValueMember   = "ID";
                    int bcID = 5;
                    if (res.MES_TM_TMINFO_LIST[0].WLLBNAME.Equals("正极粉"))
                    {
                        bcID = 12;
                    }
                    List <MES_SY_TYPEMXLIST> bclist = GetDictionaryMX(bcID, gc).ToList();
                    bclist.Insert(0, zfsdnode);
                    bccomboBox.DataSource    = bclist;
                    bccomboBox.DisplayMember = "MXNAME";
                    bccomboBox.ValueMember   = "ID";


                    //scbzcomboBox.DataSource = GetDictionaryMX(12);
                    //scbzcomboBox.DisplayMember = "MXNAME";
                    //scbzcomboBox.ValueMember = "ID";

                    List <MES_SY_TYPEMXLIST> dcdjlist = GetDictionaryMX(7, gc).ToList();
                    dcdjlist.Insert(0, zfsdnode);
                    dcdjcomboBox.DataSource    = dcdjlist;
                    dcdjcomboBox.DisplayMember = "MXNAME";
                    dcdjcomboBox.ValueMember   = "ID";

                    List <MES_SY_TYPEMXLIST> sbcdlist = GetDictionaryMX(15, gc).ToList();
                    sbcdlist.Insert(0, zfsdnode);
                    sbcdcomboBox.DataSource    = sbcdlist;
                    sbcdcomboBox.DisplayMember = "MXNAME";
                    sbcdcomboBox.ValueMember   = "ID";

                    List <MES_SY_TYPEMXLIST> zfsdlist = GetDictionaryMX(17, gc).ToList();
                    zfsdlist.Insert(0, zfsdnode);
                    zflbcomboBox.DataSource    = zfsdlist;
                    zflbcomboBox.DisplayMember = "MXNAME";
                    zflbcomboBox.ValueMember   = "ID";

                    List <MES_SY_TYPEMXLIST> hdgxlist = GetDictionaryMX(19, gc).ToList();
                    hdgxlist.Insert(0, zfsdnode);
                    hgxcomboBox.DisplayMember = "MXNAME";
                    hgxcomboBox.ValueMember   = "ID";
                    hgxcomboBox.DataSource    = hdgxlist;

                    List <MES_SY_TYPEMXLIST> yslist = GetDictionaryMX(33, gc).ToList();
                    yslist.Insert(0, zfsdnode);
                    yscomboBox.DisplayMember = "MXNAME";
                    yscomboBox.ValueMember   = "ID";
                    yscomboBox.DataSource    = yslist;

                    List <MES_SY_TYPEMXLIST> cptypelist = GetDictionaryMX(32, gc).ToList();
                    cptypelist.Insert(0, zfsdnode);
                    cptypecomboBox.DisplayMember = "MXNAME";
                    cptypecomboBox.ValueMember   = "ID";
                    cptypecomboBox.DataSource    = cptypelist;


                    tmtextBox1.Text            = MES_TM_TMINFO_LIST.TM;
                    wlhtextBox2.Text           = MES_TM_TMINFO_LIST.WLH;
                    wllbtextBox.Text           = MES_TM_TMINFO_LIST.WLLBNAME;
                    wlmstextBox.Text           = MES_TM_TMINFO_LIST.WLMS;
                    dcxhcomboBox.SelectedValue = MES_TM_TMINFO_LIST.DCXH;
                    dcdjcomboBox.SelectedValue = MES_TM_TMINFO_LIST.DCDJ;
                    kssjtextBox.Text           = MES_TM_TMINFO_LIST.KSTIME;
                    jssjtextBox.Text           = MES_TM_TMINFO_LIST.JSTIME;
                    cpztcomboBox.SelectedValue = MES_TM_TMINFO_LIST.CPZT;
                    //bztextBox.Text = MES_TM_TMINFO_LIST.REMARK;
                    bzrichTextBox1.Text          = MES_TM_TMINFO_LIST.REMARK;
                    xsddtextBox.Text             = MES_TM_TMINFO_LIST.NOBILL;
                    xsxmtextBox.Text             = MES_TM_TMINFO_LIST.NOBILLMX;
                    gyspctextBox.Text            = MES_TM_TMINFO_LIST.GYSPC;
                    thtextBox.Text               = MES_TM_TMINFO_LIST.TH.ToString();
                    pctextBox.Text               = MES_TM_TMINFO_LIST.PC;
                    clpbtextBox.Text             = MES_TM_TMINFO_LIST.CLPBDM;
                    zflbcomboBox.SelectedValue   = MES_TM_TMINFO_LIST.ZFDCLB;
                    cptypecomboBox.SelectedValue = MES_TM_TMINFO_LIST.CPTYPE;
                    bccomboBox.SelectedValue     = MES_TM_TMINFO_LIST.BC;
                    if (MES_TM_TMINFO_LIST.DCSLYS != 0)
                    {
                        wstextBox1.Text = MES_TM_TMINFO_LIST.DCSLYS.ToString();
                    }
                    if (MES_TM_TMINFO_LIST.DCSLMBSL != 0)
                    {
                        mbsltextBox2.Text = MES_TM_TMINFO_LIST.DCSLMBSL.ToString();
                    }
                    if (MES_TM_TMINFO_LIST.DCSLBS != 0)
                    {
                        bstextBox3.Text = MES_TM_TMINFO_LIST.DCSLBS.ToString();
                    }
                    hgxcomboBox.SelectedValue  = MES_TM_TMINFO_LIST.XDGX;
                    bbpmtextBox.Text           = MES_TM_TMINFO_LIST.RQM;
                    scdatetextBox.Text         = MES_TM_TMINFO_LIST.SCDATE;
                    sbcdcomboBox.SelectedValue = MES_TM_TMINFO_LIST.SBCD;
                    sltextBox.Text             = MES_TM_TMINFO_LIST.SL.ToString();
                    //ystextBox.Text = MES_TM_TMINFO_LIST.MFQCOLORNAME;
                    yscomboBox.SelectedValue = MES_TM_TMINFO_LIST.MFQCOLOR;
                    wqhtextBox.Text          = MES_TM_TMINFO_LIST.WQH;
                    if (MES_TM_TMINFO_LIST.TMSX == 622)// zswlbsk = 622  物料标识卡
                    {
                        ReadOnlyTextboxzswlbsk();
                    }
                    else if (MES_TM_TMINFO_LIST.TMSX == 621)//zswllot = 621, 物料lot表
                    {
                        sltextBox.ReadOnly     = true;
                        bccomboBox.Enabled     = false;
                        scdatetextBox.ReadOnly = true;
                        Sonluk.UI.Model.MES.TM_GLService.MES_TM_GL glmodel = new Sonluk.UI.Model.MES.TM_GLService.MES_TM_GL();
                        glmodel.LB   = 1;
                        glmodel.XCTM = MES_TM_TMINFO_LIST.TM;
                        Sonluk.UI.Model.MES.TM_GLService.MES_TM_GL_SELECT glres = ServicModel.TM_GL.SELECT(glmodel, getToken());
                        if (glres.MES_RETURN.TYPE.Equals("S"))
                        {
                            if (glres.MES_TM_GL.Length > 0)
                            {
                                if (glres.MES_TM_GL[0].SCTMRESDUESL > 0)
                                {
                                    ReadOnlyTextboxzswllot();
                                }
                                else
                                {
                                }
                            }
                            else
                            {
                                cptypecomboBox.Enabled = true;
                            }
                        }
                        else
                        {
                            ShowMeg(glres.MES_RETURN.MESSAGE);
                        }
                    }
                }
                else
                {
                    //ShowMeg("条码数据异常");
                    ShowMeg(q(Msg_Type.msgtmexcept));
                }
            }
            else
            {
                ShowMeg(res.MES_RETURN.MESSAGE);
            }
            smtextBox.Clear();
        }
コード例 #5
0
        private void smtextBox_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                TM_Type type = TMtype(smtextBox.Text.Trim().ToUpper());
                switch (type)
                {
                case TM_Type.none:
                    //MessageBox.Show("你扫描的是无效的条码!!", "消息框");
                    ShowMeg(q(Msg_Type.msgscantminvalid));
                    break;

                case TM_Type.staffno:
                {
                    MES_RETURN_UI res = ServicModel.PUBLIC_FUNC.GET_YGNAME(smtextBox.Text.Trim().ToUpper(), getToken());
                    if (res.TYPE.Equals("S"))
                    {
                        czrtextBox.Text = res.MESSAGE;
                        Gh = smtextBox.Text.Trim().ToUpper();
                    }
                    else
                    {
                        ShowMeg(res.MESSAGE);
                    }
                }
                break;

                case TM_Type.gd:
                    //MessageBox.Show("你扫描的是无效的条码!!", "消息框");
                    ShowMeg(q(Msg_Type.msgscantminvalid));
                    break;

                case TM_Type.ph:
                {
                    MES_TM_TMINFO model = new MES_TM_TMINFO();
                    model.TM      = smtextBox.Text.Trim().ToUpper();
                    model.STAFFID = Convert.ToInt32(getUserInfo("staffid"));
                    SELECT_MES_TM_TMINFO_BYTM res = ServicModel.TM_TMINFO.SELECT_BY_KCDDLimit(model, getToken());
                    if (res.MES_RETURN.TYPE.Equals("S"))
                    {
                        if (res.MES_TM_TMINFO_LIST.Length == 1)
                        {
                            MES_TM_TMINFO_LIST  = res.MES_TM_TMINFO_LIST[0];
                            ytmtextBox.Text     = MES_TM_TMINFO_LIST.TM;
                            ytmwllbtextBox.Text = MES_TM_TMINFO_LIST.WLLBNAME;
                            tlsstextBox.Text    = MES_TM_TMINFO_LIST.SCDATE;
                        }
                        else if (res.MES_TM_TMINFO_LIST.Length == 0)
                        {
                            ShowMeg(q(Msg_Type.msgtmnoexistorunrole));        //"条码信息不存在或账号没有权限查询"
                        }
                        else
                        {
                            ShowMeg(q(Msg_Type.msgtmexcept));        //"获得的条码数据异常,请联系管理员"
                        }
                    }
                    else
                    {
                        ShowMeg(res.MES_RETURN.MESSAGE);
                    }
                }
                break;

                case TM_Type.rwd:
                    //MessageBox.Show("你扫描的是无效的条码!!", "消息框");
                    ShowMeg(q(Msg_Type.msgscantminvalid));
                    break;

                default:
                    //MessageBox.Show("你扫描的是无效的条码!!", "消息框");
                    ShowMeg(q(Msg_Type.msgscantminvalid));
                    break;
                }
                smtextBox.Clear();
                smtextBox.Select();
            }
        }