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

272 lines
11 KiB

  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/ProductionRAFMR/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. } else if (cellvalue == "2") {
  76. return "领料申请单退料";
  77. } else if (cellvalue == "3") {
  78. return "材料出库退料";
  79. }
  80. else { return ""; }
  81. }
  82. },
  83. { label: '备注', name: 'Memo', width: 200, align: 'left' },
  84. { label: '创建人', name: 'CreatePerson', width: 150, align: 'left' },
  85. { label: '创建时间', name: 'CreateDateTime', width: 150, align: 'left' },
  86. ],
  87. shrinkToFit: false,//宽度自适应
  88. autoWidth:true,
  89. gridComplete: function () {
  90. },
  91. pager: "#gridPager",
  92. sortorder: "desc",
  93. sortname: 'ApplyNegCode',
  94. viewrecords: true,
  95. multiselect: true,
  96. //beforeSelectRow: function (rowid, e) {
  97. // $("#gridList").jqGrid('resetSelection');
  98. // return (true);
  99. //},
  100. subGrid: true, // (1)开启子表格支持
  101. subGridRowExpanded: function (subgrid_id, rowid) { // (2)子表格容器的id和需要展开子表格的行id,将传入此事件函数
  102. debugger;
  103. $("#gridList").jqGrid("setSelection", rowid, false);
  104. bindSubGrid(subgrid_id, rowid)
  105. }
  106. });
  107. }
  108. function bindSubGrid(subgrid_id, rowid) {
  109. debugger;
  110. $("#gridList").jqGrid("setSelection", rowid, false);
  111. var subgrid_table_id;
  112. subgrid_table_id = subgrid_id + "_t"; // (3)根据subgrid_id定义对应的子表格的table的id
  113. var subgrid_pager_id;
  114. subgrid_pager_id = subgrid_id + "_pgr" // (4)根据subgrid_id定义对应的子表格的pager的id
  115. // (5)动态添加子报表的table和pager
  116. $("#" + subgrid_id).html("<table id='" + subgrid_table_id + "' class='scroll'></table><div id='" + subgrid_pager_id + "' class='scroll'></div>");
  117. var ApplyNegCode = $("#gridList").jqGrid('getRowData', rowid).ApplyNegCode;
  118. // (6)创建jqGrid对象
  119. $("#" + subgrid_table_id).dataGrid({
  120. cellEdit: true,
  121. url: "/WMS/ProductionRAFMR/GetICSMOApplyNegDetail?ApplyNegCode=" + ApplyNegCode + "&" + Math.random(), // (7)子表格数据对应的url,注意传入的contact.id参数
  122. colModel: [
  123. { label: "主键", name: "ID", hidden: true, key: true },
  124. { label: "退料申请单号", name: "ApplyNegCode", width: 150, align: 'left' },
  125. { label: "退料申请单行号", name: "Sequence", width: 150, align: 'left' },
  126. { label: '来源单据表体ID', name: 'SourceDetailID', width: 100, align: 'left' },
  127. { label: '料品编码', name: 'InvCode', width: 100, align: 'left' },
  128. { label: '数量', name: 'Quantity', width: 100, align: 'left' },
  129. { label: '辅计量数量', name: 'Amount', width: 100, align: 'left' },
  130. { label: '已退数量', name: 'IssueNegQuantity', width: 100, align: 'left' },
  131. { label: '自由项唯一标识', name: 'ExtensionID', width: 150, align: 'left' },
  132. { label: '操作人名称', name: 'MUSERName', width: 150, align: 'left' },
  133. { label: '操作时间', name: 'MTIME', width: 150, align: 'left' },
  134. ],
  135. sortname: 'MTIME',
  136. shrinkToFit: true,//宽度自适应
  137. //multiselect: true,
  138. prmNames: { search: "search" },
  139. viewrecords: true,
  140. height: "100%",
  141. rowNum: 20,
  142. pager: subgrid_pager_id,
  143. });
  144. }
  145. function btn_Delete() {
  146. var objArr = '';
  147. var objList = $("#gridList").jqGrid('getGridParam', 'selarrrow');
  148. for (var i = 0; i < objList.length; i++) {
  149. var rowId = objList[i];
  150. var rowData = $("#gridList").jqGrid('getRowData', rowId);
  151. objArr += "'" + rowData.ApplyNegCode + "',";
  152. }
  153. if (objArr == '') {
  154. $.modalAlert("请选择一项进行删除!");
  155. return;
  156. }
  157. $.deleteForm({
  158. url: "/WMS/ProductionRAFMR/DeleteICSMOApplyNeg" + "?" + Math.random(),
  159. param: { keyValue: JSON.stringify(objArr) },
  160. success: function () {
  161. $.currentWindow().$("#gridList").trigger("reloadGrid");
  162. }
  163. })
  164. }
  165. //修改类型
  166. function btn_update() {
  167. var ids = $("#gridList").jqGrid('getGridParam', 'selarrrow'); //获取 多行数据
  168. if (ids.length != 1) {
  169. $.modalAlert("请选择一行数据进行修改!");
  170. return;
  171. }
  172. for (var i in ids) {
  173. var rowData = jQuery("#gridList").jqGrid("getRowData", ids[i]);
  174. var ID = rowData.ID;
  175. var ApplyNegCode = rowData.ApplyNegCode;
  176. var WHCode = rowData.WHCode;
  177. $.modalOpen({
  178. id: "Details",
  179. title: "修改",
  180. url: "/WMS/ProductionRAFMR/ICSMOApplyNegPRAFMRUpdate?ID=" + ID + "&ApplyNegCode=" + ApplyNegCode + "&WHCode=" + WHCode + "&" + Math.random(),
  181. width: "1000px",
  182. height: "1200px",
  183. callBack: function (iframeId) {
  184. top.frames[iframeId].submitForm();
  185. }
  186. });
  187. }
  188. }
  189. function btnCreate() {
  190. $.modalOpen({
  191. id: "BRGCodeAdd",
  192. title: "新增",
  193. url: "/WMS/ProductionRAFMR/ICSMOApplyNegPRAFMRAdd" + "?" + Math.random(),
  194. width: "1000px",
  195. height: "1200px",
  196. callBack: function (iframeId) {
  197. top.frames[iframeId].submitForm();
  198. }
  199. });
  200. }
  201. function btn_Audit() {
  202. var ids = $("#gridList").jqGrid('getGridParam', 'selarrrow'); //获取 多行数据
  203. if (ids.length != 1) {
  204. $.modalAlert("请选择一条数据进行审核!");
  205. return;
  206. }
  207. var RoleEnCode = '@NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode'
  208. var WorkPoint = '@NFine.Code.OperatorProvider.Provider.GetCurrent().Location'
  209. var date = new Date();
  210. for (var i in ids) {
  211. ID = $("#gridList").jqGrid('getRowData', ids[i]).ID;
  212. Status = $("#gridList").jqGrid('getRowData', ids[i]).Status;
  213. if (Status!='开立') {
  214. $.modalAlert("该单据已无法审核!");
  215. return;
  216. }
  217. }
  218. var ICSASNs = {
  219. ID: ID,
  220. User: RoleEnCode,
  221. MTIME: date,
  222. Type:'2',
  223. WorkPoint: WorkPoint
  224. }
  225. var ICSASN = [];
  226. ICSASN.push(ICSASNs);
  227. $.submitForm({
  228. url: "/WMS/ProductionRAFMR/AuditICSMOApplyNeg?" + Math.random(),
  229. param: { ICSASN: JSON.stringify(ICSASN) },
  230. success: function () {
  231. $.currentWindow().$("#gridList").trigger("reloadGrid");
  232. }
  233. })
  234. }
  235. </script>
  236. <div class="topPanel" style="height:45px">
  237. <div class="toolbar">
  238. <div class="btn-group">
  239. <a id="NF-Create" authorize="yes" class="btn btn-primary" onclick="btnCreate()"><i class="fa fa-pencil-square-o"></i>新增</a>
  240. <a id="NF-update" authorize="yes" class="btn btn-primary" onclick="btn_update()"><i class="fa fa-pencil-square-o"></i>修改</a>
  241. <a id="NF-Audit" authorize="yes" class="btn btn-primary" onclick="btn_Audit()"><i class="fa fa-pencil-square-o"></i>审核</a>
  242. <a id="NF-Delete" authorize="yes" class="btn btn-primary" onclick="btn_Delete()"><i class="fa fa-trash-o"></i>删除</a>
  243. <a class="btn btn-primary" onclick="$.reload()"><span class="glyphicon glyphicon-refresh"></span></a>
  244. </div>
  245. </div>
  246. </div>
  247. <div class="gridPanel">
  248. <table id="gridList"></table>
  249. <div id="gridPager"></div>
  250. </div>