private int UpdatePositiveAdj(Document countTask, CountTaskBalance r, string user, Document posAdj, int curLine) { Label targetLabel; if (r.Label != null) { targetLabel = r.Label; } else { targetLabel = Factory.DaoLabel().Select(new Label { Bin = new Bin { BinID = r.Bin.BinID }, LabelType = new DocumentType { DocTypeID = LabelType.BinLocation } }).First(); } //Creando la linea del Ajuste DocumentLine addLine = new DocumentLine { Product = r.Product, Quantity = Math.Abs(r.Difference), //Math.Abs(binTask.QtyDiff), QtyAllocated = r.QtyExpected, ModifiedBy = user, CreationDate = DateTime.Now, CreatedBy = user, ModDate = DateTime.Now, Unit = r.Product.BaseUnit, LineStatus = new Status { StatusID = DocStatus.New }, IsDebit = false, //r.Difference < 0 ? true : false, UnitBaseFactor = r.Product.BaseUnit.BaseAmount, //BinAffected = r.Bin.BinCode + ((r.Label != null) ? r.Label.LabelCode : ""), BinAffected = targetLabel.LabelCode, Location = countTask.Location, Note = r.Bin.BinCode, Date1 = DateTime.Now }; addLine.Document = posAdj; addLine.LineNumber = curLine; addLine = SaveAdjustmentTransaction(addLine, targetLabel, false); if (addLine.Note == "Adjust OK.") { return(curLine + 1); } else { return(curLine); } }
private Document UpdateNegativeAdj(Document countTask, CountTaskBalance r, string user) { Label targetLabel; if (r.Label != null) { targetLabel = r.Label; } else { targetLabel = Factory.DaoLabel().Select(new Label { Bin = new Bin { BinID = r.Bin.BinID }, LabelType = new DocumentType { DocTypeID = LabelType.BinLocation } }).First(); } //Creando la linea del Ajuste DocumentLine addLine = new DocumentLine { Product = r.Product, Quantity = Math.Abs(r.Difference), //Math.Abs(binTask.QtyDiff), QtyAllocated = r.QtyExpected, ModifiedBy = user, CreationDate = DateTime.Now, CreatedBy = user, ModDate = DateTime.Now, Unit = r.Product.BaseUnit, LineStatus = new Status { StatusID = DocStatus.New }, IsDebit = true, //r.Difference < 0 ? true : false, UnitBaseFactor = r.Product.BaseUnit.BaseAmount, //BinAffected = r.Bin.BinCode + ((r.Label != null) ? " " + r.Label.LabelCode : ""), BinAffected = targetLabel.LabelCode, Location = countTask.Location, Note = r.Bin.BinCode, Date1 = DateTime.Now }; //Crear Ajustes de inventario positivos en un solo ajuste. Document negativeAdj = new Document { DocType = new DocumentType { DocTypeID = SDocType.InventoryAdjustment }, CreatedBy = user, Location = countTask.Location, Company = countTask.Company, IsFromErp = false, CrossDocking = false, Comment = "CountTask Posting (Negative Adj) " + countTask.DocNumber + ", " + user, Date1 = DateTime.Now, CustPONumber = countTask.DocNumber, Notes = WmsSetupValues.Counting_Bach }; negativeAdj = DocMngr.CreateNewDocument(negativeAdj, false); addLine.Document = negativeAdj; addLine.LineNumber = 1; addLine = SaveAdjustmentTransaction(addLine, targetLabel, false); if (addLine.Note == "Adjust OK.") { return(negativeAdj); } else { return(null); } }
private IList <CountTaskBalance> GetCountBalanceObject(IList <Object[]> retList) { if (retList == null || retList.Count == 0) { return(new List <CountTaskBalance>()); } IList <CountTaskBalance> retBalance = new List <CountTaskBalance>(); CountTaskBalance curBalance; Document document = Factory.DaoDocument().SelectById(new Document { DocID = (int)retList[0][0] }); foreach (Object[] obj in retList) { curBalance = new CountTaskBalance(); //TaskDocumentID, BinID, LabelID, ProductID, QtyExpected, UnitExpID, QtyCount, UnitCountID curBalance.CountTask = document; curBalance.BinByTask = Factory.DaoBinByTask().Select(new BinByTask { RowID = (int)obj[1] }).First(); curBalance.Bin = Factory.DaoBin().Select(new Bin { BinID = (int)obj[2] }).First(); if ((long)obj[3] > 0) { curBalance.Label = Factory.DaoLabel().Select(new Label { LabelID = (long)obj[3] }).First(); } curBalance.Product = Factory.DaoProduct().SelectById(new Product { ProductID = (int)obj[4] }); curBalance.QtyExpected = Double.Parse(obj[5].ToString()); try { curBalance.UnitExpected = Factory.DaoUnit().SelectById(new Unit { UnitID = (int)obj[6] }); } catch { } curBalance.QtyCount = Double.Parse(obj[7].ToString()); try { curBalance.UnitCount = Factory.DaoUnit().SelectById(new Unit { UnitID = (int)obj[8] }); } catch { } curBalance.CaseType = int.Parse(obj[9].ToString()); retBalance.Add(curBalance); } return(retBalance); }
private IList<CountTaskBalance> GetCountBalanceObject(IList<Object[]> retList) { if (retList == null || retList.Count == 0) return new List<CountTaskBalance>(); IList<CountTaskBalance> retBalance = new List<CountTaskBalance>(); CountTaskBalance curBalance; Document document = Factory.DaoDocument().SelectById(new Document { DocID = (int)retList[0][0] }); foreach (Object[] obj in retList) { curBalance = new CountTaskBalance(); //TaskDocumentID, BinID, LabelID, ProductID, QtyExpected, UnitExpID, QtyCount, UnitCountID curBalance.CountTask = document; curBalance.BinByTask = Factory.DaoBinByTask().Select(new BinByTask { RowID = (int)obj[1] }).First(); curBalance.Bin = Factory.DaoBin().Select(new Bin { BinID = (int)obj[2] }).First(); if ((long)obj[3] > 0) curBalance.Label = Factory.DaoLabel().Select(new Label { LabelID = (long)obj[3] }).First(); curBalance.Product = Factory.DaoProduct().SelectById(new Product { ProductID = (int)obj[4] }); curBalance.QtyExpected = Double.Parse(obj[5].ToString()); try { curBalance.UnitExpected = Factory.DaoUnit().SelectById(new Unit { UnitID = (int)obj[6] }); } catch { } curBalance.QtyCount = Double.Parse(obj[7].ToString()); try { curBalance.UnitCount = Factory.DaoUnit().SelectById(new Unit { UnitID = (int)obj[8] }); } catch { } curBalance.CaseType = int.Parse(obj[9].ToString()); retBalance.Add(curBalance); } return retBalance; }
private int UpdatePositiveAdj(Document countTask, CountTaskBalance r, string user, Document posAdj, int curLine) { Label targetLabel; if (r.Label != null) targetLabel = r.Label; else targetLabel = Factory.DaoLabel().Select(new Label { Bin = new Bin { BinID = r.Bin.BinID }, LabelType = new DocumentType { DocTypeID = LabelType.BinLocation } }).First(); //Creando la linea del Ajuste DocumentLine addLine = new DocumentLine { Product = r.Product, Quantity = Math.Abs(r.Difference), //Math.Abs(binTask.QtyDiff), QtyAllocated = r.QtyExpected, ModifiedBy = user, CreationDate = DateTime.Now, CreatedBy = user, ModDate = DateTime.Now, Unit = r.Product.BaseUnit, LineStatus = new Status { StatusID = DocStatus.New }, IsDebit = false, //r.Difference < 0 ? true : false, UnitBaseFactor = r.Product.BaseUnit.BaseAmount, //BinAffected = r.Bin.BinCode + ((r.Label != null) ? r.Label.LabelCode : ""), BinAffected = targetLabel.LabelCode, Location = countTask.Location, Note = r.Bin.BinCode, Date1 = DateTime.Now }; addLine.Document = posAdj; addLine.LineNumber = curLine; addLine = SaveAdjustmentTransaction(addLine, targetLabel, false); if (addLine.Note == "Adjust OK.") return curLine + 1; else return curLine; }
private Document UpdateNegativeAdj(Document countTask, CountTaskBalance r, string user) { Label targetLabel; if (r.Label != null) targetLabel = r.Label; else targetLabel = Factory.DaoLabel().Select(new Label { Bin = new Bin { BinID = r.Bin.BinID }, LabelType = new DocumentType { DocTypeID = LabelType.BinLocation } }).First(); //Creando la linea del Ajuste DocumentLine addLine = new DocumentLine { Product = r.Product, Quantity = Math.Abs(r.Difference), //Math.Abs(binTask.QtyDiff), QtyAllocated = r.QtyExpected, ModifiedBy = user, CreationDate = DateTime.Now, CreatedBy = user, ModDate = DateTime.Now, Unit = r.Product.BaseUnit, LineStatus = new Status { StatusID = DocStatus.New }, IsDebit = true, //r.Difference < 0 ? true : false, UnitBaseFactor = r.Product.BaseUnit.BaseAmount, //BinAffected = r.Bin.BinCode + ((r.Label != null) ? " " + r.Label.LabelCode : ""), BinAffected = targetLabel.LabelCode, Location = countTask.Location, Note = r.Bin.BinCode, Date1 = DateTime.Now }; //Crear Ajustes de inventario positivos en un solo ajuste. Document negativeAdj = new Document { DocType = new DocumentType { DocTypeID = SDocType.InventoryAdjustment }, CreatedBy = user, Location = countTask.Location, Company = countTask.Company, IsFromErp = false, CrossDocking = false, Comment = "CountTask Posting (Negative Adj) " + countTask.DocNumber + ", " + user, Date1 = DateTime.Now, CustPONumber = countTask.DocNumber, Notes = WmsSetupValues.Counting_Bach }; negativeAdj = DocMngr.CreateNewDocument(negativeAdj, false); addLine.Document = negativeAdj; addLine.LineNumber = 1; addLine = SaveAdjustmentTransaction(addLine, targetLabel, false); if (addLine.Note == "Adjust OK.") return negativeAdj; else return null; }