private void CompareExpectedListResultCommon(StorageAccountListResponse response) { StorageAccountModel result = response.StorageAccounts[2]; Assert.Equal(result.Properties.AccountType, StorageAccountType.StandardLRS); Assert.Equal(result.Properties.CreationTime, "Thu, 20 Aug 2015 16:09:18 GMT"); Assert.Equal(result.Properties.TenantAccountName, "705mystorageaccount3"); Assert.Equal(result.Properties.State, StorageAccountState.Created); Assert.Equal(result.Properties.PrimaryLocation, "DevFabric"); Assert.Equal(result.Properties.StatusOfPrimary, RegionStatus.Available); result = response.StorageAccounts[0]; Assert.Equal(result.Properties.AccountStatus, StorageAccountStatus.OutOfRetentionPeriod); Assert.NotNull(result.Properties.DeletedTime); Assert.Null(result.Properties.RecycledTime); Assert.Equal(result.Properties.CurrentOperation, StorageAccountOperation.Delete); Assert.Equal(result.Properties.PrimaryEndpoints.Count, 3); }
private void CompareExpectedGetResult(StorageAccountGetResponse response) { StorageAccountModel result = response.StorageAccount; Assert.Equal(result.Properties.AccountType, StorageAccountType.StandardLRS); Assert.Equal(result.Properties.CreationTime, "Thu, 20 Aug 2015 16:08:53 GMT"); Assert.Equal(result.Properties.TenantAccountName, "705mystorageaccount1@2015-08-20T16:09:34.2006267Z"); Assert.Equal(result.Properties.State, StorageAccountState.Created); Assert.Equal(result.Properties.PrimaryLocation, "DevFabric"); Assert.Equal(result.Properties.StatusOfPrimary, RegionStatus.Available); result = response.StorageAccount; Assert.Equal(result.Properties.AccountStatus, StorageAccountStatus.OutOfRetentionPeriod); Assert.NotNull(result.Properties.DeletedTime); Assert.Null(result.Properties.RecycledTime); Assert.Equal(result.Properties.CurrentOperation, StorageAccountOperation.Delete); Assert.Equal(result.Properties.PrimaryEndpoints.Count, 3); Assert.NotNull(result.Properties.WacInternalState); Assert.NotNull(result.Properties.AccountId); Assert.NotNull(result.Properties.Permissions); }
/// <summary> /// 记录是否存在 /// </summary> /// <param name="model"></param> /// <returns></returns> public static bool IsExist(StorageAccountModel model) { bool Result = true; StringBuilder sql = new StringBuilder(); sql.AppendLine("select * from officedba.StorageAccount where ProductID=" + model.ProductID + " AND StorageID=" + model.StorageID + " AND CompanyCD='" + model.CompanyCD + "' "); if (!string.IsNullOrEmpty(model.BatchNo)) { sql.AppendLine(" and BatchNo='" + model.BatchNo.Trim() + "' "); } else { sql.AppendLine(" and (BatchNo is null or BatchNo='') "); } DataTable dt = SqlHelper.ExecuteSql(sql.ToString()); if (dt.Rows.Count > 0) { Result = true; } else { Result = false; } return(Result); }
public ActionResult Add() { IEnumerable <SelectListItem> storagePlugins = GetSupportedStoragePlugins(); var model = new StorageAccountModel { StoragePlugins = storagePlugins }; return(View(model)); }
public StorageAccountResponse(StorageAccountModel model, string farmName) : base(model) { // Manually set those with different names or in root this.AccountId = long.Parse(model.Name, CultureInfo.InvariantCulture); this.AdminViewId = model.Id; this.Location = model.Location; this.WacAccountId = model.Properties.AccountId; this.ResourceType = model.ResourceType; this.Type = model.Type; this.Tags = model.Tags; this.FarmName = farmName; }
/// <summary> /// 返回 SQLCommand /// </summary> /// <param name="model"></param> /// <returns></returns> public static SqlCommand InsertStorageAccountBySqlCommand(StorageAccountModel model) { #region 库存流水账表SQL语句 StringBuilder sql = new StringBuilder(); sql.AppendLine("INSERT INTO officedba.StorageAccount"); sql.AppendLine(" (CompanyCD"); sql.AppendLine(" ,BillType"); sql.AppendLine(" ,ProductID"); sql.AppendLine(" ,StorageID"); sql.AppendLine(" ,BatchNo"); sql.AppendLine(" ,BillNo"); sql.AppendLine(" ,HappenDate"); sql.AppendLine(" ,HappenCount"); sql.AppendLine(" ,ProductCount"); sql.AppendLine(" ,Creator"); sql.AppendLine(" ,Price"); sql.AppendLine(" ,PageUrl)"); sql.AppendLine(" VALUES"); sql.AppendLine(" (@CompanyCD"); sql.AppendLine(" ,@BillType"); sql.AppendLine(" ,@ProductID"); sql.AppendLine(" ,@StorageID"); sql.AppendLine(" ,@BatchNo"); sql.AppendLine(" ,@BillNo"); sql.AppendLine(" ,getdate()"); sql.AppendLine(" ,@HappenCount"); sql.AppendLine(" ,@ProductCount"); sql.AppendLine(" ,@Creator"); sql.AppendLine(" ,@Price"); sql.AppendLine(" ,@PageUrl)"); SqlCommand comm = new SqlCommand(); comm.CommandText = sql.ToString(); comm.Parameters.Add(SqlHelper.GetParameter("@CompanyCD", model.CompanyCD)); comm.Parameters.Add(SqlHelper.GetParameter("@BillType", model.BillType)); comm.Parameters.Add(SqlHelper.GetParameter("@ProductID", model.ProductID)); comm.Parameters.Add(SqlHelper.GetParameter("@StorageID", model.StorageID)); comm.Parameters.Add(SqlHelper.GetParameter("@BatchNo", model.BatchNo)); comm.Parameters.Add(SqlHelper.GetParameter("@BillNo", model.BillNo)); comm.Parameters.Add(SqlHelper.GetParameter("@HappenCount", model.HappenCount)); comm.Parameters.Add(SqlHelper.GetParameter("@ProductCount", model.ProductCount)); comm.Parameters.Add(SqlHelper.GetParameter("@Creator", model.Creator)); comm.Parameters.Add(SqlHelper.GetParameter("@Price", model.Price)); comm.Parameters.Add(SqlHelper.GetParameter("@PageUrl", model.PageUrl)); return(comm); #endregion }
public StorageAccountResponse(StorageAccountModel model, string farmName) : base(model) { // Manually set those with different names or in root this.AccountId = model.Name; this.AdminViewId = model.Id; this.Location = model.Location; this.Type = model.Type; this.Tags = model.Tags; this.FarmName = farmName; this.SubscriptionId = model.Properties.TenantSubscriptionId; this.StorageAccountName = model.Properties.TenantAccountName; this.ResourceGroupName = model.Properties.TenantResourceGroupName; }
/// <summary> /// /// </summary> /// <param name="model"></param> /// <param name="loginUserID"></param> /// <returns></returns> public static bool InsertStorageAccount(StorageAccountModel model, string loginUserID) { StringBuilder sql = new StringBuilder(); sql.AppendLine("INSERT INTO officedba.StorageAccount"); sql.AppendLine(" (CompanyCD"); sql.AppendLine(" ,BillType"); sql.AppendLine(" ,ProductID"); sql.AppendLine(" ,StorageID"); sql.AppendLine(" ,BatchNo"); sql.AppendLine(" ,BillNo"); sql.AppendLine(" ,HappenDate"); sql.AppendLine(" ,HappenCount"); sql.AppendLine(" ,ProductCount"); sql.AppendLine(" ,Creator"); sql.AppendLine(" ,Price"); sql.AppendLine(" ,PageUrl)"); sql.AppendLine(" VALUES"); sql.AppendLine(" (@CompanyCD"); sql.AppendLine(" ,@BillType"); sql.AppendLine(" ,@ProductID"); sql.AppendLine(" ,@StorageID"); sql.AppendLine(" ,@BatchNo"); sql.AppendLine(" ,@BillNo"); sql.AppendLine(" ,getdate()"); sql.AppendLine(" ,@HappenCount"); sql.AppendLine(" ,@ProductCount"); sql.AppendLine(" ,@Creator"); sql.AppendLine(" ,@Price"); sql.AppendLine(" ,@PageUrl)"); //设置参数 SqlParameter[] param = new SqlParameter[11]; param[0] = SqlHelper.GetParameter("@CompanyCD", model.CompanyCD); param[1] = SqlHelper.GetParameter("@BillType", model.BillType); param[2] = SqlHelper.GetParameter("@ProductID", model.ProductID); param[3] = SqlHelper.GetParameter("@StorageID", model.StorageID); param[4] = SqlHelper.GetParameter("@BatchNo", model.BatchNo); param[5] = SqlHelper.GetParameter("@BillNo", model.BillNo); param[6] = SqlHelper.GetParameter("@HappenCount", model.HappenCount); param[7] = SqlHelper.GetParameter("@ProductCount", model.ProductCount); param[8] = SqlHelper.GetParameter("@Creator", model.Creator); param[9] = SqlHelper.GetParameter("@Price", model.Price); param[10] = SqlHelper.GetParameter("@PageUrl", model.PageUrl); SqlHelper.ExecuteTransSql(sql.ToString(), param); return(SqlHelper.Result.OprateCount > 0 ? true : false); }
private void CompareExpectedListResultWacProperties(StorageAccountListResponse response, bool isSummary) { StorageAccountModel result = response.StorageAccounts[2]; if (isSummary) { Assert.Null(result.Properties.WacInternalState); Assert.Null(result.Properties.AccountId); Assert.Null(result.Properties.Permissions); } else { Assert.Equal(result.Properties.WacInternalState, WacAccountStates.Active); Assert.Equal(result.Properties.AccountId, (ulong)999); Assert.Equal(result.Properties.Permissions, WacAccountPermissions.Full); } }
/// <summary> /// 取得库存流量最后更新的现有存量 /// </summary> /// <param name="model"></param> /// <returns></returns> public static DataTable RetProductCount(StorageAccountModel model) { StringBuilder sql = new StringBuilder(); sql.AppendLine("SELECT ProductCount From officedba.StorageAccount "); sql.AppendLine("WHERE ID=(select MAX(ID) ID from officedba.StorageAccount where ProductID=" + model.ProductID + " AND StorageID=" + model.StorageID + " AND CompanyCD='" + model.CompanyCD + "' AND (Remark IS NULL OR Remark='') "); if (!string.IsNullOrEmpty(model.BatchNo)) { sql.AppendLine(" and BatchNo='" + model.BatchNo.Trim() + "' "); } else { sql.AppendLine(" and (BatchNo is null or BatchNo='') "); } sql.AppendLine(" ) "); DataTable dt = SqlHelper.ExecuteSql(sql.ToString()); return(dt); }
/// <summary> /// 插入库存流水账 /// </summary> /// <param name="model"></param> /// <returns></returns> public static bool InsertStorageAccount(StorageAccountModel model) { bool Rev = false; StringBuilder strSql = new StringBuilder(); strSql.Append("insert into officedba.StorageAccount("); strSql.Append("CompanyCD,BillType,ProductID,StorageID,BillNo,HappenDate,HappenCount,ProductCount,Creator,Price,PageUrl,ReMark)"); strSql.Append(" values ("); strSql.Append("@CompanyCD,@BillType,@ProductID,@StorageID,@BillNo,@HappenDate,@HappenCount,@ProductCount,@Creator,@Price,@PageUrl,@ReMark)"); strSql.Append(";select @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@CompanyCD", SqlDbType.VarChar, 8), new SqlParameter("@BillType", SqlDbType.Int, 4), new SqlParameter("@ProductID", SqlDbType.Int, 4), new SqlParameter("@StorageID", SqlDbType.Int, 4), new SqlParameter("@BillNo", SqlDbType.VarChar, 50), new SqlParameter("@HappenDate", SqlDbType.DateTime), new SqlParameter("@HappenCount", SqlDbType.Decimal, 13), new SqlParameter("@ProductCount", SqlDbType.Decimal, 13), new SqlParameter("@Creator", SqlDbType.Int, 4), new SqlParameter("@Price", SqlDbType.Decimal, 9), new SqlParameter("@PageUrl", SqlDbType.VarChar, 500), new SqlParameter("@ReMark", SqlDbType.VarChar, 500) }; parameters[0].Value = model.CompanyCD; parameters[1].Value = model.BillType; parameters[2].Value = model.ProductID; parameters[3].Value = model.StorageID; parameters[4].Value = model.BillNo; parameters[5].Value = model.HappenDate; parameters[6].Value = model.HappenCount; parameters[7].Value = model.ProductCount; parameters[8].Value = model.Creator; parameters[9].Value = model.Price; parameters[10].Value = model.PageUrl; parameters[11].Value = model.ReMark; Rev = SqlHelper.ExecuteTransSql(strSql.ToString(), parameters) > 0 ? true : false; return(Rev); }
public ActionResult Add(StorageAccountModel storageAccountModel) { if (storageAccountModel == null) { storageAccountModel = new StorageAccountModel(); ModelState.AddModelError("empty_model", ValidationResources.AccountInvalidError); } IEnumerable <SelectListItem> storagePlugins = GetSupportedStoragePlugins(); storageAccountModel.StoragePlugins = storagePlugins; if (ModelState.IsValid) { StorageAccount account = new StorageAccount { AccountName = storageAccountModel.AccountName, StoragePluginId = storageAccountModel.PluginId, UserId = User.Identity.UserId }; StorageAccountCreationResult result = _storageAccountService.CreateStorageAccount(account); switch (result) { case StorageAccountCreationResult.PluginNotFound: ModelState.AddModelError("storage_plugin_not_found", ValidationResources.StoragePluginNotFoundError); break; case StorageAccountCreationResult.AccountExists: ModelState.AddModelError("storage_account_exists", ValidationResources.AccountExistsError); break; case StorageAccountCreationResult.Success: return(RedirectToAction("Edit", new { account.Id })); } } return(View(storageAccountModel)); }
/// <summary> /// 初始化库存流水账--总店 /// </summary> /// <returns></returns> public static void InitInfo() { /*获取已开通且使用进销存的企业*/ DataTable CompanyDT = StrongeInit.GetDistinctCompany(); foreach (DataRow row in CompanyDT.Rows) { /*获取某企业使用进销存的商品及仓库对应的记录*/ DataTable ProAndStroDT = StrongeInit.GetDistinctProductAndStronge(row["CompanyCD"].ToString()); /*获取某企业使用进销存的日期记录*/ DataTable CompanyTimedt = StrongeInit.GetDistinctDate(row["CompanyCD"].ToString()); string BeginDate = string.Empty;//企业使用进销存的开始日期 string EndDate = string.Empty; if (CompanyTimedt.Rows.Count > 0 && CompanyTimedt != null) { BeginDate = CompanyTimedt.Rows[0]["EnterDate"].ToString(); EndDate = CompanyTimedt.Rows[CompanyTimedt.Rows.Count - 1]["EnterDate"].ToString(); } foreach (DataRow rowP in ProAndStroDT.Rows) { /*获取该企业对应的物品,仓库的所有操作记录,按日期顺序取数据*/ DataTable CompanyInfoDT = StrongeInit.GetCompanyInfo(row["CompanyCD"].ToString(), rowP["ProductID"].ToString(), rowP["StorageID"].ToString()); decimal ret = 0;//计算累计现有存量 foreach (DataRow rowCom in CompanyInfoDT.Rows) { StorageAccountModel model = new StorageAccountModel(); if (!GetType(rowCom["flag"].ToString())) { ret += Convert.ToDecimal(0 - Convert.ToDecimal(rowCom["ProductCount"].ToString())); } else { ret += Convert.ToDecimal(rowCom["ProductCount"].ToString()); //现有存量 } model.BillNo = rowCom["NoCode"].ToString(); //业务单编号 model.BillType = int.Parse(rowCom["flag"].ToString()); //单据类型 model.CompanyCD = rowCom["CompanyCD"].ToString(); //企业编号 model.HappenCount = Convert.ToDecimal(rowCom["ProductCount"].ToString()); //出入库数量 model.HappenDate = Convert.ToDateTime(rowCom["EnterDate"].ToString()); //出入库时间 model.Price = Convert.ToDecimal(rowCom["Price"].ToString()); //单价 model.ProductID = int.Parse(rowCom["ProductID"].ToString()); //物品 model.StorageID = int.Parse(rowCom["StorageID"].ToString()); //仓库 model.Creator = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).EmployeeID; //创建人 model.ProductCount = ret; //现有存量 model.PageUrl = ""; //跳转URL model.ReMark = ""; //备注 StrongeInit.InsertStorageAccount(model); //插入库存流水账 } decimal StorageProduct = StrongeInit.GetStorageProduct(row["CompanyCD"].ToString(), rowP["ProductID"].ToString(), rowP["StorageID"].ToString()); decimal DiffCount = StorageProduct - ret; //判断分仓存量表中的现有存量和计算出的现有存量之前是否存在差异,若存在差异,则说明该物品-仓库在前期存在批量导入.DiffCount为批量导入数量 if (DiffCount > 0) //若存在差异,则在该企业最初使用进销存当天插入批量导入信息 { //获取符合条件的库存流水账的最大ID int maxid = StrongeInit.GetMaxID(row["CompanyCD"].ToString(), rowP["ProductID"].ToString(), rowP["StorageID"].ToString()); //更新有批量导入记录物品的库存流水账记录 StrongeInit.UpdateStorageAccount(row["CompanyCD"].ToString(), rowP["ProductID"].ToString(), rowP["StorageID"].ToString(), maxid.ToString()); //更新最大一条记录的现有存量(有批量导入的物品) StrongeInit.UpdateMaxAccount(maxid.ToString(), StorageProduct); StorageAccountModel model = new StorageAccountModel(); model.BillNo = ""; //业务单编号 model.BillType = 2; //单据类型 model.CompanyCD = row["CompanyCD"].ToString(); //企业编号 model.HappenCount = DiffCount; //出入库数量 model.HappenDate = Convert.ToDateTime(BeginDate); //出入库时间 model.Price = 0; //单价 model.ProductID = int.Parse(rowP["ProductID"].ToString()); //物品 model.StorageID = int.Parse(rowP["StorageID"].ToString()); //仓库 model.Creator = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).EmployeeID; //创建人 model.ProductCount = 0; //现有存量 model.PageUrl = ""; //跳转URL model.ReMark = "在" + BeginDate + "到" + EndDate + "期间的批量导入总和"; //备注 StrongeInit.InsertStorageAccount(model); //插入库存流水账 } } } }
internal override void Repopulate() { var userInfo = this.Storage.User.GetInfo(this.Id); this.login = userInfo.Login; if (!this.EmailUpdated) { this.email = userInfo.Email; } if (!this.AvatarUpdated) { this.avatar = userInfo.Avatar; } if (!this.MainAccountUpdated) { this.mainAccount = this.StorageContext.InternalAccounts.InternalFind(userInfo.MainAccountId); } this.Populated = true; }
/// <summary> /// InOrOut:入库“0”,出库:“1” /// </summary> /// <param name="model"></param> /// <param name="loginUserID"></param> /// <returns></returns> public static SqlCommand InsertStorageAccountCommand(StorageAccountModel model, string InOrOut) { if (IsExist(model)) { DataTable dt = RetProductCount(model); if (dt.Rows.Count > 0) { if (InOrOut == "0") { model.ProductCount = Convert.ToDecimal(dt.Rows[0]["ProductCount"].ToString()) + model.HappenCount; } else { model.ProductCount = Convert.ToDecimal(dt.Rows[0]["ProductCount"].ToString()) - model.HappenCount; } } } else { if (InOrOut == "0") { model.ProductCount = 0 + model.HappenCount; } else { model.ProductCount = 0 - model.HappenCount; } } StringBuilder sql = new StringBuilder(); sql.AppendLine("INSERT INTO officedba.StorageAccount"); sql.AppendLine(" (CompanyCD"); sql.AppendLine(" ,BillType"); sql.AppendLine(" ,ProductID"); sql.AppendLine(" ,StorageID"); sql.AppendLine(" ,BatchNo"); sql.AppendLine(" ,BillNo"); sql.AppendLine(" ,HappenDate"); sql.AppendLine(" ,HappenCount"); sql.AppendLine(" ,ProductCount"); sql.AppendLine(" ,Creator"); sql.AppendLine(" ,Price"); sql.AppendLine(" ,PageUrl)"); sql.AppendLine(" VALUES"); sql.AppendLine(" (@CompanyCD"); sql.AppendLine(" ,@BillType"); sql.AppendLine(" ,@ProductID"); sql.AppendLine(" ,@StorageID"); sql.AppendLine(" ,@BatchNo"); sql.AppendLine(" ,@BillNo"); sql.AppendLine(" ,getdate()"); sql.AppendLine(" ,@HappenCount"); sql.AppendLine(" ,@ProductCount"); sql.AppendLine(" ,@Creator"); sql.AppendLine(" ,@Price"); sql.AppendLine(" ,@PageUrl)"); SqlCommand comm = new SqlCommand(); comm.CommandText = sql.ToString(); comm.Parameters.Add(SqlHelper.GetParameterFromString("@CompanyCD", model.CompanyCD)); comm.Parameters.Add(SqlHelper.GetParameterFromString("@BillType", model.BillType.ToString())); comm.Parameters.Add(SqlHelper.GetParameterFromString("@ProductID", model.ProductID.ToString())); comm.Parameters.Add(SqlHelper.GetParameterFromString("@StorageID", model.StorageID.ToString())); comm.Parameters.Add(SqlHelper.GetParameterFromString("@BatchNo", model.BatchNo)); comm.Parameters.Add(SqlHelper.GetParameterFromString("@BillNo", model.BillNo)); comm.Parameters.Add(SqlHelper.GetParameterFromString("@HappenCount", model.HappenCount.ToString())); comm.Parameters.Add(SqlHelper.GetParameterFromString("@ProductCount", model.ProductCount.ToString())); comm.Parameters.Add(SqlHelper.GetParameterFromString("@Creator", model.Creator.ToString())); comm.Parameters.Add(SqlHelper.GetParameterFromString("@Price", model.Price.ToString())); comm.Parameters.Add(SqlHelper.GetParameterFromString("@PageUrl", model.PageUrl)); return(comm); }
public static bool ConfirmBill(StorageInitailModel model) { ArrayList lstConfirm = new ArrayList(); StringBuilder sql = new StringBuilder(); sql.AppendLine(" UPDATE officedba.StorageInitail SET"); sql.AppendLine(" Confirmor = @Confirmor,"); sql.AppendLine(" confirmDate = getdate(),"); sql.AppendLine(" BillStatus = 2,"); sql.AppendLine(" ModifiedUserID = @ModifiedUserID,"); sql.AppendLine(" ModifiedDate = getdate()"); sql.AppendLine(" Where CompanyCD=@CompanyCD and ID=@ID"); SqlCommand comm = new SqlCommand(); comm.CommandText = sql.ToString(); comm.Parameters.Add(SqlHelper.GetParameterFromString("@Confirmor", model.Confirmor)); comm.Parameters.Add(SqlHelper.GetParameterFromString("@ModifiedUserID", model.ModifiedUserID)); comm.Parameters.Add(SqlHelper.GetParameterFromString("@CompanyCD", model.CompanyCD)); comm.Parameters.Add(SqlHelper.GetParameterFromString("@ID", model.ID)); lstConfirm.Add(comm); List <StorageInitailDetailModel> modelList = new List <StorageInitailDetailModel>(); string sqlSele = "select a.ID,a.CompanyCD, a.ProductID,b.StorageID,a.BatchNo,a.InNo BillNo,a.UnitPrice Price,Convert(varchar(10),b.EnterDate,23) HappenDate," + " a.Remark, a.ProductCount from officedba.StorageInitailDetail a left join" + " officedba.StorageInitail b on a.InNo=b.InNo and a.CompanyCD = b.CompanyCD where a.CompanyCD='" + model.CompanyCD + "' and a.InNo=(select InNo from officedba.StorageInitail where ID=" + model.ID + ")"; DataTable dt = SqlHelper.ExecuteSql(sqlSele); if (dt != null && dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { StorageInitailDetailModel modelDetail = new StorageInitailDetailModel(); StorageAccountModel StorageAccountM = new StorageAccountModel(); if (dt.Rows[i]["ProductID"].ToString() != "") { modelDetail.ProductID = dt.Rows[i]["ProductID"].ToString(); StorageAccountM.ProductID = Convert.ToInt32(dt.Rows[i]["ProductID"].ToString()); } if (dt.Rows[i]["ProductCount"].ToString() != "") { modelDetail.ProductCount = dt.Rows[i]["ProductCount"].ToString(); StorageAccountM.HappenCount = Convert.ToDecimal(dt.Rows[i]["ProductCount"].ToString()); StorageAccountM.ProductCount = Convert.ToDecimal(dt.Rows[i]["ProductCount"].ToString()); } if (dt.Rows[i]["StorageID"].ToString() != "") { model.StorageID = dt.Rows[i]["StorageID"].ToString(); StorageAccountM.StorageID = Convert.ToInt32(dt.Rows[i]["StorageID"].ToString()); } //插入流水账表 StorageAccountM.CompanyCD = dt.Rows[i]["CompanyCD"].ToString(); StorageAccountM.BillType = 1; if (dt.Rows[i]["BatchNo"].ToString() != "") { modelDetail.BatchNo = dt.Rows[i]["BatchNo"].ToString(); StorageAccountM.BatchNo = dt.Rows[i]["BatchNo"].ToString(); } modelList.Add(modelDetail); StorageAccountM.BillNo = dt.Rows[i]["BillNo"].ToString(); StorageAccountM.Price = Convert.ToDecimal(dt.Rows[i]["Price"].ToString()); StorageAccountM.HappenDate = Convert.ToDateTime(dt.Rows[i]["HappenDate"].ToString()); StorageAccountM.Creator = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).EmployeeID; StorageAccountM.PageUrl = "../Office/StorageManager/StorageInitailAdd.aspx"; StorageAccountM.ReMark = dt.Rows[i]["Remark"].ToString(); SqlCommand commSA = new SqlCommand(); commSA = StorageAccountDBHelper.InsertStorageAccountCommand(StorageAccountM, "0"); lstConfirm.Add(commSA); } } if (modelList != null && modelList.Count > 0)//明细不为空的时候 { for (int i = 0; i < modelList.Count; i++) { SqlCommand commPD = new SqlCommand(); if (Exists(modelList[i].BatchNo, model.StorageID, modelList[i].ProductID, model.CompanyCD)) { commPD = updateStorageProduct(modelList[i].BatchNo, modelList[i].ProductID, model.StorageID, modelList[i].ProductCount, model, true); } else { commPD = InsertStorageProduct(modelList[i].BatchNo, modelList[i].ProductID, model.StorageID, modelList[i].ProductCount, model.CompanyCD); } lstConfirm.Add(commPD); } } return(SqlHelper.ExecuteTransWithArrayList(lstConfirm)); }