Esempio n. 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string   workorder      = Request.QueryString["workorder"];
        string   status         = Request.QueryString["status"];
        string   partsdrawingno = Request.QueryString["partsdrawingno"];
        string   order          = Request.QueryString["order"];
        string   starttime      = Request.QueryString["starttime"];
        string   endtime        = Request.QueryString["endtime"];
        DateTime dtstart        = DateTime.Today.AddDays(-100);
        DateTime dtend          = DateTime.Now;

        if (!string.IsNullOrEmpty(starttime) && !string.IsNullOrEmpty(endtime))
        {
            dtstart = Convert.ToDateTime(starttime);
            dtend   = Convert.ToDateTime(endtime);
        }
        WorkOrderDetails wo = new WorkOrderDetails();

        wo.WO               = workorder;
        wo.STATUS           = status == "4"?"":status;
        wo.PartsdrawingCode = partsdrawingno;
        wo.OrderNumber      = order;
        wo.StartTime        = dtstart;
        wo.EndTime          = dtend;
        SystemBO _bal = BLLFactory.GetBal <SystemBO>(userInfo);
        IList <WorkOrderDetails> woobjs = _bal.FindWorkOrderDetailsInfo(wo);
        WsSystem ws = new WsSystem();

        if (woobjs == null || woobjs.Count == 0)
        {
            Response.Write("no data");
            return;
        }

        HSSFWorkbook hssfWorkbook = new HSSFWorkbook();
        Row          row          = null;
        Cell         cell         = null;
        Sheet        hssfSheet    = hssfWorkbook.CreateSheet("WorkOrderInfo");

        row = hssfSheet.CreateRow(0);
        //填充头
        string objs = "工单单号,订单单号,零件图号,工单状态,机床类型,机床名称,负责人员,产品名称,计划开始,计划结束,批次,计划数量,产出数量,计划检验,计划入库,操作人,时间,工序,工序号";

        for (int i = 0; i < objs.Split(',').Length; i++)
        {
            cell = row.CreateCell(i);
            cell.SetCellValue(objs.Split(',')[i]);
        }
        if (woobjs != null)
        {
            for (int i = 2; i <= woobjs.Count + 1; i++)
            {
                row  = hssfSheet.CreateRow(i);
                cell = row.CreateCell(0);
                cell.SetCellValue(woobjs[i - 2].WO);
                cell = row.CreateCell(1);
                cell.SetCellValue(woobjs[i - 2].OrderNumber);
                cell = row.CreateCell(2);
                cell.SetCellValue(woobjs[i - 2].PartsdrawingCode);
                cell = row.CreateCell(3);
                cell.SetCellValue(woobjs[i - 2].StatusMemo);
                cell = row.CreateCell(4);
                cell.SetCellValue(woobjs[i - 2].MachineType);
                cell = row.CreateCell(5);
                cell.SetCellValue(woobjs[i - 2].MachineName);
                cell = row.CreateCell(6);
                cell.SetCellValue(woobjs[i - 2].WorkerName);
                cell = row.CreateCell(7);
                cell.SetCellValue(woobjs[i - 2].ProductName);
                cell = row.CreateCell(8);
                cell.SetCellValue(woobjs[i - 2].StartTime.ToString());
                cell = row.CreateCell(9);
                cell.SetCellValue(woobjs[i - 2].EndTime.ToString());
                cell = row.CreateCell(10);
                cell.SetCellValue(woobjs[i - 2].BatchNumber);
                cell = row.CreateCell(11);
                cell.SetCellValue(woobjs[i - 2].PlanQuantity.ToString());
                cell = row.CreateCell(12);
                cell.SetCellValue(woobjs[i - 2].QUANTITY.ToString());
                cell = row.CreateCell(13);
                cell.SetCellValue(woobjs[i - 2].CheckTime.ToString());
                cell = row.CreateCell(14);
                cell.SetCellValue(woobjs[i - 2].InstockTime.ToString());
                cell = row.CreateCell(15);
                cell.SetCellValue(ws.FindUserNameByCode(woobjs[i - 2].UpdatedBy));
                cell = row.CreateCell(16);
                cell.SetCellValue(woobjs[i - 2].UpdatedDate == null ? woobjs[i - 2].CreatedDate.ToString() : woobjs[i - 2].UpdatedDate.ToString());
                cell = row.CreateCell(17);
                cell.SetCellValue(woobjs[i - 2].StationName.ToString());
                cell = row.CreateCell(18);
                cell.SetCellValue(woobjs[i - 2].RouteCode.ToString());
            }
        }

        MemoryStream file = new MemoryStream();

        hssfWorkbook.Write(file);
        String fileName = "WorkOrderInfo" + DateTime.Now.ToString("yyyyMMddHHmmss");

        Response.Clear();
        Response.ClearContent();
        Response.ClearHeaders();
        Response.AddHeader("Content-Disposition", string.Format("attachment;filename={0}.xls", fileName));
        Response.AddHeader("Content-Length", file.Length.ToString());
        Response.AddHeader("Content-Transfer-Encoding", "binary");
        Response.ContentType     = "application/octet-stream";
        Response.ContentEncoding = System.Text.Encoding.GetEncoding("utf-8");
        Response.BinaryWrite(file.GetBuffer());
        Response.Flush();
        Response.End();
    }
Esempio n. 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string   partsdrawingno = Request.QueryString["partsdrawingno"];
        string   custcode       = Request.QueryString["custcode"];
        string   starttime      = Request.QueryString["starttime"];
        string   endtime        = Request.QueryString["endtime"];
        DateTime dtstart        = DateTime.Today.AddDays(-100);
        DateTime dtend          = DateTime.Now;

        if (custcode == "-1")
        {
            custcode = "";
        }
        if (!string.IsNullOrEmpty(starttime) && !string.IsNullOrEmpty(endtime))
        {
            dtstart = Convert.ToDateTime(starttime);
            dtend   = Convert.ToDateTime(endtime);
        }

        SystemBO _bal = BLLFactory.GetBal <SystemBO>(userInfo);
        IList <PartsdrawingCode> woobjs = _bal.FindPartsdrawingInfo(partsdrawingno, custcode, starttime, endtime);
        WsSystem ws = new WsSystem();

        if (woobjs == null || woobjs.Count == 0)
        {
            Response.Write("no data");
            return;
        }

        HSSFWorkbook hssfWorkbook = new HSSFWorkbook();
        Row          row          = null;
        Cell         cell         = null;
        Sheet        hssfSheet    = hssfWorkbook.CreateSheet("PartsdrawingInfo");

        row = hssfSheet.CreateRow(0);
        //填充头
        string objs = "零件图号,客户名称,客户代码,产品名称,投产总数,质量编号,交付数量,炉批号,交付时间,创建人,时间";

        for (int i = 0; i < objs.Split(',').Length; i++)
        {
            cell = row.CreateCell(i);
            cell.SetCellValue(objs.Split(',')[i]);
        }
        if (woobjs != null)
        {
            for (int i = 2; i <= woobjs.Count + 1; i++)
            {
                row  = hssfSheet.CreateRow(i);
                cell = row.CreateCell(0);
                cell.SetCellValue(woobjs[i - 2].PartsCode);
                cell = row.CreateCell(1);
                cell.SetCellValue(woobjs[i - 2].CustName);
                cell = row.CreateCell(2);
                cell.SetCellValue(woobjs[i - 2].CustCode);
                cell = row.CreateCell(3);
                cell.SetCellValue(woobjs[i - 2].ProductName);
                cell = row.CreateCell(4);
                cell.SetCellValue(woobjs[i - 2].PlanQuantity.ToString());
                cell = row.CreateCell(5);
                cell.SetCellValue(woobjs[i - 2].QualityCode);
                cell = row.CreateCell(6);
                cell.SetCellValue(woobjs[i - 2].AskQuantity.ToString());
                cell = row.CreateCell(7);
                cell.SetCellValue(woobjs[i - 2].BatchNumber);
                cell = row.CreateCell(8);
                cell.SetCellValue(woobjs[i - 2].AskDate.ToString());
                cell = row.CreateCell(9);
                cell.SetCellValue(ws.FindUserNameByCode(woobjs[i - 2].UpdatedBy));
                cell = row.CreateCell(10);
                cell.SetCellValue(woobjs[i - 2].UpdatedDate == null ? woobjs[i - 2].CreatedDate.ToString() : woobjs[i - 2].UpdatedDate.ToString());
            }
        }

        MemoryStream file = new MemoryStream();

        hssfWorkbook.Write(file);
        String fileName = "PartsdrawingInfo" + DateTime.Now.ToString("yyyyMMddHHmmss");

        Response.Clear();
        Response.ClearContent();
        Response.ClearHeaders();
        Response.AddHeader("Content-Disposition", string.Format("attachment;filename={0}.xls", fileName));
        Response.AddHeader("Content-Length", file.Length.ToString());
        Response.AddHeader("Content-Transfer-Encoding", "binary");
        Response.ContentType     = "application/octet-stream";
        Response.ContentEncoding = System.Text.Encoding.GetEncoding("utf-8");
        Response.BinaryWrite(file.GetBuffer());
        Response.Flush();
        Response.End();
    }
Esempio n. 3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string          codename = Request.QueryString["codename"];
        SystemBO        _bal     = BLLFactory.GetBal <SystemBO>(userInfo);
        WsSystem        ws       = new WsSystem();
        IList <BasCode> objods   = _bal.FindBasCode("", codename);//.FindFailItems(failcode,failtype);

        if (objods == null || objods.Count == 0)
        {
            Response.Write("no data");
            return;
        }

        HSSFWorkbook hssfWorkbook = new HSSFWorkbook();
        Row          row          = null;
        Cell         cell         = null;
        Sheet        hssfSheet    = hssfWorkbook.CreateSheet("CodeQuery");

        row = hssfSheet.CreateRow(0);
        //填充头
        string objs = "编码名称,编码类型,前缀字符,日期格式,绑定序列,编码长度,操作人,时间";

        for (int i = 0; i < objs.Split(',').Length; i++)
        {
            cell = row.CreateCell(i);
            cell.SetCellValue(objs.Split(',')[i]);
        }
        for (int i = 1; i < objods.Count + 1; i++)
        {
            row  = hssfSheet.CreateRow(i);
            cell = row.CreateCell(0);
            cell.SetCellValue(objods[i - 1].NAME);
            cell = row.CreateCell(1);
            cell.SetCellValue(objods[i - 1].TYPE);
            cell = row.CreateCell(2);
            cell.SetCellValue(objods[i - 1].PREFIX);
            cell = row.CreateCell(3);
            cell.SetCellValue(objods[i - 1].DateFormat);
            cell = row.CreateCell(4);
            cell.SetCellValue(objods[i - 1].BindSequence);
            cell = row.CreateCell(5);
            cell.SetCellValue(objods[i - 1].CodeLen.ToString());
            cell = row.CreateCell(6);
            cell.SetCellValue(ws.FindUserNameByCode(objods[i - 1].UpdatedBy));
            cell = row.CreateCell(7);
            cell.SetCellValue(objods[i - 1].CreatedDate.ToString());
        }
        MemoryStream file = new MemoryStream();

        hssfWorkbook.Write(file);
        String fileName = "CodeQuery" + DateTime.Now.ToString("yyyyMMddHHmmss");

        Response.Clear();
        Response.ClearContent();
        Response.ClearHeaders();
        Response.AddHeader("Content-Disposition", string.Format("attachment;filename={0}.xls", fileName));
        Response.AddHeader("Content-Length", file.Length.ToString());
        Response.AddHeader("Content-Transfer-Encoding", "binary");
        Response.ContentType     = "application/octet-stream";
        Response.ContentEncoding = System.Text.Encoding.GetEncoding("utf-8");
        Response.BinaryWrite(file.GetBuffer());
        Response.Flush();
        Response.End();
    }
Esempio n. 4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string   sn        = Request.QueryString["sn"];
        string   starttime = Request.QueryString["starttime"];
        string   endtime   = Request.QueryString["endtime"];
        DateTime dtstart   = DateTime.Today.AddDays(-7);
        DateTime dtend     = DateTime.Now;

        if (!string.IsNullOrEmpty(starttime) && !string.IsNullOrEmpty(endtime))
        {
            dtstart = Convert.ToDateTime(starttime);
            dtend   = Convert.ToDateTime(endtime);
        }

        SystemBO           _bal   = BLLFactory.GetBal <SystemBO>(userInfo);
        IList <CartonInfo> objods = _bal.FindCartonInfo(sn, "", "", dtstart, dtend);
        WsSystem           ws     = new WsSystem();

        if (objods == null || objods.Count == 0)
        {
            Response.Write("no data");
            return;
        }

        HSSFWorkbook hssfWorkbook = new HSSFWorkbook();
        Row          row          = null;
        Cell         cell         = null;
        Sheet        hssfSheet    = hssfWorkbook.CreateSheet("CartonInfo");

        row = hssfSheet.CreateRow(0);
        //填充头
        string objs = "箱号,订单号码,零件图号,质量编号,数量,操作人,时间";

        for (int i = 0; i < objs.Split(',').Length; i++)
        {
            cell = row.CreateCell(i);
            cell.SetCellValue(objs.Split(',')[i]);
        }
        for (int i = 1; i < objods.Count + 1; i++)
        {
            row  = hssfSheet.CreateRow(i);
            cell = row.CreateCell(0);
            cell.SetCellValue(objods[i - 1].CSN);
            cell = row.CreateCell(1);
            cell.SetCellValue(objods[i - 1].OrderNumber);
            cell = row.CreateCell(2);
            cell.SetCellValue(objods[i - 1].PartsdrawingCode);
            cell = row.CreateCell(3);
            cell.SetCellValue(objods[i - 1].QualityCode);
            cell = row.CreateCell(4);
            cell.SetCellValue(objods[i - 1].QUANTITY.ToString());
            cell = row.CreateCell(5);
            cell.SetCellValue(ws.FindUserNameByCode(objods[i - 1].UpdatedBy));
            cell = row.CreateCell(6);
            cell.SetCellValue(objods[i - 1].CreatedDate.ToString());
        }
        MemoryStream file = new MemoryStream();

        hssfWorkbook.Write(file);
        String fileName = "CartonInfo" + DateTime.Now.ToString("yyyyMMddHHmmss");

        Response.Clear();
        Response.ClearContent();
        Response.ClearHeaders();
        Response.AddHeader("Content-Disposition", string.Format("attachment;filename={0}.xls", fileName));
        Response.AddHeader("Content-Length", file.Length.ToString());
        Response.AddHeader("Content-Transfer-Encoding", "binary");
        Response.ContentType     = "application/octet-stream";
        Response.ContentEncoding = System.Text.Encoding.GetEncoding("utf-8");
        Response.BinaryWrite(file.GetBuffer());
        Response.Flush();
        Response.End();
    }
Esempio n. 5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string               equipcode = Request.QueryString["equipcode"];
        string               equipname = Request.QueryString["equipname"];
        SystemBO             _bal      = BLLFactory.GetBal <SystemBO>(userInfo);
        WsSystem             ws        = new WsSystem();
        IList <BasEquipment> objods    = _bal.FindBasEquipment(equipcode, equipname);//.FindFailItems(failcode,failtype);

        if (objods == null || objods.Count == 0)
        {
            Response.Write("no data");
            return;
        }

        HSSFWorkbook hssfWorkbook = new HSSFWorkbook();
        Row          row          = null;
        Cell         cell         = null;
        Sheet        hssfSheet    = hssfWorkbook.CreateSheet("EquipmentQuery");

        row = hssfSheet.CreateRow(0);
        //填充头
        string objs = "设备编号,国别厂家,设备名称,机床类型,轴数,型号,功率,车间位置,状态,出厂编号,启用日期,更新人,时间";

        for (int i = 0; i < objs.Split(',').Length; i++)
        {
            cell = row.CreateCell(i);
            cell.SetCellValue(objs.Split(',')[i]);
        }
        for (int i = 1; i < objods.Count + 1; i++)
        {
            row  = hssfSheet.CreateRow(i);
            cell = row.CreateCell(0);
            cell.SetCellValue(objods[i - 1].CODE);
            cell = row.CreateCell(1);
            cell.SetCellValue(objods[i - 1].COMPANY);
            cell = row.CreateCell(2);
            cell.SetCellValue(objods[i - 1].MachineName);
            cell = row.CreateCell(3);
            cell.SetCellValue(objods[i - 1].MachineType);
            cell = row.CreateCell(4);
            cell.SetCellValue(objods[i - 1].AxisNumber);
            cell = row.CreateCell(5);
            cell.SetCellValue(objods[i - 1].MODEL);
            cell = row.CreateCell(6);
            cell.SetCellValue(objods[i - 1].POWER);
            cell = row.CreateCell(7);
            cell.SetCellValue(objods[i - 1].LOCATION);
            cell = row.CreateCell(8);
            cell.SetCellValue(objods[i - 1].STATUS);
            cell = row.CreateCell(9);
            cell.SetCellValue(objods[i - 1].OutCode);
            cell = row.CreateCell(10);
            cell.SetCellValue(objods[i - 1].UseDate.ToString());
            cell = row.CreateCell(11);
            cell.SetCellValue(ws.FindUserNameByCode(objods[i - 1].UpdatedBy));
            cell = row.CreateCell(12);
            cell.SetCellValue(objods[i - 1].CreatedDate.ToString());
        }
        MemoryStream file = new MemoryStream();

        hssfWorkbook.Write(file);
        String fileName = "EquipmentQuery" + DateTime.Now.ToString("yyyyMMddHHmmss");

        Response.Clear();
        Response.ClearContent();
        Response.ClearHeaders();
        Response.AddHeader("Content-Disposition", string.Format("attachment;filename={0}.xls", fileName));
        Response.AddHeader("Content-Length", file.Length.ToString());
        Response.AddHeader("Content-Transfer-Encoding", "binary");
        Response.ContentType     = "application/octet-stream";
        Response.ContentEncoding = System.Text.Encoding.GetEncoding("utf-8");
        Response.BinaryWrite(file.GetBuffer());
        Response.Flush();
        Response.End();
    }
Esempio n. 6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string psn          = Request.QueryString["psn"];
        string partsdrawing = Request.QueryString["partsdrawing"];
        string wo           = Request.QueryString["wo"];
        string status       = Request.QueryString["status"];
        string starttime    = Request.QueryString["starttime"];
        string endtime      = Request.QueryString["endtime"];

        SystemBO          _bal = BLLFactory.GetBal <SystemBO>(userInfo);
        WsSystem          ws   = new WsSystem();
        UnsurenessHistory uh   = new UnsurenessHistory();

        uh.PSN              = psn;
        uh.WorkOrder        = wo;
        uh.STATUS           = status;
        uh.PartsdrawingCode = partsdrawing;

        if (!string.IsNullOrEmpty(starttime))
        {
            uh.CreatedDate = Convert.ToDateTime(starttime);
        }
        if (!string.IsNullOrEmpty(endtime))
        {
            uh.UpdatedDate = Convert.ToDateTime(endtime);
        }
        IList <UnsurenessHistory> objs = _bal.FindUnsurenessHistory(uh);

        if (objs == null || objs.Count == 0)
        {
            Response.Write("no data");
            return;
        }

        HSSFWorkbook hssfWorkbook = new HSSFWorkbook();
        Row          row          = null;
        Cell         cell         = null;
        Sheet        hssfSheet    = hssfWorkbook.CreateSheet("UnsurenessQuery");

        row = hssfSheet.CreateRow(0);
        //填充头
        string objhead = "产品条码,工单号码,不良项,状态,加工工序,数量,来料条码,工件图号,工件名称,生产批号,操作人,时间";

        for (int i = 0; i < objhead.Split(',').Length; i++)
        {
            cell = row.CreateCell(i);
            cell.SetCellValue(objhead.Split(',')[i]);
        }
        for (int i = 1; i < objs.Count + 1; i++)
        {
            row  = hssfSheet.CreateRow(i);
            cell = row.CreateCell(0);
            cell.SetCellValue(objs[i - 1].PSN);
            cell = row.CreateCell(1);
            cell.SetCellValue(objs[i - 1].WorkOrder);
            cell = row.CreateCell(2);
            cell.SetCellValue(objs[i - 1].FailMemo);
            cell = row.CreateCell(3);
            cell.SetCellValue(objs[i - 1].MEMO);
            cell = row.CreateCell(4);
            cell.SetCellValue(objs[i - 1].StationName);
            cell = row.CreateCell(5);
            cell.SetCellValue(objs[i - 1].QUANTITY.ToString());
            cell = row.CreateCell(6);
            cell.SetCellValue(objs[i - 1].MSN);
            cell = row.CreateCell(7);
            cell.SetCellValue(objs[i - 1].PartsdrawingCode);
            cell = row.CreateCell(8);
            cell.SetCellValue(objs[i - 1].ProductName);
            cell = row.CreateCell(9);
            cell.SetCellValue(objs[i - 1].BatchNumber);
            cell = row.CreateCell(10);
            cell.SetCellValue(ws.FindUserNameByCode(objs[i - 1].UpdatedBy));
            cell = row.CreateCell(11);
            cell.SetCellValue(objs[i - 1].CreatedDate.ToString());
        }
        MemoryStream file = new MemoryStream();

        hssfWorkbook.Write(file);
        String fileName = "UnsurenessQuery" + DateTime.Now.ToString("yyyyMMddHHmmss");

        Response.Clear();
        Response.ClearContent();
        Response.ClearHeaders();
        Response.AddHeader("Content-Disposition", string.Format("attachment;filename={0}.xls", fileName));
        Response.AddHeader("Content-Length", file.Length.ToString());
        Response.AddHeader("Content-Transfer-Encoding", "binary");
        Response.ContentType     = "application/octet-stream";
        Response.ContentEncoding = System.Text.Encoding.GetEncoding("utf-8");
        Response.BinaryWrite(file.GetBuffer());
        Response.Flush();
        Response.End();
    }
Esempio n. 7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string   sn           = Request.QueryString["sn"];
        string   materialname = Request.QueryString["materialname"];
        string   custname     = Request.QueryString["custname"];
        string   batchnumber  = Request.QueryString["batchnumber"];
        string   starttime    = Request.QueryString["starttime"];
        string   endtime      = Request.QueryString["endtime"];
        DateTime dtstart      = DateTime.Today.AddDays(-7);
        DateTime dtend        = DateTime.Now;

        if (!string.IsNullOrEmpty(starttime) && !string.IsNullOrEmpty(endtime))
        {
            dtstart = Convert.ToDateTime(starttime);
            dtend   = Convert.ToDateTime(endtime);
        }

        SystemBO _bal = BLLFactory.GetBal <SystemBO>(userInfo);
        IList <MaterialStockHistory> objods = _bal.FindMaterialHistory("", "1^3", sn, materialname, custname, starttime, endtime, batchnumber);
        WsSystem ws = new WsSystem();

        if (objods == null || objods.Count == 0)
        {
            Response.Write("no data");
            return;
        }

        HSSFWorkbook hssfWorkbook = new HSSFWorkbook();
        Row          row          = null;
        Cell         cell         = null;
        Sheet        hssfSheet    = hssfWorkbook.CreateSheet("MaterialInfo");

        row = hssfSheet.CreateRow(0);
        //填充头
        string objs = "来料条码,工单号码,物料代码,物料名称,批号,数量,发料仓库,源单单号,发料员,领料员,领料时间";

        for (int i = 0; i < objs.Split(',').Length; i++)
        {
            cell = row.CreateCell(i);
            cell.SetCellValue(objs.Split(',')[i]);
        }
        for (int i = 1; i < objods.Count + 1; i++)
        {
            row  = hssfSheet.CreateRow(i);
            cell = row.CreateCell(0);
            cell.SetCellValue(objods[i - 1].MSN);
            cell = row.CreateCell(1);
            cell.SetCellValue(objods[i - 1].WorkOrder);
            cell = row.CreateCell(2);
            cell.SetCellValue(objods[i - 1].MaterialCode);
            cell = row.CreateCell(3);
            cell.SetCellValue(objods[i - 1].MaterialName);
            cell = row.CreateCell(4);
            cell.SetCellValue(objods[i - 1].BatchNumber);
            cell = row.CreateCell(5);
            cell.SetCellValue(objods[i - 1].QUANTITY.ToString());
            cell = row.CreateCell(6);
            IList <BasBase> ibb = _bal.FindBaseBySubCode(objods[i - 1].StockHouse);
            cell.SetCellValue(ibb[0].SubName);
            cell = row.CreateCell(7);
            cell.SetCellValue(objods[i - 1].DOCUMENTID);
            cell = row.CreateCell(8);
            cell.SetCellValue(ws.FindUserNameByCode(objods[i - 1].UpdatedBy));
            cell = row.CreateCell(9);
            cell.SetCellValue(objods[i - 1].MaterialHandler);
            cell = row.CreateCell(10);
            cell.SetCellValue(objods[i - 1].CreatedDate.ToString());
        }
        MemoryStream file = new MemoryStream();

        hssfWorkbook.Write(file);
        String fileName = "MaterialInfo" + DateTime.Now.ToString("yyyyMMddHHmmss");

        Response.Clear();
        Response.ClearContent();
        Response.ClearHeaders();
        Response.AddHeader("Content-Disposition", string.Format("attachment;filename={0}.xls", fileName));
        Response.AddHeader("Content-Length", file.Length.ToString());
        Response.AddHeader("Content-Transfer-Encoding", "binary");
        Response.ContentType     = "application/octet-stream";
        Response.ContentEncoding = System.Text.Encoding.GetEncoding("utf-8");
        Response.BinaryWrite(file.GetBuffer());
        Response.Flush();
        Response.End();
    }
Esempio n. 8
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string            startTime = Request.QueryString["startTime"];
        string            endTime   = Request.QueryString["endTime"];
        string            custCode  = Request.QueryString["custCode"];
        SystemBO          _bal      = BLLFactory.GetBal <SystemBO>(userInfo);
        WsSystem          ws        = new WsSystem();
        IList <BasCustom> objods    = _bal.FindBasCustom(custCode, "");//.FindBasCode("", codename);//.FindFailItems(failcode,failtype);

        if (objods == null || objods.Count == 0)
        {
            Response.Write("no data");
            return;
        }

        HSSFWorkbook hssfWorkbook = new HSSFWorkbook();
        Row          row          = null;
        Cell         cell         = null;
        Sheet        hssfSheet    = hssfWorkbook.CreateSheet("CustQuery");

        row = hssfSheet.CreateRow(0);
        //填充头
        string objs = "客户代码,客户名称,地址,运输方式,收货地点,联系人,电话,传真,开票名称,操作人,时间";

        for (int i = 0; i < objs.Split(',').Length; i++)
        {
            cell = row.CreateCell(i);
            cell.SetCellValue(objs.Split(',')[i]);
        }
        for (int i = 1; i < objods.Count + 1; i++)
        {
            row  = hssfSheet.CreateRow(i);
            cell = row.CreateCell(0);
            cell.SetCellValue(objods[i - 1].CODE);
            cell = row.CreateCell(1);
            cell.SetCellValue(objods[i - 1].NAME);
            cell = row.CreateCell(2);
            cell.SetCellValue(objods[i - 1].ADDRESS);
            cell = row.CreateCell(3);
            cell.SetCellValue(objods[i - 1].TransType);
            cell = row.CreateCell(4);
            cell.SetCellValue(objods[i - 1].ReceiveArea);
            cell = row.CreateCell(5);
            cell.SetCellValue(objods[i - 1].CONTACT);
            cell = row.CreateCell(6);
            cell.SetCellValue(objods[i - 1].MOBILE);
            cell = row.CreateCell(7);
            cell.SetCellValue(objods[i - 1].FAX);
            cell = row.CreateCell(8);
            cell.SetCellValue(objods[i - 1].InvoiceName);
            cell = row.CreateCell(9);
            cell.SetCellValue(ws.FindUserNameByCode(objods[i - 1].UpdatedBy));
            cell = row.CreateCell(10);
            cell.SetCellValue(objods[i - 1].CreatedDate.ToString());
        }
        MemoryStream file = new MemoryStream();

        hssfWorkbook.Write(file);
        String fileName = "CustQuery" + DateTime.Now.ToString("yyyyMMddHHmmss");

        Response.Clear();
        Response.ClearContent();
        Response.ClearHeaders();
        Response.AddHeader("Content-Disposition", string.Format("attachment;filename={0}.xls", fileName));
        Response.AddHeader("Content-Length", file.Length.ToString());
        Response.AddHeader("Content-Transfer-Encoding", "binary");
        Response.ContentType     = "application/octet-stream";
        Response.ContentEncoding = System.Text.Encoding.GetEncoding("utf-8");
        Response.BinaryWrite(file.GetBuffer());
        Response.Flush();
        Response.End();
    }
Esempio n. 9
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string startTime = Request.QueryString["startTime"];
        string endTime   = Request.QueryString["endTime"];
        string baseCode  = Request.QueryString["baseName"];


        BasicBO         _bal     = BLLFactory.GetBal <BasicBO>(userInfo);
        IList <BasBase> baseInfo = _bal.FindBaseByCode(startTime, endTime, baseCode);
        WsSystem        ws       = new WsSystem();

        if (baseInfo == null || baseInfo.Count == 0)
        {
            Response.Write("no data");
            return;
        }

        HSSFWorkbook hssfWorkbook = new HSSFWorkbook();
        Row          row          = null;
        Cell         cell         = null;
        Sheet        hssfSheet    = hssfWorkbook.CreateSheet("BaseInfo");

        row = hssfSheet.CreateRow(0);
        //填充头
        string objs = "信息编号,信息名称,子信息编码,子信息名称,操作人,时间";

        for (int i = 0; i < objs.Split(',').Length; i++)
        {
            cell = row.CreateCell(i);
            cell.SetCellValue(objs.Split(',')[i]);
        }
        if (baseInfo != null)
        {
            for (int i = 2; i <= baseInfo.Count + 1; i++)
            {
                row  = hssfSheet.CreateRow(i);
                cell = row.CreateCell(0);
                cell.SetCellValue(baseInfo[i - 2].CODE);
                cell = row.CreateCell(1);
                cell.SetCellValue(baseInfo[i - 2].NAME);
                cell = row.CreateCell(2);
                cell.SetCellValue(baseInfo[i - 2].SubCode);
                cell = row.CreateCell(3);
                cell.SetCellValue(baseInfo[i - 2].SubName);
                cell = row.CreateCell(4);
                cell.SetCellValue(ws.FindUserNameByCode(baseInfo[i - 2].UpdatedBy));
                cell = row.CreateCell(5);
                cell.SetCellValue(baseInfo[i - 2].UpdatedDate == null ? baseInfo[i - 2].CreatedDate.ToString() : baseInfo[i - 2].UpdatedDate.ToString());
            }
        }

        MemoryStream file = new MemoryStream();

        hssfWorkbook.Write(file);
        String fileName = "BaseInfo" + DateTime.Now.ToString("yyyyMMddHHmmss");

        Response.Clear();
        Response.ClearContent();
        Response.ClearHeaders();
        Response.AddHeader("Content-Disposition", string.Format("attachment;filename={0}.xls", fileName));
        Response.AddHeader("Content-Length", file.Length.ToString());
        Response.AddHeader("Content-Transfer-Encoding", "binary");
        Response.ContentType     = "application/octet-stream";
        Response.ContentEncoding = System.Text.Encoding.GetEncoding("utf-8");
        Response.BinaryWrite(file.GetBuffer());
        Response.Flush();
        Response.End();
    }
Esempio n. 10
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string   workorder   = Request.QueryString["workorder"];
        string   status      = Request.QueryString["status"];
        string   productname = Request.QueryString["productname"];
        string   batchnumber = Request.QueryString["batchnumber"];
        string   starttime   = Request.QueryString["starttime"];
        string   endtime     = Request.QueryString["endtime"];
        DateTime dtstart     = DateTime.Today.AddDays(-7);
        DateTime dtend       = DateTime.Now;

        if (!string.IsNullOrEmpty(starttime) && !string.IsNullOrEmpty(endtime))
        {
            dtstart = Convert.ToDateTime(starttime);
            dtend   = Convert.ToDateTime(endtime);
        }

        WareHouseBO                 _bal       = BLLFactory.GetBal <WareHouseBO>(userInfo);
        WsSystem                    ws         = new WsSystem();
        IList <ProductStock>        objstock   = null;
        IList <ProductStockHistory> objhistory = null;

        if (status == "2")
        {
            objstock = _bal.FindProductStockInfo(workorder, productname, batchnumber, starttime, endtime);
        }
        else
        {
            if (status == "3")
            {
                status = "";
            }
            objhistory = _bal.FindProductStockHistory(status, workorder, productname, batchnumber, starttime, endtime);
        }
        if (objstock == null && objhistory.Count == 0)
        {
            Response.Write("no data");
            return;
        }

        HSSFWorkbook hssfWorkbook = new HSSFWorkbook();
        Row          row          = null;
        Cell         cell         = null;
        Sheet        hssfSheet    = hssfWorkbook.CreateSheet("ProductInfo");

        row = hssfSheet.CreateRow(0);
        //填充头
        string objs = "产品条码,工单号码,交货单位,单据编号,收货仓库,产品代码,产品名称,单位,数量,批号,保管员,移交人,时间";

        for (int i = 0; i < objs.Split(',').Length; i++)
        {
            cell = row.CreateCell(i);
            cell.SetCellValue(objs.Split(',')[i]);
        }
        if (objstock != null)
        {
            for (int i = 1; i < objstock.Count + 1; i++)
            {
                row  = hssfSheet.CreateRow(i);
                cell = row.CreateCell(0);
                cell.SetCellValue(objstock[i - 1].PSN);
                cell = row.CreateCell(1);
                cell.SetCellValue(objstock[i - 1].WorkOrder);
                cell = row.CreateCell(2);
                cell.SetCellValue(objstock[i - 1].MANUFACTURE);
                cell = row.CreateCell(3);
                cell.SetCellValue(objstock[i - 1].DOCUMENTID);
                cell = row.CreateCell(4);
                cell.SetCellValue(objstock[i - 1].StockHouse);
                cell = row.CreateCell(5);
                cell.SetCellValue(objstock[i - 1].ProductCode);
                cell = row.CreateCell(6);
                cell.SetCellValue(objstock[i - 1].ProductName);
                cell = row.CreateCell(7);
                cell.SetCellValue(objstock[i - 1].UNIT);
                cell = row.CreateCell(8);
                cell.SetCellValue(objstock[i - 1].QUANTITY.ToString());
                cell = row.CreateCell(9);
                cell.SetCellValue(objstock[i - 1].BatchNumber);
                cell = row.CreateCell(10);
                cell.SetCellValue(ws.FindUserNameByCode(objstock[i - 1].UpdatedBy));
                cell = row.CreateCell(11);
                cell.SetCellValue(ws.FindUserNameByCode(objstock[i - 1].FromBy));
                cell = row.CreateCell(12);
                cell.SetCellValue(objstock[i - 1].UpdatedDate == null ? objstock[i - 1].CreatedDate.ToString() : objstock[i - 1].UpdatedDate.ToString());
            }
        }
        else
        {
            for (int i = 1; i < objhistory.Count + 1; i++)
            {
                row  = hssfSheet.CreateRow(i);
                cell = row.CreateCell(0);
                cell.SetCellValue(objhistory[i - 1].PSN);
                cell = row.CreateCell(1);
                cell.SetCellValue(objhistory[i - 1].WorkOrder);
                cell = row.CreateCell(2);
                cell.SetCellValue(objhistory[i - 1].MANUFACTURE);
                cell = row.CreateCell(3);
                cell.SetCellValue(objhistory[i - 1].DOCUMENTID);
                cell = row.CreateCell(4);
                cell.SetCellValue(objhistory[i - 1].StockHouse);
                cell = row.CreateCell(5);
                cell.SetCellValue(objhistory[i - 1].ProductCode);
                cell = row.CreateCell(6);
                cell.SetCellValue(objhistory[i - 1].ProductName);
                cell = row.CreateCell(7);
                cell.SetCellValue(objhistory[i - 1].UNIT);
                cell = row.CreateCell(8);
                cell.SetCellValue(objhistory[i - 1].QUANTITY.ToString());
                cell = row.CreateCell(9);
                cell.SetCellValue(objhistory[i - 1].BatchNumber);
                cell = row.CreateCell(10);
                cell.SetCellValue(ws.FindUserNameByCode(objhistory[i - 1].UpdatedBy));
                cell = row.CreateCell(11);
                cell.SetCellValue(ws.FindUserNameByCode(objhistory[i - 1].FromBy));
                cell = row.CreateCell(12);
                cell.SetCellValue(objhistory[i - 1].UpdatedDate == null ? objhistory[i - 1].CreatedDate.ToString() : objhistory[i - 1].UpdatedDate.ToString());
            }
        }
        MemoryStream file = new MemoryStream();

        hssfWorkbook.Write(file);
        String fileName = "ProductInfo" + DateTime.Now.ToString("yyyyMMddHHmmss");

        Response.Clear();
        Response.ClearContent();
        Response.ClearHeaders();
        Response.AddHeader("Content-Disposition", string.Format("attachment;filename={0}.xls", fileName));
        Response.AddHeader("Content-Length", file.Length.ToString());
        Response.AddHeader("Content-Transfer-Encoding", "binary");
        Response.ContentType     = "application/octet-stream";
        Response.ContentEncoding = System.Text.Encoding.GetEncoding("utf-8");
        Response.BinaryWrite(file.GetBuffer());
        Response.Flush();
        Response.End();
    }