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

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