diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/Ass_Acceptance/Form.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/Ass_Acceptance/Form.cshtml index 0efd837dc..b658a9a11 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/Ass_Acceptance/Form.cshtml +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/Ass_Acceptance/Form.cshtml @@ -10,10 +10,10 @@
申请单号
-
+ @*
申请名称
-
+
*@
总价
@@ -30,7 +30,7 @@
明细操作
- @**@ +
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/Ass_Acceptance/Form.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/Ass_Acceptance/Form.js index 88cbd0844..5e4c93c5e 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/Ass_Acceptance/Form.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/Ass_Acceptance/Form.js @@ -57,9 +57,11 @@ var bootstrap = function ($, learun) { // }); //}); $("#detailedit").on('click', function () { - var keyValue = $('#Ass_Acceptance').jfGridValue('Id'); + var keyValue = $('#Ass_Acceptance').jfGridValue('AAIId'); + var AAICode = $('#Ass_Acceptance').jfGridValue('AAICode'); selectedRow = $('#Ass_Acceptance').jfGridGet('rowdata'); - if (learun.checkrow(keyValue)) { + + if (learun.checkrow(AAICode)) { learun.layerForm({ id: 'formitem', title: '编辑明细', @@ -67,7 +69,6 @@ var bootstrap = function ($, learun) { width: 860, height: 600, callBack: function (id) { - //return top[id].acceptClick(refreshGirdData); return top[id].acceptClick(refreshGirdData); } }); @@ -75,12 +76,12 @@ var bootstrap = function ($, learun) { }); $("#detailadd").on('click', function () { selectedRow = null; - learun.layerFormForPercent({ + learun.layerForm({ id: 'formitem', title: '新增明细', - url: top.$.rootUrl + '/AssetManagementSystem/Ass_AssetsInfoItem/IndexTwo', - width: "90%", - height: "90%", + url: top.$.rootUrl + '/AssetManagementSystem/Ass_Acceptance/FormItem', + width: 860, + height: 600, callBack: function (id) { return top[id].acceptClick(refreshGirdData); } @@ -150,9 +151,23 @@ var bootstrap = function ($, learun) { }); } }, + { + label: '资产来源', name: 'AAISource', width: 100, align: 'left', formatterAsync: function (callback, value, row, op, $cell) { + learun.clientdata.getAsync('dataItem', { + key: value, + code: 'zcly', + callback: function (_data) { + callback(_data.text); + } + }); + } + }, { label: '单价', name: 'AAIPrice', width: 100, align: 'left' }, + { + label: '数量', name: 'AAIStock', width: 80, align: 'left' + }, { label: '单位', name: 'AAIUnit', width: 80, align: 'left', formatterAsync: function (callback, value, row, op, $cell) { learun.clientdata.getAsync('dataItem', { @@ -164,6 +179,36 @@ var bootstrap = function ($, learun) { }); } }, + { + label: '生成资产明细', name: 'AAIHasDetail', width: 80, align: 'left', formatter: function (cellvalue) { + return (cellvalue === true || cellvalue === "true") ? "" : ""; + } + }, + { + label: '库房', name: 'AAIStorageId', width: 100, align: 'left', formatterAsync: function (callback, value, row, op, $cell) { + learun.clientdata.getAsync('custmerData', { + url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'Ass_StorageData', + key: value, + keyId: 'sid', + callback: function (_data) { + callback(_data['sname']); + } + }); + } + }, + { + label: '库位', name: 'AAIStoragePosition', width: 100, align: 'left', + formatterAsync: function (callback, value, row, op, $cell) { + learun.clientdata.getAsync('custmerData', { + url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'Ass_Storage_Room', + key: value, + keyId: 'rid', + callback: function (_data) { + callback(_data['rname']); + } + }); + } + }, { label: '英文名称', name: 'AAIEName', width: 100, align: 'left' }, @@ -172,62 +217,31 @@ var bootstrap = function ($, learun) { }, { label: '生产厂家', name: 'AAIManufacturer', width: 100, align: 'left' + }, + { + label: '资产规格', name: 'AAISpecification', width: 100, align: 'left' + }, + { + label: '用途', name: 'AAIUse', width: 100, align: 'left' + }, + { + label: '供应商', name: 'AAISupplierId', width: 100, align: 'left', formatterAsync: function (callback, value, row, op, $cell) { + learun.clientdata.getAsync('custmerData', { + url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'Ass_SupplierData', + key: value, + keyId: 'sid', + callback: function (_data) { + callback(_data['sname']); + } + }); + } } ], height: 400, mainId: 'AAIId', reloadSelected: false }); - //$('#Ass_Acceptance').jfGrid({ - // headData: [ - // { label: "设备名称", name: "Name", width: 100, align: "left" }, - // { label: "品牌", name: "Manufacturer", width: 100, align: "left" }, - // { label: "规格型号", name: "Model", width: 100, align: "left" }, - // { label: "单位", name: "Unit", width: 100, align: "left" }, - // { label: "数量", name: "Stock", width: 100, align: "left" }, - // { label: "单价", name: "Price", width: 100, align: "left" }, - // { label: "总价", name: "TotalPrice", width: 100, align: "left" }, - // { - // label: "使用部门", name: "DepartmentId", width: 100, align: "left", - // formatterAsync: function (callback, value, row, op, $cell) { - // learun.clientdata.getAsync('department', { - // key: value, - // callback: function (_data) { - // callback(_data.name); - // } - // }); - // } - // }, - // { - // label: "使用人", name: "UserID", width: 100, align: "left", - // formatterAsync: function (callback, value, row, op, $cell) { - // learun.clientdata.getAsyncReal('user', { - // key: value, - // callback: function (_data) { - // callback(_data.name); - // } - // }); - // } - // }, - // { label: "放置地点", name: "Place", width: 100, align: "left" }, - // //{ - // // label: "状态", name: "Status", width: 100, align: "left", - // // formatter: function (cellvalue, row) { - // // if (cellvalue === '1') { - // // return '审批中'; - // // } else if (cellvalue === '2') { - // // return '已审核'; - // // } else { - // // return '草稿'; - // // } - // // } - // //}, - // { label: "备注", name: "Remark", width: 100, align: "left" }, - // ], - // height: 400, - // mainId: 'Id', - // reloadSelected: false, - //}); + }, initData: function () { if (!!keyValue) { @@ -256,51 +270,50 @@ var bootstrap = function ($, learun) { var list = []; //总价计算 pricecount = 0; - $.each(temprow, - function (i, item) { - var entity = { - //AAICode: item.AICode, - AAICode: item.AICodeNumJY, - AAIName: item.AIASSName, - AAITId: item.AIASSClass, - AAIPrice: item.AIAssValue, - AAIUnit: item.AIUnits, - AAIEName: '', - AAIModel: item.AISpecificationtype, - AAIManufacturer: item.AIManufacturer, - AAIId: learun.newGuid() - } - list.push(entity); + //$.each(temprow, + // function (i, item) { + // var entity = { + // //AAICode: item.AICode, + // AAICode: item.AICodeNumJY, + // AAIName: item.AIASSName, + // AAITId: item.AIASSClass, + // AAIPrice: item.AIAssValue, + // AAIUnit: item.AIUnits, + // AAIEName: '', + // AAIModel: item.AISpecificationtype, + // AAIManufacturer: item.AIManufacturer, + // AAIId: learun.newGuid() + // } + // list.push(entity); - }); + // }); + //$.each(list, + // function (j, item2) { + // $.each(tempdatra, + // function (key, val) { - $.each(list, - function (j, item2) { - $.each(tempdatra, - function (key, val) { - - if (tempdatra[key].AAICode === item2.AAICode) { - tempdatra[key] = item2; - ifnewrow = false; - } - }); - if (ifnewrow) { - tempdatra.push(item2); - } - }); + // if (tempdatra[key].AAICode === item2.AAICode) { + // tempdatra[key] = item2; + // ifnewrow = false; + // } + // }); + // if (ifnewrow) { + // tempdatra.push(item2); + // } + // }); //var ifnewrow = true; - //$.each(tempdatra, function (key, val) { - // if (tempdatra[key].MainId === temprow.AICodeNumJY) { - // tempdatra[key] = temprow; - // ifnewrow = false; - // } - //}); - //if (ifnewrow) { - // tempdatra.push(temprow); - //} + $.each(tempdatra, function (key, val) { + if (tempdatra[key].AAICode === temprow.AAICode) { + tempdatra[key] = temprow; + ifnewrow = false; + } + }); + if (ifnewrow) { + tempdatra.push(temprow); + } for (var i = 0; i < tempdatra.length; i++) { - pricecount = parseFloat(pricecount) + parseFloat(tempdatra[i].AAIPrice); + pricecount = parseFloat(pricecount) + parseFloat(tempdatra[i].AAIPrice * tempdatra[i].AAIStock); } $("#TotalPrice").val(pricecount); $('#Ass_Acceptance').jfGridSet('refreshdata', tempdatra.sort(sortNumber)); diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/Ass_Acceptance/FormItem.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/Ass_Acceptance/FormItem.cshtml index 3017a379f..7a3d6eccf 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/Ass_Acceptance/FormItem.cshtml +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/Ass_Acceptance/FormItem.cshtml @@ -3,53 +3,69 @@ Layout = "~/Views/Shared/_Form.cshtml"; }
-
-
选择已登记资产
-
+
+
资产编号*
+
-
-
设备名称*
- +
+
资产名称
+
-
-
品牌
- +
+
资产类别
+
-
-
规格型号
- +
+
资产来源
+
-
+
单位
- +
-
+
数量*
- +
-
+
单价*
- +
-
-
总价
- +
+
生成资产明细
+
-
-
使用部门
-
+
+
库房
+
-
-
使用人
-
+
+
库位
+
-
-
放置地点
- +
+
英文名称
+
-
-
备注
- +
+
资产型号
+ +
+
+
生产厂家
+ +
+
+
资产规格
+ +
+
+
用途
+ +
+
+
供应商
+
@Html.AppendJsFile("/Areas/AssetManagementSystem/Views/Ass_Acceptance/FormItem.js") diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/Ass_Acceptance/FormItem.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/Ass_Acceptance/FormItem.js index 9443a317b..88408af80 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/Ass_Acceptance/FormItem.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/Ass_Acceptance/FormItem.js @@ -16,6 +16,7 @@ var validForm; var save; var bootstrap = function ($, learun) { "use strict"; + var selectedRow = learun.iframe('layer_form', top.frames).selectedRow; //learun.frameTab.currentIframe().selectedRow; var page = { init: function () { $('.lr-form-wrap').lrscroll(); @@ -23,117 +24,85 @@ var bootstrap = function ($, learun) { page.initData(); }, bind: function () { - $('#DepartmentId').lrselect({ + //资产类别 + $('#AAITId').lrDataSourceSelect({ code: 'Ass_AssetsType', value: 'atid', text: 'aname' }); + $('#AAISupplierId').lrDataSourceSelect({ code: 'Ass_SupplierData', value: 'sid', text: 'sname' }); + $('#AAISource').lrDataItemSelect({ code: 'zcly' }); + $('#AAIHasDetail').lrDataItemSelect({ code: 'YesOrNoBit' }); + $('#AAIUnit').lrDataItemSelect({ code: 'sldw' }); + + $('#AAIStorageId').lrselect({ type: 'tree', allowSearch: true, - url: top.$.rootUrl + '/LR_OrganizationModule/Department/GetTree', + url: top.$.rootUrl + '/AssetManagementSystem/AssStorageRoom/GetTree', param: {}, select: function (val) { - console.log(val.value); - $('#UserID').lrselectRefresh({ url: '/LR_OrganizationModule/User/GetListByDepartmentId?departmentId=' + val.value }); + var storageId = ""; + if (val) { + storageId = val.value; + } + $('#AAIStoragePosition').lrselectRefresh({ + url: top.$.rootUrl + '/AssetManagementSystem/AssStorageRoom/GetListForStorageId?storageId=' + storageId, + text: "RCode", + value: "RId", + allowSearch: true + }); } }); - $('#UserID').lrselect({ text: 'F_RealName', value: 'F_UserId' }); - - - $("#AAOldCode").lrlayerselect({ - treeUrl: top.$.rootUrl + '/AssetManagementSystem/Ass_AssetsType/GetAllTree', - treeParentId: 'atptid', - treeValueId: 'atid', - treeTextId: 'aname', - dataUrl: top.$.rootUrl + '/AssetManagementSystem/Ass_AssetsInfo/GetList', - dataTreeId: 'ATId', - dataValueId: 'AId', - dataTextId: 'AName', - - grid: [ - { label: '资产编号', name: 'ACode', width: 200, align: 'left' }, - { label: '资产名称', name: 'AName', width: 200, align: 'left' }, - { label: "英文名称", name: "AEName", width: 200, align: "left" }, - { label: "资产型号", name: "AModel", width: 200, align: "left" }, - { label: "生产厂家", name: "AManufacturer", width: 200, align: "left" }, - { - label: "供应商", name: "ASupplierId", width: 100, align: "left", formatterAsync: function (callback, value, row, op, $cell) { - learun.clientdata.getAsync('custmerData', { - url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'Ass_SupplierData', - key: value, - keyId: 'sid', - callback: function (_data) { - callback(_data['sname']); - } - }); - } - } - ], - select: function (values, texts) { - if (values && values.length > 0) { - //绑定 - $.lrSetForm(top.$.rootUrl + '/AssetManagementSystem/Ass_AssetsInfo/GetFormData?keyValue=' + values[0], function (data) { - data = data.Ass_AssetsInfo; - $('#Name').val(data.AName);//设备名称 - $('#AAIUnit').lrselectSet(data.AUnit);//单位 - $('#Model').val(data.AModel);//规格型号 - $('#AAIManufacturer').val(data.AManufacturer);//品牌 - $('#Price').val(data.APrice)//单价 - }); - } - }, - unknowselect: function () { - $("#AAOldCode").find('span').text(""); - $('#Name').val("");//设备名称 - $('#Model').val("");//规格型号 - $('#AAIManufacturer').val("");//品牌 - }, - isMultiple: false + //库位 + $('#AAIStoragePosition').lrselect({ + value: 'RId', text: 'RCode', allowSearch: true }); + //$('#Stock').bind('change', function () { + // var stock = $(this).val(); + // var price = $('#Price').val(); + // $('#TotalPrice').val(stock * price); - $('#Stock').bind('change', function () { - var stock = $(this).val(); - var price = $('#Price').val(); - $('#TotalPrice').val(stock * price); - - }) - $('#Price').bind('change', function () { - var stock = $('#Stock').val(); - var price = $(this).val(); - $('#TotalPrice').val(stock * price); + //}) + //$('#Price').bind('change', function () { + // var stock = $('#Stock').val(); + // var price = $(this).val(); + // $('#TotalPrice').val(stock * price); - }) + //}) }, initData: function () { - if (!!keyValue) { - $.lrSetForm(top.$.rootUrl + '/AssetManagementSystem/Ass_Acceptance/GetFormData?keyValue=' + keyValue, function (data) { - for (var id in data) { - if (!!data[id].length && data[id].length > 0) { - $('#' + id).jfGridSet('refreshdata', data[id]); - } - else { - $('[data-table="' + id + '"]').lrSetFormData(data[id]); - } - } - }); + if (!!selectedRow) { + $('#form').lrSetFormData(selectedRow); } + //if (!!keyValue) { + // $.lrSetForm(top.$.rootUrl + '/AssetManagementSystem/Ass_Acceptance/GetFormData?keyValue=' + keyValue, function (data) { + // for (var id in data) { + // if (!!data[id].length && data[id].length > 0) { + // $('#' + id).jfGridSet('refreshdata', data[id]); + // } + // else { + // $('[data-table="' + id + '"]').lrSetFormData(data[id]); + // } + // } + // }); + //} } }; // 设置表单数据 setFormData = function (processId, param, callback) { - if (!!processId) { - $.lrSetForm(top.$.rootUrl + '/AssetManagementSystem/Ass_Acceptance/GetFormDataByProcessId?processId=' + processId, function (data) { - for (var id in data) { - if (!!data[id] && data[id].length > 0) { - $('#' + id).jfGridSet('refreshdata', data[id]); - } - else { - if (id == 'Ass_Acceptance' && data[id]) { - keyValue = data[id].ID; - } - $('[data-table="' + id + '"]').lrSetFormData(data[id]); - } - } - }); - } + //if (!!processId) { + // $.lrSetForm(top.$.rootUrl + '/AssetManagementSystem/Ass_Acceptance/GetFormDataByProcessId?processId=' + processId, function (data) { + // for (var id in data) { + // if (!!data[id] && data[id].length > 0) { + // $('#' + id).jfGridSet('refreshdata', data[id]); + // } + // else { + // if (id == 'Ass_Acceptance' && data[id]) { + // keyValue = data[id].ID; + // } + // $('[data-table="' + id + '"]').lrSetFormData(data[id]); + // } + // } + // }); + //} callback && callback(); } // 验证数据是否填写完整 @@ -161,21 +130,6 @@ var bootstrap = function ($, learun) { return true; } }; - //// 保存数据 - //save = function (processId, callBack, i) { - // var formData = $('body').lrGetFormData(); - // if (!!processId) { - // formData.ProcessId = processId; - // } - // var postData = { - // strEntity: JSON.stringify(formData) - // }; - // $.lrSaveForm(top.$.rootUrl + '/AssetManagementSystem/Ass_Acceptance/SaveForm?keyValue=' + keyValue, postData, function (res) { - // // 保存成功后才回调 - // if (!!callBack) { - // callBack(res, i); - // } - // }); - //}; + page.init(); } diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/Ass_Acceptance/FormView.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/Ass_Acceptance/FormView.cshtml index ce7e3e6b0..2656db9d8 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/Ass_Acceptance/FormView.cshtml +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/Ass_Acceptance/FormView.cshtml @@ -10,10 +10,10 @@
申请单号
-
+ @*
申请名称
-
+
*@
总价
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/Ass_Acceptance/FormView.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/Ass_Acceptance/FormView.js index 32092db9c..95e1be523 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/Ass_Acceptance/FormView.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/Ass_Acceptance/FormView.js @@ -127,9 +127,23 @@ var bootstrap = function ($, learun) { }); } }, + { + label: '资产来源', name: 'AAISource', width: 100, align: 'left', formatterAsync: function (callback, value, row, op, $cell) { + learun.clientdata.getAsync('dataItem', { + key: value, + code: 'zcly', + callback: function (_data) { + callback(_data.text); + } + }); + } + }, { label: '单价', name: 'AAIPrice', width: 100, align: 'left' }, + { + label: '数量', name: 'AAIStock', width: 80, align: 'left' + }, { label: '单位', name: 'AAIUnit', width: 80, align: 'left', formatterAsync: function (callback, value, row, op, $cell) { learun.clientdata.getAsync('dataItem', { @@ -141,6 +155,36 @@ var bootstrap = function ($, learun) { }); } }, + { + label: '生成资产明细', name: 'AAIHasDetail', width: 80, align: 'left', formatter: function (cellvalue) { + return (cellvalue === true || cellvalue === "true") ? "" : ""; + } + }, + { + label: '库房', name: 'AAIStorageId', width: 100, align: 'left', formatterAsync: function (callback, value, row, op, $cell) { + learun.clientdata.getAsync('custmerData', { + url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'Ass_StorageData', + key: value, + keyId: 'sid', + callback: function (_data) { + callback(_data['sname']); + } + }); + } + }, + { + label: '库位', name: 'AAIStoragePosition', width: 100, align: 'left', + formatterAsync: function (callback, value, row, op, $cell) { + learun.clientdata.getAsync('custmerData', { + url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'Ass_Storage_Room', + key: value, + keyId: 'rid', + callback: function (_data) { + callback(_data['rname']); + } + }); + } + }, { label: '英文名称', name: 'AAIEName', width: 100, align: 'left' }, @@ -149,6 +193,24 @@ var bootstrap = function ($, learun) { }, { label: '生产厂家', name: 'AAIManufacturer', width: 100, align: 'left' + }, + { + label: '资产规格', name: 'AAISpecification', width: 100, align: 'left' + }, + { + label: '用途', name: 'AAIUse', width: 100, align: 'left' + }, + { + label: '供应商', name: 'AAISupplierId', width: 100, align: 'left', formatterAsync: function (callback, value, row, op, $cell) { + learun.clientdata.getAsync('custmerData', { + url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'Ass_SupplierData', + key: value, + keyId: 'sid', + callback: function (_data) { + callback(_data['sname']); + } + }); + } } ], height: 400, diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/Ass_Acceptance/Index.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/Ass_Acceptance/Index.js index 924ac219d..7367a7a34 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/Ass_Acceptance/Index.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/Ass_Acceptance/Index.js @@ -140,7 +140,7 @@ var bootstrap = function ($, learun) { url: top.$.rootUrl + '/AssetManagementSystem/Ass_Acceptance/GetPageList', headData: [ { label: "申请单号", name: "Code", width: 200, align: "left" }, - { label: "申请名称", name: "Name", width: 200, align: "left" }, + //{ label: "申请名称", name: "Name", width: 200, align: "left" }, { label: "总价", name: "TotalPrice", width: 100, align: "left" }, { label: "申请时间", name: "CreateTime", width: 150, align: "left" }, { diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/Ass_Acceptance/Ass_AcceptanceEntity.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/Ass_Acceptance/Ass_AcceptanceEntity.cs index ef8885d5e..ae7095147 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/Ass_Acceptance/Ass_AcceptanceEntity.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/Ass_Acceptance/Ass_AcceptanceEntity.cs @@ -30,17 +30,17 @@ namespace Learun.Application.TwoDevelopment.AssetManagementSystem [Column("AAICODE")] public string AAICode { get; set; } /// - /// AAIName + /// 资产名称 /// [Column("AAINAME")] public string AAIName { get; set; } /// - /// AAITId + /// 资产类别 /// [Column("AAITID")] public string AAITId { get; set; } /// - /// AAIEName + /// 英文名称 /// [Column("AAIENAME")] public string AAIEName { get; set; } @@ -60,38 +60,38 @@ namespace Learun.Application.TwoDevelopment.AssetManagementSystem [Column("AAIORDER")] public int? AAIOrder { get; set; } /// - /// AAIModel + /// 资产型号 /// [Column("AAIMODEL")] public string AAIModel { get; set; } /// - /// AAIManufacturer + /// 生产厂家 /// [Column("AAIMANUFACTURER")] public string AAIManufacturer { get; set; } /// - /// AAISupplierId + /// 供应商 /// [Column("AAISUPPLIERID")] public string AAISupplierId { get; set; } /// - /// AAISource + /// 资产来源 /// [Column("AAISOURCE")] public string AAISource { get; set; } /// - /// AAIPrice + /// 单价 /// [Column("AAIPRICE")] public decimal? AAIPrice { get; set; } /// - /// AAISTOCK + /// 数量 /// [Column("AAISTOCK")] public decimal? AAIStock { get; set; } /// - /// AAIUNIT + /// 单位 /// [Column("AAIUNIT")] public string AAIUnit { get; set; } @@ -106,6 +106,11 @@ namespace Learun.Application.TwoDevelopment.AssetManagementSystem /// [Column("AISCHECK")] public bool? AIsCheck { get; set; } + /// + /// AAIHasDetail + /// + [Column("AAIHASDETAIL")] + public bool? AAIHasDetail { get; set; } /// /// AResult @@ -117,12 +122,28 @@ namespace Learun.Application.TwoDevelopment.AssetManagementSystem /// [Column("AREMARK")] public string ARemark { get; set; } - /// - /// AAddress - /// - [Column("AADDRESS")] - public string AAddress { get; set; } + /// + /// 库房 + /// + [Column("AAISTORAGEID")] + public string AAIStorageId { get; set; } + /// + /// 库位 + /// + [Column("AAISTORAGEPOSITION")] + public string AAIStoragePosition { get; set; } + + /// + /// 资产规格 + /// + [Column("AAISPECIFICATION")] + public string AAISpecification { get; set; } + /// + /// 资产用途 + /// + [Column("AAIUSE")] + public string AAIUse { get; set; } #endregion diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/Ass_AcceptanceMain/Ass_AcceptanceMainEntity.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/Ass_AcceptanceMain/Ass_AcceptanceMainEntity.cs index 55567e8a7..f4f3cfb3a 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/Ass_AcceptanceMain/Ass_AcceptanceMainEntity.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/Ass_AcceptanceMain/Ass_AcceptanceMainEntity.cs @@ -29,6 +29,12 @@ namespace Learun.Application.TwoDevelopment.AssetManagementSystem /// [Column("NAME")] public string Name { get; set; } + /// + /// 资产类别 + /// + [Column("ASSTYPE")] + public int? AssType { get; set; } + /// /// CreateTime /// diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/Ass_AcceptanceMain/Ass_AcceptanceMainService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/Ass_AcceptanceMain/Ass_AcceptanceMainService.cs index f081e5df7..c0795750d 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/Ass_AcceptanceMain/Ass_AcceptanceMainService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/Ass_AcceptanceMain/Ass_AcceptanceMainService.cs @@ -4,6 +4,7 @@ using Learun.Util; using System; using System.Collections.Generic; using System.Data; +using System.Linq; using System.Text; namespace Learun.Application.TwoDevelopment.AssetManagementSystem @@ -201,19 +202,261 @@ namespace Learun.Application.TwoDevelopment.AssetManagementSystem public void ChangeStatusByProcessId(string parameterProcessId, int p1) { + var db = BaseRepository().BeginTrans(); try { - var entity = this.BaseRepository() + var entity = db .FindEntity(a => a.ProcessId == parameterProcessId); - if (null != entity) + entity.Status = p1; + + db.Update(entity); + if (p1 == 2) { - entity.Status = p1; + //登记在册 + var assinfo = db.FindList(); + //验收明细 + var itemList = db.FindList(x => x.MainId == entity.Id); + + //出入库单表 + Ass_AssetsChangeEntity ac = new Ass_AssetsChangeEntity(); + ac.Create(); + ac.ACCode = "RK_" + CommonHelper.CreateNo(); + ac.ACPrice = entity.TotalPrice; + ac.ACTime = DateTime.Now; + ac.ACUserId = entity.CreateUserId; + ac.ACInOrOut = true; + ac.ACReasonType = "14"; + ac.ACDetailId = entity.Id; + db.Insert(ac); + + foreach (var assitemapp in itemList) + { + var assinfoitem = assinfo.Where(m => m.ACode == assitemapp.AAICode).FirstOrDefault(); + //有登记 + if (assinfoitem != null) + { + //是否生成明细 + if (assinfoitem.HasDetail == true) + { + var Ass_AssetsInfoItemMaxNum = db.FindList(m => m.AId == assinfoitem.AId).Max(m => m.AICodeNum); + for (int i = 0; i < assitemapp.AAIStock; i++) + { + //资产明细 + Ass_AssetsInfoItemEntity insertassinfoitem = new Ass_AssetsInfoItemEntity(); + insertassinfoitem.Create(); + insertassinfoitem.AId = assinfoitem.AId; + insertassinfoitem.AICodeNum = Ass_AssetsInfoItemMaxNum + 1 + i; + insertassinfoitem.AICode = assinfoitem.ACode + "_" + insertassinfoitem.AICodeNum.ToString(); + insertassinfoitem.AICodeNumJY = assinfoitem.ACode + "_" + insertassinfoitem.AICodeNum.ToString();//金隅编号 + insertassinfoitem.AIAssValue = assinfoitem.APrice;//价值 + insertassinfoitem.AIUnits = assinfoitem.AUnit;//单位 + insertassinfoitem.AISpecificationtype = assinfoitem.AModel;//型号 + insertassinfoitem.AIManufacturer = assinfoitem.AManufacturer;//厂家 + insertassinfoitem.AIUse = assinfoitem.AUse;//用途 + insertassinfoitem.AISpecification = assinfoitem.ASpecification;//规格 + + insertassinfoitem.AIIStorageId = assitemapp.AAIStorageId; + insertassinfoitem.AIASSName = assitemapp.AAIName; + insertassinfoitem.AIIStoragePosition = assitemapp.AAIStoragePosition; + insertassinfoitem.AIIsInStorage = true; + insertassinfoitem.AISpecification = assitemapp.AAISpecification; + insertassinfoitem.AIAssType = entity.AssType; + insertassinfoitem.AIASSClass = assinfoitem.ATId;//类别 + insertassinfoitem.AIUse = assitemapp.AAIUse; + db.Insert(insertassinfoitem); + //出入库明细表 + Ass_AssetsChangeItemEntity ass_assetschangeitem = new Ass_AssetsChangeItemEntity(); + ass_assetschangeitem.Create(); + ass_assetschangeitem.AIId = insertassinfoitem.AIId; + ass_assetschangeitem.ACId = ac.ACId; + ass_assetschangeitem.ACOldStock = assinfoitem.AStock + i; + ass_assetschangeitem.AAmount = 1; + ass_assetschangeitem.ACNewStock = ass_assetschangeitem.ACOldStock + 1; + ass_assetschangeitem.ACTime = DateTime.Now; + ass_assetschangeitem.ACUserId = entity.CreateUserId; + ass_assetschangeitem.ACInOrOut = true; + ass_assetschangeitem.ACReasonType = "14"; + ass_assetschangeitem.ACCStorageId = assitemapp.AAIStorageId; + ass_assetschangeitem.ACCStoragePosition = assitemapp.AAIStoragePosition; + db.Insert(ass_assetschangeitem); + } + //更新总库存 + assinfoitem.AStock = assinfoitem.AStock + assitemapp.AAIStock; + assinfoitem.AAssType = entity.AssType; + db.Update(assinfoitem); + } + else + { + //资产明细 + Ass_AssetsInfoItemEntity insertassinfoitem = db.FindEntity(m => m.AId == assinfoitem.AId); + //出入库明细表 + Ass_AssetsChangeItemEntity ass_assetschangeitem = new Ass_AssetsChangeItemEntity(); + ass_assetschangeitem.Create(); + ass_assetschangeitem.AIId = insertassinfoitem.AIId; + ass_assetschangeitem.ACId = ac.ACId; + ass_assetschangeitem.ACOldStock = assinfoitem.AStock; + ass_assetschangeitem.AAmount = assitemapp.AAIStock; + ass_assetschangeitem.ACNewStock = ass_assetschangeitem.ACOldStock + assitemapp.AAIStock; + ass_assetschangeitem.ACTime = DateTime.Now; + ass_assetschangeitem.ACUserId = entity.CreateUserId; + ass_assetschangeitem.ACInOrOut = true; + ass_assetschangeitem.ACReasonType = "14"; + ass_assetschangeitem.ACCStorageId = assitemapp.AAIStorageId; + ass_assetschangeitem.ACCStoragePosition = assitemapp.AAIStoragePosition; + db.Insert(ass_assetschangeitem); + //更新总库存 + assinfoitem.AStock = assinfoitem.AStock + assitemapp.AAIStock; + //assinfoitem.AAssType = assPurchase.PAssType; + db.Update(assinfoitem); + if (insertassinfoitem.AIIsInStorage == false) + { + insertassinfoitem.AIIsInStorage = true; + db.Update(insertassinfoitem); + } + } + } + //没登记 + else + { + //类型获取 + var asstypeinfo = db.FindEntity(m => m.ATId == assitemapp.AAITId); + //是否生成明细 + if (assitemapp.AAIHasDetail == true) + { + //登记造册 + Ass_AssetsInfoEntity insertAss_AssetsInfo = new Ass_AssetsInfoEntity(); + insertAss_AssetsInfo.Create(); + insertAss_AssetsInfo.ACode = asstypeinfo.ATCode + "_" + assitemapp.AAICode; + insertAss_AssetsInfo.AName = assitemapp.AAIName; + insertAss_AssetsInfo.ATId = assitemapp.AAITId; + insertAss_AssetsInfo.AEName = assitemapp.AAIEName; + insertAss_AssetsInfo.APhoto = assitemapp.AAIPhoto; + insertAss_AssetsInfo.AContent = assitemapp.AAIContent; + insertAss_AssetsInfo.AOrder = assitemapp.AAIOrder; + insertAss_AssetsInfo.AModel = assitemapp.AAIModel; + insertAss_AssetsInfo.AManufacturer = assitemapp.AAIManufacturer; + insertAss_AssetsInfo.ASupplierId = assitemapp.AAISupplierId; + insertAss_AssetsInfo.ASource = assitemapp.AAISource; + insertAss_AssetsInfo.APrice = assitemapp.AAIPrice; + insertAss_AssetsInfo.AStock = assitemapp.AAIStock; + insertAss_AssetsInfo.AUnit = assitemapp.AAIUnit; + insertAss_AssetsInfo.HasDetail = assitemapp.AAIHasDetail; + insertAss_AssetsInfo.AAssType = entity.AssType; + insertAss_AssetsInfo.ASpecification = assitemapp.AAISpecification; + insertAss_AssetsInfo.AUse = assitemapp.AAIUse; + db.Insert(insertAss_AssetsInfo); + for (int i = 0; i < assitemapp.AAIStock; i++) + { + //资产明细 + Ass_AssetsInfoItemEntity insertassinfoitem = new Ass_AssetsInfoItemEntity(); + insertassinfoitem.Create(); + insertassinfoitem.AId = insertAss_AssetsInfo.AId; + insertassinfoitem.AICodeNum = i + 1; + insertassinfoitem.AICode = insertAss_AssetsInfo.ACode + "_" + insertassinfoitem.AICodeNum.ToString(); + insertassinfoitem.AICodeNumJY = insertAss_AssetsInfo.ACode + "_" + insertassinfoitem.AICodeNum.ToString(); + insertassinfoitem.AIAssValue = assinfoitem.APrice;//价值 + insertassinfoitem.AIUnits = assinfoitem.AUnit;//单位 + insertassinfoitem.AISpecificationtype = assinfoitem.AModel;//型号 + insertassinfoitem.AIManufacturer = assinfoitem.AManufacturer;//厂家 + insertassinfoitem.AIUse = assinfoitem.AUse;//用途 + insertassinfoitem.AISpecification = assinfoitem.ASpecification;//规格 + insertassinfoitem.AIASSName = assitemapp.AAIName; + insertassinfoitem.AIIStorageId = assitemapp.AAIStorageId; + insertassinfoitem.AIAssType = entity.AssType; + insertassinfoitem.AIIStoragePosition = assitemapp.AAIStoragePosition; + insertassinfoitem.AIIsInStorage = true; + insertassinfoitem.AISpecification = assitemapp.AAISpecification; + insertassinfoitem.AIASSClass = insertAss_AssetsInfo.ATId; + insertassinfoitem.AIUse = assitemapp.AAIUse; + db.Insert(insertassinfoitem); + //出入库明细表 + Ass_AssetsChangeItemEntity ass_assetschangeitem = new Ass_AssetsChangeItemEntity(); + ass_assetschangeitem.Create(); + ass_assetschangeitem.AIId = insertassinfoitem.AIId; + ass_assetschangeitem.ACId = ac.ACId; + ass_assetschangeitem.ACOldStock = i; + ass_assetschangeitem.AAmount = 1; + ass_assetschangeitem.ACNewStock = ass_assetschangeitem.ACOldStock + 1; + ass_assetschangeitem.ACTime = DateTime.Now; + ass_assetschangeitem.ACUserId = entity.CreateUserId; + ass_assetschangeitem.ACInOrOut = true; + ass_assetschangeitem.ACReasonType = "14"; + ass_assetschangeitem.ACCStorageId = assitemapp.AAIStorageId; + ass_assetschangeitem.ACCStoragePosition = assitemapp.AAIStoragePosition; + db.Insert(ass_assetschangeitem); + } + } + else + { + //登记造册 + Ass_AssetsInfoEntity insertAss_AssetsInfo = new Ass_AssetsInfoEntity(); + insertAss_AssetsInfo.Create(); + insertAss_AssetsInfo.ACode = asstypeinfo.ATCode + "_" + assitemapp.AAICode; + insertAss_AssetsInfo.AName = assitemapp.AAIName; + insertAss_AssetsInfo.ATId = assitemapp.AAITId; + insertAss_AssetsInfo.AEName = assitemapp.AAIEName; + insertAss_AssetsInfo.APhoto = assitemapp.AAIPhoto; + insertAss_AssetsInfo.AContent = assitemapp.AAIContent; + insertAss_AssetsInfo.AOrder = assitemapp.AAIOrder; + insertAss_AssetsInfo.AModel = assitemapp.AAIModel; + insertAss_AssetsInfo.AManufacturer = assitemapp.AAIManufacturer; + insertAss_AssetsInfo.AAssType = entity.AssType; + insertAss_AssetsInfo.ASupplierId = assitemapp.AAISupplierId; + insertAss_AssetsInfo.ASource = assitemapp.AAISource; + insertAss_AssetsInfo.APrice = assitemapp.AAIPrice; + insertAss_AssetsInfo.AStock = assitemapp.AAIStock; + insertAss_AssetsInfo.AUnit = assitemapp.AAIUnit; + insertAss_AssetsInfo.HasDetail = assitemapp.AAIHasDetail; + insertAss_AssetsInfo.ASpecification = assitemapp.AAISpecification; + insertAss_AssetsInfo.AUse = assitemapp.AAIUse; + db.Insert(insertAss_AssetsInfo); + //资产明细 + Ass_AssetsInfoItemEntity insertassinfoitem = new Ass_AssetsInfoItemEntity(); + insertassinfoitem.Create(); + insertassinfoitem.AId = insertAss_AssetsInfo.AId; + insertassinfoitem.AICodeNum = 1; + insertassinfoitem.AICode = insertAss_AssetsInfo.ACode + "_" + insertassinfoitem.AICodeNum.ToString(); + insertassinfoitem.AICodeNumJY = insertAss_AssetsInfo.ACode + "_" + insertassinfoitem.AICodeNum.ToString(); + insertassinfoitem.AIAssValue = assinfoitem.APrice;//价值 + insertassinfoitem.AIUnits = assinfoitem.AUnit;//单位 + insertassinfoitem.AISpecificationtype = assinfoitem.AModel;//型号 + insertassinfoitem.AIManufacturer = assinfoitem.AManufacturer;//厂家 + insertassinfoitem.AIUse = assinfoitem.AUse;//用途 + insertassinfoitem.AISpecification = assinfoitem.ASpecification;//规格 + insertassinfoitem.AIASSName = assitemapp.AAIName; + insertassinfoitem.AIIStorageId = assitemapp.AAIStorageId; + insertassinfoitem.AIAssType = entity.AssType; + insertassinfoitem.AIIStoragePosition = assitemapp.AAIStoragePosition; + insertassinfoitem.AIIsInStorage = true; + insertassinfoitem.AIASSClass = insertAss_AssetsInfo.ATId; + insertassinfoitem.AISpecification = assitemapp.AAISpecification; + insertassinfoitem.AIUse = assitemapp.AAIUse; + db.Insert(insertassinfoitem); + //出入库明细表 + Ass_AssetsChangeItemEntity ass_assetschangeitem = new Ass_AssetsChangeItemEntity(); + ass_assetschangeitem.Create(); + ass_assetschangeitem.AIId = insertassinfoitem.AIId; + ass_assetschangeitem.ACId = ac.ACId; + ass_assetschangeitem.ACOldStock = 0; + ass_assetschangeitem.AAmount = assitemapp.AAIStock; + ass_assetschangeitem.ACNewStock = ass_assetschangeitem.ACOldStock + assitemapp.AAIStock; + ass_assetschangeitem.ACTime = DateTime.Now; + ass_assetschangeitem.ACUserId = entity.CreateUserId; + ass_assetschangeitem.ACInOrOut = true; + ass_assetschangeitem.ACReasonType = "14"; + ass_assetschangeitem.ACCStorageId = assitemapp.AAIStorageId; + ass_assetschangeitem.ACCStoragePosition = assitemapp.AAIStoragePosition; + db.Insert(ass_assetschangeitem); + } + } + } } - this.BaseRepository().Update(entity); + db.Commit(); } catch (Exception ex) { + db.Rollback(); throw ExceptionEx.ThrowServiceException(ex); } } diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/Ass_AssetsInfoApply/Ass_AssetsInfoApplyService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/Ass_AssetsInfoApply/Ass_AssetsInfoApplyService.cs index f8a158480..365561e9f 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/Ass_AssetsInfoApply/Ass_AssetsInfoApplyService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/Ass_AssetsInfoApply/Ass_AssetsInfoApplyService.cs @@ -272,8 +272,6 @@ namespace Learun.Application.TwoDevelopment.AssetManagementSystem //审批通过操作 if (status == 2) { - //登记在册 - var assinfo = db.FindList(); //读入库申请记录 var assinfoapp = db.FindEntity(m => m.AAProcessId == processId); var assPurchase = db.FindEntity(a => a.PId == assinfoapp.PId); @@ -287,240 +285,50 @@ namespace Learun.Application.TwoDevelopment.AssetManagementSystem assPurchase.PStoregeStatus = 2; db.Update(assPurchase); } - //出入库单表 - Ass_AssetsChangeEntity ac = new Ass_AssetsChangeEntity(); - ac.Create(); - ac.ACCode = "RK_" + CommonHelper.CreateNo(); - ac.ACPrice = assinfoapp.AAPrice; - ac.ACTime = DateTime.Now; - ac.ACUserId = assinfoapp.AACreateUserId; - ac.ACInOrOut = true; - ac.ACReasonType = "14"; - ac.ACDetailId = assinfoapp.AAId; - db.Insert(ac); + //生成资产验收草稿 + //入库申请明细 var ass_AssetsInfoItemApplyEntityList = db.FindList(m => m.AAId == assinfoapp.AAId); - foreach (var assitemapp in ass_AssetsInfoItemApplyEntityList) + + Ass_AcceptanceMainEntity acceptanceMain = new Ass_AcceptanceMainEntity(); + acceptanceMain.Id = Guid.NewGuid().ToString(); + acceptanceMain.CreateTime=DateTime.Now; + acceptanceMain.CreateUserId = assinfoapp.AACreateUserId; + acceptanceMain.CreateDeptId = assinfoapp.AACreateDeptId; + acceptanceMain.Code = assinfoapp.AACode; + acceptanceMain.TotalPrice = assinfoapp.AAPrice; + acceptanceMain.AssType = assinfoapp.AAAssType; + acceptanceMain.Status = 0; + db.Insert(acceptanceMain); + foreach (var assitem in ass_AssetsInfoItemApplyEntityList) { - var assinfoitem = assinfo.FirstOrDefault(m => m.ACode == assitemapp.AAICode); - //有登记 - if (assinfoitem != null) - { - //是否生成明细 - if (assinfoitem.HasDetail == true) - { - var Ass_AssetsInfoItemMaxNum = db.FindList(m => m.AId == assinfoitem.AId).Max(m => m.AICodeNum); - for (int i = 0; i < assitemapp.AAIStock; i++) - { - //资产明细 - Ass_AssetsInfoItemEntity insertassinfoitem = new Ass_AssetsInfoItemEntity(); - insertassinfoitem.Create(); - insertassinfoitem.AId = assinfoitem.AId; - insertassinfoitem.AICodeNum = Ass_AssetsInfoItemMaxNum + 1 + i; - insertassinfoitem.AICode = assinfoitem.ACode + "_" + insertassinfoitem.AICodeNum.ToString(); - insertassinfoitem.AICodeNumJY = assinfoitem.ACode + "_" + insertassinfoitem.AICodeNum.ToString();//金隅编号 - insertassinfoitem.AIAssValue = assinfoitem.APrice;//价值 - insertassinfoitem.AIUnits = assinfoitem.AUnit;//单位 - insertassinfoitem.AISpecificationtype = assinfoitem.AModel;//型号 - insertassinfoitem.AIManufacturer = assinfoitem.AManufacturer;//厂家 - insertassinfoitem.AIUse = assinfoitem.AUse;//用途 - insertassinfoitem.AISpecification = assinfoitem.ASpecification;//规格 + Ass_AcceptanceEntity acc = new Ass_AcceptanceEntity(); + acc.Create(); + acc.MainId = acceptanceMain.Id; + acc.AAICode = assitem.AAICode; + acc.AAIName = assitem.AAIName; + acc.AAITId = assitem.AAITId; + acc.AAIEName = assitem.AAIEName; + acc.AAIPhoto = assitem.AAIPhoto; + acc.AAIContent = assitem.AAIContent; + acc.AAIOrder = assitem.AAIOrder; + acc.AAIModel = assitem.AAIModel; + acc.AAIManufacturer = assitem.AAIManufacturer; + acc.AAISupplierId = assitem.AAISupplierId; + acc.AAISource = assitem.AAISource; + acc.AAIPrice = assitem.AAIPrice; + acc.AAIStock = assitem.AAIStock; + acc.AAIUnit = assitem.AAIUnit; + acc.AAIStorageId = assitem.AAIStorageId; + acc.AAIStoragePosition = assitem.AAIStoragePosition; + acc.AAISpecification = assitem.AAISpecification; + acc.AAIUse = assitem.AAIUse; + acc.AAIHasDetail = assitem.AAIHasDetail; - insertassinfoitem.AIIStorageId = assitemapp.AAIStorageId; - insertassinfoitem.AIASSName = assitemapp.AAIName; - insertassinfoitem.AIIStoragePosition = assitemapp.AAIStoragePosition; - insertassinfoitem.AIIsInStorage = true; - insertassinfoitem.AISpecification = assitemapp.AAISpecification; - insertassinfoitem.AIAssType = assinfoapp.AAAssType; - insertassinfoitem.AIASSClass = assinfoitem.ATId;//类别 - insertassinfoitem.AIUse = assitemapp.AAIUse; - db.Insert(insertassinfoitem); - //出入库明细表 - Ass_AssetsChangeItemEntity ass_assetschangeitem = new Ass_AssetsChangeItemEntity(); - ass_assetschangeitem.Create(); - ass_assetschangeitem.AIId = insertassinfoitem.AIId; - ass_assetschangeitem.ACId = ac.ACId; - ass_assetschangeitem.ACOldStock = assinfoitem.AStock + i; - ass_assetschangeitem.AAmount = 1; - ass_assetschangeitem.ACNewStock = ass_assetschangeitem.ACOldStock + 1; - ass_assetschangeitem.ACTime = DateTime.Now; - ass_assetschangeitem.ACUserId = assinfoapp.AACreateUserId; - ass_assetschangeitem.ACInOrOut = true; - ass_assetschangeitem.ACReasonType = "14"; - ass_assetschangeitem.ACCStorageId = assitemapp.AAIStorageId; - ass_assetschangeitem.ACCStoragePosition = assitemapp.AAIStoragePosition; - db.Insert(ass_assetschangeitem); - } - //更新总库存 - assinfoitem.AStock = assinfoitem.AStock + assitemapp.AAIStock; - assinfoitem.AAssType = assinfoapp.AAAssType; - db.Update(assinfoitem); - } - else - { - //资产明细 - Ass_AssetsInfoItemEntity insertassinfoitem = db.FindEntity(m => m.AId == assinfoitem.AId); - //出入库明细表 - Ass_AssetsChangeItemEntity ass_assetschangeitem = new Ass_AssetsChangeItemEntity(); - ass_assetschangeitem.Create(); - ass_assetschangeitem.AIId = insertassinfoitem.AIId; - ass_assetschangeitem.ACId = ac.ACId; - ass_assetschangeitem.ACOldStock = assinfoitem.AStock; - ass_assetschangeitem.AAmount = assitemapp.AAIStock; - ass_assetschangeitem.ACNewStock = ass_assetschangeitem.ACOldStock + assitemapp.AAIStock; - ass_assetschangeitem.ACTime = DateTime.Now; - ass_assetschangeitem.ACUserId = assinfoapp.AACreateUserId; - ass_assetschangeitem.ACInOrOut = true; - ass_assetschangeitem.ACReasonType = "14"; - ass_assetschangeitem.ACCStorageId = assitemapp.AAIStorageId; - ass_assetschangeitem.ACCStoragePosition = assitemapp.AAIStoragePosition; - db.Insert(ass_assetschangeitem); - //更新总库存 - assinfoitem.AStock = assinfoitem.AStock + assitemapp.AAIStock; - //assinfoitem.AAssType = assPurchase.PAssType; - db.Update(assinfoitem); - if (insertassinfoitem.AIIsInStorage == false) - { - insertassinfoitem.AIIsInStorage = true; - db.Update(insertassinfoitem); - } - } - } - //没登记 - else - { - //类型获取 - var asstypeinfo = db.FindEntity(m => m.ATId == assitemapp.AAITId); - //是否生成明细 - if (assitemapp.AAIHasDetail == true) - { - //登记造册 - Ass_AssetsInfoEntity insertAss_AssetsInfo = new Ass_AssetsInfoEntity(); - insertAss_AssetsInfo.Create(); - insertAss_AssetsInfo.ACode = asstypeinfo.ATCode + "_" + assitemapp.AAICode; - insertAss_AssetsInfo.AName = assitemapp.AAIName; - insertAss_AssetsInfo.ATId = assitemapp.AAITId; - insertAss_AssetsInfo.AEName = assitemapp.AAIEName; - insertAss_AssetsInfo.APhoto = assitemapp.AAIPhoto; - insertAss_AssetsInfo.AContent = assitemapp.AAIContent; - insertAss_AssetsInfo.AOrder = assitemapp.AAIOrder; - insertAss_AssetsInfo.AModel = assitemapp.AAIModel; - insertAss_AssetsInfo.AManufacturer = assitemapp.AAIManufacturer; - insertAss_AssetsInfo.ASupplierId = assitemapp.AAISupplierId; - insertAss_AssetsInfo.ASource = assitemapp.AAISource; - insertAss_AssetsInfo.APrice = assitemapp.AAIPrice; - insertAss_AssetsInfo.AStock = assitemapp.AAIStock; - insertAss_AssetsInfo.AUnit = assitemapp.AAIUnit; - insertAss_AssetsInfo.HasDetail = assitemapp.AAIHasDetail; - insertAss_AssetsInfo.AAssType = assinfoapp.AAAssType; - insertAss_AssetsInfo.ASpecification = assitemapp.AAISpecification; - insertAss_AssetsInfo.AUse = assitemapp.AAIUse; - db.Insert(insertAss_AssetsInfo); - for (int i = 0; i < assitemapp.AAIStock; i++) - { - //资产明细 - Ass_AssetsInfoItemEntity insertassinfoitem = new Ass_AssetsInfoItemEntity(); - insertassinfoitem.Create(); - insertassinfoitem.AId = insertAss_AssetsInfo.AId; - insertassinfoitem.AICodeNum = i + 1; - insertassinfoitem.AICode = insertAss_AssetsInfo.ACode + "_" + insertassinfoitem.AICodeNum.ToString(); - insertassinfoitem.AICodeNumJY = insertAss_AssetsInfo.ACode + "_" + insertassinfoitem.AICodeNum.ToString(); - insertassinfoitem.AIAssValue = assinfoitem.APrice;//价值 - insertassinfoitem.AIUnits = assinfoitem.AUnit;//单位 - insertassinfoitem.AISpecificationtype = assinfoitem.AModel;//型号 - insertassinfoitem.AIManufacturer = assinfoitem.AManufacturer;//厂家 - insertassinfoitem.AIUse = assinfoitem.AUse;//用途 - insertassinfoitem.AISpecification = assinfoitem.ASpecification;//规格 - insertassinfoitem.AIASSName = assitemapp.AAIName; - insertassinfoitem.AIIStorageId = assitemapp.AAIStorageId; - insertassinfoitem.AIAssType = assinfoapp.AAAssType; - insertassinfoitem.AIIStoragePosition = assitemapp.AAIStoragePosition; - insertassinfoitem.AIIsInStorage = true; - insertassinfoitem.AISpecification = assitemapp.AAISpecification; - insertassinfoitem.AIASSClass = insertAss_AssetsInfo.ATId; - insertassinfoitem.AIUse = assitemapp.AAIUse; - db.Insert(insertassinfoitem); - //出入库明细表 - Ass_AssetsChangeItemEntity ass_assetschangeitem = new Ass_AssetsChangeItemEntity(); - ass_assetschangeitem.Create(); - ass_assetschangeitem.AIId = insertassinfoitem.AIId; - ass_assetschangeitem.ACId = ac.ACId; - ass_assetschangeitem.ACOldStock = i; - ass_assetschangeitem.AAmount = 1; - ass_assetschangeitem.ACNewStock = ass_assetschangeitem.ACOldStock + 1; - ass_assetschangeitem.ACTime = DateTime.Now; - ass_assetschangeitem.ACUserId = assinfoapp.AACreateUserId; - ass_assetschangeitem.ACInOrOut = true; - ass_assetschangeitem.ACReasonType = "14"; - ass_assetschangeitem.ACCStorageId = assitemapp.AAIStorageId; - ass_assetschangeitem.ACCStoragePosition = assitemapp.AAIStoragePosition; - db.Insert(ass_assetschangeitem); - } - } - else - { - //登记造册 - Ass_AssetsInfoEntity insertAss_AssetsInfo = new Ass_AssetsInfoEntity(); - insertAss_AssetsInfo.Create(); - insertAss_AssetsInfo.ACode = asstypeinfo.ATCode + "_" + assitemapp.AAICode; - insertAss_AssetsInfo.AName = assitemapp.AAIName; - insertAss_AssetsInfo.ATId = assitemapp.AAITId; - insertAss_AssetsInfo.AEName = assitemapp.AAIEName; - insertAss_AssetsInfo.APhoto = assitemapp.AAIPhoto; - insertAss_AssetsInfo.AContent = assitemapp.AAIContent; - insertAss_AssetsInfo.AOrder = assitemapp.AAIOrder; - insertAss_AssetsInfo.AModel = assitemapp.AAIModel; - insertAss_AssetsInfo.AManufacturer = assitemapp.AAIManufacturer; - insertAss_AssetsInfo.AAssType = assinfoapp.AAAssType; - insertAss_AssetsInfo.ASupplierId = assitemapp.AAISupplierId; - insertAss_AssetsInfo.ASource = assitemapp.AAISource; - insertAss_AssetsInfo.APrice = assitemapp.AAIPrice; - insertAss_AssetsInfo.AStock = assitemapp.AAIStock; - insertAss_AssetsInfo.AUnit = assitemapp.AAIUnit; - insertAss_AssetsInfo.HasDetail = assitemapp.AAIHasDetail; - insertAss_AssetsInfo.ASpecification = assitemapp.AAISpecification; - insertAss_AssetsInfo.AUse = assitemapp.AAIUse; - db.Insert(insertAss_AssetsInfo); - //资产明细 - Ass_AssetsInfoItemEntity insertassinfoitem = new Ass_AssetsInfoItemEntity(); - insertassinfoitem.Create(); - insertassinfoitem.AId = insertAss_AssetsInfo.AId; - insertassinfoitem.AICodeNum = 1; - insertassinfoitem.AICode = insertAss_AssetsInfo.ACode + "_" + insertassinfoitem.AICodeNum.ToString(); - insertassinfoitem.AICodeNumJY = insertAss_AssetsInfo.ACode + "_" + insertassinfoitem.AICodeNum.ToString(); - insertassinfoitem.AIAssValue = assinfoitem.APrice;//价值 - insertassinfoitem.AIUnits = assinfoitem.AUnit;//单位 - insertassinfoitem.AISpecificationtype = assinfoitem.AModel;//型号 - insertassinfoitem.AIManufacturer = assinfoitem.AManufacturer;//厂家 - insertassinfoitem.AIUse = assinfoitem.AUse;//用途 - insertassinfoitem.AISpecification = assinfoitem.ASpecification;//规格 - insertassinfoitem.AIASSName = assitemapp.AAIName; - insertassinfoitem.AIIStorageId = assitemapp.AAIStorageId; - insertassinfoitem.AIAssType = assinfoapp.AAAssType; - insertassinfoitem.AIIStoragePosition = assitemapp.AAIStoragePosition; - insertassinfoitem.AIIsInStorage = true; - insertassinfoitem.AIASSClass = insertAss_AssetsInfo.ATId; - insertassinfoitem.AISpecification = assitemapp.AAISpecification; - insertassinfoitem.AIUse = assitemapp.AAIUse; - db.Insert(insertassinfoitem); - //出入库明细表 - Ass_AssetsChangeItemEntity ass_assetschangeitem = new Ass_AssetsChangeItemEntity(); - ass_assetschangeitem.Create(); - ass_assetschangeitem.AIId = insertassinfoitem.AIId; - ass_assetschangeitem.ACId = ac.ACId; - ass_assetschangeitem.ACOldStock = 0; - ass_assetschangeitem.AAmount = assitemapp.AAIStock; - ass_assetschangeitem.ACNewStock = ass_assetschangeitem.ACOldStock + assitemapp.AAIStock; - ass_assetschangeitem.ACTime = DateTime.Now; - ass_assetschangeitem.ACUserId = assinfoapp.AACreateUserId; - ass_assetschangeitem.ACInOrOut = true; - ass_assetschangeitem.ACReasonType = "14"; - ass_assetschangeitem.ACCStorageId = assitemapp.AAIStorageId; - ass_assetschangeitem.ACCStoragePosition = assitemapp.AAIStoragePosition; - db.Insert(ass_assetschangeitem); - } - } + db.Insert(acc); } + + } BaseRepository().ExecuteBySql("update Ass_AssetsInfoApply set AAStatus=" + status + " where AAProcessId='" + processId + "'", null); db.Commit();