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.

397 lines
17 KiB

  1. @{
  2. ViewBag.Title = "Index";
  3. Layout = "~/Views/Shared/_Index.cshtml";
  4. }
  5. <script src="~/Content/js/datepicker/WdatePicker.js"></script>
  6. <script>
  7. $(document).ready(function () {
  8. $("input.cell").keyup(function (e) {
  9. switch (e.keyCode) {
  10. case 40:
  11. $(this).parent()
  12. .parent()
  13. .next()
  14. .children("td")
  15. .children("input.cell[name="
  16. + $(this).attr("name") + "]")
  17. .focus();
  18. break;
  19. case 38:
  20. $(this).parent()
  21. .parent()
  22. .prev()
  23. .children("td")
  24. .children("input.cell[name="
  25. + $(this).attr("name") + "]")
  26. .focus();
  27. break;
  28. }
  29. });
  30. });</script>
  31. <script>
  32. $(function () {
  33. var _Clos = new Array();
  34. var _Closs = new Array();
  35. SetCols();
  36. SetColsDetails();
  37. gridList();
  38. })
  39. function SetCols() {
  40. $.ajax({
  41. url: "/Print/SelectColumnName?" + Math.random(),
  42. dataType: "json",
  43. async: false,
  44. success: function (data) {
  45. var cols = new Array();
  46. var collast = { label: "主键", name: "ID", hidden: true, key: true };
  47. cols.push(collast);
  48. //var collast = { label: "销售订单号", name: "SDNCode", width: 150, align: 'left' };
  49. // cols.push(collast);
  50. var collast = { label: "不良原因组编码", name: "BRGCode", width: 150, align: 'left' };
  51. cols.push(collast);
  52. var collast = { label: '不良原因组描述', name: 'BRGDesc', width: 100, align: 'left' };
  53. cols.push(collast);
  54. var collast = { label: '操作人', name: 'MUSER', width: 100, align: 'left' };
  55. cols.push(collast);
  56. var collast = { label: '操作人名称', name: 'MUSERName', width: 100, align: 'left' };
  57. cols.push(collast);
  58. var collast = { label: '操作时间', name: 'MTIME', width: 150, align: 'left' };
  59. cols.push(collast);
  60. //if (data != null && data.length > 0) {
  61. // DateList = data;
  62. // for (var i = 0; i < data.length; i++) {
  63. // var ColName = data[i].ColName;
  64. // var ColCode = data[i].ColCode;
  65. // var obj = new Array();
  66. // obj = {
  67. // label: ColName,
  68. // name: ColCode,
  69. // width: 80,
  70. // align: "left"
  71. // }
  72. // cols.push(obj);
  73. // }
  74. //}
  75. $.ajax({
  76. url: "/Print/SelectTableColumnName?" + Math.random(),
  77. dataType: "json",
  78. async: false,
  79. success: function (data) {
  80. if (data != null && data.length > 0) {
  81. DateList = data;
  82. for (var i = 0; i < data.length; i++) {
  83. var TableCode = data[i].TableCode;
  84. if (TableCode == "ICSBadReasonGroup") {
  85. var Code = data[i].Code;
  86. var Name = data[i].Name;
  87. var obj = new Array();
  88. obj = {
  89. label: Name,
  90. name: Code,
  91. width: 80,
  92. align: "left"
  93. }
  94. cols.push(obj);
  95. }
  96. //if (TableCode == "ICSInventory") {
  97. // var Code = data[i].Code;
  98. // var Name = data[i].Name;
  99. // var obj = new Array();
  100. // obj = {
  101. // label: Name,
  102. // name: Code,
  103. // width: 80,
  104. // align: "left"
  105. // }
  106. // cols.push(obj);
  107. // //cols1.push(obj);
  108. //}
  109. }
  110. }
  111. _Clos = cols;
  112. //_Clos1 = cols1;
  113. }
  114. });
  115. _Clos = cols;
  116. }
  117. });
  118. }
  119. function SetColsDetails() {
  120. $.ajax({
  121. url: "/Print/SelectColumnName?" + Math.random(),
  122. dataType: "json",
  123. async: false,
  124. success: function (data) {
  125. var cols = new Array();
  126. var collast = { label: "主键", name: "ID", hidden: true, key: true };
  127. cols.push(collast);
  128. //var collast = { label: "销售订单号", name: "SDNCode", width: 150, align: 'left' };
  129. // cols.push(collast);
  130. var collast = { label: "不良原因组唯一标识", name: "BRGroupID", width: 150, align: 'left',hidden:true };
  131. cols.push(collast);
  132. var collast = { label: '不良原因编码', name: 'BadReasonCode', width: 100, align: 'left' };
  133. cols.push(collast);
  134. var collast = { label: '不良原因描述', name: 'BadReasonDesc', width: 100, align: 'left' };
  135. cols.push(collast);
  136. var collast = { label: '操作人名称', name: 'MUSERName', width: 100, align: 'left' };
  137. cols.push(collast);
  138. var collast = { label: '操作时间', name: 'MTIME', width: 150, align: 'left' };
  139. cols.push(collast);
  140. //if (data != null && data.length > 0) {
  141. // DateList = data;
  142. // for (var i = 0; i < data.length; i++) {
  143. // var ColName = data[i].ColName;
  144. // var ColCode = data[i].ColCode;
  145. // var obj = new Array();
  146. // obj = {
  147. // label: ColName,
  148. // name: ColCode,
  149. // width: 80,
  150. // align: "left"
  151. // }
  152. // cols.push(obj);
  153. // }
  154. //}
  155. $.ajax({
  156. url: "/Print/SelectTableColumnName?" + Math.random(),
  157. dataType: "json",
  158. async: false,
  159. success: function (data) {
  160. if (data != null && data.length > 0) {
  161. DateList = data;
  162. for (var i = 0; i < data.length; i++) {
  163. var TableCode = data[i].TableCode;
  164. if (TableCode == "ICSBadReasonGroup") {
  165. var Code = data[i].Code;
  166. var Name = data[i].Name;
  167. var obj = new Array();
  168. obj = {
  169. label: Name,
  170. name: Code,
  171. width: 80,
  172. align: "left"
  173. }
  174. cols.push(obj);
  175. }
  176. //if (TableCode == "ICSInventory") {
  177. // var Code = data[i].Code;
  178. // var Name = data[i].Name;
  179. // var obj = new Array();
  180. // obj = {
  181. // label: Name,
  182. // name: Code,
  183. // width: 80,
  184. // align: "left"
  185. // }
  186. // cols.push(obj);
  187. // //cols1.push(obj);
  188. //}
  189. }
  190. }
  191. _Closs = cols;
  192. //_Clos1 = cols1;
  193. }
  194. });
  195. _Closs = cols;
  196. }
  197. });
  198. }
  199. function gridList() {
  200. var $gridList = $("#gridList");
  201. var queryJson = {
  202. BadReason: $("#txt_BadReason").val(),
  203. BadReasonName: $("#txt_BadReasonName").val(),
  204. }
  205. $gridList.dataGrid({
  206. url: "/WMS/BasicSettings/GetICSBadReasonGroup" + "?" + Math.random(),
  207. postData: { queryJson: JSON.stringify(queryJson) },
  208. height: $(window).height() - 200,
  209. width: $(window).width() - 300,
  210. colModel:_Clos,
  211. // [
  212. // { label: "主键", name: "ID", hidden: true, key: true },
  213. // { label: 'ID', name: 'ID', hidden: true },
  214. // { label: '不良原因组编码', name: 'BRGCode', width: 120, align: 'left' },
  215. // { label: '不良原因组描述', name: 'BRGDesc', width: 150, align: 'left' },
  216. // { label: '操作人', name: 'MUSER', width: 100, align: 'left' },
  217. // { label: '操作人名称', name: 'MUSERName', width: 200, align: 'left' },
  218. // { label: '操作时间', name: 'MTIME', width: 200, align: 'left' },
  219. //],
  220. shrinkToFit: false,//宽度自适应
  221. autoWidth:true,
  222. gridComplete: function () {
  223. },
  224. pager: "#gridPager",
  225. sortorder: "desc",
  226. sortname: 'BRGCode ',
  227. viewrecords: true,
  228. multiselect: true,
  229. subGrid: true, // (1)开启子表格支持
  230. subGridRowExpanded: function (subgrid_id, rowid) { // (2)子表格容器的id和需要展开子表格的行id,将传入此事件函数
  231. $("#gridList").jqGrid("setSelection", rowid, false);
  232. bindSubGrid(subgrid_id, rowid)
  233. }
  234. });
  235. $("#btn_search").click(function () {
  236. var warehouse = $("#warehouse a.active").attr('data-value');
  237. var queryJson = {
  238. BadReason: $("#txt_BadReason").val(),
  239. BadReasonName: $("#txt_BadReasonName").val(),
  240. }
  241. $gridList.jqGrid('setGridParam', {
  242. postData: { queryJson: JSON.stringify(queryJson) },
  243. }).trigger('reloadGrid');
  244. });
  245. $(".unwritten").hide();
  246. }
  247. function bindSubGrid(subgrid_id, rowid) {
  248. $("#gridList").jqGrid("setSelection", rowid, false);
  249. var subgrid_table_id;
  250. subgrid_table_id = subgrid_id + "_t"; // (3)根据subgrid_id定义对应的子表格的table的id
  251. var subgrid_pager_id;
  252. subgrid_pager_id = subgrid_id + "_pgr" // (4)根据subgrid_id定义对应的子表格的pager的id
  253. // (5)动态添加子报表的table和pager
  254. $("#" + subgrid_id).html("<table id='" + subgrid_table_id + "' class='scroll'></table><div id='" + subgrid_pager_id + "' class='scroll'></div>");
  255. var BRGroupID = $("#gridList").jqGrid('getRowData', rowid).ID;
  256. // (6)创建jqGrid对象
  257. $("#" + subgrid_table_id).dataGrid({
  258. cellEdit: true,
  259. url: "/WMS/BasicSettings/GetICSBadReason?BRGroupID=" + BRGroupID + "&" + Math.random(), // (7)子表格数据对应的url,注意传入的contact.id参数
  260. colModel: [
  261. { label: "主键", name: "ID", hidden: true, key: true },
  262. { label: "不良原因组唯一标识", name: "BRGroupID", hidden: true },
  263. { label: "不良原因编码", name: "BadReasonCode", width: 150, align: 'left' },
  264. { label: '不良原因描述', name: 'BadReasonDesc', width: 100, align: 'left' },
  265. { label: '操作人名称', name: 'MUSERName', width: 150, align: 'left' },
  266. { label: '操作时间', name: 'MTIME', width: 150, align: 'left' },
  267. ],
  268. sortname: 'MTIME',
  269. shrinkToFit: true,//宽度自适应
  270. //multiselect: true,
  271. prmNames: { search: "search" },
  272. viewrecords: true,
  273. height: "100%",
  274. rowNum: 20,
  275. pager: subgrid_pager_id,
  276. });
  277. }
  278. function btn_Delete() {
  279. var objArr = '';
  280. var objList = $("#gridList").jqGrid('getGridParam', 'selarrrow');
  281. for (var i = 0; i < objList.length; i++) {
  282. var rowId = objList[i];
  283. var rowData = $("#gridList").jqGrid('getRowData', rowId);
  284. objArr += "'" + rowData.ID + "',";
  285. }
  286. if (objArr == '') {
  287. $.modalAlertNew("WMS00001");
  288. return;
  289. }
  290. $.deleteForm({
  291. url: "/WMS/BasicSettings/DeleteICSBadReasonGroup" + "?" + Math.random(),
  292. param: { keyValue: JSON.stringify(objArr) },
  293. success: function () {
  294. $.currentWindow().$("#gridList").trigger("reloadGrid");
  295. }
  296. })
  297. }
  298. //修改类型
  299. function btn_update() {
  300. var ids = $("#gridList").jqGrid('getGridParam', 'selarrrow'); //获取 多行数据
  301. if (ids.length != 1) {
  302. $.modalAlertNew("WMS00006");
  303. return;
  304. }
  305. for (var i in ids) {
  306. var rowData = jQuery("#gridList").jqGrid("getRowData", ids[i]);
  307. //ID
  308. var ID = rowData.ID;
  309. var BRGCode = rowData.BRGCode;
  310. var BRGDesc = rowData.BRGDesc;
  311. $.modalOpen({
  312. id: "Details",
  313. title: "修改",
  314. url: "/WMS/BasicSettings/ICSBadReasonGroupAdd?ID=" + ID + "&BRGCode=" + BRGCode + "&BRGDesc=" + encodeURI(encodeURI(BRGDesc)) + "&" + Math.random(),
  315. width: "900px",
  316. height: "800px",
  317. callBack: function (iframeId) {
  318. top.frames[iframeId].submitForm();
  319. }
  320. });
  321. }
  322. }
  323. function btnCreate() {
  324. $.modalOpen({
  325. id: "BRGCodeAdd",
  326. title: "新增",
  327. url: "/WMS/BasicSettings/ICSBadReasonGroupAdd" + "?" + Math.random(),
  328. width: "900px",
  329. height: "800px",
  330. callBack: function (iframeId) {
  331. top.frames[iframeId].submitForm();
  332. }
  333. });
  334. }
  335. </script>
  336. <div class="topPanel" style="height:60px">
  337. <div class="toolbar">
  338. <div class="btn-group">
  339. <a id="NF-Create" authorize="yes" class="btn btn-primary" onclick="btnCreate()"><i class="fa fa-pencil-square-o"></i>新增</a>
  340. <a id="NF-update" authorize="yes" class="btn btn-primary" onclick="btn_update()"><i class="fa fa-pencil-square-o"></i>修改</a>
  341. <a id="NF-Delete" authorize="yes" class="btn btn-primary" onclick="btn_Delete()"><i class="fa fa-trash-o"></i>删除</a>
  342. <a class="btn btn-primary" onclick="$.reload()"><span class="glyphicon glyphicon-refresh"></span></a>
  343. </div>
  344. </div>
  345. <div class="search">
  346. <table>
  347. <tr>
  348. <td style="text-align:right;"><label class="lglabel" for="txt_POCode">不良原因组编号</label>:</td>
  349. <td>
  350. <div class="input-group">
  351. <input id="txt_BadReason" type="text" class="form-control" style="width: 100px;">
  352. </div>
  353. </td>
  354. <td style="width:20px"></td>
  355. <td style="text-align:right;"><label class="lglabel" for="txt_POCode">不良原因组描述</label>:</td>
  356. <td>
  357. <div class="input-group">
  358. <input id="txt_BadReasonName" type="text" class="form-control" style="width: 100px;">
  359. </div>
  360. </td>
  361. <td>
  362. <span class="input-group-btn">
  363. <button id="btn_search" type="button" class="btn btn-primary"><i class="fa fa-search"></i></button>
  364. </span>
  365. </td>
  366. </tr>
  367. </table>
  368. </div>
  369. </div>
  370. <div class="gridPanel">
  371. <table id="gridList"></table>
  372. <div id="gridPager"></div>
  373. </div>