/// <summary> /// Captures carton_productivity. /// </summary> /// <remarks> /// Productivity of a carton must be captured in the talbel carton_prodcutivity, as we do not /// want to change the behavior of Restock Prodctivity report we are inserting it in box_productivity. /// </remarks> public void CaptureProductivity(RestockCarton carton, bool isRestockCarton) { const string QUERY = @" INSERT INTO <proxy />box_productivity ( OPERATION_CODE, MODULE_CODE, OPERATOR, OPERATION_START_DATE, OPERATION_END_DATE, OUTCOME, UCC128_ID, UPC_CODE, LABEL_ID, TO_LOCATION_ID, FROM_INVENTORY_AREA, TO_INVENTORY_AREA, NUM_OF_PIECES, NUM_OF_UNITS, WAREHOUSE_LOCATION_ID, VWH_ID, FROM_PALLET) VALUES ( '$RST', :MODULE, NVL(:OPERATOR,user), SYSDATE, SYSDATE, :OUTCOME, :CARTON_ID, :UPC_CODE, :LABEL_ID, :LOCATION_ID, :CARTON_SOURCE_AREA, :CARTON_DESTINATION_AREA, :PIECES, :NO_OF_UNITS, :WAREHOUSE_LOCATION_ID, :VWH_ID, :PALLET_ID) "; var binder = SqlBinder.Create(); binder.Parameter("CARTON_ID", carton.CartonId) .Parameter("UPC_CODE", carton.UpcCode) .Parameter("OPERATOR", _userName) .Parameter("MODULE", Module_Name) .Parameter("LOCATION_ID", carton.RestockAtLocation) .Parameter("CARTON_SOURCE_AREA", carton.CartonStorageArea) .Parameter("CARTON_DESTINATION_AREA", isRestockCarton ? carton.PickAreaId : carton.CartonStorageArea) .Parameter("PIECES", carton.PiecesInCarton) .Parameter("NO_OF_UNITS", carton.NumberOfUnits) .Parameter("WAREHOUSE_LOCATION_ID", carton.BuildingId) .Parameter("OUTCOME", isRestockCarton ? "RESTOCKED" : "CARTON IN SUSPENSE") .Parameter("VWH_ID", carton.VwhId) .Parameter("LABEL_ID", carton.LabelId) .Parameter("PALLET_ID", carton.PalletId); _db.ExecuteNonQuery(QUERY, binder); }
/// <summary> /// This function restocks passed carton on the passed location /// </summary> /// <param name="carton">RestockCarton entity</param> /// <param name="locationId"></param> public void RestockCarton(RestockCarton carton, string locationId) { if (carton == null) { throw new ArgumentNullException("carton"); } if (carton.SkuId == null) { throw new ArgumentNullException("carton.SkuId"); } const string QUERY = @" declare LRelatedTransactionId NUMBER(10); begin <proxy />pkg_resv.add_to_ialoc2(alocation_id => :alocation, asku_id => :asku_id, apieces => :apieces); LRelatedTransactionId := <proxy />pkg_inv_3.openctn(acarton_id => :acarton_id, adestination_area => :adestination_area, arelated_transaction_id => NULL); end; "; var binder = SqlBinder.Create(); binder.Parameter("alocation", locationId) .Parameter("asku_id", carton.SkuId) .Parameter("apieces", carton.PiecesInCarton) .Parameter("acarton_id", carton.CartonId) .Parameter("adestination_area", "SHL"); _db.ExecuteNonQuery(QUERY, binder); }
/// <summary> /// Restocks carton /// </summary> /// <param name="carton">RestockCarton entity</param> /// <param name="locationId">string</param> public void RestockCarton(RestockCarton carton, string locationId) { if (carton == null || string.IsNullOrWhiteSpace(carton.CartonId)) { throw new ArgumentNullException("carton"); } if (string.IsNullOrWhiteSpace(locationId)) { throw new ArgumentNullException("locationId"); } using (var trans = _repos.BeginTransaction()) { _repos.RestockCarton(carton, locationId); _repos.CaptureProductivity(carton, true); trans.Commit(); } CartonCache.Remove(carton.CartonId); // Remove assigned locations of SKU from the cache so that we can see updated pieces at location if (carton.SkuId.HasValue) { // Safety check IList <AssignedLocation> dummy; SkuLocationCache.TryRemove(carton.SkuId.Value, out dummy); } }
/// <summary> /// Puts carton in suspense /// </summary> /// <param name="carton">String</param> public void SuspenseCarton(RestockCarton carton) { if (carton == null || string.IsNullOrWhiteSpace(carton.CartonId)) { throw new ArgumentNullException("carton"); } using (var trans = _repos.BeginTransaction()) { _repos.SuspenseCarton(carton.CartonId); _repos.CaptureProductivity(carton, false); trans.Commit(); } CartonCache.Remove(carton.CartonId); }