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

322 lines
13 KiB

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