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

324 lines
13 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. });
  41. var _Clos = new Array();
  42. $(function () {
  43. SetCols();
  44. gridList();
  45. })
  46. function SetCols() {
  47. $.ajax({
  48. url: "/Print/SelectColumnName?" + Math.random(),
  49. dataType: "json",
  50. async: false,
  51. success: function (data) {
  52. var cols = new Array();
  53. var collast = { label: "主键", name: "ID", hidden: true, key: true };
  54. cols.push(collast);
  55. var collast = { label: "退料申请单号", name: "ApplyNegCode", width: 150, align: 'left' };
  56. cols.push(collast);
  57. var collast = { label: "退料申请单行号", name: "Sequence", width: 150, align: 'left' };
  58. cols.push(collast);
  59. var collast = { label: '来源单据表体ID', name: 'SourceDetailID', width: 100, align: 'left' };
  60. cols.push(collast);
  61. var collast = { label: '料品编码', name: 'InvCode', width: 100, align: 'left' };
  62. cols.push(collast);
  63. var collast = { label: '数量', name: 'Quantity', width: 100, align: 'left' };
  64. cols.push(collast);
  65. var collast = { label: '辅计量数量', name: 'Amount', width: 100, align: 'left' };
  66. cols.push(collast);
  67. var collast = { label: '已退数量', name: 'IssueNegQuantity', width: 100, align: 'left' };
  68. cols.push(collast);
  69. var collast = { label: '操作人名称', name: 'MUSERName', width: 150, align: 'left' };
  70. cols.push(collast);
  71. var collast = { label: '操作时间', name: 'MTIME', width: 150, align: 'left' };
  72. cols.push(collast);
  73. var collast = { label: '自由项唯一标识', name: 'ExtensionID', hidden: true };
  74. cols.push(collast);
  75. if (data != null && data.length > 0) {
  76. DateList = data;
  77. for (var i = 0; i < data.length; i++) {
  78. var ColName = data[i].ColName;
  79. var ColCode = data[i].ColCode;
  80. var obj = new Array();
  81. obj = {
  82. label: ColName,
  83. name: ColCode,
  84. width: 80,
  85. align: "left"
  86. }
  87. cols.push(obj);
  88. }
  89. }
  90. _Clos = cols;
  91. }
  92. });
  93. }
  94. function gridList() {
  95. var $gridList = $("#gridList");
  96. $gridList.dataGrid({
  97. url: "/WMS/MaterialsDeliveredRTM/GetICSMOApplyNeg" + "?" + Math.random(),
  98. height: $(window).height() - 200,
  99. width: $(window).width() - 300,
  100. colModel: [
  101. { label: "主键", name: "ID", hidden: true, key: true },
  102. { label: 'ID', name: 'ID', hidden: true },
  103. { label: '退料申请单号', name: 'ApplyNegCode', width: 120, align: 'left' },
  104. { label: '仓库代码', name: 'WHCode', width: 150, align: 'left' },
  105. { label: '仓库名称', name: 'WarehouseName', width: 150, align: 'left' },
  106. {
  107. label: "状态", name: "Status", width: 80, align: "left",
  108. formatter: function (cellvalue) {
  109. if (cellvalue == "1") {
  110. return "开立";
  111. } else if (cellvalue == "2") {
  112. return "审核";
  113. } else if (cellvalue == "3") {
  114. return "关闭";
  115. }
  116. else { return ""; }
  117. }
  118. },
  119. {
  120. label: "类型", name: "Type", width: 80, align: "left",
  121. formatter: function (cellvalue) {
  122. if (cellvalue == "1") {
  123. return "生产订单备料退料";
  124. } else if (cellvalue == "2") {
  125. return "领料申请单退料";
  126. } else if (cellvalue == "3") {
  127. return "材料出库退料";
  128. }
  129. else { return ""; }
  130. }
  131. },
  132. { label: '备注', name: 'Memo', width: 200, align: 'left' },
  133. { label: '创建人', name: 'CreatePerson', width: 150, align: 'left' },
  134. { label: '创建时间', name: 'CreateDateTime', width: 150, align: 'left' },
  135. ],
  136. shrinkToFit: false,//宽度自适应
  137. autoWidth:true,
  138. gridComplete: function () {
  139. },
  140. pager: "#gridPager",
  141. sortorder: "desc",
  142. sortname: 'ApplyNegCode',
  143. viewrecords: true,
  144. multiselect: true,
  145. //beforeSelectRow: function (rowid, e) {
  146. // $("#gridList").jqGrid('resetSelection');
  147. // return (true);
  148. //},
  149. subGrid: true, // (1)开启子表格支持
  150. subGridRowExpanded: function (subgrid_id, rowid) { // (2)子表格容器的id和需要展开子表格的行id,将传入此事件函数
  151. debugger;
  152. $("#gridList").jqGrid("setSelection", rowid, false);
  153. bindSubGrid(subgrid_id, rowid)
  154. }
  155. });
  156. }
  157. function bindSubGrid(subgrid_id, rowid) {
  158. debugger;
  159. $("#gridList").jqGrid("setSelection", rowid, false);
  160. var subgrid_table_id;
  161. subgrid_table_id = subgrid_id + "_t"; // (3)根据subgrid_id定义对应的子表格的table的id
  162. var subgrid_pager_id;
  163. subgrid_pager_id = subgrid_id + "_pgr" // (4)根据subgrid_id定义对应的子表格的pager的id
  164. // (5)动态添加子报表的table和pager
  165. $("#" + subgrid_id).html("<table id='" + subgrid_table_id + "' class='scroll'></table><div id='" + subgrid_pager_id + "' class='scroll'></div>");
  166. var ApplyNegCode = $("#gridList").jqGrid('getRowData', rowid).ApplyNegCode;
  167. // (6)创建jqGrid对象
  168. $("#" + subgrid_table_id).dataGrid({
  169. cellEdit: true,
  170. url: "/WMS/MaterialsDeliveredRTM/GetICSMOApplyNegDetail?ApplyNegCode=" + ApplyNegCode + "&" + Math.random(), // (7)子表格数据对应的url,注意传入的contact.id参数
  171. //colModel: [
  172. // { label: "主键", name: "ID", hidden: true, key: true },
  173. // { label: "退料申请单号", name: "ApplyNegCode", width: 150, align: 'left' },
  174. // { label: "退料申请单行号", name: "Sequence", width: 150, align: 'left' },
  175. // { label: '来源单据表体ID', name: 'SourceDetailID', width: 100, align: 'left' },
  176. // { label: '料品编码', name: 'InvCode', width: 100, align: 'left' },
  177. // { label: '数量', name: 'Quantity', width: 100, align: 'left' },
  178. // { label: '辅计量数量', name: 'Amount', width: 100, align: 'left' },
  179. // { label: '已退数量', name: 'IssueNegQuantity', width: 100, align: 'left' },
  180. // { label: '自由项唯一标识', name: 'ExtensionID', width: 150, align: 'left' },
  181. // { label: '操作人名称', name: 'MUSERName', width: 150, align: 'left' },
  182. // { label: '操作时间', name: 'MTIME', width: 150, align: 'left' },
  183. //],
  184. colModel: _Clos,
  185. sortname: 'MTIME',
  186. shrinkToFit: true,//宽度自适应
  187. //multiselect: true,
  188. prmNames: { search: "search" },
  189. viewrecords: true,
  190. height: "100%",
  191. rowNum: 20,
  192. pager: subgrid_pager_id,
  193. });
  194. }
  195. function btn_Delete() {
  196. var objArr = '';
  197. var objList = $("#gridList").jqGrid('getGridParam', 'selarrrow');
  198. for (var i = 0; i < objList.length; i++) {
  199. var rowId = objList[i];
  200. var rowData = $("#gridList").jqGrid('getRowData', rowId);
  201. objArr += "'" + rowData.ApplyNegCode + "',";
  202. }
  203. if (objArr == '') {
  204. $.modalAlertNew("WMS00001");
  205. return;
  206. }
  207. $.deleteForm({
  208. url: "/WMS/MaterialsDeliveredRTM/DeleteICSMOApplyNeg" + "?" + Math.random(),
  209. param: { keyValue: JSON.stringify(objArr) },
  210. success: function () {
  211. $.currentWindow().$("#gridList").trigger("reloadGrid");
  212. }
  213. })
  214. }
  215. //修改类型
  216. function btn_update() {
  217. var ids = $("#gridList").jqGrid('getGridParam', 'selarrrow'); //获取 多行数据
  218. if (ids.length != 1) {
  219. $.modalAlertNew("WMS00006");
  220. return;
  221. }
  222. for (var i in ids) {
  223. var rowData = jQuery("#gridList").jqGrid("getRowData", ids[i]);
  224. var ID = rowData.ID;
  225. var ApplyNegCode = rowData.ApplyNegCode;
  226. var WHCode = rowData.WHCode;
  227. $.modalOpen({
  228. id: "Details",
  229. title: "修改",
  230. url: "/WMS/MaterialsDeliveredRTM/ICSMOApplyNegMDUpdate?ID=" + ID + "&ApplyNegCode=" + ApplyNegCode + "&WHCode=" + WHCode + "&" + Math.random(),
  231. width: "1000px",
  232. height: "1200px",
  233. callBack: function (iframeId) {
  234. top.frames[iframeId].submitForm();
  235. }
  236. });
  237. }
  238. }
  239. function btnCreate() {
  240. $.modalOpen({
  241. id: "BRGCodeAdd",
  242. title: "新增",
  243. url: "/WMS/MaterialsDeliveredRTM/ICSMOApplyNegMDAdd" + "?" + Math.random(),
  244. width: "1000px",
  245. height: "1200px",
  246. callBack: function (iframeId) {
  247. top.frames[iframeId].submitForm();
  248. }
  249. });
  250. }
  251. function btn_Audit() {
  252. var ids = $("#gridList").jqGrid('getGridParam', 'selarrrow'); //获取 多行数据
  253. if (ids.length != 1) {
  254. $.modalAlertNew("WMS00087");
  255. return;
  256. }
  257. var RoleEnCode = '@NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode'
  258. var WorkPoint = '@NFine.Code.OperatorProvider.Provider.GetCurrent().Location'
  259. var date = new Date();
  260. for (var i in ids) {
  261. ID = $("#gridList").jqGrid('getRowData', ids[i]).ID;
  262. Status = $("#gridList").jqGrid('getRowData', ids[i]).Status;
  263. if (Status != '开立') {
  264. $.modalAlertNew("WMS00088");
  265. return;
  266. }
  267. }
  268. var ICSASNs = {
  269. ID: ID,
  270. User: RoleEnCode,
  271. MTIME: date,
  272. WorkPoint: WorkPoint
  273. }
  274. var ICSASN = [];
  275. ICSASN.push(ICSASNs);
  276. $.submitForm({
  277. url: "/WMS/ProductionIssue/AuditICSMOApplyNeg?" + Math.random(),
  278. param: { ICSASN: JSON.stringify(ICSASN) },
  279. success: function () {
  280. $.currentWindow().$("#gridList").trigger("reloadGrid");
  281. }
  282. })
  283. }
  284. </script>
  285. <div class="topPanel" style="height:45px">
  286. <div class="toolbar">
  287. <div class="btn-group">
  288. <a id="NF-Create" authorize="yes" class="btn btn-primary" onclick="btnCreate()"><i class="fa fa-pencil-square-o"></i>新增</a>
  289. <a id="NF-update" authorize="yes" class="btn btn-primary" onclick="btn_update()"><i class="fa fa-pencil-square-o"></i>修改</a>
  290. <a id="NF-Audit" authorize="yes" class="btn btn-primary" onclick="btn_Audit()"><i class="fa fa-pencil-square-o"></i>审核</a>
  291. <a id="NF-Delete" authorize="yes" class="btn btn-primary" onclick="btn_Delete()"><i class="fa fa-trash-o"></i>删除</a>
  292. <a class="btn btn-primary" onclick="$.reload()"><span class="glyphicon glyphicon-refresh"></span></a>
  293. </div>
  294. </div>
  295. </div>
  296. <div class="gridPanel">
  297. <table id="gridList"></table>
  298. <div id="gridPager"></div>
  299. </div>