private LendRequestInfo ConvertRequestVMToInfo(LendRequestVM vm) { LendRequestInfo info = vm.ConvertVM <LendRequestVM, LendRequestInfo>((v, i) => { i.Stock = new StockInfo { SysNo = v.StockSysNo }; i.CreateUser = new BizEntity.Common.UserInfo { SysNo = v.CreateUserSysNo }; i.EditUser = new BizEntity.Common.UserInfo { SysNo = v.EditUserSysNo }; i.AuditUser = new BizEntity.Common.UserInfo { SysNo = v.AuditUserSysNo }; i.OutStockUser = new BizEntity.Common.UserInfo { SysNo = v.OutStockUserSysNo }; i.LendUser = new BizEntity.Common.UserInfo { SysNo = v.LendUserSysNo }; i.ProductLineSysno = v.ProductLineSysno; }); info.LendItemInfoList = new List <LendRequestItemInfo>(); vm.LendItemInfoList.ForEach(item => { LendRequestItemInfo itemInfo = item.ConvertVM <LendRequestItemVM, LendRequestItemInfo>(); if (itemInfo.BatchDetailsInfoList != null) { itemInfo.BatchDetailsInfoList.ForEach(p => { var re = item.BatchDetailsInfoList.FirstOrDefault(k => k.ProductSysNo == p.ProductSysNo && k.BatchNumber.Equals(p.BatchNumber)); if (re != null) { p.ReturnQty = re.ReturnQuantity ?? 0; } }); } itemInfo.LendProduct = new BizEntity.IM.ProductInfo { SysNo = item.ProductSysNo.Value }; if (item.ReturnDateETA.HasValue) { itemInfo.ExpectReturnDate = (DateTime)item.ReturnDateETA; } info.LendItemInfoList.Add(itemInfo); }); return(info); }
/// <summary> /// 更新借货商品记录 /// </summary> /// <param name="lendItem"></param> /// <returns></returns> public virtual LendRequestItemInfo UpdateLendItem(LendRequestItemInfo lendItem) { DataCommand dc = DataCommandManager.GetDataCommand("Inventory_UpdateLendItem"); dc.SetParameterValue("@LendItemSysNo", lendItem.SysNo); dc.SetParameterValue("@ProductSysNo", lendItem.LendProduct.SysNo); dc.SetParameterValue("@LendQuantity", lendItem.LendQuantity); dc.SetParameterValue("@ExpectReturnDate", lendItem.ExpectReturnDate); dc.SetParameterValue("@LendUnitCost", lendItem.LendUnitCost); dc.SetParameterValue("@LendUnitCostWithoutTax", lendItem.LendUnitCostWithoutTax); //dc.SetParameterValue("@LendUnitCostWhenCreate", lendItem.LendUnitCostWhenCreate); return(dc.ExecuteEntity <LendRequestItemInfo>()); }
/// <summary> /// 创建借货商品记录 /// </summary> /// <param name="requestSysNo"></param> /// <param name="lendItem"></param> /// <returns></returns> public virtual LendRequestItemInfo CreateLendItem(LendRequestItemInfo lendItem, int requestSysNo) { DataCommand dc = DataCommandManager.GetDataCommand("Inventory_CreateLendItem"); dc.SetParameterValue("@RequestSysNo", requestSysNo); dc.SetParameterValue("@ProductSysNo", lendItem.LendProduct.SysNo); dc.SetParameterValue("@LendQuantity", lendItem.LendQuantity); dc.SetParameterValue("@ExpectReturnDate", lendItem.ExpectReturnDate); dc.SetParameterValue("@LendUnitCost", lendItem.LendUnitCost); dc.SetParameterValue("@LendUnitCostWithoutTax", lendItem.LendUnitCostWithoutTax); dc.SetParameterValue("@LendUnitCostWhenCreate", lendItem.LendUnitCostWhenCreate); dc.SetParameterValue("@CompanyCode", "8601");//[Mark][Alan.X.Luo 硬编码] return(dc.ExecuteEntity <LendRequestItemInfo>()); }