/// <summary> /// 减库存 /// </summary> /// <param name="storeParam">药品库存参数</param> /// <returns>返回库存结果</returns> public MWStoreResult ReduceStore(StoreParam storeParam) { MWStoreResult storeResult = new MWStoreResult(); if (storeParam != null) { MW_Storage storage = NewDao <IMWDao>().GetStorageInfo(storeParam.DeptID, storeParam.MaterialId); if (storage != null) { MW_Batch batch = NewDao <IMWDao>().GetBatchAmount(storeParam.DeptID, storeParam.MaterialId, storeParam.BatchNO); if (batch != null) { //本批次存量 和库存总量都必须大于出库数量 if (batch.BatchAmount >= storeParam.Amount && storage.Amount >= storeParam.Amount) { storage.Amount = storage.Amount - storeParam.Amount; storage.save(); batch.BatchAmount -= storeParam.Amount; batch.save(); MWBatchAllot batchAllot = new MWBatchAllot(); batchAllot.BatchNO = storeParam.BatchNO; batchAllot.RetailPrice = storeParam.RetailPrice; batchAllot.StockPrice = batch.StockPrice; batchAllot.StoreAmount = batch.BatchAmount; batchAllot.StorageID = storage.StorageID; storeResult.BatchAllot = new MWBatchAllot[1]; storeResult.BatchAllot[0] = batchAllot; storeResult.StoreAmount = storage.Amount; storeResult.UnitAmount = storeParam.UnitAmount; storeResult.StorageID = storage.StorageID; return(storeResult); } else { storeResult.Result = 1; storeResult.StoreAmount = storage.Amount; storeResult.UnitAmount = 1; storeResult.StorageID = storage.StorageID; return(storeResult); } } else { storeResult.Result = 1; storeResult.StoreAmount = storage.Amount; storeResult.UnitAmount = 1; storeResult.StorageID = storage.StorageID; return(storeResult); } } else { storeResult.Result = 1; return(storeResult); } } return(storeResult); }
/// <summary> /// 按批次更新库存 /// </summary> /// <param name="storeParam">药品库存入参</param> /// <returns>库存处理结果</returns> public MWStoreResult UpdateStore(StoreParam storeParam) { MWStoreResult storeResult = new MWStoreResult(); if (storeParam != null) { MW_Storage storage = NewDao <IMWDao>().GetStorageInfo(storeParam.DeptID, storeParam.MaterialId); if (storage != null) { //获取批次数据 MW_Batch batch = NewDao <IMWDao>().GetBatchAmount(storeParam.DeptID, storeParam.MaterialId, storeParam.BatchNO); if (batch != null) { //如果批次数量加退货数量大于0 if (batch.BatchAmount + storeParam.Amount >= 0) { bool addRtn = NewDao <IMWDao>().AddStoreAmount(storeParam.DeptID, storeParam.MaterialId, storeParam.Amount); addRtn = NewDao <IMWDao>().AddBatchAmount(storeParam.DeptID, storeParam.MaterialId, storeParam.BatchNO, storeParam.Amount); if (addRtn) { //添加成功 MWBatchAllot batchAllot = new MWBatchAllot(); batchAllot.BatchNO = storeParam.BatchNO; batchAllot.StoreAmount = batch.BatchAmount + storeParam.Amount; batchAllot.StorageID = storage.StorageID; storeResult.BatchAllot = new MWBatchAllot[1]; storeResult.BatchAllot[0] = batchAllot; storeResult.StoreAmount = storage.Amount + storeParam.Amount; storeResult.UnitAmount = 1; storeResult.StorageID = storage.StorageID; return(storeResult); } else { //添加失败 storeResult.Result = 2; storeResult.StoreAmount = storage.Amount; storeResult.UnitAmount = 1; storeResult.StorageID = storage.StorageID; return(storeResult); } } else { storeResult.Result = 1; storeResult.StoreAmount = storage.Amount; storeResult.UnitAmount = 1; storeResult.StorageID = storage.StorageID; return(storeResult); } } } } return(storeResult); }
/// <summary> /// 台账写入 /// </summary> /// <typeparam name="THead">物资库盘点单表头模板</typeparam> /// <typeparam name="TDetail">物资库盘点单明细模板</typeparam> /// <param name="billHead">物资库盘点单头</param> /// <param name="billDetails">物资库盘点单明细</param> /// <param name="storeResult">库存返回结果</param> public void WriteAccount <THead, TDetail>(THead billHead, TDetail billDetails, MWStoreResult storeResult) { MW_AuditDetail detail = billDetails as MW_AuditDetail; MW_AuditHead head = billHead as MW_AuditHead; int actYear; int actMonth; string errMsg; if (!GetAccountTime(head.DeptID, out errMsg, out actYear, out actMonth)) { throw new Exception(errMsg); } MW_Account account = NewObject <MW_Account>(); account.BalanceYear = actYear; account.BalanceMonth = actMonth; account.AccountType = 0; account.BalanceFlag = 0; account.BatchNO = detail.BatchNO; account.BusiType = head.BusiType; account.DeptID = head.DeptID; account.DetailID = detail.AuditDetailID; account.MaterialID = detail.MaterialID; account.UnitID = detail.UnitID; account.UnitName = detail.UnitName; account.BillNO = head.BillNO; account.RegTime = DateTime.Now; //盘盈 借方 //盘亏 贷方 //借方 if (detail.FactAmount - detail.ActAmount > 0) { account.StockPrice = detail.StockPrice; account.RetailPrice = detail.RetailPrice; account.LendAmount = detail.FactAmount - detail.ActAmount; account.LendRetailFee = (detail.FactAmount - detail.ActAmount) * detail.RetailPrice; account.LendStockFee = (detail.FactAmount - detail.ActAmount) * detail.StockPrice; account.OverAmount = storeResult.StoreAmount; account.OverRetailFee = storeResult.StoreAmount * account.RetailPrice; account.OverStockFee = storeResult.StoreAmount * account.StockPrice; } else { //贷方 account.StockPrice = detail.StockPrice; account.RetailPrice = detail.RetailPrice; account.DebitAmount = detail.ActAmount - detail.FactAmount; account.DebitRetailFee = (detail.ActAmount - detail.FactAmount) * detail.RetailPrice; account.DebitStockFee = (detail.ActAmount - detail.FactAmount) * detail.StockPrice; account.OverAmount = storeResult.StoreAmount; account.OverRetailFee = storeResult.StoreAmount * account.RetailPrice; account.OverStockFee = storeResult.StoreAmount * account.StockPrice; } account.save(); }
/// <summary> /// 审核物资库盘点单 /// </summary> /// <param name="deptId">库房ID</param> /// <param name="auditEmpID">审核人ID</param> /// <param name="auditEmpName">审核人姓名</param> /// <returns>单据处理结果</returns> public MWBillResult AuditBill(int deptId, int auditEmpID, string auditEmpName) { string serialNO = string.Empty;//审核单据号 //1.检查库房状态是否处于盘点状态 int checkStatus = NewDao <SqlMWDao>().GetStoreRoomStatus(deptId); if (checkStatus == 0) { throw new Exception("系统没有进入盘点状态,请启用盘点状态"); } //2.提取所有未审核的单据返回DataTable; DataTable dtNotAuditDetail = NewDao <SqlMWDao>().GetAllNotAuditDetail(deptId); //3.创建盘点审核单据头 MW_AuditHead auditHead = NewObject <MW_AuditHead>(); decimal profitRetailFee = 0, profitStockFee = 0, lossRetailFee = 0, lossStockFee = 0; decimal checkStockFee = 0, actStockFee = 0, checkRetailFee = 0, actRetailFee = 0; checkStockFee = Convert.ToDecimal(dtNotAuditDetail.Compute("sum(FactStockFee)", "true")); //盘存进货金额 actStockFee = Convert.ToDecimal(dtNotAuditDetail.Compute("sum(ActStockFee)", "true")); //账存进货金额 checkRetailFee = Convert.ToDecimal(dtNotAuditDetail.Compute("sum(FactRetailFee)", "true")); //盘存零售金额 actRetailFee = Convert.ToDecimal(dtNotAuditDetail.Compute("sum(ActRetailFee)", "true")); //账存零售金额 profitRetailFee = checkRetailFee - actRetailFee > 0 ? checkRetailFee - actRetailFee : 0; //盘盈零售金额 profitStockFee = checkStockFee - actStockFee > 0 ? checkStockFee - actStockFee : 0; //盘盈进货金额 lossRetailFee = checkRetailFee - actRetailFee < 0 ? Math.Abs(checkRetailFee - actRetailFee) : 0; //盘亏零售金额 lossStockFee = checkStockFee - actStockFee < 0 ? Math.Abs(checkStockFee - actStockFee) : 0; //盘亏进货金额 serialNO = NewObject <SerialNumberSource>().GetSerialNumber(SnType.物资, deptId, MWConstant.OP_MW_AUDITCHECK); auditHead.BillNO = Convert.ToInt64(serialNO); auditHead.EmpID = auditEmpID; auditHead.EmpName = auditEmpName; auditHead.AuditTime = System.DateTime.Now; auditHead.Remark = string.Empty; auditHead.DelFlag = 0; auditHead.AuditFlag = 1; auditHead.BusiType = MWConstant.OP_MW_AUDITCHECK; auditHead.DeptID = deptId; auditHead.ProfitRetailFee = profitRetailFee; auditHead.ProfitStockFee = profitStockFee; auditHead.LossRetailFee = lossRetailFee; auditHead.LossStockFee = lossStockFee; auditHead.CheckStockFee = checkStockFee; auditHead.ActStockFee = actStockFee; auditHead.CheckRetailFee = checkRetailFee; auditHead.ActRetailFee = actRetailFee; BindDb(auditHead); auditHead.save(); //循环DataTable,根据DataTable的每一行的值去构建盘点审核单明细和盘点审核单头; //4.保存盘点审核单表头和明细 //5、按盘点审核单内容更新物资库库存 MWBillResult result = new MWBillResult(); foreach (DataRow drNotAuditRow in dtNotAuditDetail.Rows) { MW_AuditDetail auditdetail = NewObject <MW_AuditDetail>(); auditdetail.StorageID = Convert.ToInt32(drNotAuditRow["StorageID"]); auditdetail.MaterialID = Convert.ToInt32(drNotAuditRow["MaterialID"]); auditdetail.Place = drNotAuditRow["Place"].ToString(); auditdetail.BatchNO = drNotAuditRow["BatchNO"].ToString(); auditdetail.ValidityDate = Convert.ToDateTime(drNotAuditRow["ValidityDate"]); auditdetail.DeptID = deptId; auditdetail.BillNO = Convert.ToInt64(serialNO); auditdetail.FactAmount = Convert.ToDecimal(drNotAuditRow["FactAmount"]); auditdetail.FactStockFee = Convert.ToDecimal(drNotAuditRow["FactStockFee"]); auditdetail.FactRetailFee = Convert.ToDecimal(drNotAuditRow["FactRetailFee"]); auditdetail.ActAmount = Convert.ToDecimal(drNotAuditRow["ActAmount"]); auditdetail.ActStockFee = Convert.ToDecimal(drNotAuditRow["ActStockFee"]); auditdetail.ActRetailFee = Convert.ToDecimal(drNotAuditRow["ActRetailFee"]); auditdetail.UnitID = Convert.ToInt32(drNotAuditRow["UnitID"]); auditdetail.UnitName = drNotAuditRow["UnitName"].ToString(); auditdetail.RetailPrice = Convert.ToDecimal(drNotAuditRow["RetailPrice"]); auditdetail.StockPrice = Convert.ToDecimal(drNotAuditRow["StockPrice"]); auditdetail.AuditHeadID = auditHead.AuditHeadID; BindDb(auditdetail); auditdetail.save(); StoreParam storeParam = new StoreParam(); storeParam.Amount = auditdetail.FactAmount - auditdetail.ActAmount; storeParam.BatchNO = auditdetail.BatchNO; storeParam.DeptID = auditdetail.DeptID; storeParam.MaterialId = auditdetail.MaterialID; storeParam.RetailPrice = auditdetail.RetailPrice; storeParam.StockPrice = auditdetail.StockPrice; storeParam.UnitID = auditdetail.UnitID; storeParam.UnitName = auditdetail.UnitName; storeParam.ValidityTime = auditdetail.ValidityDate; MWStoreResult storeRtn = NewObject <MwStore>().AddStore(storeParam); if (storeRtn.Result != 0) { result.Result = 1; if (storeRtn.Result == 1) { result.LstNotEnough = new List <MWNotEnoughInfo>(); MWNotEnoughInfo notEnough = new MWNotEnoughInfo(); notEnough.DeptID = auditdetail.DeptID; notEnough.MaterialId = auditdetail.MaterialID; notEnough.LackAmount = storeRtn.StoreAmount + auditdetail.FactAmount - auditdetail.ActAmount; notEnough.MaterialInfo = "物资批次号:" + auditdetail.BatchNO.ToString(); result.LstNotEnough.Add(notEnough); result.ErrMsg = "【" + notEnough.MaterialInfo + "】库存不足"; } else { result.ErrMsg = "物资更新库存出错"; } return(result); } else { //6、按盘点审核单内容写入台账 WriteAccount(auditHead, auditdetail, storeRtn); } } //7、更新所有未审核的盘点录入单状态 MW_CheckHead checkHead = NewObject <MW_CheckHead>(); checkHead.AuditEmpID = auditEmpID; checkHead.AuditEmpName = auditEmpName; checkHead.AuditHeadID = auditHead.AuditHeadID; checkHead.AuditNO = auditHead.BillNO; checkHead.DeptID = deptId; int ret = NewDao <IMWDao>().UpdateCheckHeadStatus(checkHead); if (ret > 0) { //8、设置库房盘点状态为运营状态 NewDao <IMWDao>().SetCheckStatus(deptId, 0); result.Result = 0; } else { result.Result = 1; } return(result); }
/// <summary> /// 写入采购计划台账(不实现) /// </summary> /// <typeparam name="THead">采购计划头模板</typeparam> /// <typeparam name="TDetail">采购计划明细模板</typeparam> /// <param name="billHead">采购计划表头</param> /// <param name="billDetails">采购计划明细</param> /// <param name="storeResult">库存处理结果</param> public void WriteAccount <THead, TDetail>(THead billHead, TDetail billDetails, MWStoreResult storeResult) { throw new NotImplementedException(); }
/// <summary> /// 审核单据 /// </summary> /// <param name="headID">头id</param> /// <param name="auditEmpID">审核人id</param> /// <param name="auditEmpName">审核人名称</param> /// <returns>审核结果信息</returns> public MWBillResult AuditBill(int headID, int auditEmpID, string auditEmpName) { MW_OutStoreHead head = (MW_OutStoreHead)NewObject <MW_OutStoreHead>().getmodel(headID); MWBillResult result = new MWBillResult(); if (!NewObject <MaterialDeptMgr>().IsDeptChecked(head.DeptID)) { result.Result = 1; result.ErrMsg = "当前科室处于盘点状态或者没有设置科室的盘点状态 不能处理业务操作"; return(result); } if (head.AuditFlag == 1) { result.Result = 1; result.ErrMsg = "物资已经被审核,请刷新数据"; return(result); } if (head != null) { List <MW_OutStoreDetail> lstDetails = NewObject <MW_OutStoreDetail>().getlist <MW_OutStoreDetail>("OutHeadID=" + headID); head.AuditEmpID = auditEmpID; head.AuditEmpName = auditEmpName; head.AuditTime = System.DateTime.Now; head.AuditFlag = 1; head.save(); foreach (MW_OutStoreDetail detail in lstDetails) { StoreParam storeParam = new StoreParam(); storeParam.BatchNO = detail.BatchNO; storeParam.DeptID = head.DeptID; storeParam.MaterialId = detail.MaterialID; storeParam.RetailPrice = detail.RetailPrice; storeParam.StockPrice = detail.StockPrice; storeParam.UnitID = detail.UnitID; storeParam.UnitName = detail.UnitName; storeParam.ValidityTime = detail.ValidityDate; storeParam.UnitAmount = 1; storeParam.Amount = detail.Amount; storeParam.PackAmount = 1; storeParam.BussConstant = head.BusiType; MWStoreResult storeRtn = NewObject <MwStore>().ReduceStore(storeParam); if (storeRtn.Result != 0) { result.Result = 1; if (storeRtn.Result == 1) { result.LstNotEnough = new List <MWNotEnoughInfo>(); MWNotEnoughInfo notEnough = new MWNotEnoughInfo(); notEnough.DeptID = head.DeptID; notEnough.MaterialId = detail.MaterialID; notEnough.LackAmount = storeRtn.StoreAmount + detail.Amount; notEnough.MaterialInfo = "药品编号" + detail.MaterialID + "批次号:" + detail.BatchNO; result.LstNotEnough.Add(notEnough); result.ErrMsg = "【" + notEnough.MaterialInfo + "】库存不足"; } else { result.ErrMsg = "药品更新库存出错"; } return(result); } else { WriteAccount(head, detail, storeRtn); } } result.Result = 0; return(result); } return(result); }
/// <summary> /// 写台帐 /// </summary> /// <typeparam name="THead">单据头实体类</typeparam> /// <typeparam name="TDetail">单据明细实体类</typeparam> /// <param name="billHead">单据头</param> /// <param name="billDetails">单据明细</param> /// <param name="storeResult">库存结果信息</param> public void WriteAccount <THead, TDetail>(THead billHead, TDetail billDetails, MWStoreResult storeResult) { MW_OutStoreDetail detail = billDetails as MW_OutStoreDetail; MW_OutStoreHead head = billHead as MW_OutStoreHead; int actYear; int actMonth; string errMsg; if (!GetAccountTime(head.DeptID, out errMsg, out actYear, out actMonth)) { throw new Exception(errMsg); } MW_Account account = NewObject <MW_Account>(); account.BalanceYear = actYear; account.BalanceMonth = actMonth; account.AccountType = 0; account.BalanceFlag = 0; account.BatchNO = detail.BatchNO; account.BusiType = head.BusiType; account.DeptID = head.DeptID; account.DetailID = detail.OutDetailID; account.MaterialID = detail.MaterialID; account.UnitID = detail.UnitID; account.UnitName = detail.UnitName; account.BillNO = detail.BillNO; account.RegTime = DateTime.Now; if (head.BusiType == MWConstant.OP_MW_RETURNSTORE) { account.StockPrice = storeResult.BatchAllot[0].StockPrice; account.RetailPrice = storeResult.BatchAllot[0].RetailPrice; account.DebitAmount = detail.Amount; account.DebitRetailFee = account.DebitAmount * account.RetailPrice; account.DebitStockFee = account.DebitAmount * account.StockPrice; account.OverAmount = storeResult.BatchAllot[0].StoreAmount; account.OverRetailFee = storeResult.BatchAllot[0].StoreAmount * account.RetailPrice; account.OverStockFee = storeResult.BatchAllot[0].StoreAmount * account.StockPrice; } else { account.StockPrice = detail.StockPrice; account.RetailPrice = detail.RetailPrice; account.DebitAmount = detail.Amount; account.DebitRetailFee = detail.RetailFee; account.DebitStockFee = detail.StockFee; account.OverAmount = storeResult.BatchAllot[0].StoreAmount; account.OverRetailFee = storeResult.BatchAllot[0].StoreAmount * account.RetailPrice; account.OverStockFee = storeResult.BatchAllot[0].StoreAmount * account.StockPrice; } account.save(); }
/// <summary> /// 按批次增加库存 /// </summary> /// <param name="storeParam">药品库存入参</param> /// <returns>库存处理结果</returns> public MWStoreResult AddStore(StoreParam storeParam) { MWStoreResult storeResult = new MWStoreResult(); if (storeParam != null) { MW_Storage storage = NewDao <IMWDao>().GetStorageInfo(storeParam.DeptID, storeParam.MaterialId); if (storage != null) { //获取批次数据 MW_Batch batch = NewDao <IMWDao>().GetBatchAmount(storeParam.DeptID, storeParam.MaterialId, storeParam.BatchNO); if (batch != null) { //如果批次数量加退货数量大于0 if (batch.BatchAmount + storeParam.Amount >= 0) { bool addRtn = NewDao <IMWDao>().AddStoreAmount(storeParam.DeptID, storeParam.MaterialId, storeParam.Amount); addRtn = NewDao <IMWDao>().AddBatchAmount(storeParam.DeptID, storeParam.MaterialId, storeParam.BatchNO, storeParam.Amount); if (addRtn) { //添加成功 MWBatchAllot batchAllot = new MWBatchAllot(); batchAllot.BatchNO = storeParam.BatchNO; batchAllot.RetailPrice = storeParam.RetailPrice; batchAllot.StockPrice = batch.StockPrice; batchAllot.StoreAmount = batch.BatchAmount + storeParam.Amount; batchAllot.StorageID = storage.StorageID; storeResult.BatchAllot = new MWBatchAllot[1]; storeResult.BatchAllot[0] = batchAllot; storeResult.StoreAmount = storage.Amount + storeParam.Amount; storeResult.UnitAmount = 1; storeResult.StorageID = storage.StorageID; return(storeResult); } else { //添加失败 storeResult.Result = 2; storeResult.StoreAmount = storage.Amount; storeResult.UnitAmount = 1; storeResult.StorageID = storage.StorageID; return(storeResult); } } else { storeResult.Result = 1; storeResult.StoreAmount = storage.Amount; storeResult.UnitAmount = 1; storeResult.StorageID = storage.StorageID; return(storeResult); } } else { //批次不存在 //如果退库业务 if (storeParam.BussConstant == MWConstant.OP_MW_BACKSTORE) { storeResult.Result = 1; return(storeResult); } if (storeParam.Amount < 0) { storeResult.Result = 1; return(storeResult); } //新建批次 MW_Batch dwBatch = NewObject <MW_Batch>(); dwBatch.StorageID = storage.StorageID; dwBatch.BatchAmount = storeParam.Amount; dwBatch.BatchNO = storeParam.BatchNO; dwBatch.ValidityTime = storeParam.ValidityTime; dwBatch.DelFlag = 0; dwBatch.DeptID = storeParam.DeptID; dwBatch.MaterialID = storeParam.MaterialId; dwBatch.DelFlag = 0; dwBatch.InstoreTime = System.DateTime.Now; dwBatch.UnitID = storeParam.UnitID; dwBatch.UnitName = storeParam.UnitName; dwBatch.StockPrice = storeParam.StockPrice; dwBatch.save(); bool addRtn = NewDao <IMWDao>().AddStoreAmount(storeParam.DeptID, storeParam.MaterialId, storeParam.Amount);//改库存 if (addRtn) { //构建返回值 MWBatchAllot batchAllot = new MWBatchAllot(); batchAllot.BatchNO = storeParam.BatchNO; batchAllot.StockPrice = dwBatch.StockPrice; batchAllot.StoreAmount = dwBatch.BatchAmount; batchAllot.StorageID = storage.StorageID; storeResult.BatchAllot = new MWBatchAllot[1]; storeResult.BatchAllot[0] = batchAllot; storeResult.StoreAmount = storage.Amount + storeParam.Amount; storeResult.UnitAmount = 1; storeResult.StorageID = storage.StorageID; } else { //添加失败 storeResult.Result = 2; storeResult.StoreAmount = storage.Amount; storeResult.UnitAmount = 1; storeResult.StorageID = storage.StorageID; return(storeResult); } } } else { if (storeParam.Amount < 0) { storeResult.Result = 1; return(storeResult); } //新建库存记录 MW_Storage dwStorage = NewObject <MW_Storage>(); dwStorage.MaterialID = storeParam.MaterialId; dwStorage.DeptID = storeParam.DeptID; dwStorage.DelFlag = 0; dwStorage.UnitID = storeParam.UnitID; dwStorage.UnitName = storeParam.UnitName; dwStorage.Amount = storeParam.Amount; dwStorage.UpperLimit = 0; dwStorage.LowerLimit = 0; dwStorage.LocationID = 0; dwStorage.Place = string.Empty; dwStorage.RegTime = System.DateTime.Now; dwStorage.LStockPrice = 0; dwStorage.save(); //新建批次记录 MW_Batch dwBatch = NewObject <MW_Batch>(); dwBatch.StorageID = dwStorage.StorageID; dwBatch.BatchAmount = storeParam.Amount; dwBatch.BatchNO = storeParam.BatchNO; dwBatch.ValidityTime = storeParam.ValidityTime; dwBatch.DelFlag = 0; dwBatch.DeptID = storeParam.DeptID; dwBatch.MaterialID = storeParam.MaterialId; dwBatch.DelFlag = 0; dwBatch.InstoreTime = dwStorage.RegTime; dwBatch.UnitID = storeParam.UnitID; dwBatch.UnitName = storeParam.UnitName; //dwBatch.RetailPrice = storeParam.RetailPrice; dwBatch.StockPrice = storeParam.StockPrice; dwBatch.save(); //构建返回值 MWBatchAllot batchAllot = new MWBatchAllot(); batchAllot.BatchNO = storeParam.BatchNO; batchAllot.RetailPrice = storeParam.RetailPrice; batchAllot.StockPrice = storeParam.StockPrice; batchAllot.StoreAmount = storeParam.Amount; batchAllot.StorageID = dwStorage.StorageID; storeResult.BatchAllot = new MWBatchAllot[1] { batchAllot }; storeResult.StoreAmount = storeParam.Amount; storeResult.UnitAmount = 1; storeResult.StorageID = dwStorage.StorageID; return(storeResult); } } return(storeResult); }