public override Boolean Equals(object obj) { if ((obj == null) || (obj.GetType() != this.GetType())) { return(false); } TaskDocumentRelation castObj = (TaskDocumentRelation)obj; return((castObj != null) && (this.RowID == castObj.RowID)); }
public IList<TaskDocumentRelation> Select(TaskDocumentRelation data) { IList<TaskDocumentRelation> datos = new List<TaskDocumentRelation>(); try { datos = GetHsql(data).List<TaskDocumentRelation>(); if (!Factory.IsTransactional) Factory.Commit(); } catch (Exception e) { NHibernateHelper.WriteEventLog(WriteLog.GetTechMessage(e)); } return datos; }
public void DeleteTaskDocumentRelation(TaskDocumentRelation data) { Factory.DaoTaskDocumentRelation().Delete(data); }
public void UpdateTaskDocumentRelation(TaskDocumentRelation data) { Factory.DaoTaskDocumentRelation().Update(data); }
public TaskDocumentRelation SaveTaskDocumentRelation(TaskDocumentRelation data) { return Factory.DaoTaskDocumentRelation().Save(data); }
//public IList<NodeTraceHistory> GetNodeTraceHistory(NodeTraceHistory data) { return Factory.DaoNodeTraceHistory().Select(data); } //public NodeTraceHistory SaveNodeTraceHistory(NodeTraceHistory data) { return Factory.DaoNodeTraceHistory().Save(data); } //public void UpdateNodeTraceHistory(NodeTraceHistory data) { Factory.DaoNodeTraceHistory().Update(data); } //public void DeleteNodeTraceHistory(NodeTraceHistory data) { Factory.DaoNodeTraceHistory().Delete(data); } public IList<TaskDocumentRelation> GetTaskDocumentRelation(TaskDocumentRelation data) { return Factory.DaoTaskDocumentRelation().Select(data); }
public TaskDocumentRelation SelectById(TaskDocumentRelation data) { return (TaskDocumentRelation)base.SelectById(data); }
public Boolean Delete(TaskDocumentRelation data) { return base.Delete(data); }
public Boolean Update(TaskDocumentRelation data) { return base.Update(data); }
public TaskDocumentRelation Save(TaskDocumentRelation data) { return (TaskDocumentRelation)base.Save(data); }
public Document CreateNewTaskDocument(IList<Document> docList, Document taskDocument) { Factory.IsTransactional = true; //Crea un nuevo documento tipo Task taskDocument = CreateNewDocument(taskDocument, false); //Start Transaction //Asocia los documentos del Task a TaskDocument TaskDocumentRelation taskDocRel; foreach (Document curDoc in docList) { taskDocRel = new TaskDocumentRelation { TaskDoc = taskDocument, IncludedDoc = curDoc, CreatedBy = "", CreationDate = DateTime.Now }; Factory.DaoTaskDocumentRelation().Save(taskDocRel); //Actualizando el Status del documento a In Process curDoc.DocStatus = WType.GetStatus(new Status { StatusID = DocStatus.InProcess }); Factory.DaoDocument().Update(curDoc); } IList<DocumentLine> taskDocLines = new List<DocumentLine>(); DocumentLine curLine; int i = 1; foreach (Object[] obj in Factory.DaoDocument().GetDocumentConsolidation(taskDocument)) { curLine = new DocumentLine(); curLine.Document = taskDocument; curLine.Quantity = (Double)obj[0]; curLine.QtyCancel = 0; curLine.Product = Factory.DaoProduct().SelectById(new Product { ProductID = (int)obj[1] }); curLine.Unit = Factory.DaoUnit().SelectById(new Unit { UnitID = (int)obj[2] }); ; curLine.UnitBaseFactor = (Double)obj[3]; curLine.LineNumber = i++; curLine.CreationDate = DateTime.Now; curLine.CreatedBy = taskDocument.CreatedBy; curLine.LineStatus = Factory.DaoStatus().SelectById(new Status { StatusID = 101 }); ; curLine.Location = taskDocument.Location; curLine.IsDebit = false; taskDocLines.Add(curLine); } taskDocument.DocumentLines = taskDocLines; //Saving Document task with Lines Factory.DaoDocument().Update(taskDocument); Factory.Commit(); return taskDocument; }
//Confirm CrossDock Document - Create Task public Document ConfirmCrossDockProcess(IList<DocumentBalance> crossDockBalance, string user) { Document cdDocument = null; try { Factory.IsTransactional = true; //1. Crea un Documento de Cross Dock. Y los relaciona con el PO y SO. DocumentType docType = WType.GetDocumentType(new DocumentType { DocTypeID = SDocType.CrossDock }); DocumentTypeSequence docSeq = GetNextDocSequence(crossDockBalance[0].Document.Company, docType); Account vendor = null; try { vendor = crossDockBalance.Where(f => f.Document.DocType.DocClass.DocClassID == SDocClass.Receiving).First().Document.Vendor; } catch { } //Crear Document header cdDocument = new Document { DocNumber = docSeq.CodeSequence, DocType = docType, IsFromErp = false, CrossDocking = true, Date1 = DateTime.Now, CreatedBy = user, Company = crossDockBalance[0].Document.Company, Vendor = vendor }; CreateNewDocument(cdDocument, false); //2. CrossDock Document Lines int line = 1; foreach (DocumentBalance curBal in crossDockBalance.Where(f=> f.QtyProcessed > 0 && f.Document.DocType.DocClass.DocClassID == SDocClass.Shipping)) { DocumentLine docLine = new DocumentLine { Document = cdDocument, Product = curBal.Product, LineStatus = new Status { StatusID = DocStatus.New }, Unit = curBal.Unit, Quantity = curBal.QtyProcessed, CreationDate = DateTime.Now, IsDebit = false, LineNumber = line, Location = curBal.Location, UnitBaseFactor = curBal.Unit.BaseAmount, LinkDocNumber = curBal.Document.DocNumber, CreatedBy = user }; cdDocument.DocumentLines.Add(docLine); line++; } Factory.Commit(); //3. Asocia los documentos que hacen parte del proceso, el purchase y los sales TaskDocumentRelation taskDocRel; foreach (Document curDoc in crossDockBalance.Select(f=>f.Document).Distinct()) { taskDocRel = new TaskDocumentRelation(); taskDocRel.TaskDoc = cdDocument; taskDocRel.IncludedDoc = curDoc; taskDocRel.CreatedBy = user; taskDocRel.CreationDate = DateTime.Now; Factory.DaoTaskDocumentRelation().Save(taskDocRel); //Actualizando el Status del documento a In Process curDoc.DocStatus = WType.GetStatus(new Status { StatusID = DocStatus.InProcess }); Factory.DaoDocument().Update(curDoc); } //Actualiza el Documento de Receiving y lo pone como IsCrossDock = treu foreach (Document doc in crossDockBalance.Where(f => f.Document.DocType.DocClass.DocClassID == SDocClass.Receiving).Select(f => f.Document).Distinct()) { doc.CrossDocking = true; Factory.DaoDocument().Update(doc); } Factory.Commit(); return cdDocument; } catch (Exception ex) { Factory.Rollback(); //Factory.DaoDocument().Delete(cdDocument); ExceptionMngr.WriteEvent("ConfirmCrossDockDocuments:Doc#" + cdDocument.DocNumber, ListValues.EventType.Fatal, ex, null, ListValues.ErrorCategory.Business); throw; } }