public override Boolean Equals(object obj) { if ((obj == null) || (obj.GetType() != this.GetType())) { return(false); } CustomProcess castObj = (CustomProcess)obj; return((castObj != null) && (this.ProcessID == castObj.ProcessID)); }
public static void PrintDocumentsInBatch(IList<Document> documentList, string appPath, string printer, CustomProcess process) { if (string.IsNullOrEmpty(appPath)) appPath = Path.Combine(Path.GetDirectoryName( Assembly.GetExecutingAssembly().Location), WmsSetupValues.WebServer); if (string.IsNullOrEmpty(printer)) printer = WmsSetupValues.DEFAULT; //Create el therat desde este punto. BatchPrintProcess threadP = new BatchPrintProcess { DocumentList = documentList.ToList(), AppPath = appPath, Printer = printer, Process = process }; //RptMngr.PrintDocumentsInBatch(documentList, appPath, printer, process); Thread th = new Thread(new ParameterizedThreadStart(PrintDocumentsInBatchThread)); th.Start(threadP); }
public string ProcessFile(CustomProcess process, string stream, SysUser user) { return (new ProcessMngr()).ProcessFile(process, stream, user); }
public void EvaluateBasicProcess(CustomProcess processName, SysUser user, string message) { (new ProcessMngr()).EvaluateBasicProcess(processName, user, message); }
public void UpdateCustomProcess(CustomProcess data) { Factory.DaoCustomProcess().Update(data); }
public void DeleteCustomProcess(CustomProcess data) { Factory.DaoCustomProcess().Delete(data); }
public CustomProcess SaveCustomProcess(CustomProcess data) { return Factory.DaoCustomProcess().Save(data); }
public IList<CustomProcess> GetCustomProcess(CustomProcess data) { return Factory.DaoCustomProcess().Select(data); }
public void PrintDocumentsInBatch(IList<Document> documentList, string appPath, string printer, CustomProcess process) { BasicMngr.PrintDocumentsInBatch(documentList, appPath, printer, process); }
public void PrintDocument(Document document, LabelTemplate report, string appPath, CustomProcess process) { curTemplate = report; try { if (curTemplate.DefPrinter == null) throw new Exception("No printer defined for report " + report.Name +"."); //Save the File printed for Document to show Later. //Solo si no existe. try { Factory.DaoProcessEntityResource().Save( new ProcessEntityResource { Entity = new ClassEntity { ClassEntityID = EntityID.Document }, EntityRowID = document.DocID, CreatedBy = WmsSetupValues.SystemUser, CreationDate = DateTime.Now, Process = process, Status = new Status { StatusID = EntityStatus.Active }, Template = report }); } catch { } //Usa la default Printer del template usePrinter = new Printer { PrinterName = curTemplate.DefPrinter.Name, PrinterPath = curTemplate.DefPrinter.CnnString }; //Ejecutar la impresion global en un Hilo //Thread th = new Thread(new ParameterizedThreadStart(PrintDocumentThread)); //th.Start(document); PrintDocumentThread(document); } catch (Exception ex) { //throw new Exception("Report could not be printed: " + report.Name + ", " + ex.Message); ExceptionMngr.WriteEvent("Report could not be printed: " + report.Name + ", " + ex.Message, ListValues.EventType.Error, ex, null, ListValues.ErrorCategory.ErpConnection); } }
private void ProcessEntity(short entity, int entityRow, CustomProcess process, string appPath, Document document) { //Seleccionando los Files para ese proceso. IEnumerable<ProcessEntityResource> resourceList = Factory.DaoProcessEntityResource().Select(new ProcessEntityResource { Entity = new ClassEntity { ClassEntityID = entity }, EntityRowID = entityRow, Process = process }); ProcessEntityResource curResource; Console.WriteLine("Process for " + entity.ToString()); foreach (ProcessEntityResource resource in resourceList) { //Usa Cur REsource en lugar del anterior curResource = Factory.DaoProcessEntityResource().Select( new ProcessEntityResource { RowID = resource.RowID }).First(); //Ejecutar la impresion global en un Hilo if (curResource.Template != null) { //Si es un Hazmat revisa si el documento contiene HAZMAT //if (curResource.Template.Header == WmsSetupValues.HAZMAT_REPORT && !document.QuoteNumber.Equals("Y")) //continue; PrintDocument(document, curResource.Template, appPath, process); } else if (curResource.File != null) { if (process.Printer != null) curResource.Printer = curResource.Printer; //Save the File printed for Document to show Later. //Solo si no existe. try { Factory.DaoProcessEntityResource().Save( new ProcessEntityResource { Entity = new ClassEntity { ClassEntityID = EntityID.Document }, EntityRowID = document.DocID, CreatedBy = WmsSetupValues.SystemUser, CreationDate = DateTime.Now, File = curResource.File, Process = process, Status = new Status { StatusID = EntityStatus.Active } }); } catch { } //Thread th = new Thread(new ParameterizedThreadStart(PrintFileThread)); //th.Start(curResource); /* try { PrintFileThread(curResource); } catch (Exception ex) { ExceptionMngr.WriteEvent("PrintFileThread: " + curResource.File.ImageName, ListValues.EventType.Error, ex, null, ListValues.ErrorCategory.ErpConnection); } */ } Thread.Sleep(4000); } }
/// <summary> /// Recorre el Documento Obtiene los procesos para el tipo de Documento, Cliente, Vendor, Product /// </summary> /// <param name="curDoc"></param> /// <param name="process"></param> private void PrintProcessDocuments(Document curDoc, CustomProcess process, string appPath) { //Recorre los procesos para cada una de la entidades descritas. //Productos. IEnumerable<Product> productList = Factory.DaoDocumentLine() .Select(new DocumentLine { Document = new Document { DocID = curDoc.DocID } }) .Select(f => f.Product).Distinct(); Console.WriteLine("Products"); foreach (Product product in productList) ProcessEntity(EntityID.Product, product.ProductID, process, appPath, curDoc); //Imprime el HAZMAT si hay producto con Hazmat. try { LabelTemplate hazmatTpl = Factory.DaoLabelTemplate().Select( new LabelTemplate { Header = WmsSetupValues.HAZMAT_REPORT }).First(); foreach (Product prd in productList) { if (prd.ProductTrack.Any(f => f.TrackOption.Name == "HAZMAT")) { PrintDocument(curDoc, hazmatTpl, appPath, process); Thread.Sleep(3000); break; } } } catch { } //Procesnado los documentos para el tipo de Documento Console.WriteLine("Document Type"); ProcessEntity(EntityID.DocumentType, curDoc.DocType.DocTypeID, process, appPath, curDoc); }
//public void PrintShipmentDocs(Document shipment, string printer, string appPath) //{ // shipment = Factory.DaoDocument().Select(new Document { DocID = shipment.DocID }).First(); // //Inicializando variables usadas en la impresion // m_streams = new Dictionary<LabelTemplate, IList<Stream>>(); // m_currentPageIndex = new Dictionary<LabelTemplate, int>(); // AppPath = appPath; // //Obtiene los documentos que se deben imprimir para el Shipment y los manda a imprimir // PrintDocument(shipment, shipment.DocType.Template, appPath); //} public void PrintDocumentsInBatch(IList<Document> documentList, string appPath, string printer, CustomProcess process) { Document curDoc; //Inicializando variables usadas en la impresion m_streams = new Dictionary<LabelTemplate, IList<Stream>>(); m_currentPageIndex = new Dictionary<LabelTemplate, int>(); AppPath = appPath; //Factory.IsTransactional = true; Console.WriteLine("Document List"); foreach (Document document in documentList) { curDoc = Factory.DaoDocument().Select(new Document { DocID = document.DocID }).First(); Console.WriteLine("Print " + curDoc.DocType.Name); //Obtiene los documentos que se deben imprimir para el Shipment y los manda a imprimir PrintDocument(curDoc, curDoc.DocType.Template, appPath, process); Thread.Sleep(3000); if (process != null) PrintProcessDocuments(curDoc, process, appPath); } //Factory.Commit(); }
/// <summary> /// Este metodo Crea un documento por cada Vendor de la lista de labels y agrupa los labels en un solo tipo de producto /// </summary> /// <param name="document"></param> /// <param name="processLabels"></param> /// <param name="appPath"></param> private void EvaluateRepair(Document document, CustomProcess process, IList<Label> processLabels, string appPath) { //1. Select the list of different vedors for the document //IList<int> vendors = Factory.DaoCustomProcess().GetInspectionVendors(document); //if (vendors == null || vendors.Count == 0) //return; IList<ProductStock> stockList; //foreach (int vID in vendors.Distinct()) //{ // document.Vendor = WType.GetAccount(new Account { AccountID = vID }); //2. Select The product Stock data document.DocumentLines = new List<DocumentLine>(); stockList = Factory.DaoCustomProcess().GetInspectionVendorStock(document, document.Vendor); foreach (ProductStock ps in stockList) { //Arma el LabelList para enviar al proceso document.DocumentLines.Add(new DocumentLine { Document = document, Product = ps.Product, Unit = ps.Product.BaseUnit, Quantity = ps.Stock }); } //Envia al proceso try { (new ProcessMngr()).EvaluateInspectionProcess(document, process, processLabels, appPath); } catch (Exception ex) { ExceptionMngr.WriteEvent("EvaluateRepair:", ListValues.EventType.Fatal, ex, null, ListValues.ErrorCategory.Business); } //} }
public CustomProcess GetCustomProcess(CustomProcess data) { return Factory.DaoCustomProcess().Select(data).First(); }