diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/Ass_FixAssets/ImportForm.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/Ass_FixAssets/ImportForm.js index 4e5689112..9275f3bc0 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/Ass_FixAssets/ImportForm.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/Ass_FixAssets/ImportForm.js @@ -6,7 +6,6 @@ * 描 述:导入固定资产信息 */ var id = request('id'); -//var classno = request('classno'); var keyVaule = ''; @@ -107,8 +106,7 @@ var bootstrap = function ($, learun) { param['chunks'] = fileInfo[file.id].chunks; param['ext'] = file.ext; param['templateId'] = id; - param['classno'] = classno; - learun.httpAsyncPost(top.$.rootUrl + "/LR_SystemModule/ExcelImport/StuInfoBasicImport", param, function (res) { + learun.httpAsyncPost(top.$.rootUrl + "/LR_SystemModule/ExcelImport/Ass_FixAssetsImport", param, function (res) { var $fileItem = $('#lr_form_file_queue_list').find('#lr_filequeue_' + file.id); $fileItem.find('.lr-uploader-progress').remove(); if (res.code == learun.httpCode.success) { diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/Ass_FixAssetsApply/Form.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/Ass_FixAssetsApply/Form.cshtml index 207631d69..bf7fdbf6f 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/Ass_FixAssetsApply/Form.cshtml +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/Ass_FixAssetsApply/Form.cshtml @@ -11,11 +11,11 @@
联系方式
-
+
接收人*
-
+
联系方式*
@@ -23,12 +23,12 @@
是否归还*
-
+
卡片编号*
-
+
资产名称*
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/Ass_FixAssetsApply/FormView.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/Ass_FixAssetsApply/FormView.cshtml index 83763348c..376217d8e 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/Ass_FixAssetsApply/FormView.cshtml +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/Ass_FixAssetsApply/FormView.cshtml @@ -11,11 +11,11 @@
联系方式
-
+
接收人*
-
+
联系方式*
@@ -23,11 +23,11 @@
是否归还*
-
+
卡片编号*
-
+
资产名称*
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Content/excel/AssFixAssetsImport.xls b/Learun.Framework.Ultimate V7/Learun.Application.Web/Content/excel/AssFixAssetsImport.xls new file mode 100644 index 000000000..4e33dc2fc Binary files /dev/null and b/Learun.Framework.Ultimate V7/Learun.Application.Web/Content/excel/AssFixAssetsImport.xls differ diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj b/Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj index da4ed898c..ec7e38123 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj @@ -960,7 +960,6 @@ - @@ -8177,7 +8176,7 @@ - + diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/Ass_FixAssets/Ass_FixAssetsService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/Ass_FixAssets/Ass_FixAssetsService.cs index dae0fa652..dafa67314 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/Ass_FixAssets/Ass_FixAssetsService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/Ass_FixAssets/Ass_FixAssetsService.cs @@ -22,6 +22,9 @@ namespace Learun.Application.TwoDevelopment.AssetManagementSystem /// public class Ass_FixAssetsService : RepositoryFactory { + private DataSourceIBLL dataSourceIBLL = new DataSourceBLL(); + private DataItemIBLL dataItemIBLL = new DataItemBLL(); + #region 获取数据 /// @@ -330,10 +333,11 @@ namespace Learun.Application.TwoDevelopment.AssetManagementSystem { failDt.Columns.Add(dc.ColumnName, dc.DataType); } - IEnumerable Ass_FixAssetsHistory = this.BaseRepository("CollegeMIS").FindList("select * from Ass_FixAssets"); + var db = this.BaseRepository().BeginTrans(); + IEnumerable Ass_FixAssetsHistory = db.FindList("select * from Ass_FixAssets"); List Ass_FixAssetsinsert = new List(); - var db = this.BaseRepository("CollegeMIS").BeginTrans(); + // 循环遍历导入 foreach (DataRow dr in dt.Rows) { @@ -464,7 +468,7 @@ namespace Learun.Application.TwoDevelopment.AssetManagementSystem } if (Ass_FixAssetsinsert.Count(s => s.FACode == dr["资产编号"].ToString()) > 0) { - throw (new Exception("资产编号导入数据重复")); + throw (new Exception("导入数据中资产编号重复")); } //写入要导入替换的数据 @@ -472,39 +476,40 @@ namespace Learun.Application.TwoDevelopment.AssetManagementSystem { FAId = Guid.NewGuid().ToString(), FACode = dr["资产编号"].ToString(), - //ATGId = dr["资产编号"].ToString(), - //ATId = dr["资产编号"].ToString(), + ATGId = dataSourceIBLL.GetKeyByValue("Ass_AssetsType", "aname", dr["资产国标大类"].ToString(), "atid"), + ATId = dataSourceIBLL.GetKeyByValue("Ass_AssetsType", "aname", dr["资产分类"].ToString(), "atid"), FAName = dr["资产名称"].ToString(), - FinanceEntryDate = dr["财务入账日期"].ToDate(), - //ValueType = dr["资产编号"].ToString(), + FinanceEntryDate = Convert.ToDateTime(dr["财务入账日期"]), + ValueType = FindDataItemValue(dataItemIBLL.GetDetailList("ValueType"), dr["价值类型"].ToString(), "价值类型", false), Value = dr["价值"].ToDecimal(), - //GetWay = dr["资产编号"].ToString(), - GetDate = dr["取得日期"].ToDate(), - //UseCondition = dr["资产编号"].ToString(), - //UseDepartment = dr["资产编号"].ToString(), - //ManageDepartment = dr["资产编号"].ToString(), - //UsePeople = dr["资产编号"].ToString(), + GetWay = FindDataItemValue(dataItemIBLL.GetDetailList("GetWay"), dr["取得方式"].ToString(), "取得方式", false), + GetDate = Convert.ToDateTime(dr["取得日期"]), + UseCondition = FindDataItemValue(dataItemIBLL.GetDetailList("AssState"), dr["使用状况"].ToString(), "使用状况", false), + UseDepartment = dataSourceIBLL.GetKeyByValue("classdata", "name", dr["使用部门"].ToString(), "id"), + ManageDepartment = dataSourceIBLL.GetKeyByValue("classdata", "name", dr["管理部门"].ToString(), "id"), + UsePeople = dataSourceIBLL.GetKeyByValue("teacheruserdata", "f_realname", dr["使用人"].ToString(), "f_userid"), Amount = dr["数量"].ToInt(), MakePeople = dr["制单人"].ToString(), - MakeDate = dr["制单时间"].ToDate(), - //Unit = dr["资产编号"].ToString(), - //CardStatus = dr["资产编号"].ToString(), + MakeDate = Convert.ToDateTime(dr["制单时间"]), + Unit = dataSourceIBLL.GetKeyByValue("company", "f_fullname", dr["所属单位"].ToString(), "f_companyid"), + CardStatus = FindDataItemValue(dataItemIBLL.GetDetailList("CardStatus"), dr["卡片状态"].ToString(), "卡片状态", false), DepreciationLife = dr["折旧年限"].ToInt(), AccumulatedDepreciation = dr["累计折旧"].ToDecimal(), HaveDepreciationMonths = dr["已提折旧月数"].ToInt(), MonthlyDepreciation = dr["月折旧额"].ToDecimal(), - //DepreciationMothod = dr["资产编号"].ToString(), + DepreciationMothod = FindDataItemValue(dataItemIBLL.GetDetailList("DepreciationMothod"), dr["折旧方法"].ToString(), "折旧方法", false), NetValue = dr["净值"].ToDecimal(), PurchaseOrganizationForm = dr["采购组织形式"].ToString(), Brand = dr["品牌"].ToString(), SpecificationModel = dr["规格型号"].ToString(), - //StorageId = dr["资产编号"].ToString(), - //SupplierId = dr["资产编号"].ToString(), + StorageId = dataSourceIBLL.GetKeyByValue("Ass_StorageData", "sname", dr["存放地点"].ToString(), "sid"), + SupplierId = dataSourceIBLL.GetKeyByValue("Ass_SupplierData", "sname", dr["销售商"].ToString(), "sid"), UseArea = dr["使用权面积/建筑面积"].ToDecimal(), FinancialAppropriation = dr["财政拨款"].ToDecimal(), NonFinancialAppropriation = dr["非财政拨款"].ToDecimal(), AccountDocumentNumber = dr["会计凭证号"].ToString(), - //DepreciationStatus = dr["资产编号"].ToString(), + DepreciationStatus = FindDataItemValue(dataItemIBLL.GetDetailList("DepreciationStatus"), dr["折旧/摊销状态"].ToString(), "折旧/摊销状态", false), + //默认数据 CreateTime = DateTime.Now, CreateUserId = LoginUserInfo.Get().userId, @@ -513,71 +518,10 @@ namespace Learun.Application.TwoDevelopment.AssetManagementSystem Status = 0, ProcessId = Guid.NewGuid().ToString(), }; - var detailList = this.BaseRepository().FindList(@"SELECT t.*,t2.F_ItemCode FROM LR_Base_DataItemDetail t - INNER JOIN LR_Base_DataItem t2 ON t.F_ItemId = t2.F_ItemId - WHERE t.F_DeleteMark = 0"); - var ValueType = dr["价值类型"].ToString().Trim(); - var ValueTypelity = detailList.FirstOrDefault(x => x.F_ItemCode == "ValueType" && x.F_ItemName == ValueType); - if (!string.IsNullOrEmpty(ValueType) && ValueTypelity == null) - { - throw (new Exception("【价值类型】数据字典找不到对应的数据")); - } - else - { - Ass_FixAssetsEntity.ValueType = ValueTypelity?.F_ItemValue; - } - var GetWay = dr["取得方式"].ToString().Trim(); - var GetWaylity = detailList.FirstOrDefault(x => x.F_ItemCode == "GetWay" && x.F_ItemName == GetWay); - if (!string.IsNullOrEmpty(GetWay) && GetWaylity == null) - { - throw (new Exception("【取得方式】数据字典找不到对应的数据")); - } - else - { - Ass_FixAssetsEntity.GetWay = GetWaylity?.F_ItemValue; - } - var UseCondition = dr["使用状况"].ToString().Trim(); - var UseConditionlity = detailList.FirstOrDefault(x => x.F_ItemCode == "UseCondition" && x.F_ItemName == GetWay); - if (!string.IsNullOrEmpty(UseCondition) && UseConditionlity == null) - { - throw (new Exception("【使用状况】数据字典找不到对应的数据")); - } - else - { - Ass_FixAssetsEntity.UseCondition = GetWaylity?.F_ItemValue; - } - var CardStatus = dr["卡片状态"].ToString().Trim(); - var CardStatuslity = detailList.FirstOrDefault(x => x.F_ItemCode == "CardStatus" && x.F_ItemName == GetWay); - if (!string.IsNullOrEmpty(CardStatus) && CardStatuslity == null) - { - throw (new Exception("【卡片状态】数据字典找不到对应的数据")); - } - else - { - Ass_FixAssetsEntity.CardStatus = GetWaylity?.F_ItemValue; - } - var DepreciationMothod = dr["折旧方法"].ToString().Trim(); - var DepreciationMothodlity = detailList.FirstOrDefault(x => x.F_ItemCode == "DepreciationMothod" && x.F_ItemName == GetWay); - if (!string.IsNullOrEmpty(DepreciationMothod) && DepreciationMothodlity == null) - { - throw (new Exception("【折旧方法】数据字典找不到对应的数据")); - } - else - { - Ass_FixAssetsEntity.DepreciationMothod = GetWaylity?.F_ItemValue; - } - var DepreciationStatus = dr["折旧/摊销状态"].ToString().Trim(); - var DepreciationStatuslity = detailList.FirstOrDefault(x => x.F_ItemCode == "DepreciationStatus" && x.F_ItemName == GetWay); - if (!string.IsNullOrEmpty(DepreciationStatus) && DepreciationStatuslity == null) - { - throw (new Exception("【折旧/摊销状态】数据字典找不到对应的数据")); - } - else - { - Ass_FixAssetsEntity.DepreciationStatus = GetWaylity?.F_ItemValue; - } + Ass_FixAssetsinsert.Add(Ass_FixAssetsEntity); - db.Delete(x => x.FACode == dr["资产编号"].ToString()); + var FACode = dr["资产编号"].ToString(); + db.Delete(x => x.FACode == FACode && x.Status == 0); snum++; } catch (Exception ex) @@ -612,5 +556,31 @@ namespace Learun.Application.TwoDevelopment.AssetManagementSystem } #endregion + /// + /// 数据字典查找Value + /// + /// 数据字典数据 + /// 项目名 + /// 列名 + /// + private string FindDataItemValue(List dataItemList, string itemName, string colName, bool IsMandatory) + { + DataItemDetailEntity dataItem = dataItemList.Find(t => t.F_ItemName == itemName); + if (dataItem != null) + { + return dataItem.F_ItemValue; + } + else + { + if (IsMandatory) + { + throw (new Exception("【" + colName + "】数据字典找不到对应值")); + } + else + { + return ""; + } + } + } } }