コード例 #1
0
        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);
        }
コード例 #2
0
        public override IQuery GetHsql(Object data)
        {
            StringBuilder        sql          = new StringBuilder("select a from TaskDocumentRelation a    where  ");
            TaskDocumentRelation taskdocument = (TaskDocumentRelation)data;

            if (taskdocument != null)
            {
                Parms = new List <Object[]>();
                if (taskdocument.RowID != 0)
                {
                    sql.Append(" a.RowID = :id     and   ");
                    Parms.Add(new Object[] { "id", taskdocument.RowID });
                }


                if (taskdocument.IncludedDoc != null && taskdocument.IncludedDoc.DocID != 0)
                {
                    sql.Append(" a.IncludedDoc.DocID = :id1     and   ");
                    Parms.Add(new Object[] { "id1", taskdocument.IncludedDoc.DocID });
                }

                if (taskdocument.TaskDoc != null && taskdocument.TaskDoc.DocID != 0)
                {
                    sql.Append(" a.TaskDoc.DocID = :id2     and   ");
                    Parms.Add(new Object[] { "id2", taskdocument.TaskDoc.DocID });
                }

                if (taskdocument.TaskDoc != null && taskdocument.TaskDoc.DocType != null && taskdocument.TaskDoc.DocType.DocTypeID != 0)
                {
                    sql.Append(" a.TaskDoc.DocType.DocTypeID = :id3     and   ");
                    Parms.Add(new Object[] { "id3", taskdocument.TaskDoc.DocType.DocTypeID });
                }
            }

            sql = new StringBuilder(sql.ToString());
            sql.Append("1=1 order by a.RowID asc ");
            IQuery query = Factory.Session.CreateQuery(sql.ToString());

            SetParameters(query);
            return(query);
        }
コード例 #3
0
        //07 - Marzo 2009 Check if was involved i a cross dock process
        private void CheckIfCrossDock()
        {
            View.StkCross.Visibility = Visibility.Collapsed;
            View.Model.CrossDock = null;

            //Revisar si ya se realizo una tarea de crossdock sobre ses documento
            TaskDocumentRelation taskRel = new TaskDocumentRelation
            {
                IncludedDoc = View.Model.Document,
                TaskDoc = new Document { DocType = new DocumentType { DocTypeID = SDocType.CrossDock } }
            };

            IList<TaskDocumentRelation> listTask = service.GetTaskDocumentRelation(taskRel)
                .Where(f => f.TaskDoc.DocStatus.StatusID != DocStatus.Cancelled).ToList();
            if (listTask != null && listTask.Count > 0)
            {
                View.StkCross.Visibility = Visibility.Visible;
                View.Model.CrossDock = listTask[0].TaskDoc;
            }
        }
コード例 #4
0
        private bool CheckReceiptCrossDock(Document document)
        {
            TaskDocumentRelation taskRel = new TaskDocumentRelation
            {
                IncludedDoc = document,
                TaskDoc = new Document { DocType = new DocumentType { DocTypeID = SDocType.CrossDock } }
            };

            try
            {
                IList<TaskDocumentRelation> listTask = service.GetTaskDocumentRelation(taskRel)
                    .Where(f => f.TaskDoc.DocStatus.StatusID != DocStatus.Cancelled).ToList();
                if (listTask != null && listTask.Count > 0)
                    return true;
            }
            catch { }

            return false;

        }
コード例 #5
0
 public Boolean Delete(TaskDocumentRelation data)
 {
     return(base.Delete(data));
 }
コード例 #6
0
 public TaskDocumentRelation SelectById(TaskDocumentRelation data)
 {
     return((TaskDocumentRelation)base.SelectById(data));
 }
コード例 #7
0
 public TaskDocumentRelation Save(TaskDocumentRelation data)
 {
     return((TaskDocumentRelation)base.Save(data));
 }
コード例 #8
0
 public Boolean Update(TaskDocumentRelation data)
 {
     return(base.Update(data));
 }
コード例 #9
0
        private void OnConfirmCrossDock(object sender, EventArgs e)
        {
            ProcessWindow pw = null;
            Document      crossDockDocument = null;
            Document      pReceipt          = null;

            View.Model.Document.Location   = App.curLocation;
            View.Model.Document.Company    = App.curCompany;
            View.Model.Document.ModifiedBy = App.curUser.UserName;
            int step = 0;

            View.BtnStep2.IsEnabled = false;

            try
            {
                //1. Create Cross Dock document
                pw = new ProcessWindow("Creating Cross Dock document ...");

                //Poniendo el Location al documento
                for (int i = 0; i < View.Model.CrossDockBalance.Count; i++)
                {
                    View.Model.CrossDockBalance[i].Location = App.curLocation;
                }

                //Crea un documento con las transacciones finales a mover en despacho.
                crossDockDocument = service.ConfirmCrossDockProcess(View.Model.CrossDockBalance.ToList(), App.curUser.UserName);

                step = 1;

                //Update the purchase documento to Cross = true
                //View.Model.Document.CrossDocking = true;
                //service.UpdateDocument(View.Model.Document);


                pw.Close();
            }
            catch (Exception ex)
            {
                if (step == 1)
                {
                    CancelDocument(crossDockDocument);
                }

                pw.Close();
                Util.ShowError("Problem creating Cross Dock document.\n" + ex.Message);
                return;
            }


            //if (App.IsConnectedToErpReceving)
            //{

            //Este procesos ejecutar.
            //2. Create Purchase Receipt Solo si esta pegado al ERP.

            try
            {
                pw       = new ProcessWindow("Creating Purchase Receipt for document " + View.Model.Document.DocNumber + " ...");
                pReceipt = service.CreatePurchaseReceipt(View.Model.Document);

                step = 2;

                //Adicionando un ocmentario de Cross Dock al recibo.
                pReceipt.Comment      = "Receipt under Cross Dock process. Document " + crossDockDocument.DocNumber;
                pReceipt.CrossDocking = true;
                service.UpdateDocument(pReceipt);

                step = 3;


                //Adiciona el PR ala relacion del CrossDock.
                TaskDocumentRelation tkDoc = new TaskDocumentRelation
                {
                    CreationDate = DateTime.Now,
                    CreatedBy    = App.curUser.UserName,
                    IncludedDoc  = pReceipt,
                    TaskDoc      = crossDockDocument
                };

                service.SaveTaskDocumentRelation(tkDoc);
                step = 4;

                pw.Close();
            }
            catch (Exception ex)
            {
                CancelDocument(crossDockDocument);

                if (step >= 2)
                {
                    service.ReversePurchaseReceipt(pReceipt); //reversar el recibo
                }
                pw.Close();
                Util.ShowError("Problem creating Purchase Receipt.\n" + ex.Message);
                return;
            }

            //}


            try
            {
                //3. Picking Product Based on CrossDock Preview. - Lo Saca de MAIN or putawayZone
                pw = new ProcessWindow("Allocating sales document quantities ...");
                //IList<DocumentLine> crossLines = service.GetDocumentLine(new DocumentLine { Document = crossDockDocument });

                //Del documento de cross co obtiene solo las lineas de Sales Orders para ser piqueadeas
                //foreach (DocumentLine line in crossLines)
                service.PickCrossDockProduct(View.Model.Document, View.Model.CrossDockBalance.ToList(), App.curUser);

                pw.Close();
            }
            catch (Exception ex)
            {
                pReceipt.Comment = "Cross Dock transaction problem.";
                service.ReversePurchaseReceipt(pReceipt); //reversar el recibo
                CancelDocument(crossDockDocument);        //Reversar el Cross Dock
                pw.Close();
                Util.ShowError("Problem allocating sales document quantities.\n" + ex.Message);
                return;
            }


            Util.ShowMessage("Cross Dock Process Complete.");
        }
コード例 #10
0
        public void LoadDocument(Document document, Document taskDoc)
        {
            ShowProcess = true;

            View.DgHistList.MaxHeight = SystemParameters.FullPrimaryScreenHeight - 330;

            try
            {
                View.Model.Document = document;

                if (taskDoc != null)
                {
                    AlreadyProcessed = true;
                    ShowProcess      = false;
                    ShowProcessPanel();
                    pw.Close();
                    LoadDetails(taskDoc);
                    return;
                }

                pw = new ProcessWindow("Loading data for document " + document.DocNumber);


                //Revisar si ya se realizo una tarea de crossdock sobre ese documento
                TaskDocumentRelation taskRel = new TaskDocumentRelation
                {
                    IncludedDoc = document,
                    TaskDoc     = new Document {
                        DocType = new DocumentType {
                            DocTypeID = SDocType.CrossDock
                        }
                    }
                };


                IList <TaskDocumentRelation> listTask = service.GetTaskDocumentRelation(taskRel)
                                                        .Where(f => f.TaskDoc.DocStatus.StatusID != DocStatus.Cancelled).ToList();
                if (listTask != null && listTask.Count > 0)
                {
                    //Este documento ya fue procesado
                    AlreadyProcessed = true;
                    ShowProcess      = false;
                }


                ShowProcessPanel();

                //Si ya lo proceso se manda a la historia.
                if (AlreadyProcessed)
                {
                    pw.Close();
                    Util.ShowError("Document " + View.Model.Document + " was already processed.");

                    //Load CrossDock History
                    LoadDetails(listTask[0].TaskDoc);

                    return;
                }



                //Load Sales Order Document List
                View.Model.AvailableDocs = service.GetCrossDockSalesOrders(document);
                if (View.Model.AvailableDocs == null || View.Model.AvailableDocs.Count == 0)
                {
                    pw.Close();
                    Util.ShowError("Sales document products do not match with the received products to make Cross Dock.");
                    //lo deja en los historicos de Cross Dock.
                    //View.TbCross.IsEnabled = false;
                    ShowProcess = false;
                    ShowProcessPanel();
                }
                else
                {
                    //Si hay documentos con productos que coincidan
                    LoadSalesDocument();

                    //Cargando el purchasing Document
                    View.Model.DocumentData  = Util.ToShowData(document);
                    View.Model.DocumentLines = service.GetDocumentLine(new DocumentLine {
                        Document = document
                    });

                    RefreshBalance(document);
                    pw.Close();
                }
            }
            catch (Exception ex)
            {
                pw.Close();
                Util.ShowError("Error loading document. \n" + ex.Message);
            }
            finally { pw.Close(); }
        }
コード例 #11
0
        public void LoadDocument(Document document, Document taskDoc)
        {
            ShowProcess = true;

            View.DgHistList.MaxHeight = SystemParameters.FullPrimaryScreenHeight - 330;

            try
            {

                View.Model.Document = document;

                if (taskDoc != null)
                {
                    AlreadyProcessed = true;
                    ShowProcess = false;
                    ShowProcessPanel();
                    pw.Close();
                    LoadDetails(taskDoc);
                    return;
                }

                pw = new ProcessWindow("Loading data for document " + document.DocNumber);


                //Revisar si ya se realizo una tarea de crossdock sobre ese documento
                TaskDocumentRelation taskRel = new TaskDocumentRelation
                {
                    IncludedDoc = document,
                    TaskDoc = new Document { DocType = new DocumentType { DocTypeID = SDocType.CrossDock } }
                };


                IList<TaskDocumentRelation> listTask = service.GetTaskDocumentRelation(taskRel)
                    .Where(f => f.TaskDoc.DocStatus.StatusID != DocStatus.Cancelled).ToList();
                if (listTask != null && listTask.Count > 0)
                {
                    //Este documento ya fue procesado 
                    AlreadyProcessed = true;
                    ShowProcess = false;
                }


                ShowProcessPanel();

                //Si ya lo proceso se manda a la historia.
                if (AlreadyProcessed)
                {
                    pw.Close();
                    Util.ShowError("Document " + View.Model.Document + " was already processed.");

                    //Load CrossDock History
                    LoadDetails(listTask[0].TaskDoc);

                    return;
                }



                //Load Sales Order Document List
                View.Model.AvailableDocs = service.GetCrossDockSalesOrders(document);
                if (View.Model.AvailableDocs == null || View.Model.AvailableDocs.Count == 0)
                {
                    pw.Close();
                    Util.ShowError("Sales document products do not match with the received products to make Cross Dock.");
                    //lo deja en los historicos de Cross Dock.
                    //View.TbCross.IsEnabled = false;
                    ShowProcess = false;
                    ShowProcessPanel();
                }
                else
                {
                    //Si hay documentos con productos que coincidan
                    LoadSalesDocument();

                    //Cargando el purchasing Document
                    View.Model.DocumentData = Util.ToShowData(document);
                    View.Model.DocumentLines = service.GetDocumentLine(new DocumentLine { Document = document });

                    RefreshBalance(document);
                    pw.Close();
                }


            }
            catch (Exception ex)
            {
                pw.Close();
                Util.ShowError("Error loading document. \n" + ex.Message);
            }
            finally { pw.Close();  }

        }
コード例 #12
0
        private void OnConfirmCrossDock(object sender, EventArgs e)
        {
            ProcessWindow pw = null;
            Document crossDockDocument = null;
            Document pReceipt = null;
            View.Model.Document.Location = App.curLocation;
            View.Model.Document.Company = App.curCompany;
            View.Model.Document.ModifiedBy = App.curUser.UserName;
            int step = 0;

            View.BtnStep2.IsEnabled = false;

            try
            {
                //1. Create Cross Dock document
                pw = new ProcessWindow("Creating Cross Dock document ...");

                //Poniendo el Location al documento
                for (int i = 0; i < View.Model.CrossDockBalance.Count; i++)
                    View.Model.CrossDockBalance[i].Location = App.curLocation;

                //Crea un documento con las transacciones finales a mover en despacho.
                crossDockDocument = service.ConfirmCrossDockProcess(View.Model.CrossDockBalance.ToList(), App.curUser.UserName);

                step = 1;

                //Update the purchase documento to Cross = true
                //View.Model.Document.CrossDocking = true;
                //service.UpdateDocument(View.Model.Document);


                pw.Close();
            }
            catch (Exception ex)
            {
                if (step == 1)
                    CancelDocument(crossDockDocument);

                pw.Close();
                Util.ShowError("Problem creating Cross Dock document.\n" + ex.Message);
                return;
            }


            //if (App.IsConnectedToErpReceving)
            //{

            //Este procesos ejecutar.
            //2. Create Purchase Receipt Solo si esta pegado al ERP.

            try
            {

                pw = new ProcessWindow("Creating Purchase Receipt for document " + View.Model.Document.DocNumber + " ...");
                pReceipt = service.CreatePurchaseReceipt(View.Model.Document);

                step = 2;

                //Adicionando un ocmentario de Cross Dock al recibo.
                pReceipt.Comment = "Receipt under Cross Dock process. Document " + crossDockDocument.DocNumber;
                pReceipt.CrossDocking = true;
                service.UpdateDocument(pReceipt);

                step = 3;


                //Adiciona el PR ala relacion del CrossDock.
                TaskDocumentRelation tkDoc = new TaskDocumentRelation
                {
                    CreationDate = DateTime.Now,
                    CreatedBy = App.curUser.UserName,
                    IncludedDoc = pReceipt,
                    TaskDoc = crossDockDocument
                };

                service.SaveTaskDocumentRelation(tkDoc);
                step = 4;

                pw.Close();
            }
            catch (Exception ex)
            {
                CancelDocument(crossDockDocument);

                if (step >= 2)
                    service.ReversePurchaseReceipt(pReceipt); //reversar el recibo

                pw.Close();
                Util.ShowError("Problem creating Purchase Receipt.\n" + ex.Message);
                return;
            }

            //}


            try
            {
                //3. Picking Product Based on CrossDock Preview. - Lo Saca de MAIN or putawayZone
                pw = new ProcessWindow("Allocating sales document quantities ...");
                //IList<DocumentLine> crossLines = service.GetDocumentLine(new DocumentLine { Document = crossDockDocument });

                //Del documento de cross co obtiene solo las lineas de Sales Orders para ser piqueadeas
                //foreach (DocumentLine line in crossLines)
                service.PickCrossDockProduct(View.Model.Document, View.Model.CrossDockBalance.ToList(), App.curUser);

                pw.Close();
            }
            catch (Exception ex)
            {
                pReceipt.Comment = "Cross Dock transaction problem.";
                service.ReversePurchaseReceipt(pReceipt); //reversar el recibo
                CancelDocument(crossDockDocument); //Reversar el Cross Dock
                pw.Close();
                Util.ShowError("Problem allocating sales document quantities.\n" + ex.Message);
                return;
            }


            Util.ShowMessage("Cross Dock Process Complete.");

        }
コード例 #13
0
 public void DeleteTaskDocumentRelation(TaskDocumentRelation data)
 {
     try {
     SetService();  SerClient.DeleteTaskDocumentRelation(data); }
     finally
     {
         SerClient.Close();
         if (SerClient.State == CommunicationState.Faulted)
         SerClient.Abort(); 
     }
 }
コード例 #14
0
 public TaskDocumentRelation SaveTaskDocumentRelation(TaskDocumentRelation data)
 {
     try {
     SetService();  return SerClient.SaveTaskDocumentRelation(data); }
     finally
     {
         SerClient.Close();
         if (SerClient.State == CommunicationState.Faulted)
         SerClient.Abort(); 
     }
 }
コード例 #15
0
        //This method revisa si el recibo pertenece a aun procesos de cross dock
        //y Anula el docuemnto de crossdock y sus lineas, y Unpick las cantidades
        //piqueadas para los documentos de ventas
        private void ReverseCrossDockProcess(Document receipt)
        {
            if (receipt.CrossDocking != true)
            {
                return;
            }

            try
            {
                Factory.IsTransactional = true;

                Status cancelled = WType.GetStatus(new Status {
                    StatusID = DocStatus.Cancelled
                });

                TaskDocumentRelation taskRel = new TaskDocumentRelation
                {
                    IncludedDoc = receipt,
                    TaskDoc     = new Document {
                        DocType = new DocumentType {
                            DocTypeID = SDocType.CrossDock
                        }
                    }
                };


                IList <TaskDocumentRelation> listTask = Factory.DaoTaskDocumentRelation().Select(taskRel)
                                                        .Where(f => f.TaskDoc.DocStatus.StatusID != DocStatus.Cancelled).ToList();

                //Cuando no tiene docuemnto asociado
                if (listTask == null || listTask.Count == 0)
                {
                    return;
                }

                //Si tiene docuemnto asociado continua.
                //1. Cancela el documento cross dock y sus lineas.
                Document crossDockDocument = listTask[0].TaskDoc;
                crossDockDocument.DocStatus = cancelled;
                WType.GetStatus(new Status {
                    StatusID = DocStatus.Cancelled
                });
                crossDockDocument.Comment   += "\nDocument cancelled due the reversion of receipt " + receipt.DocNumber;
                crossDockDocument.ModifiedBy = receipt.ModifiedBy;
                crossDockDocument.ModDate    = DateTime.Now;

                foreach (DocumentLine line in crossDockDocument.DocumentLines)
                {
                    line.LineStatus = cancelled;
                    Factory.DaoDocumentLine().Update(line);
                }

                //Actualizando el documento
                Factory.DaoDocument().Update(crossDockDocument);

                //Reversando las cantidades piqeuadas para suplir los documentos de ventas.
                //Obtiene las cantidades que fueron piquedas por cada liena de cada documento de vantas

                //Node traces que fueron afectados con ese recibo.
                NodeTrace sourceTrace = new NodeTrace
                {
                    Node = new Node {
                        NodeID = NodeType.Picked
                    },
                    Status = new Status {
                        StatusID = EntityStatus.Active
                    },
                    Comment = receipt.CustPONumber
                };

                IList <NodeTrace> nodes = Factory.DaoNodeTrace().Select(sourceTrace);

                Node labelNode = Factory.DaoNode().Select(new Node {
                    NodeID = NodeType.Stored
                }).First();

                //revesar todo lo piqueado a main
                Bin bin = WType.GetBin(new Bin {
                    Location = receipt.Location, BinCode = DefaultBin.PUTAWAY
                });

                Status status = Factory.DaoStatus().Select(new Status {
                    StatusID = EntityStatus.Active
                }).First();

                ReverseNodeTrace(nodes, receipt.ModifiedBy, labelNode, bin, status);

                Factory.Commit();
            }
            catch (Exception ex)
            {
                Factory.Rollback();

                ExceptionMngr.WriteEvent("ReverseCrossDockProcess:Doc#" + receipt.DocNumber, ListValues.EventType.Fatal, ex, null, ListValues.ErrorCategory.Business);
                throw;
            }
        }