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

468 lines
16 KiB

3 years ago
  1. 
  2. @{
  3. ViewBag.Title = "Index";
  4. Layout = "~/Views/Shared/_Index.cshtml";
  5. }
  6. <style>
  7. .formTitle {
  8. text-align: right;
  9. width: 10%;
  10. }
  11. .formActions {
  12. text-align: left;
  13. width: 15%;
  14. }
  15. .project-list table tr td {
  16. padding: 5px;
  17. }
  18. .th_classAdd {
  19. text-align: center !important;
  20. }
  21. .th_classMar {
  22. padding: 10px;
  23. vertical-align: inherit;
  24. }
  25. .ui-jqgrid .ui-jqgrid-view {
  26. height: 500px;
  27. }
  28. .ui-jqgrid .ui-jqgrid-bdiv {
  29. height: 500px !important;
  30. }
  31. .bootstrap-select:not([class*="col-"]):not([class*="form-control"]):not(.input-group-btn) {
  32. width: 100%;
  33. }
  34. .lr-layout-center {
  35. padding: 0 5px;
  36. }
  37. .th_classMar {
  38. padding: 0;
  39. }
  40. .lr-layout-tool {
  41. height: 50px;
  42. }
  43. .lr-layout-center .lr-layout-wrap.lr-layout-wrap-notitle {
  44. padding-top: 50px;
  45. }
  46. .wrapper .nav-tabs {
  47. padding: 0;
  48. }
  49. .webuploader-pick {
  50. padding: 7px 15px;
  51. }
  52. .table > tbody > tr > td, .table > tbody > tr > th, .table > tfoot > tr > td, .table > tfoot > tr > th, .table > thead > tr > td, .table > thead > tr > th {
  53. padding: 3px;
  54. }
  55. .form .formTitle {
  56. padding-right: 8px;
  57. }
  58. .form-control, .single-line {
  59. padding: 3px;
  60. }
  61. .ibox-title {
  62. height: 20px;
  63. line-height: 20px;
  64. padding: 0;
  65. padding-left: 15px;
  66. }
  67. .table {
  68. margin-bottom: 0;
  69. }
  70. .bootstrap-select > .dropdown-toggle {
  71. height: 22px;
  72. padding: 2px 6px;
  73. }
  74. .bootstrap-select > .dropdown-toggle.bs-placeholder, .bootstrap-select > .dropdown-toggle.bs-placeholder:hover, .bootstrap-select > .dropdown-toggle.bs-placeholder:focus, .bootstrap-select > .dropdown-toggle.bs-placeholder:active {
  75. height: 22px;
  76. padding: 2px 6px;
  77. }
  78. .form-control, .single-line {
  79. padding: 3px;
  80. height: 22px;
  81. padding: 0 3px;
  82. }
  83. </style>
  84. <link href="~/Content/js/select2/select2.min.css" rel="stylesheet" />
  85. <script src="~/Content/js/select2/select2.min.js"></script>
  86. <script src="~/Content/js/layer/layer.js"></script>
  87. <script>
  88. var BID = $.request("ID");
  89. var InvCode = $.request("InvCode");
  90. var GroupName = decodeURI($.request("GroupName"));
  91. var Flag = '';
  92. $(function () {
  93. debugger;
  94. InitControl1();
  95. if (BID != "") {
  96. $("#txtInvCode").val(InvCode);
  97. $("#sel_GroupCode option:contains('" + GroupName + "')").attr('selected', true).trigger("change");
  98. gridList2();
  99. } else {
  100. gridList();
  101. }
  102. $("#sel_GroupCode").change(function () {
  103. var InvCode = $("#txtInvCode").val();
  104. if (InvCode=='') {
  105. $.modalAlertNew("WMS00042");
  106. return;
  107. }
  108. debugger;
  109. jQuery("#gridList").jqGrid("clearGridData");
  110. var ID = $("#sel_GroupCode").children('option:selected').val();
  111. $.ajax({
  112. url: "/WMS/BasicSettings/GetInspectionListInfo?ID=" + ID,
  113. dataType: "json",
  114. async: false,
  115. success: function (data) {
  116. debugger;
  117. if (data == "" || data == null) {
  118. $.modalAlertNew("WMS00022");
  119. return;
  120. }
  121. for (var i = 0; i < data.rows.length; i++) {
  122. var obj = {
  123. ID: data.rows[i].ID,
  124. ListCode: data.rows[i].ListCode,
  125. ListName: data.rows[i].ListName,
  126. Unit: data.rows[i].Unit,
  127. SetValueMax: data.rows[i].SetValueMax,
  128. SetValueMin: data.rows[i].SetValueMin,
  129. Enable: data.rows[i].Enable,
  130. };
  131. $("#gridList").jqGrid('addRowData', obj.ID, obj, 'first');
  132. }
  133. //最后一行新增数据
  134. $(".unwritten").hide();
  135. }
  136. });
  137. });
  138. })
  139. function gridList() {
  140. var $gridList = $("#gridList");
  141. $gridList.dataGrid({
  142. url: "/WMS/BasicSettings/GetICSInventoryInspectionList?" + Math.random(),
  143. height: $(window).height() -50,
  144. width: $(window).width() - 400,
  145. cellEdit: true,
  146. cellsubmit: "clientArray",
  147. colModel: [
  148. { label: "主键", name: "ID", hidden: true, key: true },
  149. { label: '检验项目代码', name: 'ListCode', width: 135, align: 'left', editable: true, },
  150. { label: '检验项目名称', name: 'ListName', width: 135, align: 'left', editable: true, },
  151. { label: '单位', name: 'Unit', width: 135, align: 'left', editable: true, },
  152. { label: '标准上限', name: 'SetValueMax', width: 135, align: 'left', editable: true, },
  153. { label: '标准下限', name: 'SetValueMin', width: 135, align: 'left', editable: true, },
  154. // { label: '是否启用', name: 'Enable', width: 135, align: 'left', editable: true, },
  155. { label: '是否启用', name: 'Enable', width: 80, align: 'center', edittype: 'select', editoptions: { value: GetItemCode(), }, editable: true },
  156. ],
  157. afterSaveCell: function (rowid, cellname, value) {
  158. if (cellname === 'ProjectCN') {
  159. $gridList.jqGrid("setCell", rowid, 'ProjectID', value);
  160. }
  161. },
  162. width: "100%",
  163. autowidth: true,
  164. rownumbers: true,
  165. viewrecords: true,
  166. });
  167. }
  168. function gridList2() {
  169. var $gridList = $("#gridList");
  170. $gridList.dataGrid({
  171. url: "/WMS/BasicSettings/GetICSInventoryInspectionList2?BID=" + BID + "&" + Math.random(),
  172. height: $(window).height() - 50,
  173. width: $(window).width() - 400,
  174. cellEdit: true,
  175. cellsubmit: "clientArray",
  176. colModel: [
  177. { label: "主键", name: "ID", hidden: true, key: true },
  178. { label: '检验项目代码', name: 'ListCode', width: 135, align: 'left', editable: true, },
  179. { label: '检验项目名称', name: 'ListName', width: 135, align: 'left', editable: true, },
  180. { label: '单位', name: 'Unit', width: 135, align: 'left', editable: true, },
  181. { label: '标准上限', name: 'SetValueMax', width: 135, align: 'left', editable: true, },
  182. { label: '标准下限', name: 'SetValueMin', width: 135, align: 'left', editable: true, },
  183. // { label: '是否启用', name: 'Enable', width: 135, align: 'left', editable: true, },
  184. { label: '是否启用', name: 'Enable', width: 80, align: 'center', edittype: 'select', editoptions: { value: GetItemCode(), }, editable: true },
  185. ],
  186. afterSaveCell: function (rowid, cellname, value) {
  187. if (cellname === 'ProjectCN') {
  188. $gridList.jqGrid("setCell", rowid, 'ProjectID', value);
  189. }
  190. },
  191. width: "100%",
  192. autowidth: true,
  193. rownumbers: true,
  194. viewrecords: true,
  195. });
  196. }
  197. function guid() {
  198. return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
  199. var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
  200. return v.toString(16);
  201. });
  202. }
  203. function AddRows_ColorFastness() {
  204. var obj = {
  205. ID: guid(),
  206. ListCode: "",
  207. ListName: "",
  208. SetValueMax: "",
  209. SetValueMin: "",
  210. Enable: "",
  211. };
  212. $("#gridList").jqGrid('addRowData', obj.ID, obj, 'last');
  213. $(".unwritten").hide();
  214. } gridList
  215. function DelRows_ColorFastness() {
  216. var rowid = $("#gridList").jqGridRowValue().ID
  217. $.ajax({
  218. url: "/WMS/BasicSettings/DeleteINvItem?" + Math.random(),
  219. data: { ID: rowid },
  220. dataType: "json",
  221. async: false,
  222. success: function (data) {
  223. $("#gridList").delRowData(rowid);
  224. }
  225. });
  226. }
  227. function submitForm() {
  228. debugger;
  229. $("#gridList").find($("td[aria-describedby='gridList_rn']")).click();//提交取消编辑状态
  230. var InvCode = $("#txtInvCode").val();
  231. var ID = $("#sel_GroupCode").children('option:selected').val();
  232. var Enables = '';
  233. if (InvCode == '') {
  234. $.modalAlertNew("WMS00010");
  235. return;
  236. }
  237. if (ID == '') {
  238. $.modalAlertNew("WMS00011");
  239. return;
  240. }
  241. var obj_Item1 = $("#gridList");
  242. var rowIds_Item1 = obj_Item1.getDataIDs();
  243. var arrayData_Item1 = new Array();
  244. if (rowIds_Item1.length > 0) {
  245. debugger;
  246. for (var i = 0; i < rowIds_Item1.length; i++) {
  247. var RowData_Item1 = obj_Item1.getRowData(rowIds_Item1[i]);
  248. if (RowData_Item1.ListCode == '') {
  249. $.modalAlertNew("WMS00012");
  250. return;
  251. }
  252. if (RowData_Item1.ListName == '') {
  253. $.modalAlertNew("WMS00012");
  254. return;
  255. }
  256. if (RowData_Item1.Unit == '') {
  257. $.modalAlertNew("WMS00012");
  258. return;
  259. }
  260. if (RowData_Item1.SetValueMax == '') {
  261. $.modalAlertNew("WMS00012");
  262. return;
  263. }
  264. if (RowData_Item1.SetValueMin == '') {
  265. $.modalAlertNew("WMS00012");
  266. return;
  267. }
  268. if (RowData_Item1.Enable == '') {
  269. $.modalAlertNew("WMS00012");
  270. return;
  271. }
  272. if (RowData_Item1.Enable == '是') {
  273. Enables = '1';
  274. } else {
  275. Enables = '0';
  276. }
  277. var obj = {
  278. ID: RowData_Item1.ID,
  279. ListCode: RowData_Item1.ListCode,
  280. ListName: RowData_Item1.ListName,
  281. Unit: RowData_Item1.Unit,
  282. SetValueMax: RowData_Item1.SetValueMax,
  283. SetValueMin: RowData_Item1.SetValueMin,
  284. Enable: Enables,
  285. };
  286. arrayData_Item1.push(obj);
  287. }
  288. }
  289. var arrayItem1 = JSON.stringify(arrayData_Item1);
  290. debugger;
  291. if (BID != "") {
  292. $.ajax({
  293. url: "/WMS/BasicSettings/UpdateICSInventoryInspectionGroup?BID=" + BID + "&InvCode=" + InvCode + "&ID=" + ID + "&" + Math.random(),
  294. data: {
  295. arrayShellFabricItem: arrayItem1,
  296. },
  297. //type: "post",
  298. dataType: "json",
  299. success: function (data) {
  300. layer.msg(data.message);
  301. if (data.message == '修改成功!') {
  302. window.setTimeout(function () {
  303. $.modalClose();
  304. }, 2500);
  305. }
  306. $.currentWindow().$("#gridList").trigger("reloadGrid");
  307. },
  308. });
  309. } else {
  310. $.ajax({
  311. url: "/WMS/BasicSettings/SubICSInventoryInspectionGroupAdd?ID=" + ID + "&InvCode=" + InvCode + "&" + Math.random(),
  312. data: {
  313. arrayShellFabricItem: arrayItem1,
  314. },
  315. type: "post",
  316. dataType: "json",
  317. success: function (data) {
  318. layer.msg(data.message);
  319. if (data.message == '保存成功!') {
  320. window.setTimeout(function () {
  321. $.modalClose();
  322. }, 2500);
  323. }
  324. $.currentWindow().$("#gridList").trigger("reloadGrid");
  325. },
  326. });
  327. }
  328. }
  329. function btnSearch() {
  330. $.modalOpen({
  331. id: "ICSSearchInventory",
  332. title: "查询物料",
  333. url: "/WMS/BasicSettings/ICSSearchInventory?" + Math.random(),
  334. width: "1000px",
  335. height: "1000px",
  336. callBack: function (iframeId) {
  337. var obj = top.frames[iframeId].submitForm();
  338. $("#txtInvCode").val(obj.invcode);
  339. top.frames[iframeId].Close();
  340. }
  341. })
  342. }
  343. function InitControl1() {
  344. var $GroupCode = $("#sel_GroupCode");
  345. $GroupCode.select2({
  346. allowClear: true,
  347. escapeMarkup: function (m) {
  348. return m;
  349. }
  350. });
  351. $.ajax({
  352. url: "/WMS/BasicSettings/GetGroupCode" + "?" + Math.random(),
  353. dataType: "json",
  354. async: false,
  355. success: function (data) {
  356. $.each(data, function (index, item) {
  357. $GroupCode.append("<option value='" + item.ID + "'>&nbsp;" + item.GroupName + "</option>");
  358. });
  359. }
  360. });
  361. }
  362. function GetItemCode() {
  363. var str = ":;是:是;否:否";
  364. /*debugger;*/
  365. return str;
  366. }
  367. </script>
  368. <form id="form1">
  369. <div style="padding-top: 20px; margin-right: 20px;">
  370. <div class="ibox-title">
  371. 主表
  372. </div>
  373. <table class="form">
  374. <tr>
  375. <th class="formTitle">料品编码:</th>
  376. <td class="formValue">
  377. <input id="txtInvCode" type="text" class="form-control" style="width: 200px;" disabled="disabled" >
  378. </td>
  379. <td class="formValue">
  380. <a id="Getinv" authorize="yes" style="margin-left:3px;" class="btn btn-info" onclick="btnSearch()"><i class="fa fa-pencil-square-o"></i>查询</a>
  381. </td>
  382. <th class="formTitle">检验项目组:</th>
  383. <td class="formValue">
  384. <select id="sel_GroupCode" name="sel_GroupCode" class="form-control select2" style="width: 120px" ></select>
  385. </td>
  386. </tr>
  387. </table>
  388. </div>
  389. </form>
  390. <!--色牢度-->
  391. <div class="gridPanel" style="width: 100% ">
  392. <div class="ibox-title">
  393. 子表
  394. </div>
  395. <div class="gridPanel">
  396. <div id="gridPager">
  397. <label class="radio-inline">
  398. <a style="margin-left:3px;" class="btn btn-next" onclick="AddRows_ColorFastness()"><i class="fa fa-plus" style="margin-right:5px"></i>新增</a>
  399. </label>
  400. <label class="radio-inline">
  401. <a style="margin-left:3px;" class="btn btn-next" onclick="DelRows_ColorFastness()"><i class="fa fa-minus" style="margin-right:5px"></i>删除</a>
  402. </label>
  403. </div>
  404. <table id="gridList"></table>
  405. </div>
  406. </div>
  407. n