public static PickList GeneratePickList(int orderId) { PickList pklist = new PickList(); pklist.AddNew(); pklist.OrderID = orderId; pklist.PickType = "Pick"; pklist.IssuedDate = DateTime.Today; pklist.IsConfirmed = true; pklist.SavedDate = DateTime.Today; pklist.IsWarehouseConfirmed = 0; pklist.Save(); return pklist; }
public static PickList GeneratePickList(int orderId) { PickList pklist = new PickList(); pklist.AddNew(); pklist.OrderID = orderId; pklist.PickType = "Pick"; pklist.IssuedDate = DateTime.Today; pklist.IsConfirmed = true; pklist.SavedDate = DateTime.Today; pklist.IsWarehouseConfirmed = 0; pklist.Save(); return(pklist); }
/// <summary> /// Saves issue order details /// </summary> /// <param name="orderID"></param> /// <param name="dvPickListMakeup"></param> public void SavePickList(int orderID, DataView dvPickListMakeup, int userID) { //~ Check if This Order has a previous Printed Picklist with detail: Note a header only doesnt affect us! // var pickList = new PickList(); pickList.LoadByOrderID(orderID); if (pickList.RowCount > 0) { var pldetail = new PickListDetail(); pldetail.LoadByPickListID(pickList.ID); if (pldetail.RowCount > 0) { RemoveFakePartialCommitPickListDetails(orderID); var pickL = new PickList(); pickL.LoadByOrderID(orderID); if (pickL.RowCount > 0) { throw new Exception("Picklist has already been printed for this Order "); // This error has been apprearing for the last one year so funny! I hope it won't come again! day: 10/21/2014 @yido // } } } // Create a pick list entry Order ord = new Order(); ord.LoadByPrimaryKey(orderID); PickList pl = new PickList(); PalletLocation plocation = new PalletLocation(); plocation.LoadByPrimaryKey(Convert.ToInt32(dvPickListMakeup[0]["PalletLocationID"])); pl.AddNew(); pl.OrderID = orderID; pl.PickType = "Pick"; pl.PickedBy = userID; pl.IsConfirmed = false; pl.IssuedDate = DateTimeHelper.ServerDateTime; pl.SavedDate = DateTimeHelper.ServerDateTime; pl.PickedDate = DateTimeHelper.ServerDateTime; pl.IsWarehouseConfirmed = 0; pl.WarehouseID = plocation.WarehouseID; pl.Save(); PickListDetail pld = new PickListDetail(); ReceivePallet rp = new ReceivePallet(); ReceiveDoc rd = new ReceiveDoc(); PickFace pf = new PickFace(); foreach (DataRowView drv in dvPickListMakeup) { pld.AddNew(); pld.PickListID = pl.ID; pld.OrderDetailID = Convert.ToInt32(drv["OrderDetailID"]); pld.ItemID = Convert.ToInt32(drv["ItemID"]); pld.BatchNumber = (drv["BatchNo"].ToString()); if (drv["ExpDate"] != DBNull.Value) { pld.ExpireDate = Convert.ToDateTime(drv["ExpDate"]); } pld.ManufacturerID = Convert.ToInt32(drv["ManufacturerID"]); pld.BoxLevel = Convert.ToInt32(drv["BoxLevel"]); pld.QtyPerPack = Convert.ToInt32(drv["QtyPerPack"]); pld.Packs = Convert.ToDecimal(drv["Pack"]); pld.PalletLocationID = Convert.ToInt32(drv["PalletLocationID"]); pld.QuantityInBU = Convert.ToDecimal(drv["QtyInBU"]); pld.ReceiveDocID = Convert.ToInt32(drv["ReceiveDocID"]); pld.ReceivePalletID = Convert.ToInt32(drv["ReceivePalletID"]); if (drv["CalculatedCost"] != DBNull.Value) { pld.Cost = Convert.ToDouble(drv["CalculatedCost"]); } if (drv["UnitPrice"] != DBNull.Value) { pld.UnitPrice = Convert.ToDouble(drv["UnitPrice"]); } int ReceivePalletID = Convert.ToInt32(drv["ReceivePalletID"]); rp.LoadByPrimaryKey(ReceivePalletID); pld.StoreID = Convert.ToInt32(drv["StoreID"]); if (drv["DeliveryNote"] != null) { pld.DeliveryNote = Convert.ToBoolean(drv["DeliveryNote"]); } else { pld.DeliveryNote = false; } if (rp.IsColumnNull("ReservedStock")) { rp.ReservedStock = Convert.ToDecimal(pld.QuantityInBU); } else { rp.ReservedStock += Convert.ToDecimal(pld.QuantityInBU); } if (drv["UnitID"] != DBNull.Value) { pld.UnitID = Convert.ToInt32(drv["UnitID"]); } plocation.LoadByPrimaryKey(Convert.ToInt32(drv["PalletLocationID"])); pld.PhysicalStoreID = plocation.PhysicalStoreID; rp.Save(); if (drv["StorageTypeID"].ToString() == StorageType.PickFace) { pf.LoadByPalletLocation(Convert.ToInt32(drv["PalletLocationID"])); //pf.Balance -= Convert.ToDecimal(pld.QuantityInBU); pf.Save(); } } pld.Save(); ord.ChangeStatus(OrderStatus.Constant.PICK_LIST_GENERATED, CurrentContext.UserId); ord.Save(); }
/// <summary> /// Saves issue order details /// </summary> /// <param name="orderID"></param> /// <param name="dvPickListMakeup"></param> public void SavePickList(int orderID, DataView dvPickListMakeup, int userID) { //~ Check if This Order has a previous Printed Picklist with detail: Note a header only doesnt affect us! // var pickList = new PickList(); pickList.LoadByOrderID(orderID); if(pickList.RowCount>0) { var pldetail = new PickListDetail(); pldetail.LoadByPickListID(pickList.ID); if (pldetail.RowCount > 0) { RemoveFakePartialCommitPickListDetails(orderID); var pickL = new PickList(); pickL.LoadByOrderID(orderID); if (pickL.RowCount > 0) { throw new Exception("Picklist has already been printed for this Order "); // This error has been apprearing for the last one year so funny! I hope it won't come again! day: 10/21/2014 @yido // } } } // Create a pick list entry Order ord = new Order(); ord.LoadByPrimaryKey(orderID); PickList pl = new PickList(); PalletLocation plocation = new PalletLocation(); plocation.LoadByPrimaryKey(Convert.ToInt32(dvPickListMakeup[0]["PalletLocationID"])); pl.AddNew(); pl.OrderID = orderID; pl.PickType = "Pick"; pl.PickedBy = userID; pl.IsConfirmed = false; pl.IssuedDate = DateTimeHelper.ServerDateTime; pl.SavedDate = DateTimeHelper.ServerDateTime; pl.PickedDate = DateTimeHelper.ServerDateTime; pl.IsWarehouseConfirmed = 0; pl.WarehouseID = plocation.WarehouseID; pl.Save(); PickListDetail pld = new PickListDetail(); ReceivePallet rp = new ReceivePallet(); ReceiveDoc rd = new ReceiveDoc(); PickFace pf = new PickFace(); foreach (DataRowView drv in dvPickListMakeup) { pld.AddNew(); pld.PickListID = pl.ID; pld.OrderDetailID = Convert.ToInt32(drv["OrderDetailID"]); pld.ItemID = Convert.ToInt32(drv["ItemID"]); pld.BatchNumber = (drv["BatchNo"].ToString()); if (drv["ExpDate"] != DBNull.Value) { pld.ExpireDate = Convert.ToDateTime(drv["ExpDate"]); } pld.ManufacturerID = Convert.ToInt32(drv["ManufacturerID"]); pld.BoxLevel = Convert.ToInt32(drv["BoxLevel"]); pld.QtyPerPack = Convert.ToInt32(drv["QtyPerPack"]); pld.Packs = Convert.ToDecimal(drv["Pack"]); pld.PalletLocationID = Convert.ToInt32(drv["PalletLocationID"]); pld.QuantityInBU = Convert.ToDecimal(drv["QtyInBU"]); pld.ReceiveDocID = Convert.ToInt32(drv["ReceiveDocID"]); pld.ReceivePalletID = Convert.ToInt32(drv["ReceivePalletID"]); if (drv["CalculatedCost"] != DBNull.Value) pld.Cost = Convert.ToDouble(drv["CalculatedCost"]); if (drv["UnitPrice"] != DBNull.Value) pld.UnitPrice = Convert.ToDouble(drv["UnitPrice"]); int ReceivePalletID = Convert.ToInt32(drv["ReceivePalletID"]); rp.LoadByPrimaryKey(ReceivePalletID); pld.StoreID = Convert.ToInt32(drv["StoreID"]); if (drv["DeliveryNote"] != null) pld.DeliveryNote = Convert.ToBoolean(drv["DeliveryNote"]); else pld.DeliveryNote = false; if (rp.IsColumnNull("ReservedStock")) { rp.ReservedStock = Convert.ToDecimal(pld.QuantityInBU); } else { rp.ReservedStock += Convert.ToDecimal(pld.QuantityInBU); } if (drv["UnitID"] != DBNull.Value) { pld.UnitID = Convert.ToInt32(drv["UnitID"]); } plocation.LoadByPrimaryKey(Convert.ToInt32(drv["PalletLocationID"])); pld.PhysicalStoreID = plocation.PhysicalStoreID; rp.Save(); if (drv["StorageTypeID"].ToString() == StorageType.PickFace) { pf.LoadByPalletLocation(Convert.ToInt32(drv["PalletLocationID"])); //pf.Balance -= Convert.ToDecimal(pld.QuantityInBU); pf.Save(); } } pld.Save(); ord.ChangeStatus(OrderStatus.Constant.PICK_LIST_GENERATED,CurrentContext.UserId); ord.Save(); }
private int GeneratePickList(int OrderID) { PickList pklist = new PickList(); pklist.AddNew(); pklist.OrderID = OrderID; pklist.PickType = "Pick"; pklist.IssuedDate = DateTimeHelper.ServerDateTime; pklist.IsConfirmed = true; pklist.SavedDate = DateTimeHelper.ServerDateTime; pklist.PickedDate = DateTimeHelper.ServerDateTime; pklist.IsWarehouseConfirmed = 0; pklist.Save(); return pklist.ID; }