@@ -58,7 +58,15 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers | |||
{ | |||
return View(); | |||
} | |||
/// <summary> | |||
/// 明细删除 | |||
/// <summary> | |||
/// <returns></returns> | |||
[HttpGet] | |||
public ActionResult FormDelete() | |||
{ | |||
return View(); | |||
} | |||
#endregion | |||
#region 获取数据 | |||
@@ -104,6 +112,22 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers | |||
return Success(jsonData); | |||
} | |||
/// <summary> | |||
/// 获取表单数据 | |||
/// </summary> | |||
/// <param name="keyValue">主键</param> | |||
/// <returns></returns> | |||
[HttpGet] | |||
[AjaxOnly] | |||
public ActionResult GetFormDataEdit(string keyValue) | |||
{ | |||
var TextBookInOutData = textBookInOutIBLL.GetKCEntity(keyValue); | |||
var jsonData = new | |||
{ | |||
TextBookInOut = TextBookInOutData, | |||
}; | |||
return Success(jsonData); | |||
} | |||
#endregion | |||
@@ -92,8 +92,7 @@ var bootstrap = function ($, learun) { | |||
}, | |||
initData: function () { | |||
if (!!keyValue) { | |||
$.lrSetForm(top.$.rootUrl + '/EducationalAdministration/TextBookIn/GetFormData?keyValue=' + keyValue, function (data) { | |||
console.log(data); | |||
$.lrSetForm(top.$.rootUrl + '/EducationalAdministration/TextBookIn/GetFormDataEdit?keyValue=' + keyValue, function (data) { | |||
for (var id in data) { | |||
if (!!data[id].length && data[id].length > 0) { | |||
$('#' + id).jfGridSet('refreshdata', data[id]); | |||
@@ -0,0 +1,55 @@ | |||
@{ | |||
ViewBag.Title = "教材库存表"; | |||
Layout = "~/Views/Shared/_Form.cshtml"; | |||
} | |||
<div class="lr-form-wrap"> | |||
<div class="col-xs-6 lr-form-item" data-table="TextBookInOut"> | |||
<div class="lr-form-item-title">库存单</div> | |||
<input id="BookCode" type="text" class="form-control" readonly /> | |||
</div> | |||
<div class="col-xs-6 lr-form-item" data-table="TextBookInOut"> | |||
<div class="lr-form-item-title">课程</div> | |||
<div id="LessonNo" isvalid="yes" checkexpession="NotNull" readonly></div> | |||
</div> | |||
<div class="col-xs-12 lr-form-item" data-table="TextBookInOut"> | |||
<div class="lr-form-item-title">所选书籍</div> | |||
<input id="TextBookName" type="text" class="form-control" readonly /> | |||
</div> | |||
<div class="col-xs-6 lr-form-item" data-table="TextBookInOut"> | |||
<div class="lr-form-item-title">出版号</div> | |||
<input id="PublishNo" type="text" class="form-control" readonly /> | |||
</div> | |||
<div class="col-xs-6 lr-form-item" data-table="TextBookInOut"> | |||
<div class="lr-form-item-title">作者</div> | |||
<input id="FirstAuthor" type="text" class="form-control" readonly /> | |||
</div> | |||
<div class="col-xs-6 lr-form-item" data-table="TextBookInOut"> | |||
<div class="lr-form-item-title">其他作者</div> | |||
<input id="OtherAuthor" type="text" class="form-control" readonly /> | |||
</div> | |||
<div class="col-xs-6 lr-form-item" data-table="TextBookInOut"> | |||
<div class="lr-form-item-title">出版社</div> | |||
<input id="Publisher" type="text" class="form-control" readonly /> | |||
</div> | |||
<div class="col-xs-6 lr-form-item" data-table="TextBookInOut"> | |||
<div class="lr-form-item-title">版次</div> | |||
<input id="Edition" type="text" class="form-control" readonly /> | |||
</div> | |||
<div class="col-xs-6 lr-form-item" data-table="TextBookInOut"> | |||
<div class="lr-form-item-title">当前库存</div> | |||
<input id="FinallyNum" type="text" class="form-control" readonly /> | |||
</div> | |||
<div class="col-xs-12 lr-form-item" data-table="TextBookInOut"> | |||
<div class="lr-form-item-title">备注</div> | |||
<textarea id="Remark" class="form-control" style="height: 100px;" readonly></textarea> | |||
</div> | |||
<div class="col-xs-12 lr-form-item"> | |||
<div class="lr-form-item-title">明细操作</div> | |||
@*<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"> | |||
<div id="TextBookIn"></div> | |||
</div> | |||
</div> | |||
@Html.AppendJsFile("/Areas/EducationalAdministration/Views/TextBookIn/FormDelete.js") |
@@ -0,0 +1,131 @@ | |||
/* * 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架(http://www.learun.cn) | |||
* Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 | |||
* 创建人:超级管理员 | |||
* 日 期:2022-03-02 10:37 | |||
* 描 述:教材库存表 | |||
*/ | |||
var acceptClick; | |||
var keyValue = request('keyValue'); | |||
var DelkeyValue = request('DelkeyValue'); | |||
// 设置权限 | |||
var setAuthorize; | |||
// 设置表单数据 | |||
var setFormData; | |||
// 验证数据是否填写完整 | |||
var validForm; | |||
// 保存数据 | |||
var save; | |||
var selectedRow; | |||
var refreshGirdData; | |||
var tempdatra = new Array(); | |||
var bootstrap = function ($, learun) { | |||
"use strict"; | |||
// 设置权限 | |||
setAuthorize = function (data) { | |||
}; | |||
var page = { | |||
init: function () { | |||
$('.lr-form-wrap').lrscroll(); | |||
page.bind(); | |||
page.initData(); | |||
}, | |||
bind: function () { | |||
$('#LessonNo').lrDataSourceSelect({ code: 'LessonInfo', value: 'lessonno', text: 'lessonname' }); | |||
$('#TextBookIn').jfGrid({ | |||
headData: [ | |||
{ label: '入库单', name: 'BookCode', width: 180, align: 'left' }, | |||
{ label: '入库数量', name: 'variate', width: 100, align: 'left' }, | |||
{ label: '入库时间', name: 'CreateTime', width: 200, align: 'left' }, | |||
{ label: '入库用户', name: 'CrateUserID', width: 100, align: 'left' }, | |||
{ label: '备注', name: 'Remark', width: 100, align: 'left' }, | |||
], | |||
height: 400, | |||
mainId: 'CreateTime desc', | |||
reloadSelected: false, | |||
}); | |||
$("#detaildel").on('click', function () { | |||
var NewkeyValue = $('#TextBookIn').jfGridValue('ID'); | |||
if (learun.checkrow(NewkeyValue)) { | |||
learun.layerConfirm('是否确认删除该项!', function (res, index) { | |||
if (res) { | |||
learun.deleteForm(top.$.rootUrl + '/EducationalAdministration/TextBookIn/DeleteForm', { keyValue: NewkeyValue }, function () { | |||
refreshGirdData(); | |||
learun.layerClose(window.name); | |||
}); | |||
} | |||
}); | |||
} | |||
}); | |||
}, | |||
initData: function () { | |||
if (!!keyValue) { | |||
$.lrSetForm(top.$.rootUrl + '/EducationalAdministration/TextBookIn/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]); | |||
} | |||
} | |||
}); | |||
} | |||
} | |||
}; | |||
refreshGirdData = function (temprow) { | |||
var ifnewrow = true; | |||
$.each(tempdatra, function (key, val) { | |||
if (tempdatra[key].BookCode === temprow.InOutBook) { | |||
tempdatra[key] = temprow; | |||
ifnewrow = false; | |||
} | |||
}); | |||
if (ifnewrow) { | |||
tempdatra.push(temprow); | |||
} | |||
$('#TextBookIn').jfGridSet('refreshdata', tempdatra); | |||
}; | |||
// 设置表单数据 | |||
setFormData = function (processId, param, callback) { | |||
if (!!processId) { | |||
$.lrSetForm(top.$.rootUrl + '/EducationalAdministration/TextBookIn/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 == 'TextBookIn' && data[id]) { | |||
keyValue = data[id].ID; | |||
} | |||
$('[data-table="' + id + '"]').lrSetFormData(data[id]); | |||
} | |||
} | |||
}); | |||
} | |||
} | |||
// 验证数据是否填写完整 | |||
validForm = function () { | |||
var datas = $('#TextBookIn').jfGridGet('rowdatas'); | |||
if (datas == null || datas.length == 0) { | |||
learun.alert.warning("申请未包含入库申请!请先添加入库申请!"); | |||
return false; | |||
} | |||
return true; | |||
}; | |||
// 保存数据 | |||
save = function (callBack) { | |||
var postData = {}; | |||
var formData = $('[data-table="TextBookInOut"]').lrGetFormData(); | |||
postData.strEntity = JSON.stringify(formData); | |||
postData.strTextBookInList = JSON.stringify($('#TextBookIn').jfGridGet('rowdatas')); | |||
$.lrSaveForm(top.$.rootUrl + '/EducationalAdministration/TextBookIn/SaveForm?keyValue=' + keyValue, postData, function (res) { | |||
// 保存成功后才回调 | |||
if (!!callBack) { | |||
callBack(); | |||
} | |||
}); | |||
}; | |||
page.init(); | |||
} |
@@ -25,6 +25,7 @@ | |||
<div class=" btn-group btn-group-sm" learun-authorize="yes"> | |||
<a id="lr_edit" class="btn btn-default"><i class="fa fa-pencil-square-o"></i> 教材入库</a> | |||
<a id="lr_view" class="btn btn-default"><i class="fa fa-pencil-square-o"></i> 教材明细查看</a> | |||
<a id="lr_delete" class="btn btn-default"><i class="fa fa-trash-o"></i> 删除明细</a> | |||
</div> | |||
</div> | |||
</div> | |||
@@ -59,6 +59,20 @@ var bootstrap = function ($, learun) { | |||
}); | |||
} | |||
}); | |||
// 删除 | |||
$('#lr_delete').on('click', function () { | |||
var keyValue = $('#gridtable').jfGridValue('ID'); | |||
if (learun.checkrow(keyValue)) { | |||
learun.layerForm({ | |||
id: 'formdelete', | |||
title: '删除明细', | |||
url: top.$.rootUrl + '/EducationalAdministration/TextBookIn/FormDelete?keyValue=' + keyValue, | |||
width: 1000, | |||
height: 700, | |||
btn: null, | |||
}); | |||
} | |||
}); | |||
}, | |||
// 初始化列表 | |||
initGird: function () { | |||
@@ -79,7 +79,6 @@ var bootstrap = function ($, learun) { | |||
initData: function () { | |||
if (!!keyValue) { | |||
$.lrSetForm(top.$.rootUrl + '/EducationalAdministration/TextBookInOut/GetFormData?keyValue=' + keyValue, function (data) { | |||
console.log(data); | |||
for (var id in data) { | |||
if (!!data[id].length && data[id].length > 0) { | |||
$('#' + id).jfGridSet('refreshdata', data[id]); | |||
@@ -10,7 +10,6 @@ var bootstrap = function ($, learun) { | |||
var page = { | |||
init: function () { | |||
page.initGird(); | |||
console.log(223223223); | |||
page.bind(); | |||
}, | |||
bind: function () { | |||
@@ -1178,6 +1178,7 @@ | |||
<Content Include="Areas\EducationalAdministration\Views\TextBookIndent\FormLook.js" /> | |||
<Content Include="Areas\EducationalAdministration\Views\TextBookIndent\FormDetail.js" /> | |||
<Content Include="Areas\EducationalAdministration\Views\TextBookIndent\FormView.js" /> | |||
<Content Include="Areas\EducationalAdministration\Views\TextBookIn\FormDelete.js" /> | |||
<Content Include="Areas\EducationalAdministration\Views\TextBookIn\FormView.js" /> | |||
<Content Include="Areas\EducationalAdministration\Views\TextBookIn\Form.js" /> | |||
<Content Include="Areas\EducationalAdministration\Views\TextBookIn\FormIn.cshtml" /> | |||
@@ -7615,6 +7616,7 @@ | |||
<Content Include="Areas\EducationalAdministration\Views\TextBookIndent\FormLook.cshtml" /> | |||
<Content Include="Areas\EducationalAdministration\Views\TextBookIn\Form.cshtml" /> | |||
<Content Include="Areas\EducationalAdministration\Views\TextBookIn\FormView.cshtml" /> | |||
<Content Include="Areas\EducationalAdministration\Views\TextBookIn\FormDelete.cshtml" /> | |||
<None Include="Properties\PublishProfiles\CustomProfile.pubxml" /> | |||
<None Include="Properties\PublishProfiles\FolderProfile.pubxml" /> | |||
<Content Include="Views\Login\Default-beifen.cshtml" /> | |||
@@ -115,12 +115,42 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
/// <param name="keyValue">主键</param> | |||
public void DeleteEntity(string keyValue) | |||
{ | |||
var db = this.BaseRepository("CollegeMIS").BeginTrans(); | |||
try | |||
{ | |||
this.BaseRepository("CollegeMIS").Delete<TextBookInEntity>(t => t.ID == keyValue); | |||
decimal? Num = 0; | |||
var keyValueArr = keyValue.Split(','); | |||
foreach (var item in keyValueArr) | |||
{ | |||
var entity = BaseRepository("CollegeMIS").FindEntity<TextBookInEntity>(x => x.ID == item); | |||
if (entity != null) | |||
{ | |||
Num += entity.variate; | |||
var InOutEntity = db.FindEntity<TextbookInOutEntity>(x => x.BookCode == entity.InOutCode); | |||
if (InOutEntity != null) | |||
{ | |||
InOutEntity.FinallyNum = InOutEntity.FinallyNum - Num; | |||
if (InOutEntity.FinallyNum == 0 || InOutEntity.FinallyNum > 0) | |||
{ | |||
db.Delete(entity); | |||
db.Update(InOutEntity); | |||
} | |||
else | |||
{ | |||
db.Rollback(); | |||
} | |||
} | |||
else | |||
{ | |||
db.Rollback(); | |||
} | |||
} | |||
} | |||
db.Commit(); | |||
} | |||
catch (Exception ex) | |||
{ | |||
db.Rollback(); | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||