Пример #1
0
        protected override DataRow GetGridRow(object obj)
        {
            string inventoryType = ((InventoryPeriodStandard)obj).InventoryType;

            Domain.BaseSetting.Parameter parameter = (Domain.BaseSetting.Parameter)_SystemSettingFacade.GetParameter(inventoryType, "STORAGEATTRIBUTE");
            if (parameter != null)
            {
                inventoryType = parameter.ParameterDescription;
            }

            //return new Infragistics.WebUI.UltraWebGrid.UltraGridRow(
            //    new object[]{
            //        "false",
            //        ((InventoryPeriodStandard)obj).InventoryType.ToString(),
            //        inventoryType,
            //        ((InventoryPeriodStandard)obj).PeriodGroup.ToString(),
            //        ((InventoryPeriodStandard)obj).InventoryPeriodCode.ToString(),
            //        ((InventoryPeriodStandard)obj).PercentageStandard.ToString("0.00") ,
            //        ""
            //    }
            //);

            DataRow row = this.DtSource.NewRow();

            row["StorageAttributeCode"] = ((InventoryPeriodStandard)obj).InventoryType.ToString();
            row["StorageAttribute"]     = inventoryType;
            row["PeriodGroup"]          = ((InventoryPeriodStandard)obj).PeriodGroup.ToString();
            row["InvPeriodCode"]        = ((InventoryPeriodStandard)obj).InventoryPeriodCode.ToString();
            row["IndexValue"]           = ((InventoryPeriodStandard)obj).PercentageStandard.ToString("0.00");
            return(row);
        }
Пример #2
0
        protected override string[] FormatExportRecord(object obj)
        {
            string inventoryType = ((InventoryPeriodStandard)obj).InventoryType;

            Domain.BaseSetting.Parameter parameter = (Domain.BaseSetting.Parameter)_SystemSettingFacade.GetParameter(inventoryType, "STORAGEATTRIBUTE");
            if (parameter != null)
            {
                inventoryType = parameter.ParameterDescription;
            }

            return(new string[] {
                inventoryType,
                ((InventoryPeriodStandard)obj).PeriodGroup.ToString(),
                ((InventoryPeriodStandard)obj).InventoryPeriodCode.ToString(),
                ((InventoryPeriodStandard)obj).PercentageStandard.ToString("0.00")
            });
        }
Пример #3
0
        public void Build(WebDataMenu ultraMenu, ControlLibrary.Web.Language.LanguageComponent languageComponent, IDomainDataProvider _domainDataProvider)
        {
            this.GetXMLMenu();  //获取不要显示的模块
            this.GetUnVisibilityMenu(_domainDataProvider);

            if (ultraMenu == null)
            {
                return;
            }

            ultraMenu.Items.Clear();

            //BenQGuru.eMES.Common.Domain.IDomainDataProvider _domainDataProvider = BenQGuru.eMES.Common.DomainDataProvider.DomainDataProviderManager.DomainDataProvider();
            SystemSettingFacade facade = new SystemSettingFacade(_domainDataProvider);

            #region 添加报表平台菜单入口

            //获得系统参数里面的报表平台菜单入口
            string reportViewMenuCode = string.Empty;
            Domain.BaseSetting.Parameter parameter = (Domain.BaseSetting.Parameter)facade.GetParameter("REPORTMENU", "REPORTMENU");
            if (parameter != null)
            {
                reportViewMenuCode = FormatHelper.PKCapitalFormat(FormatHelper.CleanString(parameter.ParameterAlias));
            }

            //获得系统参数里面的报表平台菜单Item
            DataMenuItem reportViewMenuItem = GetReportViewMenuRoot(reportViewMenuCode, languageComponent, _domainDataProvider);

            #endregion

            ITreeObjectNode rootNode = facade.BuildMenuTree();

            TreeObjectNodeSet set = rootNode.GetSubLevelChildrenNodes();
            foreach (MenuTreeNode node in set)
            {
                if (node.MenuWithUrl.MenuType.ToUpper() == MenuType.MenuType_BS.ToUpper())
                {
                    if (this.menuHT != null && this.menuHT.Contains(node.MenuWithUrl.ModuleCode))
                    {
                        continue;
                    }
                    if (this.htUnVisibilityMenu != null && this.htUnVisibilityMenu.Contains(node.MenuWithUrl.MenuCode))
                    {
                        continue;
                    }
                    ultraMenu.Items.Add(BuildUltraMenuItem(node, languageComponent, reportViewMenuCode, reportViewMenuItem));
                }
            }

            DataMenuItem item = new DataMenuItem();

            item.Text        = "";
            item.NavigateUrl = "#";

            ultraMenu.Items.Add(item);

            if (_domainDataProvider != null)
            {
                ((SQLDomainDataProvider)_domainDataProvider).PersistBroker.CloseConnection();
            }
        }
Пример #4
0
        //serialNumber1 和SerialNumber2 的打印方式
        public static void Print(string pinterName, System.Collections.ArrayList printValueList, string printType)
        {
            System.Text.ASCIIEncoding asciiEncoding = new System.Text.ASCIIEncoding();
            //order
            byte[] byteArray = new byte[] { (byte)27 };
            string Esc       = asciiEncoding.GetString(byteArray);

            DOCINFO di        = new DOCINFO();
            int     pcWritten = 0;

            di.pDocName  = "CT4i";
            di.pDataType = "RAW";

            //打开打印机
            string PrinterName = pinterName;
            int    lhPrinter   = openPrinter(PrinterName);
            string printValueA = string.Empty;
            int    count       = 0; //计算打印到了某一行第几个条码
            int    lineCount   = 0; //标记现在打印的是第几行

            StartDocPrinter((IntPtr)lhPrinter, 1, ref di);
            StartPagePrinter((IntPtr)lhPrinter);

            SystemSettingFacade _systemFacade = new SystemSettingFacade();

            Domain.BaseSetting.Parameter SerialNumber1 = (Domain.BaseSetting.Parameter)_systemFacade.GetParameter("SERIAL NUMBER1", "PRINTRELATE");
            Domain.BaseSetting.Parameter SerialNumber2 = (Domain.BaseSetting.Parameter)_systemFacade.GetParameter("SERIAL NUMBER2", "PRINTRELATE");

            //SATO 打印机开始指令
            if (SerialNumber1.ParameterCode != printType && SerialNumber2.ParameterCode != printType)
            {
                printValueA = asciiEncoding.GetString(new byte[] { (byte)2 }) + Esc + "A";
                WritePrinter((IntPtr)lhPrinter, printValueA, printValueA.Length, ref pcWritten);
            }
            //打印数据
            for (int i = 0; i < printValueList.Count; i++)
            {
                lineCount++;

                //防止\r\n被split掉
                if ((printValueList[i].ToString().IndexOf("#\r\n")) != -1)
                {
                    printValueA = printValueList[i].ToString().Substring(0, (printValueList[i].ToString().IndexOf("#\r\n")));
                }

                printValueA = printValueList[i].ToString().Replace("#", "   ");                  //将字符串里面的#替换成3个空格

                WritePrinter((IntPtr)lhPrinter, printValueA, printValueA.Length, ref pcWritten); //打一行
                if (lineCount == 2)
                {
                    lineCount = 0;
                    //一组条码打印好之后换到下一行
                    string NewLine = asciiEncoding.GetString(new byte[] { (byte)27 }) + asciiEncoding.GetString(new byte[] { (byte)65 }) + asciiEncoding.GetString(new byte[] { (byte)28 });
                    if (SerialNumber1.ParameterCode == printType || SerialNumber2.ParameterCode == printType)
                    {
                        NewLine = "\r\n";
                    }

                    WritePrinter((IntPtr)lhPrinter, NewLine, NewLine.Length, ref pcWritten);
                }
            }
            //SATO打印结束指令
            if (SerialNumber1.ParameterCode != printType && SerialNumber2.ParameterCode != printType)
            {
                printValueA = Esc + "Q1" + Esc + "Z" + asciiEncoding.GetString(new byte[] { (byte)3 });
                WritePrinter((IntPtr)lhPrinter, printValueA, printValueA.Length, ref pcWritten);
            }

            EndPagePrinter((IntPtr)lhPrinter);
            EndDocPrinter((IntPtr)lhPrinter);
            ClosePrinter((IntPtr)lhPrinter);
        }
Пример #5
0
        protected override void Grid_ClickCellButton(GridRecord row, string commandName)
        {
            // base.Grid_ClickCellButton(sender, e);

            SystemSettingFacade systemSettingFacade = new SystemSettingFacade(this.DataProvider);
            UserFacade          userFacade          = new UserFacade(this.DataProvider);

            if (commandName == "Download")
            {
                string tryCode = row.Items.FindItemByKey("TryCode").Value.ToString();
                if (facade == null)
                {
                    facade = new TryFacade(base.DataProvider);
                }
                object trySelected = facade.GetTry(tryCode);
                if (trySelected == null)
                {
                    ExceptionManager.Raise(this.GetType(), "试流单不存在");
                }
                Try selectedTry = trySelected as Try;

                string originalFilePath = this.Request.PhysicalApplicationPath + @"download\TryCode.htm";
                if (!File.Exists(originalFilePath))
                {
                    ExceptionManager.Raise(this.GetType(), "文件[TryCode.htm]不存在");
                }

                //获取Deparment Name
                string deparmentCode = selectedTry.Department;
                string deparmentName = " ";
                if (deparmentCode.Trim().Length > 0)
                {
                    Domain.BaseSetting.Parameter department = (Domain.BaseSetting.Parameter)systemSettingFacade.GetParameter(selectedTry.Department, "DEPARTMENT");
                    if (department != null)
                    {
                        deparmentName = department.ParameterAlias;
                    }
                }

                //获取Create User Name
                string createUserCode = selectedTry.CreateUser;
                string createUserName = "******";
                if (createUserCode.Trim().Length > 0)
                {
                    User createUser = (User)userFacade.GetUser(createUserCode);
                    if (createUser != null)
                    {
                        createUserName = createUser.UserName;
                    }
                }

                string fileContent = File.ReadAllText(originalFilePath, Encoding.GetEncoding("GB2312"));
                fileContent = fileContent.Replace("$$TryCode$$", selectedTry.TryCode);
                fileContent = fileContent.Replace("$$Department$$", deparmentName);
                fileContent = fileContent.Replace("$$CreateUser$$", createUserName);
                fileContent = fileContent.Replace("$$ReleaseDate$$", selectedTry.ReleaseDate == 0 ? " " : FormatHelper.ToDateString(selectedTry.ReleaseDate, "/"));
                //fileContent = fileContent.Replace("$$ReleaseDate$$", selectedTry.ReleaseDate == 0 ? " " : selectedTry.ReleaseDate.ToString());
                fileContent = fileContent.Replace("$$MaterialCode$$", selectedTry.ItemCode == "" ? " " : selectedTry.ItemCode);
                fileContent = fileContent.Replace("$$MaterialDescription$$", row.Items.FindItemByKey("Dept").Value.ToString() == "" ? " " : row.Items.FindItemByKey("Dept").Value.ToString());
                fileContent = fileContent.Replace("$$PlanQuantity$$", selectedTry.PlanQty.ToString());
                fileContent = fileContent.Replace("$$VendorCode$$", selectedTry.VendorName == "" ? " " : selectedTry.VendorName);
                fileContent = fileContent.Replace("$$Result$$", selectedTry.Result == "" ? " " : selectedTry.Result);
                fileContent = fileContent.Replace("$$Memo$$", selectedTry.Memo == "" ? " " : selectedTry.Memo);
                //fileContent = fileContent.Replace("$$PrintDateTime$$", DateTime.Now.ToString("yyyy/MM/dd hh:mm:ss", new System.Globalization.CultureInfo("en-US")));
                fileContent = fileContent.Replace("$$TryType$$", selectedTry.TryType.Trim() == "" ? " " : this.languageComponent1.GetString(selectedTry.TryType));
                fileContent = fileContent.Replace("$$TryReason$$", selectedTry.TryReason == "" ? " " : selectedTry.TryReason);
                fileContent = fileContent.Replace("$$SoftVersion$$", selectedTry.SoftVersion == "" ? " " : selectedTry.SoftVersion);
                fileContent = fileContent.Replace("$$WaitTry$$", selectedTry.WaitTry == "" ? " " : this.languageComponent1.GetString(selectedTry.WaitTry));
                fileContent = fileContent.Replace("$$Change$$", selectedTry.Change == "" ? " " : this.languageComponent1.GetString(selectedTry.Change));
                fileContent = fileContent.Replace("$$BurnINDuration$$", selectedTry.BurnINDuration == "" ? " " : selectedTry.BurnINDuration);

                string downloadPhysicalPath = this.Request.PhysicalApplicationPath + @"upload\";
                if (!Directory.Exists(downloadPhysicalPath))
                {
                    Directory.CreateDirectory(downloadPhysicalPath);
                }

                string filename = string.Format("{0}_{1}_{2}", row.Items.FindItemByKey("TryCode").Value.ToString(), FormatHelper.TODateInt(System.DateTime.Now).ToString(), FormatHelper.TOTimeInt(System.DateTime.Now).ToString());
                string filepath = string.Format(@"{0}{1}{2}", downloadPhysicalPath, filename, ".xls");

                while (File.Exists(filepath))
                {
                    filename = string.Format("{0}_{1}", filename, "0");
                    filepath = string.Format(@"{0}{1}{2}", downloadPhysicalPath, filename, ".xls");
                }

                StreamWriter writer = new StreamWriter(filepath, false, System.Text.Encoding.GetEncoding("GB2312"));
                writer.Write(fileContent);
                writer.Flush();
                writer.Close();

                this.DownloadFile(filename);
            }
        }