Ejemplo n.º 1
0
        public void PrintExcel(List <ZSL_BCS303_BS> list)
        {
            IWorkbook excel = new HSSFWorkbook();          //创建.xls文件
            ISheet    sheet = excel.CreateSheet("sheet1"); //创建sheet


            IRow row = sheet.CreateRow(0);//创建行对象,填充表头

            string[] headStr = { "物料凭证", "项目", "年度", "条码", "下层码", "托数", "托数量", "箱数", "物料编码", "物料描述", "工厂", "库存地点", "库存地点描述", "采购订单", "项目", "批次", "销售订单", "项目", "供应商编码", "简称", "过账日期", "工艺", "设备(模)号", "材料厂家" };
            for (int i = 0; i < headStr.Length; i++)
            {
                row.CreateCell(i).SetCellValue(headStr[i]);
            }


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

                string[] content = { node.MBLNR, node.ZEILE, node.MJAHR, node.TM, node.XCZJTM, node.TS.ToString(), node.MENGE, node.XS.ToString(), node.MATNR, node.MAKTX, node.WERKS, node.LGORT, node.LGOBE, node.EBELN, node.EBELP, node.CHARG, node.MAT_KDAUF, node.MAT_KDPOS, node.LIFNR, node.SORTL, node.BUDAT, node.GY, node.SBH, node.CLCJ };
                for (int j = 0; j < content.Length; j++)
                {
                    row.CreateCell(j).SetCellValue(content[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文件(*.xls)|*.xls";
            Sfd.FileName = "物流入库导出";

            if (Sfd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                FileStream file3 = new FileStream(Sfd.FileName, FileMode.Create);
                excel.Write(file3);
                file3.Close();
                MessageBox.Show("成功导出为Excel!");
            }



            //MessageBox.Show("Excel文件已导出到桌面", "提示");
        }
Ejemplo n.º 2
0
        public void PrintExcel(List <ZSL_BCS303_BS> list)
        {
            IWorkbook excel = new XSSFWorkbook();                   //创建.xls文件
            ISheet    sheet = excel.CreateSheet("sheet1");          //创建sheet
            IRow      row   = sheet.CreateRow(0);                   //创建行对象,填充表头

            string[] headStr = q(Msg_Type.fieldwlkcArr).Split(','); //{ "物料凭证", "项目", "年度", "条码", "下层码", "托数", "托数量", "箱数", "物料编码", "物料描述", "工厂", "库存地点", "库存地点描述", "采购订单", "项目", "批次", "销售订单","项目", "供应商编码", "简称", "过账日期", "工艺", "设备(模)号", "材料厂家" };
            for (int i = 0; i < headStr.Length; i++)
            {
                row.CreateCell(i).SetCellValue(headStr[i]);
            }
            //填充内容,j从1开始,屏蔽掉第一列,循环读取
            for (int i = 0; i < ChoiceList.Count; i++)
            {
                row = sheet.CreateRow(i + 1);
                ZSL_BCS303_BS node    = ChoiceList[i];
                string[]      content = { node.MBLNR, node.ZEILE, node.MJAHR, node.TM, node.XCZJTM, node.TS.ToString(), node.MENGE, node.XS.ToString(), node.MATNR, node.MAKTX, node.WERKS, node.LGORT, node.LGOBE, node.EBELN, node.EBELP, node.CHARG, node.MAT_KDAUF, node.MAT_KDPOS, node.LIFNR, node.SORTL, node.BUDAT, node.GY, node.SBH, node.CLCJ };
                for (int j = 0; j < content.Length; j++)
                {
                    row.CreateCell(j).SetCellValue(content[j]);
                }
            }
            SaveFileDialog Sfd = new SaveFileDialog();

            Sfd.Filter   = "Excel文件(*.xlsx)|*.xlsx";
            Sfd.FileName = q(Msg_Type.titlewlrkdc) + 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("成功导出为Excel!");
                ShowMeg(q(Msg_Type.msgexportsuccess));
            }
            //MessageBox.Show("Excel文件已导出到桌面", "提示");
        }
Ejemplo n.º 3
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();
                }
            }
        }
Ejemplo n.º 4
0
 public ZBCFUN_PURBS_READ GET_WLPZ_ZJ(ZSL_BCS303_BS IS_PURBS, string ptoken)
 {
     return(client.GET_WLPZ_ZJ(IS_PURBS, ptoken));
 }