protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                YnFrame.Dal.Entities.YnUser ynUser = YnFrame.Web.FormsAuthenticationService.GetInstance().GetTicketUserData();
                if (ynUser == null)
                    throw new Exception("用户错误!");
                AscmUserInfo ascmUserInfo = AscmUserInfoService.GetInstance().Get(ynUser.userId);
                if (ascmUserInfo.extExpandType != "erp")
                    throw new Exception("供应商用户错误!");
                AscmUserInfoService.GetInstance().SetSupplier(ascmUserInfo);
                if (ascmUserInfo.ascmSupplier == null)
                    throw new Exception("供应商用户错误!");

                //提取数据
                List<AscmDeliBatSumDetail> list = new List<AscmDeliBatSumDetail>();
                string ids = Request.QueryString["ids"];
                if (!string.IsNullOrEmpty(ids))
                {
                    YnBaseDal.YnPage ynPage = new YnBaseDal.YnPage();
                    ynPage.SetPageSize(500); //pageRows;
                    ynPage.SetCurrentPage(1); //pageNumber;

                    list = AscmDeliBatSumDetailService.GetInstance().GetList("from AscmDeliBatSumDetail where id in(" + ids + ")");

                    AscmDeliBatSumDetailService.GetInstance().SetMaterial(list);
                    AscmDeliBatSumDetailService.GetInstance().SetDeliveryOrderBatch(list);
                    List<AscmDeliveryOrderBatch> listDeliveryOrderBatch = new List<AscmDeliveryOrderBatch>();
                    list.ForEach(P => listDeliveryOrderBatch.Add(
                        new AscmDeliveryOrderBatch
                        {
                            id = P.batchId
                        }));
                    //获取货位分配
                    AscmDeliveryOrderBatchService.GetInstance().SetAssignWarelocation(listDeliveryOrderBatch);
                    list.ForEach(P => P.assignWarelocation = listDeliveryOrderBatch.Find(T => T.id == P.batchId).assignWarelocation);
                    //条码
                    foreach (AscmDeliBatSumDetail ascmDeliBatSumDetail in list)
                    {
                        System.IO.MemoryStream memoryStream = new System.IO.MemoryStream();
                        if (ascmDeliBatSumDetail.ascmMaterialItem!=null&&ascmDeliBatSumDetail.ascmMaterialItem.docNumber != null)
                        {
                            #region Code128
                            MideaAscm.Code.BarCode128 barCode128 = new Code.BarCode128();
                            barCode128.TitleFont = new Font("宋体", 10);
                            barCode128.HeightImage = 50;
                            Bitmap bitmap = barCode128.GetCodeImage(ascmDeliBatSumDetail.ascmMaterialItem.docNumber, ascmDeliBatSumDetail.ascmMaterialItem.docNumber, Code.BarCode128.Encode.Code128B);
                            bitmap.Save(memoryStream, System.Drawing.Imaging.ImageFormat.Gif);
                            bitmap.Dispose();
                            #endregion

                            #region Code39
                            //YnBaseClass2.Helper.BarCode39 barCode39 = new YnBaseClass2.Helper.BarCode39();
                            //barCode39.WidthCU = 10;
                            //barCode39.WidthXI = 3;
                            //System.Drawing.Bitmap bitmap = barCode39.CreateBarCode(ascmDeliBatSumDetail.ascmMaterialItem.docNumber, ascmDeliBatSumDetail.ascmMaterialItem.docNumber, 0, 0);
                            ////生成图片
                            ////System.IO.MemoryStream memoryStream = new System.IO.MemoryStream();
                            //bitmap.Save(memoryStream, System.Drawing.Imaging.ImageFormat.Gif);
                            //bitmap.Dispose();
                            #endregion
                        }
                        ascmDeliBatSumDetail.materialBarcode = memoryStream.ToArray();

                    }
                }
                ReportViewer1.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Local;
                ReportViewer1.LocalReport.ReportPath = Server.MapPath("SupplierDriverDeliveryBarCodeReport.rdlc");
                ReportDataSource rds1 = new ReportDataSource();
                rds1.Name = "DataSet1";
                rds1.Value = list;
                ReportViewer1.LocalReport.DataSources.Clear();
                ReportViewer1.LocalReport.DataSources.Add(rds1);

                string companpyTitle = "美的中央空调";
                string title = companpyTitle + "供应商送货合单条码";

                ReportParameter[] reportParameters = new ReportParameter[] {
                    new ReportParameter("ReportParameter_SupplierName",ascmUserInfo.ascmSupplier.name )
                };

                ReportViewer1.LocalReport.SetParameters(reportParameters);
                ReportViewer1.LocalReport.Refresh();
            }
        }
Exemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                YnFrame.Dal.Entities.YnUser ynUser = YnFrame.Web.FormsAuthenticationService.GetInstance().GetTicketUserData();
                if (ynUser == null)
                    throw new Exception("用户错误!");
                AscmUserInfo ascmUserInfo = AscmUserInfoService.GetInstance().Get(ynUser.userId);
                string supplierName = "";
                if (ascmUserInfo.extExpandType == "erp")
                {
                    AscmUserInfoService.GetInstance().SetSupplier(ascmUserInfo);
                    if (ascmUserInfo.ascmSupplier != null)
                        supplierName = ascmUserInfo.ascmSupplier.name;

                }
                //if (ascmUserInfo.extExpandType != "erp")
                //    throw new Exception("供应商用户错误!");
                //AscmUserInfoService.GetInstance().SetSupplier(ascmUserInfo);
                //if (ascmUserInfo.ascmSupplier == null)
                //    throw new Exception("供应商用户错误!");

                //提取数据
                int id = 0;

                List<AscmMaterialItem> list = new List<AscmMaterialItem>();
                if (!string.IsNullOrEmpty(Request.QueryString["id"]) && int.TryParse(Request.QueryString["id"], out id))
                {
                    AscmMaterialItem ascmMaterialItem = AscmMaterialItemService.GetInstance().Get(id);
                    if (ascmMaterialItem != null)
                    {
                        //条码
                        System.IO.MemoryStream memoryStream = new System.IO.MemoryStream();
                        if (ascmMaterialItem.docNumber != null)
                        {
                            #region Code128
                            MideaAscm.Code.BarCode128 barCode128 = new Code.BarCode128();
                            barCode128.TitleFont = new System.Drawing.Font("宋体", 10);
                            barCode128.HeightImage = 50;
                            System.Drawing.Bitmap bitmap = barCode128.GetCodeImage(ascmMaterialItem.docNumber, ascmMaterialItem.docNumber, Code.BarCode128.Encode.Code128B);
                            bitmap.Save(memoryStream, System.Drawing.Imaging.ImageFormat.Gif);
                            bitmap.Dispose();
                            #endregion
                        }
                        ascmMaterialItem.materialBarcode = memoryStream.ToArray();
                        list.Add(ascmMaterialItem);
                    }
                }

                ReportViewer1.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Local;
                ReportViewer1.LocalReport.ReportPath = Server.MapPath("MaterialReport.rdlc");
                ReportDataSource rds1 = new ReportDataSource();
                rds1.Name = "DataSet1";
                rds1.Value = list;
                ReportViewer1.LocalReport.DataSources.Clear();
                ReportViewer1.LocalReport.DataSources.Add(rds1);

                string companpyTitle = "美的中央空调";
                string title = companpyTitle + "供应商送货物料条码";

                ReportParameter[] reportParameters = new ReportParameter[] {
                    new ReportParameter("ReportParameter_SupplierName",supplierName )
                };

                ReportViewer1.LocalReport.SetParameters(reportParameters);
                ReportViewer1.LocalReport.Refresh();
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                YnFrame.Dal.Entities.YnUser ynUser = YnFrame.Web.FormsAuthenticationService.GetInstance().GetTicketUserData();
                if (ynUser == null)
                    throw new Exception("用户错误!");
                AscmUserInfo ascmUserInfo = AscmUserInfoService.GetInstance().Get(ynUser.userId);
                if (ascmUserInfo.extExpandType != "erp")
                    throw new Exception("供应商用户错误!");
                AscmUserInfoService.GetInstance().SetSupplier(ascmUserInfo);
                if (ascmUserInfo.ascmSupplier == null)
                    throw new Exception("供应商用户错误!");

                //打印的数据
                List<AscmDeliBatSumDetail> sumList = new List<AscmDeliBatSumDetail>();
                //最后一个装箱
                AscmDeliBatSumDetail lastDetail = new AscmDeliBatSumDetail();
                string ids = Request.QueryString["ids"];
                string unitIds = Request.QueryString["unitIds"];
                string[] listId = ids.Split(',');
                string[] listUnitId = unitIds.Split(',');
                if (!string.IsNullOrEmpty(ids))
                {
                    List<AscmDeliBatSumDetail> list = new List<AscmDeliBatSumDetail>();
                    for (int i = 0; i < listId.Count(); i++)
                    {
                        AscmDeliBatSumDetail ascmDeliBatSumDetail = AscmDeliBatSumDetailService.GetInstance().Get(Int32.Parse(listId[i]));
                        AscmContainerUnitQuantity ascmContainerUnitQuantity = AscmContainerUnitQuantityService.GetInstance().Get(Int32.Parse(listUnitId[i]));
                        ascmDeliBatSumDetail.container = ascmContainerUnitQuantity.container;
                        ascmDeliBatSumDetail.materialUnitQuantity = ascmContainerUnitQuantity.unitQuantity;
                        ascmDeliBatSumDetail.containerUnitQuantityId = ascmContainerUnitQuantity.id;
                        list.Add(ascmDeliBatSumDetail);
                    }

                    if (list != null)
                    {
                        AscmDeliBatSumDetailService.GetInstance().SetMaterial(list);
                        AscmDeliBatSumDetailService.GetInstance().SetDeliveryOrderBatch(list);
                        List<AscmDeliveryOrderBatch> listDeliveryOrderBatch = new List<AscmDeliveryOrderBatch>();
                        list.ForEach(P => listDeliveryOrderBatch.Add(
                            new AscmDeliveryOrderBatch
                            {
                                id = P.batchId
                            }));
                        //获取货位分配
                        AscmDeliveryOrderBatchService.GetInstance().SetAssignWarelocation(listDeliveryOrderBatch);
                        list.ForEach(P => P.assignWarelocation = listDeliveryOrderBatch.Find(T => T.id == P.batchId).assignWarelocation);
                        foreach(AscmDeliBatSumDetail ascmDeliBatSumDetail in list)
                        {
                            //条码
                            System.IO.MemoryStream memoryStream = new System.IO.MemoryStream();
                            if (ascmDeliBatSumDetail.ascmMaterialItem.docNumber != null)
                            {
                                #region Code128
                                MideaAscm.Code.BarCode128 barCode128 = new Code.BarCode128();
                                barCode128.TitleFont = new System.Drawing.Font("宋体", 10);
                                barCode128.HeightImage = 50;
                                System.Drawing.Bitmap bitmap = barCode128.GetCodeImage(ascmDeliBatSumDetail.batchBarCode, ascmDeliBatSumDetail.batchBarCode, Code.BarCode128.Encode.Code128B);
                                bitmap.Save(memoryStream, System.Drawing.Imaging.ImageFormat.Gif);
                                bitmap.Dispose();
                                #endregion

                                #region Code39
                                //YnBaseClass2.Helper.BarCode39 barCode39 = new YnBaseClass2.Helper.BarCode39();
                                //barCode39.WidthCU = 10;
                                //barCode39.WidthXI = 3;
                                //System.Drawing.Bitmap bitmap = barCode39.CreateBarCode(ascmDeliBatSumDetail.ascmMaterialItem.docNumber, ascmDeliBatSumDetail.ascmMaterialItem.docNumber, 0, 0);
                                ////生成图片
                                ////System.IO.MemoryStream memoryStream = new System.IO.MemoryStream();
                                //bitmap.Save(memoryStream, System.Drawing.Imaging.ImageFormat.Gif);
                                //bitmap.Dispose();
                                #endregion
                            }
                            ascmDeliBatSumDetail.materialBarcode = memoryStream.ToArray();

                            decimal totalNumber = ascmDeliBatSumDetail.totalNumber;//总数量
                            decimal unitQuantity = ascmDeliBatSumDetail.materialUnitQuantity;//单元数
                            //decimal unitQuantity = 10;
                            decimal count = decimal.Truncate(totalNumber / unitQuantity);//箱数量>=0
                            decimal rest = totalNumber % unitQuantity;//剩余数量>=0

                            //设置装箱数 2015.3.26

                            //总数 < 单元数 ,仅有一个箱子,总数 = 剩余数量
                            if (count == 0)
                            {
                                count = 1;
                            }
                            else
                            {
                                //有剩余数量,多出一箱
                                if (rest != 0) count = count + 1;
                            }
                            for (int i = 0; i < count; i++)
                            {
                                //最后一个为剩余数量
                                if (i == count - 1 && rest != 0)
                                {
                                    lastDetail.ascmDeliveryOrderBatch = ascmDeliBatSumDetail.ascmDeliveryOrderBatch;
                                    lastDetail.ascmMaterialItem = ascmDeliBatSumDetail.ascmMaterialItem;
                                    lastDetail.assignWarelocation = ascmDeliBatSumDetail.assignWarelocation;
                                    lastDetail.materialUnitQuantity = rest;
                                    sumList.Add(lastDetail);
                                }
                                else
                                {
                                    sumList.Add(ascmDeliBatSumDetail);
                                }
                            }
                        }
                    }

                }

                ReportViewer1.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Local;
                ReportViewer1.LocalReport.ReportPath = Server.MapPath("SupplierDriverDeliveryDetialBarCodeReport.rdlc");
                ReportDataSource rds1 = new ReportDataSource();
                rds1.Name = "DataSet1";
                rds1.Value = sumList;
                ReportViewer1.LocalReport.DataSources.Clear();
                ReportViewer1.LocalReport.DataSources.Add(rds1);

                string companpyTitle = "美的中央空调";
                string title = companpyTitle + "供应商送货批单条码";

                ReportParameter[] reportParameters = new ReportParameter[] {
                    new ReportParameter("ReportParameter_SupplierName",ascmUserInfo.ascmSupplier.name )
                };

                ReportViewer1.LocalReport.SetParameters(reportParameters);
                ReportViewer1.LocalReport.Refresh();
            }
        }
Exemplo n.º 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                YnFrame.Dal.Entities.YnUser ynUser = YnFrame.Web.FormsAuthenticationService.GetInstance().GetTicketUserData();
                if (ynUser == null)
                {
                    throw new Exception("用户错误!");
                }
                AscmUserInfo ascmUserInfo = AscmUserInfoService.GetInstance().Get(ynUser.userId);
                string       supplierName = "";
                if (ascmUserInfo.extExpandType == "erp")
                {
                    AscmUserInfoService.GetInstance().SetSupplier(ascmUserInfo);
                    if (ascmUserInfo.ascmSupplier != null)
                    {
                        supplierName = ascmUserInfo.ascmSupplier.name;
                    }
                }

                //提取数据
                List <AscmMaterialItem> sumList = new List <AscmMaterialItem>();
                //最后一个装箱
                AscmMaterialItem lastDetail    = new AscmMaterialItem();
                string           ids           = Request.QueryString["ids"];
                string           unitQuantitys = Request.QueryString["unitQuantitys"];
                string           totalNumbers  = Request.QueryString["totalNumbers"];
                bool             isUnitPrint   = Boolean.Parse(Request.QueryString["isUnitPrint"]);

                string[] listId           = ids.Split(',');
                string[] listUnitQuantity = unitQuantitys.Split(',');
                string[] listTotalNumber  = totalNumbers.Split(',');

                List <AscmMaterialItem> list = new List <AscmMaterialItem>();
                for (int i = 0; i < listId.Count(); i++)
                {
                    AscmMaterialItem          ascmMaterialItem          = AscmMaterialItemService.GetInstance().Get(Int32.Parse(listId[i]));
                    AscmContainerUnitQuantity ascmContainerUnitQuantity = AscmContainerUnitQuantityService.GetInstance().Get(Int32.Parse(listUnitQuantity[i]));
                    ascmMaterialItem.container               = ascmContainerUnitQuantity.container;
                    ascmMaterialItem.unitQuantity            = ascmContainerUnitQuantity.unitQuantity;
                    ascmMaterialItem.containerUnitQuantityId = ascmContainerUnitQuantity.id;
                    ascmMaterialItem.totalNumber             = Decimal.Parse(listTotalNumber[i]);
                    list.Add(ascmMaterialItem);
                }
                if (!string.IsNullOrEmpty(ids))
                {
                    if (list != null && list.Count() > 0)
                    {
                        foreach (AscmMaterialItem ascmMaterialItem in list)
                        {
                            //条码
                            System.IO.MemoryStream memoryStream = new System.IO.MemoryStream();
                            if (ascmMaterialItem.docNumber != null)
                            {
                                #region Code128
                                MideaAscm.Code.BarCode128 barCode128 = new Code.BarCode128();
                                barCode128.TitleFont   = new System.Drawing.Font("宋体", 10);
                                barCode128.HeightImage = 50;
                                System.Drawing.Bitmap bitmap = barCode128.GetCodeImage(ascmMaterialItem.docNumber, ascmMaterialItem.docNumber, Code.BarCode128.Encode.Code128B);
                                bitmap.Save(memoryStream, System.Drawing.Imaging.ImageFormat.Gif);
                                bitmap.Dispose();
                                #endregion
                            }
                            ascmMaterialItem.materialBarcode = memoryStream.ToArray();
                            //如果是总数打印,单元数=总数
                            if (!isUnitPrint)
                            {
                                ascmMaterialItem.unitQuantity = ascmMaterialItem.totalNumber;
                            }

                            decimal totalNumber  = ascmMaterialItem.totalNumber;          //总数量
                            decimal unitQuantity = ascmMaterialItem.unitQuantity;         //单元数
                            //decimal unitQuantity = 10;
                            decimal count = decimal.Truncate(totalNumber / unitQuantity); //箱数量>=0
                            decimal rest  = totalNumber % unitQuantity;                   //剩余数量>=0

                            //设置装箱数 2015.3.26

                            //总数 < 单元数 ,仅有一个箱子,总数 = 剩余数量
                            if (count == 0)
                            {
                                count = 1;
                            }
                            else
                            {
                                //有剩余数量,多出一箱
                                if (rest != 0)
                                {
                                    count = count + 1;
                                }
                            }
                            for (int i = 0; i < count; i++)
                            {
                                //最后一个为剩余数量
                                if (i == count - 1 && rest != 0)
                                {
                                    lastDetail.materialBarcode = ascmMaterialItem.materialBarcode;
                                    lastDetail.docNumber       = ascmMaterialItem.docNumber;
                                    lastDetail.description     = ascmMaterialItem.description;
                                    lastDetail.unit            = ascmMaterialItem.unit;
                                    lastDetail.unitQuantity    = rest;
                                    sumList.Add(lastDetail);
                                }
                                else
                                {
                                    sumList.Add(ascmMaterialItem);
                                }
                            }
                        }
                    }
                }

                ReportViewer1.ProcessingMode         = Microsoft.Reporting.WebForms.ProcessingMode.Local;
                ReportViewer1.LocalReport.ReportPath = Server.MapPath("SupplierMaterialReport.rdlc");
                ReportDataSource rds1 = new ReportDataSource();
                rds1.Name  = "DataSet1";
                rds1.Value = sumList;
                ReportViewer1.LocalReport.DataSources.Clear();
                ReportViewer1.LocalReport.DataSources.Add(rds1);

                string companpyTitle = "美的中央空调";
                string title         = companpyTitle + "供应商送货物料条码";

                ReportParameter[] reportParameters = new ReportParameter[] {
                    new ReportParameter("ReportParameter_SupplierName", supplierName)
                };

                ReportViewer1.LocalReport.SetParameters(reportParameters);
                ReportViewer1.LocalReport.Refresh();
            }
        }
Exemplo n.º 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                YnFrame.Dal.Entities.YnUser ynUser = YnFrame.Web.FormsAuthenticationService.GetInstance().GetTicketUserData();
                if (ynUser == null)
                {
                    throw new Exception("用户错误!");
                }
                AscmUserInfo ascmUserInfo = AscmUserInfoService.GetInstance().Get(ynUser.userId);
                string       supplierName = "";
                if (ascmUserInfo.extExpandType == "erp")
                {
                    AscmUserInfoService.GetInstance().SetSupplier(ascmUserInfo);
                    if (ascmUserInfo.ascmSupplier != null)
                    {
                        supplierName = ascmUserInfo.ascmSupplier.name;
                    }
                }
                //if (ascmUserInfo.extExpandType != "erp")
                //    throw new Exception("供应商用户错误!");
                //AscmUserInfoService.GetInstance().SetSupplier(ascmUserInfo);
                //if (ascmUserInfo.ascmSupplier == null)
                //    throw new Exception("供应商用户错误!");

                //提取数据
                int id = 0;

                List <AscmMaterialItem> list = new List <AscmMaterialItem>();
                if (!string.IsNullOrEmpty(Request.QueryString["id"]) && int.TryParse(Request.QueryString["id"], out id))
                {
                    AscmMaterialItem ascmMaterialItem = AscmMaterialItemService.GetInstance().Get(id);
                    if (ascmMaterialItem != null)
                    {
                        //条码
                        System.IO.MemoryStream memoryStream = new System.IO.MemoryStream();
                        if (ascmMaterialItem.docNumber != null)
                        {
                            #region Code128
                            MideaAscm.Code.BarCode128 barCode128 = new Code.BarCode128();
                            barCode128.TitleFont   = new System.Drawing.Font("宋体", 10);
                            barCode128.HeightImage = 50;
                            System.Drawing.Bitmap bitmap = barCode128.GetCodeImage(ascmMaterialItem.docNumber, ascmMaterialItem.docNumber, Code.BarCode128.Encode.Code128B);
                            bitmap.Save(memoryStream, System.Drawing.Imaging.ImageFormat.Gif);
                            bitmap.Dispose();
                            #endregion
                        }
                        ascmMaterialItem.materialBarcode = memoryStream.ToArray();
                        list.Add(ascmMaterialItem);
                    }
                }

                ReportViewer1.ProcessingMode         = Microsoft.Reporting.WebForms.ProcessingMode.Local;
                ReportViewer1.LocalReport.ReportPath = Server.MapPath("MaterialReport.rdlc");
                ReportDataSource rds1 = new ReportDataSource();
                rds1.Name  = "DataSet1";
                rds1.Value = list;
                ReportViewer1.LocalReport.DataSources.Clear();
                ReportViewer1.LocalReport.DataSources.Add(rds1);

                string companpyTitle = "美的中央空调";
                string title         = companpyTitle + "供应商送货物料条码";

                ReportParameter[] reportParameters = new ReportParameter[] {
                    new ReportParameter("ReportParameter_SupplierName", supplierName)
                };

                ReportViewer1.LocalReport.SetParameters(reportParameters);
                ReportViewer1.LocalReport.Refresh();
            }
        }
Exemplo n.º 6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                List<AscmWmsPreparationMain> listAscmWmsPreparationMain = null;
                List<AscmWmsPreparationDetail> listAscmWmsPreparationDetail = null;
                List<AscmWmsPreparationDetail> listDetail = new List<AscmWmsPreparationDetail>(); ;
                AscmWmsPreparationMain ascmWmsPreparationMain = null;
                List<AscmWipDiscreteJobs> listAscmWipDiscreteJobs = null;
                string wipSupplyType = "";
                string billNoStart = "", billNoEnd = "";
                string materialDocNumberStart = "", materialDocNumberEnd = "";
                string warehouseIdStart = "", warehouseIdEnd = "";
                string scheduledStartDateStart = "", scheduledStartDateEnd = "";
                string jobScheduleGroupsStart = "", jobScheduleGroupsEnd = "";
                string jobProductionLineStart = "", jobProductionLineEnd = "";
                if (!string.IsNullOrEmpty(Request.QueryString["docNumber"]))
                {
                    string docNumber = Request.QueryString["docNumber"];
                    if (!string.IsNullOrEmpty(docNumber))
                    {
                        listAscmWmsPreparationMain = AscmWmsPreparationMainService.GetInstance().GetList(" from AscmWmsPreparationMain where docNumber='" + docNumber + "'");
                        if (listAscmWmsPreparationMain != null && listAscmWmsPreparationMain.Count() > 0)
                        {
                            YnBaseDal.YnPage ynPage = new YnBaseDal.YnPage();
                            ynPage.SetPageSize(500); //pageRows;
                            ynPage.SetCurrentPage(1); //pageNumber;

                            ascmWmsPreparationMain = listAscmWmsPreparationMain[0];
                            //listAscmWmsPreparationDetail = AscmWmsPreparationDetailService.GetInstance().GetSumList(null,"", "", ascmWmsPreparationMain.id, "", "");
                            //listAscmWmsPreparationDetail = AscmWmsPreparationDetailService.GetInstance().GetList(ynPage,"","",ascmWmsPreparationMain.id,"","");
                            listAscmWmsPreparationDetail = AscmWmsPreparationDetailService.GetInstance().GetList(null, "", "", ascmWmsPreparationMain.id, "", "");
                            AscmWmsPreparationDetailService.GetInstance().SetWipDiscreteJobs(listAscmWmsPreparationDetail);
                            List<AscmWarelocation> listAscmWarelocation = AscmWarelocationService.GetInstance().GetList("from AscmWarelocation");
                            if (listAscmWmsPreparationDetail != null && listAscmWmsPreparationDetail.Count() > 0)
                            {
                                foreach (AscmWmsPreparationDetail ascmWmsPreparationDetail in listAscmWmsPreparationDetail)
                                {
                                    var find = listAscmWarelocation.Find(item => item.id == ascmWmsPreparationDetail.warelocationId);
                                    if (find != null)
                                        ascmWmsPreparationDetail.locationDocNumber = find.docNumber;
                                }
                                billNoStart = listAscmWmsPreparationDetail.OrderBy(item => item.wipEntityName).First().wipEntityName;
                                billNoEnd = listAscmWmsPreparationDetail.OrderBy(item => item.wipEntityName).Last().wipEntityName;
                                materialDocNumberStart = listAscmWmsPreparationDetail.OrderBy(item => item.materialDocNumber).First().materialDocNumber;
                                materialDocNumberEnd = listAscmWmsPreparationDetail.OrderBy(item => item.materialDocNumber).Last().materialDocNumber;
                                warehouseIdStart = listAscmWmsPreparationDetail.OrderBy(item => item.warehouseId).First().warehouseId;
                                warehouseIdEnd = listAscmWmsPreparationDetail.OrderBy(item => item.warehouseId).Last().warehouseId;
                                //wipSupplyType = listAscmWmsPreparationDetail[0].ascmMaterialItem.wipSupplyTypeCn;
                                jobScheduleGroupsStart = listAscmWmsPreparationDetail.OrderBy(item => item.jobScheduleGroupsName).First().jobScheduleGroupsName;
                                jobScheduleGroupsEnd = listAscmWmsPreparationDetail.OrderBy(item => item.jobScheduleGroupsName).Last().jobScheduleGroupsName;
                                jobProductionLineStart = listAscmWmsPreparationDetail.OrderBy(item => item.jobProductionLine).First().jobProductionLine;
                                jobProductionLineEnd = listAscmWmsPreparationDetail.OrderBy(item => item.jobProductionLine).Last().jobProductionLine;
                                //string billIds = "";
                                var vbillIds = listAscmWmsPreparationDetail.Select(item => item.wipEntityId).Distinct();
                                if (vbillIds != null)
                                {
                                    string billIds = string.Empty;
                                    foreach (int billId in vbillIds)
                                    {
                                        if (!string.IsNullOrEmpty(billIds))
                                            billIds += ",";
                                        billIds += "'" + billId + "'";
                                    }
                                    if (!string.IsNullOrEmpty(billIds))
                                    {
                                        string whereOther = " id in (" + billIds + ")";
                                        listAscmWipDiscreteJobs = AscmWipDiscreteJobsService.GetInstance().GetList(null,"","","",whereOther);
                                        scheduledStartDateStart = listAscmWipDiscreteJobs.OrderBy(item => item._scheduledStartDate).First()._scheduledStartDate;
                                        scheduledStartDateEnd = listAscmWipDiscreteJobs.OrderBy(item => item._scheduledStartDate).Last()._scheduledStartDate;
                                    }
                                }
                                #region 合计 同种物料在一个货位,进行数量合计,同种物料在不同货位,进行分开显示
                                var groupByMaterial = listAscmWmsPreparationDetail.GroupBy(p => p.materialId);
                                foreach (IGrouping<int, AscmWmsPreparationDetail> ig in groupByMaterial)
                                {
                                    //判断此物料的有多少条数据
                                    List<AscmWmsPreparationDetail> list = listAscmWmsPreparationDetail.Where(item => item.materialId == ig.Key).ToList();
                                    if (list != null && list.Count() > 1)
                                    {
                                        var groupByWarelocation = list.GroupBy(p => p.warelocationId);
                                        foreach (IGrouping<int, AscmWmsPreparationDetail> igrouping in groupByWarelocation)
                                        {
                                            AscmWmsPreparationDetail ascmWmsPreparationDetail_ByWarelocation = igrouping.First();
                                            AscmWmsPreparationDetail ascmWmsPreparationDetail = new AscmWmsPreparationDetail();
                                            ascmWmsPreparationDetail.materialId = igrouping.Key;
                                            //ascmWmsPreparationDetail.ascmMaterialItem = ascmWmsPreparationDetail_ByWarelocation.ascmMaterialItem;
                                            ascmWmsPreparationDetail.warehouseId = ascmWmsPreparationDetail_ByWarelocation.warehouseId;
                                            ascmWmsPreparationDetail.locationDocNumber = ascmWmsPreparationDetail_ByWarelocation.locationDocNumber;
                                            ascmWmsPreparationDetail.wipSupplyType = ascmWmsPreparationDetail_ByWarelocation.wipSupplyType;
                                            ascmWmsPreparationDetail.planQuantity = igrouping.Sum(P => P.planQuantity);
                                            //ascmWmsPreparationDetail.quantity = igrouping.Sum(P => P.quantity);
                                            ascmWmsPreparationDetail.issueQuantity = igrouping.Sum(P => P.issueQuantity);
                                            ascmWmsPreparationDetail.containerBindNumber = igrouping.Sum(P => P.containerBindNumber);
                                            listDetail.Add(ascmWmsPreparationDetail);
                                        }
                                    }
                                    else
                                    {
                                        AscmWmsPreparationDetail _ascmWmsPreparationDetail = ig.First();
                                        AscmWmsPreparationDetail ascmWmsPreparationDetail = new AscmWmsPreparationDetail();
                                        ascmWmsPreparationDetail.materialId = ig.Key;
                                        //ascmWmsPreparationDetail.ascmMaterialItem = _ascmWmsPreparationDetail.ascmMaterialItem;
                                        ascmWmsPreparationDetail.warehouseId = _ascmWmsPreparationDetail.warehouseId;
                                        ascmWmsPreparationDetail.locationDocNumber = _ascmWmsPreparationDetail.locationDocNumber;
                                        ascmWmsPreparationDetail.wipSupplyType = _ascmWmsPreparationDetail.wipSupplyType;
                                        ascmWmsPreparationDetail.planQuantity = ig.Sum(P => P.planQuantity);
                                        //ascmWmsPreparationDetail.quantity = ig.Sum(P => P.quantity);
                                        ascmWmsPreparationDetail.issueQuantity = ig.Sum(P => P.issueQuantity);
                                        ascmWmsPreparationDetail.containerBindNumber = ig.Sum(P => P.containerBindNumber);
                                        listDetail.Add(ascmWmsPreparationDetail);
                                    }
                                }
                                #endregion
                            }
                            #region Code128
                            System.IO.MemoryStream memoryStream = new System.IO.MemoryStream();
                            MideaAscm.Code.BarCode128 barCode128 = new Code.BarCode128();
                            barCode128.TitleFont = new System.Drawing.Font("宋体", 10);
                            barCode128.HeightImage = 50;
                            System.Drawing.Bitmap bitmap = barCode128.GetCodeImage(docNumber, docNumber, Code.BarCode128.Encode.Code128B);
                            bitmap.Save(memoryStream, System.Drawing.Imaging.ImageFormat.Gif);
                            if (listDetail != null && listDetail.Count() > 0)
                            {
                                listDetail = listDetail.OrderBy(item => item.materialDocNumber).ToList();
                                listDetail[0].barcodeShow = memoryStream.ToArray();
                            }
                            bitmap.Dispose();
                            #endregion

                            #region 条码 Code39
                            //System.IO.MemoryStream memoryStream = new System.IO.MemoryStream();
                            //YnBaseClass2.Helper.BarCode39 barCode39 = new YnBaseClass2.Helper.BarCode39();
                            //barCode39.WidthCU = 10;
                            //barCode39.WidthXI = 3;
                            //System.Drawing.Bitmap bitmap = barCode39.CreateBarCode(docNumber, docNumber, 0, 0);
                            //bitmap.Save(memoryStream, System.Drawing.Imaging.ImageFormat.Gif);
                            //bitmap.Dispose();
                            //if (listDetail != null && listDetail.Count()>0)
                            //    listDetail[0].barcodeShow = memoryStream.ToArray();
                            #endregion
                        }
                    }
                }
                ReportViewer1.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Local;
                ReportViewer1.LocalReport.ReportPath = Server.MapPath("WmsPreparationReport.rdlc");
                ReportDataSource rds1 = new ReportDataSource();
                rds1.Name = "DataSet1";
                rds1.Value = listDetail;
                ReportViewer1.LocalReport.DataSources.Clear();//好像不clear也可以
                ReportViewer1.LocalReport.DataSources.Add(rds1);

                string title = "中央空调顺德工厂需求备料单";
                //string secondTitle = "车间任务物料需求报表";
                string userName = string.Empty;
                if (User.Identity.IsAuthenticated)
                    userName = User.Identity.Name;

                ReportParameter[] reportParameters = new ReportParameter[] {
                    new ReportParameter("ReportParameter_Title", title),
                    //new ReportParameter("ReportParameter_secondTitle", secondTitle),
                    new ReportParameter("ReportParameter_ReportTime", "打印时间:" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")),
                    new ReportParameter("ReportParameter_wipSupplyType", "供应类型:" + wipSupplyType),
                    new ReportParameter("ReportParameter_scheduledStartDate", "计划时间从:" +scheduledStartDateStart +" 至 "+scheduledStartDateEnd),
                    new ReportParameter("ReportParameter_BillNo", "任务从:" +billNoStart +" 至 "+billNoEnd),
                    new ReportParameter("ReportParameter_materialDocNumber", "组件从:" +materialDocNumberStart +" 至 "+materialDocNumberEnd),
                    new ReportParameter("ReportParameter_warehouseId", "子库从:" +warehouseIdStart +" 至 "+warehouseIdEnd),
                    new ReportParameter("ReportParameter_jobScheduleGroups", "计划组从:" +jobScheduleGroupsStart +" 至 "+jobScheduleGroupsEnd),
                    new ReportParameter("ReportParameter_jobProductionLine", "生产线从:" +jobProductionLineStart +" 至 "+jobProductionLineEnd),
                    new ReportParameter("ReportParameter_Printer", "打印人:" + userName),
                };
                ReportViewer1.LocalReport.SetParameters(reportParameters);
                ReportViewer1.LocalReport.Refresh();
            }
        }
Exemplo n.º 7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                List <AscmWmsPreparationMain>   listAscmWmsPreparationMain   = null;
                List <AscmWmsPreparationDetail> listAscmWmsPreparationDetail = null;
                List <AscmWmsPreparationDetail> listDetail              = new List <AscmWmsPreparationDetail>();;
                AscmWmsPreparationMain          ascmWmsPreparationMain  = null;
                List <AscmWipDiscreteJobs>      listAscmWipDiscreteJobs = null;
                string wipSupplyType = "";
                string billNoStart = "", billNoEnd = "";
                string materialDocNumberStart = "", materialDocNumberEnd = "";
                string warehouseIdStart = "", warehouseIdEnd = "";
                string scheduledStartDateStart = "", scheduledStartDateEnd = "";
                string jobScheduleGroupsStart = "", jobScheduleGroupsEnd = "";
                string jobProductionLineStart = "", jobProductionLineEnd = "";
                if (!string.IsNullOrEmpty(Request.QueryString["docNumber"]))
                {
                    string docNumber = Request.QueryString["docNumber"];
                    if (!string.IsNullOrEmpty(docNumber))
                    {
                        listAscmWmsPreparationMain = AscmWmsPreparationMainService.GetInstance().GetList(" from AscmWmsPreparationMain where docNumber='" + docNumber + "'");
                        if (listAscmWmsPreparationMain != null && listAscmWmsPreparationMain.Count() > 0)
                        {
                            YnBaseDal.YnPage ynPage = new YnBaseDal.YnPage();
                            ynPage.SetPageSize(500);  //pageRows;
                            ynPage.SetCurrentPage(1); //pageNumber;

                            ascmWmsPreparationMain = listAscmWmsPreparationMain[0];
                            //listAscmWmsPreparationDetail = AscmWmsPreparationDetailService.GetInstance().GetSumList(null,"", "", ascmWmsPreparationMain.id, "", "");
                            //listAscmWmsPreparationDetail = AscmWmsPreparationDetailService.GetInstance().GetList(ynPage,"","",ascmWmsPreparationMain.id,"","");
                            listAscmWmsPreparationDetail = AscmWmsPreparationDetailService.GetInstance().GetList(null, "", "", ascmWmsPreparationMain.id, "", "");
                            AscmWmsPreparationDetailService.GetInstance().SetWipDiscreteJobs(listAscmWmsPreparationDetail);
                            List <AscmWarelocation> listAscmWarelocation = AscmWarelocationService.GetInstance().GetList("from AscmWarelocation");
                            if (listAscmWmsPreparationDetail != null && listAscmWmsPreparationDetail.Count() > 0)
                            {
                                foreach (AscmWmsPreparationDetail ascmWmsPreparationDetail in listAscmWmsPreparationDetail)
                                {
                                    var find = listAscmWarelocation.Find(item => item.id == ascmWmsPreparationDetail.warelocationId);
                                    if (find != null)
                                    {
                                        ascmWmsPreparationDetail.locationDocNumber = find.docNumber;
                                    }
                                }
                                billNoStart            = listAscmWmsPreparationDetail.OrderBy(item => item.wipEntityName).First().wipEntityName;
                                billNoEnd              = listAscmWmsPreparationDetail.OrderBy(item => item.wipEntityName).Last().wipEntityName;
                                materialDocNumberStart = listAscmWmsPreparationDetail.OrderBy(item => item.materialDocNumber).First().materialDocNumber;
                                materialDocNumberEnd   = listAscmWmsPreparationDetail.OrderBy(item => item.materialDocNumber).Last().materialDocNumber;
                                warehouseIdStart       = listAscmWmsPreparationDetail.OrderBy(item => item.warehouseId).First().warehouseId;
                                warehouseIdEnd         = listAscmWmsPreparationDetail.OrderBy(item => item.warehouseId).Last().warehouseId;
                                //wipSupplyType = listAscmWmsPreparationDetail[0].ascmMaterialItem.wipSupplyTypeCn;
                                jobScheduleGroupsStart = listAscmWmsPreparationDetail.OrderBy(item => item.jobScheduleGroupsName).First().jobScheduleGroupsName;
                                jobScheduleGroupsEnd   = listAscmWmsPreparationDetail.OrderBy(item => item.jobScheduleGroupsName).Last().jobScheduleGroupsName;
                                jobProductionLineStart = listAscmWmsPreparationDetail.OrderBy(item => item.jobProductionLine).First().jobProductionLine;
                                jobProductionLineEnd   = listAscmWmsPreparationDetail.OrderBy(item => item.jobProductionLine).Last().jobProductionLine;
                                //string billIds = "";
                                var vbillIds = listAscmWmsPreparationDetail.Select(item => item.wipEntityId).Distinct();
                                if (vbillIds != null)
                                {
                                    string billIds = string.Empty;
                                    foreach (int billId in vbillIds)
                                    {
                                        if (!string.IsNullOrEmpty(billIds))
                                        {
                                            billIds += ",";
                                        }
                                        billIds += "'" + billId + "'";
                                    }
                                    if (!string.IsNullOrEmpty(billIds))
                                    {
                                        string whereOther = " id in (" + billIds + ")";
                                        listAscmWipDiscreteJobs = AscmWipDiscreteJobsService.GetInstance().GetList(null, "", "", "", whereOther);
                                        scheduledStartDateStart = listAscmWipDiscreteJobs.OrderBy(item => item._scheduledStartDate).First()._scheduledStartDate;
                                        scheduledStartDateEnd   = listAscmWipDiscreteJobs.OrderBy(item => item._scheduledStartDate).Last()._scheduledStartDate;
                                    }
                                }
                                #region 合计 同种物料在一个货位,进行数量合计,同种物料在不同货位,进行分开显示
                                var groupByMaterial = listAscmWmsPreparationDetail.GroupBy(p => p.materialId);
                                foreach (IGrouping <int, AscmWmsPreparationDetail> ig in groupByMaterial)
                                {
                                    //判断此物料的有多少条数据
                                    List <AscmWmsPreparationDetail> list = listAscmWmsPreparationDetail.Where(item => item.materialId == ig.Key).ToList();
                                    if (list != null && list.Count() > 1)
                                    {
                                        var groupByWarelocation = list.GroupBy(p => p.warelocationId);
                                        foreach (IGrouping <int, AscmWmsPreparationDetail> igrouping in groupByWarelocation)
                                        {
                                            AscmWmsPreparationDetail ascmWmsPreparationDetail_ByWarelocation = igrouping.First();
                                            AscmWmsPreparationDetail ascmWmsPreparationDetail = new AscmWmsPreparationDetail();
                                            ascmWmsPreparationDetail.materialId = igrouping.Key;
                                            //ascmWmsPreparationDetail.ascmMaterialItem = ascmWmsPreparationDetail_ByWarelocation.ascmMaterialItem;
                                            ascmWmsPreparationDetail.warehouseId       = ascmWmsPreparationDetail_ByWarelocation.warehouseId;
                                            ascmWmsPreparationDetail.locationDocNumber = ascmWmsPreparationDetail_ByWarelocation.locationDocNumber;
                                            ascmWmsPreparationDetail.wipSupplyType     = ascmWmsPreparationDetail_ByWarelocation.wipSupplyType;
                                            ascmWmsPreparationDetail.planQuantity      = igrouping.Sum(P => P.planQuantity);
                                            //ascmWmsPreparationDetail.quantity = igrouping.Sum(P => P.quantity);
                                            ascmWmsPreparationDetail.issueQuantity       = igrouping.Sum(P => P.issueQuantity);
                                            ascmWmsPreparationDetail.containerBindNumber = igrouping.Sum(P => P.containerBindNumber);
                                            listDetail.Add(ascmWmsPreparationDetail);
                                        }
                                    }
                                    else
                                    {
                                        AscmWmsPreparationDetail _ascmWmsPreparationDetail = ig.First();
                                        AscmWmsPreparationDetail ascmWmsPreparationDetail  = new AscmWmsPreparationDetail();
                                        ascmWmsPreparationDetail.materialId = ig.Key;
                                        //ascmWmsPreparationDetail.ascmMaterialItem = _ascmWmsPreparationDetail.ascmMaterialItem;
                                        ascmWmsPreparationDetail.warehouseId       = _ascmWmsPreparationDetail.warehouseId;
                                        ascmWmsPreparationDetail.locationDocNumber = _ascmWmsPreparationDetail.locationDocNumber;
                                        ascmWmsPreparationDetail.wipSupplyType     = _ascmWmsPreparationDetail.wipSupplyType;
                                        ascmWmsPreparationDetail.planQuantity      = ig.Sum(P => P.planQuantity);
                                        //ascmWmsPreparationDetail.quantity = ig.Sum(P => P.quantity);
                                        ascmWmsPreparationDetail.issueQuantity       = ig.Sum(P => P.issueQuantity);
                                        ascmWmsPreparationDetail.containerBindNumber = ig.Sum(P => P.containerBindNumber);
                                        listDetail.Add(ascmWmsPreparationDetail);
                                    }
                                }
                                #endregion
                            }
                            #region Code128
                            System.IO.MemoryStream    memoryStream = new System.IO.MemoryStream();
                            MideaAscm.Code.BarCode128 barCode128   = new Code.BarCode128();
                            barCode128.TitleFont   = new System.Drawing.Font("宋体", 10);
                            barCode128.HeightImage = 50;
                            System.Drawing.Bitmap bitmap = barCode128.GetCodeImage(docNumber, docNumber, Code.BarCode128.Encode.Code128B);
                            bitmap.Save(memoryStream, System.Drawing.Imaging.ImageFormat.Gif);
                            if (listDetail != null && listDetail.Count() > 0)
                            {
                                listDetail = listDetail.OrderBy(item => item.materialDocNumber).ToList();
                                listDetail[0].barcodeShow = memoryStream.ToArray();
                            }
                            bitmap.Dispose();
                            #endregion

                            #region 条码 Code39
                            //System.IO.MemoryStream memoryStream = new System.IO.MemoryStream();
                            //YnBaseClass2.Helper.BarCode39 barCode39 = new YnBaseClass2.Helper.BarCode39();
                            //barCode39.WidthCU = 10;
                            //barCode39.WidthXI = 3;
                            //System.Drawing.Bitmap bitmap = barCode39.CreateBarCode(docNumber, docNumber, 0, 0);
                            //bitmap.Save(memoryStream, System.Drawing.Imaging.ImageFormat.Gif);
                            //bitmap.Dispose();
                            //if (listDetail != null && listDetail.Count()>0)
                            //    listDetail[0].barcodeShow = memoryStream.ToArray();
                            #endregion
                        }
                    }
                }
                ReportViewer1.ProcessingMode         = Microsoft.Reporting.WebForms.ProcessingMode.Local;
                ReportViewer1.LocalReport.ReportPath = Server.MapPath("WmsPreparationReport.rdlc");
                ReportDataSource rds1 = new ReportDataSource();
                rds1.Name  = "DataSet1";
                rds1.Value = listDetail;
                ReportViewer1.LocalReport.DataSources.Clear();//好像不clear也可以
                ReportViewer1.LocalReport.DataSources.Add(rds1);

                string title = "中央空调顺德工厂需求备料单";
                //string secondTitle = "车间任务物料需求报表";
                string userName = string.Empty;
                if (User.Identity.IsAuthenticated)
                {
                    userName = User.Identity.Name;
                }

                ReportParameter[] reportParameters = new ReportParameter[] {
                    new ReportParameter("ReportParameter_Title", title),
                    //new ReportParameter("ReportParameter_secondTitle", secondTitle),
                    new ReportParameter("ReportParameter_ReportTime", "打印时间:" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")),
                    new ReportParameter("ReportParameter_wipSupplyType", "供应类型:" + wipSupplyType),
                    new ReportParameter("ReportParameter_scheduledStartDate", "计划时间从:" + scheduledStartDateStart + " 至 " + scheduledStartDateEnd),
                    new ReportParameter("ReportParameter_BillNo", "任务从:" + billNoStart + " 至 " + billNoEnd),
                    new ReportParameter("ReportParameter_materialDocNumber", "组件从:" + materialDocNumberStart + " 至 " + materialDocNumberEnd),
                    new ReportParameter("ReportParameter_warehouseId", "子库从:" + warehouseIdStart + " 至 " + warehouseIdEnd),
                    new ReportParameter("ReportParameter_jobScheduleGroups", "计划组从:" + jobScheduleGroupsStart + " 至 " + jobScheduleGroupsEnd),
                    new ReportParameter("ReportParameter_jobProductionLine", "生产线从:" + jobProductionLineStart + " 至 " + jobProductionLineEnd),
                    new ReportParameter("ReportParameter_Printer", "打印人:" + userName),
                };
                ReportViewer1.LocalReport.SetParameters(reportParameters);
                ReportViewer1.LocalReport.Refresh();
            }
        }
Exemplo n.º 8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                YnFrame.Dal.Entities.YnUser ynUser = YnFrame.Web.FormsAuthenticationService.GetInstance().GetTicketUserData();
                if (ynUser == null)
                    throw new Exception("用户错误!");
                AscmUserInfo ascmUserInfo = AscmUserInfoService.GetInstance().Get(ynUser.userId);
                string supplierName = "";
                if (ascmUserInfo.extExpandType == "erp")
                {
                    AscmUserInfoService.GetInstance().SetSupplier(ascmUserInfo);
                    if (ascmUserInfo.ascmSupplier != null)
                        supplierName = ascmUserInfo.ascmSupplier.name;

                }

                //提取数据
                List<AscmMaterialItem> sumList = new List<AscmMaterialItem>();
                //最后一个装箱
                AscmMaterialItem lastDetail = new AscmMaterialItem();
                string ids = Request.QueryString["ids"];
                string unitQuantitys = Request.QueryString["unitQuantitys"];
                string totalNumbers = Request.QueryString["totalNumbers"];
                bool isUnitPrint =Boolean.Parse(Request.QueryString["isUnitPrint"]);

                string[] listId = ids.Split(',');
                string[] listUnitQuantity = unitQuantitys.Split(',');
                string[] listTotalNumber = totalNumbers.Split(',');

                List<AscmMaterialItem> list = new List<AscmMaterialItem>();
                for (int i = 0; i < listId.Count(); i++)
                {
                    AscmMaterialItem ascmMaterialItem = AscmMaterialItemService.GetInstance().Get(Int32.Parse(listId[i]));
                    AscmContainerUnitQuantity ascmContainerUnitQuantity = AscmContainerUnitQuantityService.GetInstance().Get(Int32.Parse(listUnitQuantity[i]));
                    ascmMaterialItem.container = ascmContainerUnitQuantity.container;
                    ascmMaterialItem.unitQuantity = ascmContainerUnitQuantity.unitQuantity;
                    ascmMaterialItem.containerUnitQuantityId = ascmContainerUnitQuantity.id;
                    ascmMaterialItem.totalNumber = Decimal.Parse(listTotalNumber[i]);
                    list.Add(ascmMaterialItem);
                }
                if (!string.IsNullOrEmpty(ids))
                {
                    if (list != null && list.Count() > 0)
                    {
                        foreach (AscmMaterialItem ascmMaterialItem in list)
                        {
                            //条码
                            System.IO.MemoryStream memoryStream = new System.IO.MemoryStream();
                            if (ascmMaterialItem.docNumber != null)
                            {
                                #region Code128
                                MideaAscm.Code.BarCode128 barCode128 = new Code.BarCode128();
                                barCode128.TitleFont = new System.Drawing.Font("宋体", 10);
                                barCode128.HeightImage = 50;
                                System.Drawing.Bitmap bitmap = barCode128.GetCodeImage(ascmMaterialItem.docNumber, ascmMaterialItem.docNumber, Code.BarCode128.Encode.Code128B);
                                bitmap.Save(memoryStream, System.Drawing.Imaging.ImageFormat.Gif);
                                bitmap.Dispose();
                                #endregion
                            }
                            ascmMaterialItem.materialBarcode = memoryStream.ToArray();
                            //如果是总数打印,单元数=总数
                            if (!isUnitPrint)
                                ascmMaterialItem.unitQuantity = ascmMaterialItem.totalNumber;

                            decimal totalNumber = ascmMaterialItem.totalNumber;//总数量
                            decimal unitQuantity = ascmMaterialItem.unitQuantity;//单元数
                            //decimal unitQuantity = 10;
                            decimal count = decimal.Truncate(totalNumber / unitQuantity);//箱数量>=0
                            decimal rest = totalNumber % unitQuantity;//剩余数量>=0

                            //设置装箱数 2015.3.26

                            //总数 < 单元数 ,仅有一个箱子,总数 = 剩余数量
                            if (count == 0)
                            {
                                count = 1;
                            }
                            else
                            {
                                //有剩余数量,多出一箱
                                if (rest != 0) count = count + 1;
                            }
                            for (int i = 0; i < count; i++)
                            {
                                //最后一个为剩余数量
                                if (i == count - 1 && rest != 0)
                                {
                                    lastDetail.materialBarcode = ascmMaterialItem.materialBarcode;
                                    lastDetail.docNumber = ascmMaterialItem.docNumber;
                                    lastDetail.description = ascmMaterialItem.description;
                                    lastDetail.unit = ascmMaterialItem.unit;
                                    lastDetail.unitQuantity = rest;
                                    sumList.Add(lastDetail);
                                }
                                else
                                {
                                    sumList.Add(ascmMaterialItem);
                                }
                            }
                        }
                    }
                }

                ReportViewer1.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Local;
                ReportViewer1.LocalReport.ReportPath = Server.MapPath("SupplierMaterialReport.rdlc");
                ReportDataSource rds1 = new ReportDataSource();
                rds1.Name = "DataSet1";
                rds1.Value = sumList;
                ReportViewer1.LocalReport.DataSources.Clear();
                ReportViewer1.LocalReport.DataSources.Add(rds1);

                string companpyTitle = "美的中央空调";
                string title = companpyTitle + "供应商送货物料条码";

                ReportParameter[] reportParameters = new ReportParameter[] {
                    new ReportParameter("ReportParameter_SupplierName",supplierName )
                };

                ReportViewer1.LocalReport.SetParameters(reportParameters);
                ReportViewer1.LocalReport.Refresh();
            }
        }
Exemplo n.º 9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                YnFrame.Dal.Entities.YnUser ynUser = YnFrame.Web.FormsAuthenticationService.GetInstance().GetTicketUserData();
                if (ynUser == null)
                {
                    throw new Exception("用户错误!");
                }
                AscmUserInfo ascmUserInfo = AscmUserInfoService.GetInstance().Get(ynUser.userId);
                if (ascmUserInfo.extExpandType != "erp")
                {
                    throw new Exception("供应商用户错误!");
                }
                AscmUserInfoService.GetInstance().SetSupplier(ascmUserInfo);
                if (ascmUserInfo.ascmSupplier == null)
                {
                    throw new Exception("供应商用户错误!");
                }

                //提取数据
                List <AscmDeliBatSumDetail> list = new List <AscmDeliBatSumDetail>();
                string ids = Request.QueryString["ids"];
                if (!string.IsNullOrEmpty(ids))
                {
                    YnBaseDal.YnPage ynPage = new YnBaseDal.YnPage();
                    ynPage.SetPageSize(500);  //pageRows;
                    ynPage.SetCurrentPage(1); //pageNumber;

                    list = AscmDeliBatSumDetailService.GetInstance().GetList("from AscmDeliBatSumDetail where id in(" + ids + ")");

                    AscmDeliBatSumDetailService.GetInstance().SetMaterial(list);
                    AscmDeliBatSumDetailService.GetInstance().SetDeliveryOrderBatch(list);
                    List <AscmDeliveryOrderBatch> listDeliveryOrderBatch = new List <AscmDeliveryOrderBatch>();
                    list.ForEach(P => listDeliveryOrderBatch.Add(
                                     new AscmDeliveryOrderBatch
                    {
                        id = P.batchId
                    }));
                    //获取货位分配
                    AscmDeliveryOrderBatchService.GetInstance().SetAssignWarelocation(listDeliveryOrderBatch);
                    list.ForEach(P => P.assignWarelocation = listDeliveryOrderBatch.Find(T => T.id == P.batchId).assignWarelocation);
                    //条码
                    foreach (AscmDeliBatSumDetail ascmDeliBatSumDetail in list)
                    {
                        System.IO.MemoryStream memoryStream = new System.IO.MemoryStream();
                        if (ascmDeliBatSumDetail.ascmMaterialItem != null && ascmDeliBatSumDetail.ascmMaterialItem.docNumber != null)
                        {
                            #region Code128
                            MideaAscm.Code.BarCode128 barCode128 = new Code.BarCode128();
                            barCode128.TitleFont   = new Font("宋体", 10);
                            barCode128.HeightImage = 50;
                            Bitmap bitmap = barCode128.GetCodeImage(ascmDeliBatSumDetail.ascmMaterialItem.docNumber, ascmDeliBatSumDetail.ascmMaterialItem.docNumber, Code.BarCode128.Encode.Code128B);
                            bitmap.Save(memoryStream, System.Drawing.Imaging.ImageFormat.Gif);
                            bitmap.Dispose();
                            #endregion

                            #region Code39
                            //YnBaseClass2.Helper.BarCode39 barCode39 = new YnBaseClass2.Helper.BarCode39();
                            //barCode39.WidthCU = 10;
                            //barCode39.WidthXI = 3;
                            //System.Drawing.Bitmap bitmap = barCode39.CreateBarCode(ascmDeliBatSumDetail.ascmMaterialItem.docNumber, ascmDeliBatSumDetail.ascmMaterialItem.docNumber, 0, 0);
                            ////生成图片
                            ////System.IO.MemoryStream memoryStream = new System.IO.MemoryStream();
                            //bitmap.Save(memoryStream, System.Drawing.Imaging.ImageFormat.Gif);
                            //bitmap.Dispose();
                            #endregion
                        }
                        ascmDeliBatSumDetail.materialBarcode = memoryStream.ToArray();
                    }
                }
                ReportViewer1.ProcessingMode         = Microsoft.Reporting.WebForms.ProcessingMode.Local;
                ReportViewer1.LocalReport.ReportPath = Server.MapPath("SupplierDriverDeliveryBarCodeReport.rdlc");
                ReportDataSource rds1 = new ReportDataSource();
                rds1.Name  = "DataSet1";
                rds1.Value = list;
                ReportViewer1.LocalReport.DataSources.Clear();
                ReportViewer1.LocalReport.DataSources.Add(rds1);

                string companpyTitle = "美的中央空调";
                string title         = companpyTitle + "供应商送货合单条码";

                ReportParameter[] reportParameters = new ReportParameter[] {
                    new ReportParameter("ReportParameter_SupplierName", ascmUserInfo.ascmSupplier.name)
                };

                ReportViewer1.LocalReport.SetParameters(reportParameters);
                ReportViewer1.LocalReport.Refresh();
            }
        }
Exemplo n.º 10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                YnFrame.Dal.Entities.YnUser ynUser = YnFrame.Web.FormsAuthenticationService.GetInstance().GetTicketUserData();
                if (ynUser == null)
                {
                    throw new Exception("用户错误!");
                }
                AscmUserInfo ascmUserInfo = AscmUserInfoService.GetInstance().Get(ynUser.userId);
                if (ascmUserInfo.extExpandType != "erp")
                {
                    throw new Exception("供应商用户错误!");
                }
                AscmUserInfoService.GetInstance().SetSupplier(ascmUserInfo);
                if (ascmUserInfo.ascmSupplier == null)
                {
                    throw new Exception("供应商用户错误!");
                }

                //打印的数据
                List <AscmDeliBatSumDetail> sumList = new List <AscmDeliBatSumDetail>();
                //最后一个装箱
                AscmDeliBatSumDetail lastDetail = new AscmDeliBatSumDetail();
                string   ids        = Request.QueryString["ids"];
                string   unitIds    = Request.QueryString["unitIds"];
                string[] listId     = ids.Split(',');
                string[] listUnitId = unitIds.Split(',');
                if (!string.IsNullOrEmpty(ids))
                {
                    List <AscmDeliBatSumDetail> list = new List <AscmDeliBatSumDetail>();
                    for (int i = 0; i < listId.Count(); i++)
                    {
                        AscmDeliBatSumDetail      ascmDeliBatSumDetail      = AscmDeliBatSumDetailService.GetInstance().Get(Int32.Parse(listId[i]));
                        AscmContainerUnitQuantity ascmContainerUnitQuantity = AscmContainerUnitQuantityService.GetInstance().Get(Int32.Parse(listUnitId[i]));
                        ascmDeliBatSumDetail.container               = ascmContainerUnitQuantity.container;
                        ascmDeliBatSumDetail.materialUnitQuantity    = ascmContainerUnitQuantity.unitQuantity;
                        ascmDeliBatSumDetail.containerUnitQuantityId = ascmContainerUnitQuantity.id;
                        list.Add(ascmDeliBatSumDetail);
                    }

                    if (list != null)
                    {
                        AscmDeliBatSumDetailService.GetInstance().SetMaterial(list);
                        AscmDeliBatSumDetailService.GetInstance().SetDeliveryOrderBatch(list);
                        List <AscmDeliveryOrderBatch> listDeliveryOrderBatch = new List <AscmDeliveryOrderBatch>();
                        list.ForEach(P => listDeliveryOrderBatch.Add(
                                         new AscmDeliveryOrderBatch
                        {
                            id = P.batchId
                        }));
                        //获取货位分配
                        AscmDeliveryOrderBatchService.GetInstance().SetAssignWarelocation(listDeliveryOrderBatch);
                        list.ForEach(P => P.assignWarelocation = listDeliveryOrderBatch.Find(T => T.id == P.batchId).assignWarelocation);
                        foreach (AscmDeliBatSumDetail ascmDeliBatSumDetail in list)
                        {
                            //条码
                            System.IO.MemoryStream memoryStream = new System.IO.MemoryStream();
                            if (ascmDeliBatSumDetail.ascmMaterialItem.docNumber != null)
                            {
                                #region Code128
                                MideaAscm.Code.BarCode128 barCode128 = new Code.BarCode128();
                                barCode128.TitleFont   = new System.Drawing.Font("宋体", 10);
                                barCode128.HeightImage = 50;
                                System.Drawing.Bitmap bitmap = barCode128.GetCodeImage(ascmDeliBatSumDetail.batchBarCode, ascmDeliBatSumDetail.batchBarCode, Code.BarCode128.Encode.Code128B);
                                bitmap.Save(memoryStream, System.Drawing.Imaging.ImageFormat.Gif);
                                bitmap.Dispose();
                                #endregion

                                #region Code39
                                //YnBaseClass2.Helper.BarCode39 barCode39 = new YnBaseClass2.Helper.BarCode39();
                                //barCode39.WidthCU = 10;
                                //barCode39.WidthXI = 3;
                                //System.Drawing.Bitmap bitmap = barCode39.CreateBarCode(ascmDeliBatSumDetail.ascmMaterialItem.docNumber, ascmDeliBatSumDetail.ascmMaterialItem.docNumber, 0, 0);
                                ////生成图片
                                ////System.IO.MemoryStream memoryStream = new System.IO.MemoryStream();
                                //bitmap.Save(memoryStream, System.Drawing.Imaging.ImageFormat.Gif);
                                //bitmap.Dispose();
                                #endregion
                            }
                            ascmDeliBatSumDetail.materialBarcode = memoryStream.ToArray();

                            decimal totalNumber  = ascmDeliBatSumDetail.totalNumber;          //总数量
                            decimal unitQuantity = ascmDeliBatSumDetail.materialUnitQuantity; //单元数
                            //decimal unitQuantity = 10;
                            decimal count = decimal.Truncate(totalNumber / unitQuantity);     //箱数量>=0
                            decimal rest  = totalNumber % unitQuantity;                       //剩余数量>=0

                            //设置装箱数 2015.3.26

                            //总数 < 单元数 ,仅有一个箱子,总数 = 剩余数量
                            if (count == 0)
                            {
                                count = 1;
                            }
                            else
                            {
                                //有剩余数量,多出一箱
                                if (rest != 0)
                                {
                                    count = count + 1;
                                }
                            }
                            for (int i = 0; i < count; i++)
                            {
                                //最后一个为剩余数量
                                if (i == count - 1 && rest != 0)
                                {
                                    lastDetail.ascmDeliveryOrderBatch = ascmDeliBatSumDetail.ascmDeliveryOrderBatch;
                                    lastDetail.ascmMaterialItem       = ascmDeliBatSumDetail.ascmMaterialItem;
                                    lastDetail.assignWarelocation     = ascmDeliBatSumDetail.assignWarelocation;
                                    lastDetail.materialUnitQuantity   = rest;
                                    sumList.Add(lastDetail);
                                }
                                else
                                {
                                    sumList.Add(ascmDeliBatSumDetail);
                                }
                            }
                        }
                    }
                }

                ReportViewer1.ProcessingMode         = Microsoft.Reporting.WebForms.ProcessingMode.Local;
                ReportViewer1.LocalReport.ReportPath = Server.MapPath("SupplierDriverDeliveryDetialBarCodeReport.rdlc");
                ReportDataSource rds1 = new ReportDataSource();
                rds1.Name  = "DataSet1";
                rds1.Value = sumList;
                ReportViewer1.LocalReport.DataSources.Clear();
                ReportViewer1.LocalReport.DataSources.Add(rds1);

                string companpyTitle = "美的中央空调";
                string title         = companpyTitle + "供应商送货批单条码";

                ReportParameter[] reportParameters = new ReportParameter[] {
                    new ReportParameter("ReportParameter_SupplierName", ascmUserInfo.ascmSupplier.name)
                };

                ReportViewer1.LocalReport.SetParameters(reportParameters);
                ReportViewer1.LocalReport.Refresh();
            }
        }