public ActionResult GoodsReceipt() { WarehouseActionModel model = new WarehouseActionModel(); var id = Utils.ConvertToInt32(Request["WarehouseId"]); var productId = Utils.ConvertToInt32(Request["ProductId"]); try { model.WarehouseId = id; model.ProductId = productId; var productStore = GlobalContainer.IocContainer.Resolve <IStoreProduct>(); if (productId > 0) { model.ProductInfo = productStore.GetDetail(productId); } if (model.ProductInfo != null) { model.ItemCode = model.ProductInfo.Code; model.ItemName = model.ProductInfo.Name; } model.Units = CommonHelpers.GetListUnit(); } catch (Exception ex) { this.AddNotification(NotifSettings.Error_SystemBusy, NotificationType.ERROR); logger.Error("Failed for Show Goods Receipt form: " + ex.ToString()); } return(PartialView("_GoodsReceipt", model)); }
public ActionResult ReflectStockTake(WarehouseActionModel model) { var strError = string.Empty; try { var productInfo = new IdentityProduct(); var warehouseInfo = new IdentityWarehouse(); productInfo.Id = model.ProductId; productInfo.Code = model.ItemCode; var productStore = GlobalContainer.IocContainer.Resolve <IStoreProduct>(); var productInfoCheck = productStore.GetById(model.ProductId); if (productInfoCheck == null || (productInfoCheck != null && productInfoCheck.Id <= 0)) { return(Json(new { success = false, message = ManagerResource.ERROR_PRODUCT_ITEM_NOTFOUND, title = ManagerResource.LB_NOTIFICATION })); } else { productInfo = productInfoCheck; } //if (model.ProductId <= 0) //{ // if (!string.IsNullOrEmpty(model.ItemCode)) // { // var productStore = GlobalContainer.IocContainer.Resolve<IStoreProduct>(); // var productInfoCheck = productStore.GetByCode(model.ItemCode); // if (productInfoCheck == null || (productInfoCheck != null && productInfoCheck.Id <= 0)) // return Json(new { success = false, message = string.Format(ManagerResource.ERROR_PRODUCT_ITEM_CODE_NOTFOUND_FORMAT, model.ItemCode), title = ManagerResource.LB_NOTIFICATION, clientcallback = " ShowMyModalAgain();" }); // else // productInfo = productInfoCheck; // } //} //productInfo.WarehouseNum = model.WarehouseNum; warehouseInfo.ProductList.Add(productInfo); var activityInfo = new IdentityWarehouseActivity(); activityInfo.ActivityType = (int)EnumWarehouseActivityType.ReflectStockTake; activityInfo.DeviceId = RegisterNewDevice(); activityInfo.StaffId = GetCurrentStaffId(); //Database execute _mainStore.ReflectStockTake(warehouseInfo, activityInfo); } catch (Exception ex) { strError = ManagerResource.LB_SYSTEM_BUSY; logger.Error("Failed to exec ReflectStockTake because: " + ex.ToString()); return(Json(new { success = false, message = strError })); } return(Json(new { success = true, message = ManagerResource.LB_GOODS_REFLECT_STOCK_TAKE_SUCCESS, title = ManagerResource.LB_NOTIFICATION, clientcallback = " location.reload()" })); }
public ActionResult GoodsReceipt(WarehouseActionModel model) { var strError = string.Empty; try { var productInfo = new IdentityProduct(); var warehouseInfo = new IdentityWarehouse(); productInfo.Id = model.ProductId; productInfo.Code = model.ItemCode; var qty = Utils.ConvertToDouble(model.WarehouseNum); if (qty <= 0) { return(Json(new { success = false, message = ManagerResource.ERROR_QTY_MUST_LARGE_THAN_0, title = ManagerResource.LB_NOTIFICATION, clientcallback = " ShowMyModalAgain();" })); } if (model.ProductId <= 0) { if (!string.IsNullOrEmpty(model.ItemCode)) { var productStore = GlobalContainer.IocContainer.Resolve <IStoreProduct>(); var productInfoCheck = productStore.GetByCode(model.ItemCode); if (productInfoCheck == null || (productInfoCheck != null && productInfoCheck.Id <= 0)) { return(Json(new { success = false, message = string.Format(ManagerResource.ERROR_PRODUCT_ITEM_CODE_NOTFOUND_FORMAT, model.ItemCode), title = ManagerResource.LB_NOTIFICATION, clientcallback = " ShowMyModalAgain();" })); } else { productInfo = productInfoCheck; } } } productInfo.WarehouseNum = qty; warehouseInfo.ProductList.Add(productInfo); var activityInfo = new IdentityWarehouseActivity(); activityInfo.ActivityType = (int)EnumWarehouseActivityType.GoodsReceipt; activityInfo.DeviceId = RegisterNewDevice(); activityInfo.StaffId = GetCurrentStaffId(); //Database execute _mainStore.GoodsReceipt(warehouseInfo, activityInfo); } catch (Exception ex) { strError = ManagerResource.LB_SYSTEM_BUSY; logger.Error("Failed to exec GoodsReceipt because: " + ex.ToString()); return(Json(new { success = false, message = strError })); } return(Json(new { success = true, message = ManagerResource.LB_GOODS_RECEIPT_SUCCESS, title = ManagerResource.LB_NOTIFICATION, clientcallback = " location.reload()" })); }