You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

444 lines
18 KiB

  1. 
  2. @{
  3. ViewBag.Title = "Index";
  4. Layout = "~/Views/Shared/_Index.cshtml";
  5. }
  6. <style>
  7. .btn-primary {
  8. margin-right: 2px;
  9. }
  10. </style>
  11. <script src="~/Content/js/datepicker/WdatePicker.js"></script>
  12. <script>
  13. $(document).ready(function () {
  14. $("input.cell").keyup(function (e) {
  15. switch (e.keyCode) {
  16. // up arrow
  17. case 40:
  18. $(this).parent()
  19. .parent()
  20. .next()
  21. .children("td")
  22. .children("input.cell[name="
  23. + $(this).attr("name") + "]")
  24. .focus();
  25. break;
  26. // down arrow
  27. case 38:
  28. $(this).parent()
  29. .parent()
  30. .prev()
  31. .children("td")
  32. .children("input.cell[name="
  33. + $(this).attr("name") + "]")
  34. .focus();
  35. break;
  36. }
  37. });
  38. });</script>
  39. <script>
  40. var _Clos = new Array();
  41. var _Closs = new Array();
  42. $(function () {
  43. SetCols();
  44. gridList();
  45. })
  46. //动态加载列
  47. function SetCols() {
  48. $.ajax({
  49. url: "/Print/SelectColumnName?" + Math.random(),
  50. dataType: "json",
  51. async: false,
  52. success: function (data) {
  53. var cols = new Array();
  54. var collast = { label: "主键", name: "ID", hidden: true, key: true };
  55. cols.push(collast);
  56. var collast = { label: "领料单号", name: "ApplyCode", width: 150, align: 'left' };
  57. cols.push(collast);
  58. var collast = { label: "领料单行号", name: "Sequence", width: 150, align: 'left' };
  59. cols.push(collast);
  60. var collast = { label: '料品编码', name: 'InvCode', width: 100, align: 'left' };
  61. cols.push(collast);
  62. var collast = { label: '数量', name: 'Quantity', width: 100, align: 'left' };
  63. cols.push(collast);
  64. var collast = { label: '已领数量', name: 'IssueQuantity', width: 100, align: 'left' };
  65. cols.push(collast);
  66. var collast = { label: '备注', name: 'EATTRIBUTE5', hidden: true };
  67. cols.push(collast);
  68. var collast = { label: '操作人名称', name: 'MUSERName', width: 150, align: 'left' };
  69. cols.push(collast);
  70. var collast = { label: '操作时间', name: 'MTIME', width: 150, align: 'left' };
  71. cols.push(collast);
  72. var collast = { label: '自由项唯一标识', name: 'ExtensionID', hidden: true };
  73. cols.push(collast);
  74. if (data != null && data.length > 0) {
  75. DateList = data;
  76. for (var i = 0; i < data.length; i++) {
  77. var ColName = data[i].ColName;
  78. var ColCode = data[i].ColCode;
  79. var obj = new Array();
  80. obj = {
  81. label: ColName,
  82. name: ColCode,
  83. width: 80,
  84. align: "left"
  85. }
  86. cols.push(obj);
  87. }
  88. }
  89. $.ajax({
  90. url: "/Print/SelectTableColumnName?" + Math.random(),
  91. dataType: "json",
  92. async: false,
  93. success: function (data) {
  94. if (data != null && data.length > 0) {
  95. DateList = data;
  96. for (var i = 0; i < data.length; i++) {
  97. var TableCode = data[i].TableCode;
  98. if (TableCode == "ICSMOApplyNegDetail") {
  99. var Code = data[i].Code;
  100. var Name = data[i].Name;
  101. var obj = new Array();
  102. obj = {
  103. label: Name,
  104. name: Code,
  105. width: 80,
  106. align: "left"
  107. }
  108. cols.push(obj);
  109. }
  110. }
  111. }
  112. _Closs = cols;
  113. //_Clos1 = cols1;
  114. }
  115. });
  116. _Clos = cols;
  117. }
  118. });
  119. }
  120. //绑定动态列
  121. function gridList() {
  122. var $gridList = $("#gridList");
  123. var queryJson = {
  124. POCode: $("#txt_POCode").val(),
  125. InvCode: $("#txt_InvCode").val(),
  126. TimeFrom: $("#TimeFrom").val(),
  127. TimeArrive: $("#TimeArrive").val(),
  128. CreatedBy: $("#txt_CreatedBy").val(),
  129. }
  130. $gridList.dataGrid({
  131. url: "/DHAY/ICSAccessoriesMOApply/GetICSMOApply" + "?" + Math.random(),
  132. height: $(window).height() - 200,
  133. width: $(window).width() - 300,
  134. colModel: [
  135. { label: "主键", name: "ID", hidden: true, key: true },
  136. { label: '领料单号', name: 'ApplyCode', width: 120, align: 'left' },
  137. {
  138. label: "单据类型", name: "EATTRIBUTE2", width: 80, align: "left",
  139. },
  140. { label: '受益部门', name: 'EATTRIBUTE', width: 120, align: 'left' },
  141. { label: '受益项目', name: 'EATTRIBUTE7', width: 150, align: 'left' },
  142. { label: '在建工程项目', name: 'EATTRIBUTE3', width: 150, align: 'left' },
  143. { label: "客户", name: "EATTRIBUTE4", width: 80, align: "left"},
  144. {
  145. label: "状态", name: "Status", width: 80, align: "left",
  146. formatter: function (cellvalue) {
  147. if (cellvalue == "1") {
  148. return "开立";
  149. } else if (cellvalue == "2") {
  150. return "审核";
  151. } else if (cellvalue == "3") {
  152. return "关闭";
  153. }
  154. else { return ""; }
  155. }
  156. },
  157. { label: '备注', name: 'EATTRIBUTE5', width: 200, align: 'left' },
  158. { label: '创建人', name: 'CreatePerson', width: 150, align: 'left' },
  159. { label: '创建时间', name: 'CreateDateTime', width: 150, align: 'left' },
  160. ],
  161. postData: { queryJson: JSON.stringify(queryJson) },
  162. shrinkToFit: false,//宽度自适应
  163. autoWidth:true,
  164. gridComplete: function () {
  165. },
  166. pager: "#gridPager",
  167. sortorder: "desc",
  168. sortname: 'ApplyCode',
  169. viewrecords: true,
  170. multiselect: true,
  171. subGrid: true, // (1)开启子表格支持
  172. subGridRowExpanded: function (subgrid_id, rowid) { // (2)子表格容器的id和需要展开子表格的行id,将传入此事件函数
  173. debugger;
  174. $("#gridList").jqGrid("setSelection", rowid, false);
  175. bindSubGrid(subgrid_id, rowid)
  176. }
  177. });
  178. }
  179. //子表
  180. function bindSubGrid(subgrid_id, rowid) {
  181. debugger;
  182. var queryJson = {
  183. POCode: $("#txt_POCode").val(),
  184. InvCode: $("#txt_InvCode").val(),
  185. TimeFrom: $("#TimeFrom").val(),
  186. TimeArrive: $("#TimeArrive").val(),
  187. CreatedBy: $("#txt_CreatedBy").val(),
  188. }
  189. $("#gridList").jqGrid("setSelection", rowid, false);
  190. var subgrid_table_id;
  191. subgrid_table_id = subgrid_id + "_t"; // (3)根据subgrid_id定义对应的子表格的table的id
  192. var subgrid_pager_id;
  193. subgrid_pager_id = subgrid_id + "_pgr" // (4)根据subgrid_id定义对应的子表格的pager的id
  194. // (5)动态添加子报表的table和pager
  195. $("#" + subgrid_id).html("<table id='" + subgrid_table_id + "' class='scroll'></table><div id='" + subgrid_pager_id + "' class='scroll'></div>");
  196. var ApplyCode = $("#gridList").jqGrid('getRowData', rowid).ApplyCode;
  197. // (6)创建jqGrid对象
  198. $("#" + subgrid_table_id).dataGrid({
  199. cellEdit: true,
  200. url: "/DHAY/ICSAccessoriesMOApply/GetICSMOApplyDetail?ApplyCode=" + ApplyCode + "&" + Math.random(), // (7)子表格数据对应的url,注意传入的contact.id参数
  201. colModel: _Clos,
  202. postData: { queryJson: JSON.stringify(queryJson) },
  203. sortname: 'MTIME',
  204. shrinkToFit: true,//宽度自适应
  205. //multiselect: true,
  206. prmNames: { search: "search" },
  207. viewrecords: true,
  208. height: "100%",
  209. rowNum: 20,
  210. pager: subgrid_pager_id,
  211. });
  212. }
  213. //删除
  214. function btn_Delete() {
  215. var objArr = '';
  216. var objList = $("#gridList").jqGrid('getGridParam', 'selarrrow');
  217. for (var i = 0; i < objList.length; i++) {
  218. var rowId = objList[i];
  219. var rowData = $("#gridList").jqGrid('getRowData', rowId);
  220. objArr += "'" + rowData.ApplyCode + "',";
  221. }
  222. if (objArr == '') {
  223. $.modalAlertNew("WMS00001");
  224. return;
  225. }
  226. $.deleteForm({
  227. url: "/DHAY/ICSAccessoriesMOApply/DeleteICSMOApplyByCode" + "?" + Math.random(),
  228. param: { keyValue: JSON.stringify(objArr) },
  229. success: function () {
  230. $.currentWindow().$("#gridList").trigger("reloadGrid");
  231. }
  232. })
  233. }
  234. function Selchange() {
  235. document.getElementById("gridPanel").innerHTML = '<table id="gridList"></table>';//重置grid
  236. gridList();
  237. }
  238. //审核
  239. function btn_Approve() {
  240. var objArr = '';
  241. var objList = $("#gridList").jqGrid('getGridParam', 'selarrrow');
  242. for (var i = 0; i < objList.length; i++) {
  243. var rowId = objList[i];
  244. var rowData = $("#gridList").jqGrid('getRowData', rowId);
  245. objArr += "'" + rowData.ApplyCode + "',";
  246. }
  247. if (objArr == '') {
  248. $.modalAlertNew("WMS00001");
  249. return;
  250. }
  251. $.submitForm({
  252. url: "/DHAY/ICSAccessoriesMOApply/ApproveICSMOApplyByCode" + "?" + Math.random(),
  253. param: { keyValue: JSON.stringify(objArr) },
  254. success: function () {
  255. $.currentWindow().$("#gridList").trigger("reloadGrid");
  256. }
  257. })
  258. }
  259. //弃审
  260. function btn_Abandon() {
  261. var objArr = '';
  262. var objList = $("#gridList").jqGrid('getGridParam', 'selarrrow');
  263. for (var i = 0; i < objList.length; i++) {
  264. var rowId = objList[i];
  265. var rowData = $("#gridList").jqGrid('getRowData', rowId);
  266. objArr += "'" + rowData.ApplyCode + "',";
  267. }
  268. if (objArr == '') {
  269. $.modalAlertNew("WMS00001");
  270. return;
  271. }
  272. $.submitForm({
  273. url: "/DHAY/ICSAccessoriesMOApply/AbandonICSMOApplyByCode" + "?" + Math.random(),
  274. param: { keyValue: JSON.stringify(objArr) },
  275. success: function () {
  276. $.currentWindow().$("#gridList").trigger("reloadGrid");
  277. }
  278. })
  279. }
  280. //发料
  281. function btn_MOApply() {
  282. var objArr = '';
  283. var objList = $("#gridList").jqGrid('getGridParam', 'selarrrow');
  284. for (var i = 0; i < objList.length; i++) {
  285. var rowId = objList[i];
  286. var rowData = $("#gridList").jqGrid('getRowData', rowId);
  287. objArr += "'" + rowData.ApplyCode + "',";
  288. }
  289. if (objArr == '') {
  290. $.modalAlertNew("WMS00001");
  291. return;
  292. }
  293. $.submitForm({
  294. url: "/DHAY/ICSAccessoriesMOApply/FLICSMOApplyByCode" + "?" + Math.random(),
  295. param: { keyValue: JSON.stringify(objArr) },
  296. success: function () {
  297. $.currentWindow().$("#gridList").trigger("reloadGrid");
  298. }
  299. })
  300. }
  301. //关闭
  302. function btn_Close() {
  303. var objArr = '';
  304. var objList = $("#gridList").jqGrid('getGridParam', 'selarrrow');
  305. for (var i = 0; i < objList.length; i++) {
  306. var rowId = objList[i];
  307. var rowData = $("#gridList").jqGrid('getRowData', rowId);
  308. objArr += "'" + rowData.ApplyCode + "',";
  309. }
  310. if (objArr == '') {
  311. $.modalAlertNew("WMS00001");
  312. return;
  313. }
  314. $.submitForm({
  315. url: "/DHAY/ICSAccessoriesMOApply/CloseICSMOApplyByCode" + "?" + Math.random(),
  316. param: { keyValue: JSON.stringify(objArr) },
  317. success: function () {
  318. $.currentWindow().$("#gridList").trigger("reloadGrid");
  319. }
  320. })
  321. }
  322. //修改类型
  323. function btn_update() {
  324. var ids = $("#gridList").jqGrid('getGridParam', 'selarrrow'); //获取 多行数据
  325. if (ids.length != 1) {
  326. $.modalAlertNew("WMS00006");
  327. return;
  328. }
  329. for (var i in ids) {
  330. var rowData = jQuery("#gridList").jqGrid("getRowData", ids[i]);
  331. //ID
  332. var ID = rowData.ID;
  333. var ApplyCode = rowData.ApplyCode;
  334. $.modalOpen({
  335. id: "Details",
  336. title: "修改",
  337. url: "/DHAY/ICSAccessoriesMOApply/Update?ID=" + ID + "&ApplyCode=" + ApplyCode + "&" + Math.random(),
  338. width: "1000px",
  339. height: "1200px",
  340. callBack: function (iframeId) {
  341. top.frames[iframeId].submitForm();
  342. }
  343. });
  344. }
  345. }
  346. //创建
  347. function btnCreate() {
  348. $.modalOpen({
  349. id: "BRGCodeAdd",
  350. title: "新增",
  351. url: "/DHAY/ICSAccessoriesMOApply/Create" + "?" + Math.random(),
  352. width: "1000px",
  353. height: "1200px",
  354. callBack: function (iframeId) {
  355. top.frames[iframeId].submitForm();
  356. }
  357. });
  358. }
  359. </script>
  360. <div class="topPanel" style="height:60px">
  361. <div class="search">
  362. <table>
  363. <tr>
  364. <td style="text-align:right;"><label class="lglabel" for="txt_POCode">&nbsp;&nbsp;&nbsp;单据号</label>:</td>
  365. <td>
  366. <div class="input-group">
  367. <input id="txt_POCode" type="text" class="form-control" style="width: 100px;">
  368. </div>
  369. </td>
  370. <td style="text-align:right;"><label class="lglabel" for="txt_InvCode">&nbsp;&nbsp;&nbsp;料品编码</label>:</td>
  371. <td>
  372. <div class="input-group">
  373. <input id="txt_InvCode" type="text" class="form-control" style="width: 100px;">
  374. </div>
  375. </td>
  376. <td style="text-align:right;" class="Mechanism"><label class="lglabel" for="txt_CreatedBy">&nbsp;&nbsp;&nbsp;创建人</label>:</td>
  377. <td class="Mechanism">
  378. <div class="input-group">
  379. <input id="txt_CreatedBy" type="text" class="form-control" style="width: 100px;">
  380. </div>
  381. </td>
  382. <td style="text-align:right;"><label class="lglabel" for="txt_TimeFrom">&nbsp;&nbsp;&nbsp;日期(从)</label>:</td>
  383. <td>
  384. <div class="input-group">
  385. <input id="TimeFrom" name="Time" type="text" class="form-control required" style="width:80px;" maxlength="10" onclick="WdatePicker({ dateFmt: 'yyyy-MM-dd'})" placeholder="日期(从)" />
  386. </div>
  387. </td>
  388. <td style="text-align:right;"><label class="lglabel" for="txt_TimeArrive">&nbsp;&nbsp;&nbsp;日期(到)</label>:</td>
  389. <td>
  390. <div class="input-group">
  391. <input id="TimeArrive" name="Time" type="text" class="form-control required" style="width:80px;" maxlength="10" onclick="WdatePicker({ dateFmt: 'yyyy-MM-dd' })" placeholder="日期(到)" />
  392. </div>
  393. </td>
  394. <td>
  395. <span class="input-group-btn">
  396. <button id="btn_search" type="button" class="btn btn-primary" onclick="Selchange()"><i class="fa fa-search"></i></button>
  397. </span>
  398. </td>
  399. </tr>
  400. </table>
  401. </div>
  402. <div class="topPanel" style="height:60px ;" >
  403. <div class="toolbar">
  404. <div class="btn-group">
  405. <a id="NF-Create" authorize="yes" class="btn btn-primary" onclick="btnCreate()"><i class="fa fa-pencil-square-o"></i>新增</a>
  406. <a id="NF-update" authorize="yes" class="btn btn-primary" onclick="btn_update()"><i class="fa fa-pencil-square-o"></i>修改</a>
  407. <a id="NF-Delete" authorize="yes" class="btn btn-primary" onclick="btn_Delete()"><i class="fa fa-trash-o"></i>删除</a>
  408. <a id="NF-Approve" authorize="yes" class="btn btn-primary" onclick="btn_Approve()"><i class="fa fa-pencil-square-o"></i>审核</a>
  409. <a id="NF-Abandon" authorize="yes" class="btn btn-primary" onclick="btn_Abandon()"><i class="fa fa-pencil-square-o"></i>弃审</a>
  410. <a id="NF-Close" authorize="yes" class="btn btn-primary" onclick="btn_Close()"><i class="fa fa-trash-o"></i>关闭</a>
  411. <a id="NF-MOApply" authorize="yes" class="btn btn-primary" onclick="btn_MOApply()"><i class="fa fa-trash-o"></i>发料</a>
  412. <a class="btn btn-primary" onclick="$.reload()"><span class="glyphicon glyphicon-refresh"></span></a>
  413. </div>
  414. <script>$('.toolbar').authorizeButton()</script>
  415. </div>
  416. </div>
  417. </div>
  418. <div class="gridPanel" id="gridPanel">
  419. <table id="gridList"></table>
  420. <div id="gridPager"></div>
  421. </div>