纽威
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.

268 lines
10 KiB

3 years ago
  1. @{
  2. ViewBag.Title = "Index";
  3. Layout = "~/Views/Shared/_Index.cshtml";
  4. }
  5. <style>
  6. .btn-primary {
  7. margin-right: 2px;
  8. }
  9. .topPanel .toolbar {
  10. float: left;
  11. }
  12. </style>
  13. <script src="~/Content/js/datepicker/WdatePicker.js"></script>
  14. <script>
  15. $(document).ready(function () {
  16. $("input.cell").keyup(function (e) {
  17. switch (e.keyCode) {
  18. // up arrow
  19. case 40:
  20. $(this).parent()
  21. .parent()
  22. .next()
  23. .children("td")
  24. .children("input.cell[name="
  25. + $(this).attr("name") + "]")
  26. .focus();
  27. break;
  28. // down arrow
  29. case 38:
  30. $(this).parent()
  31. .parent()
  32. .prev()
  33. .children("td")
  34. .children("input.cell[name="
  35. + $(this).attr("name") + "]")
  36. .focus();
  37. break;
  38. }
  39. });
  40. });</script>
  41. <script>
  42. $(function () {
  43. gridList();
  44. })
  45. function gridList() {
  46. var $gridList = $("#gridList");
  47. $gridList.dataGrid({
  48. url: "/WMS/ProductionIssue/GetICSMOApplyNeg" + "?" + Math.random(),
  49. height: $(window).height() - 200,
  50. width: $(window).width() - 300,
  51. colModel: [
  52. { label: "主键", name: "ID", hidden: true, key: true },
  53. { label: 'ID', name: 'ID', hidden: true },
  54. { label: '退料申请单号', name: 'ApplyNegCode', width: 120, align: 'left' },
  55. { label: '仓库代码', name: 'WHCode', width: 150, align: 'left' },
  56. { label: '仓库名称', name: 'WarehouseName', width: 150, align: 'left' },
  57. {
  58. label: "状态", name: "Status", width: 80, align: "left",
  59. formatter: function (cellvalue) {
  60. if (cellvalue == "1") {
  61. return "开立";
  62. } else if (cellvalue == "2") {
  63. return "审核";
  64. } else if (cellvalue == "3") {
  65. return "关闭";
  66. }
  67. else { return ""; }
  68. }
  69. },
  70. {
  71. label: "类型", name: "Type", width: 80, align: "left",
  72. formatter: function (cellvalue) {
  73. if (cellvalue == "1") {
  74. return "生产";
  75. }
  76. else { return ""; }
  77. }
  78. },
  79. { label: '备注', name: 'Memo', width: 200, align: 'left' },
  80. { label: '创建人', name: 'CreatePerson', width: 150, align: 'left' },
  81. { label: '创建时间', name: 'CreateDateTime', width: 150, align: 'left' },
  82. ],
  83. shrinkToFit: false,//宽度自适应
  84. autoWidth:true,
  85. gridComplete: function () {
  86. },
  87. pager: "#gridPager",
  88. sortorder: "desc",
  89. sortname: 'ApplyNegCode',
  90. viewrecords: true,
  91. multiselect: true,
  92. //beforeSelectRow: function (rowid, e) {
  93. // $("#gridList").jqGrid('resetSelection');
  94. // return (true);
  95. //},
  96. subGrid: true, // (1)开启子表格支持
  97. subGridRowExpanded: function (subgrid_id, rowid) { // (2)子表格容器的id和需要展开子表格的行id,将传入此事件函数
  98. debugger;
  99. $("#gridList").jqGrid("setSelection", rowid, false);
  100. bindSubGrid(subgrid_id, rowid)
  101. }
  102. });
  103. }
  104. function bindSubGrid(subgrid_id, rowid) {
  105. debugger;
  106. $("#gridList").jqGrid("setSelection", rowid, false);
  107. var subgrid_table_id;
  108. subgrid_table_id = subgrid_id + "_t"; // (3)根据subgrid_id定义对应的子表格的table的id
  109. var subgrid_pager_id;
  110. subgrid_pager_id = subgrid_id + "_pgr" // (4)根据subgrid_id定义对应的子表格的pager的id
  111. // (5)动态添加子报表的table和pager
  112. $("#" + subgrid_id).html("<table id='" + subgrid_table_id + "' class='scroll'></table><div id='" + subgrid_pager_id + "' class='scroll'></div>");
  113. var ApplyNegCode = $("#gridList").jqGrid('getRowData', rowid).ApplyNegCode;
  114. // (6)创建jqGrid对象
  115. $("#" + subgrid_table_id).dataGrid({
  116. cellEdit: true,
  117. url: "/WMS/ProductionIssue/GetICSMOApplyNegDetail?ApplyNegCode=" + ApplyNegCode + "&" + Math.random(), // (7)子表格数据对应的url,注意传入的contact.id参数
  118. colModel: [
  119. { label: "主键", name: "ID", hidden: true, key: true },
  120. { label: "退料申请单号", name: "ApplyNegCode", width: 150, align: 'left' },
  121. { label: "退料申请单行号", name: "Sequence", width: 150, align: 'left' },
  122. { label: '来源单据表体ID', name: 'SourceDetailID', width: 100, align: 'left' },
  123. { label: '料品编码', name: 'InvCode', width: 100, align: 'left' },
  124. { label: '数量', name: 'Quantity', width: 100, align: 'left' },
  125. { label: '辅计量数量', name: 'Amount', width: 100, align: 'left' },
  126. { label: '已退数量', name: 'IssueNegQuantity', width: 100, align: 'left' },
  127. { label: '自由项唯一标识', name: 'ExtensionID', width: 150, align: 'left' },
  128. { label: '操作人名称', name: 'MUSERName', width: 150, align: 'left' },
  129. { label: '操作时间', name: 'MTIME', width: 150, align: 'left' },
  130. ],
  131. sortname: 'MTIME',
  132. shrinkToFit: true,//宽度自适应
  133. //multiselect: true,
  134. prmNames: { search: "search" },
  135. viewrecords: true,
  136. height: "100%",
  137. rowNum: 20,
  138. pager: subgrid_pager_id,
  139. });
  140. }
  141. function btn_Delete() {
  142. var objArr = '';
  143. var objList = $("#gridList").jqGrid('getGridParam', 'selarrrow');
  144. for (var i = 0; i < objList.length; i++) {
  145. var rowId = objList[i];
  146. var rowData = $("#gridList").jqGrid('getRowData', rowId);
  147. objArr += "'" + rowData.ApplyNegCode + "',";
  148. }
  149. if (objArr == '') {
  150. $.modalAlert("请选择一项进行删除!");
  151. return;
  152. }
  153. $.deleteForm({
  154. url: "/WMS/ProductionIssue/DeleteICSMOApplyNeg" + "?" + Math.random(),
  155. param: { keyValue: JSON.stringify(objArr) },
  156. success: function () {
  157. $.currentWindow().$("#gridList").trigger("reloadGrid");
  158. }
  159. })
  160. }
  161. //修改类型
  162. function btn_update() {
  163. var ids = $("#gridList").jqGrid('getGridParam', 'selarrrow'); //获取 多行数据
  164. if (ids.length != 1) {
  165. $.modalAlert("请选择一行数据进行修改!");
  166. return;
  167. }
  168. for (var i in ids) {
  169. var rowData = jQuery("#gridList").jqGrid("getRowData", ids[i]);
  170. //ID
  171. var ID = rowData.ID;
  172. var ApplyNegCode = rowData.ApplyNegCode;
  173. var WHCode = rowData.WHCode;
  174. $.modalOpen({
  175. id: "Details",
  176. title: "修改",
  177. url: "/WMS/ProductionIssue/ICSMOApplyNegUpdate?ID=" + ID + "&ApplyNegCode=" + ApplyNegCode + "&WHCode=" + WHCode + "&" + Math.random(),
  178. width: "1000px",
  179. height: "1200px",
  180. callBack: function (iframeId) {
  181. top.frames[iframeId].submitForm();
  182. }
  183. });
  184. }
  185. }
  186. function btnCreate() {
  187. $.modalOpen({
  188. id: "BRGCodeAdd",
  189. title: "新增",
  190. url: "/WMS/ProductionIssue/ICSMOApplyNegAdd" + "?" + Math.random(),
  191. width: "1000px",
  192. height: "1200px",
  193. callBack: function (iframeId) {
  194. top.frames[iframeId].submitForm();
  195. }
  196. });
  197. }
  198. function btn_Audit() {
  199. var ids = $("#gridList").jqGrid('getGridParam', 'selarrrow'); //获取 多行数据
  200. if (ids.length != 1) {
  201. $.modalAlert("请选择一条数据进行审核!");
  202. return;
  203. }
  204. var RoleEnCode = '@NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode'
  205. var WorkPoint = '@NFine.Code.OperatorProvider.Provider.GetCurrent().Location'
  206. var date = new Date();
  207. for (var i in ids) {
  208. ID = $("#gridList").jqGrid('getRowData', ids[i]).ID;
  209. Status = $("#gridList").jqGrid('getRowData', ids[i]).Status;
  210. if (Status!='开立') {
  211. $.modalAlert("该单据已无法审核!");
  212. return;
  213. }
  214. }
  215. var ICSASNs = {
  216. ID: ID,
  217. User: RoleEnCode,
  218. MTIME: date,
  219. WorkPoint: WorkPoint
  220. }
  221. var ICSASN = [];
  222. ICSASN.push(ICSASNs);
  223. $.submitForm({
  224. url: "/WMS/ProductionIssue/AuditICSMOApplyNeg?" + Math.random(),
  225. param: { ICSASN: JSON.stringify(ICSASN) },
  226. success: function () {
  227. $.currentWindow().$("#gridList").trigger("reloadGrid");
  228. }
  229. })
  230. }
  231. </script>
  232. <div class="topPanel" style="height:45px">
  233. <div class="toolbar">
  234. <div class="btn-group">
  235. <a id="NF-Create" authorize="yes" class="btn btn-primary" onclick="btnCreate()"><i class="fa fa-pencil-square-o"></i>新增</a>
  236. <a id="NF-update" authorize="yes" class="btn btn-primary" onclick="btn_update()"><i class="fa fa-pencil-square-o"></i>修改</a>
  237. <a id="NF-Audit" authorize="yes" class="btn btn-primary" onclick="btn_Audit()"><i class="fa fa-pencil-square-o"></i>审核</a>
  238. <a id="NF-Delete" authorize="yes" class="btn btn-primary" onclick="btn_Delete()"><i class="fa fa-trash-o"></i>删除</a>
  239. <a class="btn btn-primary" onclick="$.reload()"><span class="glyphicon glyphicon-refresh"></span></a>
  240. </div>
  241. </div>
  242. </div>
  243. <div class="gridPanel">
  244. <table id="gridList"></table>
  245. <div id="gridPager"></div>
  246. </div>