@@ -10,10 +10,10 @@ | |||
<div class="lr-form-item-title">申请单号</div> | |||
<input id="Code" type="text" class="form-control" readonly="readonly" /> | |||
</div> | |||
<div class="col-xs-12 lr-form-item" data-table="Ass_AcceptanceMain"> | |||
@*<div class="col-xs-12 lr-form-item" data-table="Ass_AcceptanceMain"> | |||
<div class="lr-form-item-title">申请名称</div> | |||
<input id="Name" type="text" class="form-control" /> | |||
</div> | |||
</div>*@ | |||
<div class="col-xs-12 lr-form-item" data-table="Ass_AcceptanceMain"> | |||
<div class="lr-form-item-title">总价</div> | |||
@@ -30,7 +30,7 @@ | |||
<div class="col-xs-12 lr-form-item"> | |||
<div class="lr-form-item-title">明细操作</div> | |||
<input id="detailadd" type="button" class="btn btn-success" value="新增明细" /> | |||
@*<input id="detailedit" type="button" class="btn btn-warning" value="编辑明细" />*@ | |||
<input id="detailedit" type="button" class="btn btn-warning" value="编辑明细" /> | |||
<input id="detaildel" type="button" class="btn btn-danger" value="移除明细" /> | |||
</div> | |||
<div class="col-xs-12 lr-form-item lr-form-item-grid"> | |||
@@ -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") ? "<i class=\"fa fa-toggle-on\"></i>" : "<i class=\"fa fa-toggle-off\"></i>"; | |||
} | |||
}, | |||
{ | |||
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 '<span class=\"label label-warning\">审批中</span>'; | |||
// // } else if (cellvalue === '2') { | |||
// // return '<span class=\"label label-success\">已审核</span>'; | |||
// // } else { | |||
// // return '<span class=\"label label-default\" >草稿</span>'; | |||
// // } | |||
// // } | |||
// //}, | |||
// { 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)); | |||
@@ -3,53 +3,69 @@ | |||
Layout = "~/Views/Shared/_Form.cshtml"; | |||
} | |||
<div class="lr-form-wrap" id="form"> | |||
<div class="col-xs-12 lr-form-item" data-table="Ass_Acceptance" > | |||
<div class="lr-form-item-title">选择已登记资产</div> | |||
<div id="AAOldCode"></div> | |||
<div class="col-xs-6 lr-form-item" data-table="Ass_Acceptance"> | |||
<div class="lr-form-item-title">资产编号<font face="宋体">*</font></div> | |||
<input id="AAICode" type="text" class="form-control" isvalid="yes" checkexpession="NotNull" /> | |||
</div> | |||
<div class="col-xs-12 lr-form-item" data-table="Ass_Acceptance" > | |||
<div class="lr-form-item-title">设备名称<font face="宋体">*</font></div> | |||
<input id="Name" type="text" class="form-control" isvalid="yes" checkexpession="NotNull"/> | |||
<div class="col-xs-6 lr-form-item" data-table="Ass_Acceptance"> | |||
<div class="lr-form-item-title">资产名称</div> | |||
<input id="AAIName" type="text" class="form-control" /> | |||
</div> | |||
<div class="col-xs-12 lr-form-item" data-table="Ass_Acceptance" > | |||
<div class="lr-form-item-title">品牌</div> | |||
<input id="Manufacturer" type="text" class="form-control" /> | |||
<div class="col-xs-6 lr-form-item" data-table="Ass_Acceptance"> | |||
<div class="lr-form-item-title">资产类别</div> | |||
<div id="AAITId"></div> | |||
</div> | |||
<div class="col-xs-12 lr-form-item" data-table="Ass_Acceptance" > | |||
<div class="lr-form-item-title">规格型号</div> | |||
<input id="Model" type="text" class="form-control" /> | |||
<div class="col-xs-6 lr-form-item" data-table="Ass_Acceptance"> | |||
<div class="lr-form-item-title">资产来源</div> | |||
<div id="AAISource"></div> | |||
</div> | |||
<div class="col-xs-12 lr-form-item" data-table="Ass_Acceptance" > | |||
<div class="col-xs-6 lr-form-item" data-table="Ass_Acceptance"> | |||
<div class="lr-form-item-title">单位</div> | |||
<input id="Unit" type="text" class="form-control" /> | |||
<div id="AAIUnit"></div> | |||
</div> | |||
<div class="col-xs-12 lr-form-item" data-table="Ass_Acceptance" > | |||
<div class="col-xs-6 lr-form-item" data-table="Ass_Acceptance"> | |||
<div class="lr-form-item-title">数量<font face="宋体">*</font></div> | |||
<input id="Stock" type="text" class="form-control" isvalid="yes" checkexpession="NotNull" /> | |||
<input id="AAIStock" type="number" class="form-control" isvalid="yes" checkexpession="NotNull" /> | |||
</div> | |||
<div class="col-xs-12 lr-form-item" data-table="Ass_Acceptance" > | |||
<div class="col-xs-6 lr-form-item" data-table="Ass_Acceptance"> | |||
<div class="lr-form-item-title">单价<font face="宋体">*</font></div> | |||
<input id="Price" type="text" class="form-control" isvalid="yes" checkexpession="NotNull"/> | |||
<input id="AAIPrice" type="number" class="form-control" isvalid="yes" checkexpession="NotNull" /> | |||
</div> | |||
<div class="col-xs-12 lr-form-item" data-table="Ass_Acceptance" > | |||
<div class="lr-form-item-title">总价</div> | |||
<input id="TotalPrice" type="text" class="form-control" readonly="readonly"/> | |||
<div class="col-xs-6 lr-form-item" data-table="Ass_Acceptance"> | |||
<div class="lr-form-item-title">生成资产明细</div> | |||
<div id="AAIHasDetail"></div> | |||
</div> | |||
<div class="col-xs-12 lr-form-item" data-table="Ass_Acceptance" > | |||
<div class="lr-form-item-title">使用部门</div> | |||
<div id="DepartmentId" ></div> | |||
<div class="col-xs-6 lr-form-item" data-table="Ass_Acceptance"> | |||
<div class="lr-form-item-title">库房</div> | |||
<div id="AAIStorageId"></div> | |||
</div> | |||
<div class="col-xs-12 lr-form-item" data-table="Ass_Acceptance" > | |||
<div class="lr-form-item-title">使用人</div> | |||
<div id="UserID" ></div> | |||
<div class="col-xs-6 lr-form-item" data-table="Ass_Acceptance"> | |||
<div class="lr-form-item-title">库位</div> | |||
<div id="AAIStoragePosition"></div> | |||
</div> | |||
<div class="col-xs-12 lr-form-item" data-table="Ass_Acceptance" > | |||
<div class="lr-form-item-title">放置地点</div> | |||
<input id="Place" type="text" class="form-control" /> | |||
<div class="col-xs-6 lr-form-item" data-table="Ass_Acceptance"> | |||
<div class="lr-form-item-title">英文名称</div> | |||
<input id="AAIEName" type="text" class="form-control" /> | |||
</div> | |||
<div class="col-xs-12 lr-form-item" data-table="Ass_Acceptance" > | |||
<div class="lr-form-item-title">备注</div> | |||
<textarea id="Remark" class="form-control" style="height:100px;" ></textarea> | |||
<div class="col-xs-6 lr-form-item" data-table="Ass_Acceptance"> | |||
<div class="lr-form-item-title">资产型号</div> | |||
<input id="AAIModel" type="text" class="form-control" /> | |||
</div> | |||
<div class="col-xs-6 lr-form-item" data-table="Ass_Acceptance"> | |||
<div class="lr-form-item-title">生产厂家</div> | |||
<input id="AAIManufacturer" type="text" class="form-control" /> | |||
</div> | |||
<div class="col-xs-6 lr-form-item" data-table="Ass_Acceptance"> | |||
<div class="lr-form-item-title">资产规格</div> | |||
<input id="AAISpecification" type="text" class="form-control" /> | |||
</div> | |||
<div class="col-xs-6 lr-form-item" data-table="Ass_Acceptance"> | |||
<div class="lr-form-item-title">用途</div> | |||
<input id="AAIUse" type="text" class="form-control" /> | |||
</div> | |||
<div class="col-xs-6 lr-form-item" data-table="Ass_Acceptance"> | |||
<div class="lr-form-item-title">供应商</div> | |||
<div id="AAISupplierId"></div> | |||
</div> | |||
</div> | |||
@Html.AppendJsFile("/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(); | |||
} |
@@ -10,10 +10,10 @@ | |||
<div class="lr-form-item-title">申请单号</div> | |||
<input id="Code" type="text" class="form-control" readonly="readonly" /> | |||
</div> | |||
<div class="col-xs-12 lr-form-item" data-table="Ass_AcceptanceMain"> | |||
@*<div class="col-xs-12 lr-form-item" data-table="Ass_AcceptanceMain"> | |||
<div class="lr-form-item-title">申请名称</div> | |||
<input id="Name" type="text" class="form-control" readonly/> | |||
</div> | |||
</div>*@ | |||
<div class="col-xs-12 lr-form-item" data-table="Ass_AcceptanceMain"> | |||
<div class="lr-form-item-title">总价</div> | |||
@@ -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") ? "<i class=\"fa fa-toggle-on\"></i>" : "<i class=\"fa fa-toggle-off\"></i>"; | |||
} | |||
}, | |||
{ | |||
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, | |||
@@ -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" }, | |||
{ | |||
@@ -30,17 +30,17 @@ namespace Learun.Application.TwoDevelopment.AssetManagementSystem | |||
[Column("AAICODE")] | |||
public string AAICode { get; set; } | |||
/// <summary> | |||
/// AAIName | |||
/// 资产名称 | |||
/// </summary> | |||
[Column("AAINAME")] | |||
public string AAIName { get; set; } | |||
/// <summary> | |||
/// AAITId | |||
/// 资产类别 | |||
/// </summary> | |||
[Column("AAITID")] | |||
public string AAITId { get; set; } | |||
/// <summary> | |||
/// AAIEName | |||
/// 英文名称 | |||
/// </summary> | |||
[Column("AAIENAME")] | |||
public string AAIEName { get; set; } | |||
@@ -60,38 +60,38 @@ namespace Learun.Application.TwoDevelopment.AssetManagementSystem | |||
[Column("AAIORDER")] | |||
public int? AAIOrder { get; set; } | |||
/// <summary> | |||
/// AAIModel | |||
/// 资产型号 | |||
/// </summary> | |||
[Column("AAIMODEL")] | |||
public string AAIModel { get; set; } | |||
/// <summary> | |||
/// AAIManufacturer | |||
/// 生产厂家 | |||
/// </summary> | |||
[Column("AAIMANUFACTURER")] | |||
public string AAIManufacturer { get; set; } | |||
/// <summary> | |||
/// AAISupplierId | |||
/// 供应商 | |||
/// </summary> | |||
[Column("AAISUPPLIERID")] | |||
public string AAISupplierId { get; set; } | |||
/// <summary> | |||
/// AAISource | |||
/// 资产来源 | |||
/// </summary> | |||
[Column("AAISOURCE")] | |||
public string AAISource { get; set; } | |||
/// <summary> | |||
/// AAIPrice | |||
/// 单价 | |||
/// </summary> | |||
[Column("AAIPRICE")] | |||
public decimal? AAIPrice { get; set; } | |||
/// <summary> | |||
/// AAISTOCK | |||
/// 数量 | |||
/// </summary> | |||
[Column("AAISTOCK")] | |||
public decimal? AAIStock { get; set; } | |||
/// <summary> | |||
/// AAIUNIT | |||
/// 单位 | |||
/// </summary> | |||
[Column("AAIUNIT")] | |||
public string AAIUnit { get; set; } | |||
@@ -106,6 +106,11 @@ namespace Learun.Application.TwoDevelopment.AssetManagementSystem | |||
/// </summary> | |||
[Column("AISCHECK")] | |||
public bool? AIsCheck { get; set; } | |||
/// <summary> | |||
/// AAIHasDetail | |||
/// </summary> | |||
[Column("AAIHASDETAIL")] | |||
public bool? AAIHasDetail { get; set; } | |||
/// <summary> | |||
/// AResult | |||
@@ -117,12 +122,28 @@ namespace Learun.Application.TwoDevelopment.AssetManagementSystem | |||
/// </summary> | |||
[Column("AREMARK")] | |||
public string ARemark { get; set; } | |||
/// <summary> | |||
/// AAddress | |||
/// </summary> | |||
[Column("AADDRESS")] | |||
public string AAddress { get; set; } | |||
/// <summary> | |||
/// 库房 | |||
/// </summary> | |||
[Column("AAISTORAGEID")] | |||
public string AAIStorageId { get; set; } | |||
/// <summary> | |||
/// 库位 | |||
/// </summary> | |||
[Column("AAISTORAGEPOSITION")] | |||
public string AAIStoragePosition { get; set; } | |||
/// <summary> | |||
/// 资产规格 | |||
/// </summary> | |||
[Column("AAISPECIFICATION")] | |||
public string AAISpecification { get; set; } | |||
/// <summary> | |||
/// 资产用途 | |||
/// </summary> | |||
[Column("AAIUSE")] | |||
public string AAIUse { get; set; } | |||
#endregion | |||
@@ -29,6 +29,12 @@ namespace Learun.Application.TwoDevelopment.AssetManagementSystem | |||
/// </summary> | |||
[Column("NAME")] | |||
public string Name { get; set; } | |||
/// <summary> | |||
/// 资产类别 | |||
/// </summary> | |||
[Column("ASSTYPE")] | |||
public int? AssType { get; set; } | |||
/// <summary> | |||
/// CreateTime | |||
/// </summary> | |||
@@ -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<Ass_AcceptanceMainEntity>(a => a.ProcessId == parameterProcessId); | |||
if (null != entity) | |||
entity.Status = p1; | |||
db.Update(entity); | |||
if (p1 == 2) | |||
{ | |||
entity.Status = p1; | |||
//登记在册 | |||
var assinfo = db.FindList<Ass_AssetsInfoEntity>(); | |||
//验收明细 | |||
var itemList = db.FindList<Ass_AcceptanceEntity>(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<Ass_AssetsInfoItemEntity>(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<Ass_AssetsInfoItemEntity>(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<Ass_AssetsTypeEntity>(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); | |||
} | |||
} | |||
@@ -272,8 +272,6 @@ namespace Learun.Application.TwoDevelopment.AssetManagementSystem | |||
//审批通过操作 | |||
if (status == 2) | |||
{ | |||
//登记在册 | |||
var assinfo = db.FindList<Ass_AssetsInfoEntity>(); | |||
//读入库申请记录 | |||
var assinfoapp = db.FindEntity<Ass_AssetsInfoApplyEntity>(m => m.AAProcessId == processId); | |||
var assPurchase = db.FindEntity<Ass_PurchaseEntity>(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<Ass_AssetsInfoItemApplyEntity>(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<Ass_AssetsInfoItemEntity>(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<Ass_AssetsInfoItemEntity>(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<Ass_AssetsTypeEntity>(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(); | |||