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.

250 lines
11 KiB

4 days ago
  1. @{
  2. ViewBag.Title = "Index";
  3. Layout = "~/Views/Shared/_Index.cshtml";
  4. }
  5. <script src="~/Content/js/datepicker/WdatePicker.js"></script>
  6. <script>
  7. var Type = $.request("Type");
  8. $(document).ready(function () {
  9. $("input.cell").keyup(function (e) {
  10. switch (e.keyCode) {
  11. // up arrow
  12. case 40:
  13. $(this).parent()
  14. .parent()
  15. .next()
  16. .children("td")
  17. .children("input.cell[name="
  18. + $(this).attr("name") + "]")
  19. .focus();
  20. break;
  21. // down arrow
  22. case 38:
  23. $(this).parent()
  24. .parent()
  25. .prev()
  26. .children("td")
  27. .children("input.cell[name="
  28. + $(this).attr("name") + "]")
  29. .focus();
  30. break;
  31. }
  32. });
  33. });</script>
  34. <script>
  35. $(function () {
  36. gridList();
  37. })
  38. function gridList() {
  39. var $gridList = $("#gridList");
  40. var queryJson = {
  41. InvCode: $("#txt_InvCode").val(),
  42. InvName: $("#txt_InvName").val(),
  43. VenCode: $("#txt_VenCode").val(),
  44. VenName: $("#txt_VenName").val(),
  45. }
  46. $gridList.dataGrid({
  47. url: "/KBSSRM/InvMaintenance/GetGridJson" + "?" + Math.random(),
  48. postData: { queryJson: JSON.stringify(queryJson) },
  49. height: $(window).height() - 200,
  50. width: $(window).width() - 300,
  51. colModel: [
  52. { label: "主键", name: "ID", hidden: true, key: true },
  53. { label: '物料编码', name: 'InvCode', width: 150, align: 'left' },
  54. { label: '物料名称', name: 'InvName', width: 100, align: 'left' },
  55. { label: '原材料厂商', name: 'EATTRIBUTE11', width: 150, align: 'left' },
  56. { label: 'UL证书编号', name: 'EATTRIBUTE12', width: 100, align: 'left' },
  57. { label: '工厂UL编号', name: 'EATTRIBUTE13', width: 100, align: 'left' },
  58. { label: '采购贸易商', name: 'EATTRIBUTE14', width: 100, align: 'left' },
  59. { label: '版本:', name: 'EATTRIBUTE15', width: 100, align: 'left' },
  60. { label: '制造商::', name: 'EATTRIBUTE16', width: 100, align: 'left' },
  61. { label: '地址:', name: 'EATTRIBUTE17', width: 100, align: 'left' },
  62. { label: '重量:', name: 'EATTRIBUTE18', width: 100, align: 'left' },
  63. { label: '是否食品安全级:', name: 'EATTRIBUTE19', width: 100, align: 'left' },
  64. { label: '站点:', name: 'WorkPoint', hidden: true },
  65. ],
  66. shrinkToFit: true,//宽度自适应
  67. gridComplete: function () {
  68. },
  69. pager: "#gridPager",
  70. sortorder: "desc",
  71. sortname: 'InvCode ',
  72. viewrecords: true,
  73. multiselect: true,
  74. });
  75. $("#warehouse a.btn-default").click(function () {
  76. $("#warehouse a.btn-default").removeClass("active");
  77. $(this).addClass("active");
  78. $('#btn_search').trigger("click");
  79. });
  80. $("#btn_search").click(function () {
  81. var warehouse = $("#warehouse a.active").attr('data-value');
  82. var queryJson = {
  83. InvCode: $("#txt_InvCode").val(),
  84. InvName: $("#txt_InvName").val(),
  85. VenCode: $("#txt_VenCode").val(),
  86. VenName: $("#txt_VenName").val(),
  87. }
  88. $gridList.jqGrid('setGridParam', {
  89. postData: { queryJson: JSON.stringify(queryJson) },
  90. page: 1
  91. }).trigger('reloadGrid');
  92. });
  93. }
  94. function btn_update() {
  95. debugger;
  96. var ids = $("#gridList").jqGrid('getGridParam', 'selarrrow'); //获取 多行数据
  97. if (ids.length != 1) {
  98. $.modalAlert("请选择一行数据进行修改!");
  99. return;
  100. }
  101. for (var i in ids) {
  102. var rowData = jQuery("#gridList").jqGrid("getRowData", ids[i]);
  103. var InvCode = rowData.InvCode;
  104. var WorkPoint = rowData.WorkPoint;
  105. $.modalOpen({
  106. id: "InvMaintenanceUpdate",
  107. title: "修改",
  108. url: "/KBSSRM/InvMaintenance/InvMaintenanceUpdate?InvCode=" + InvCode + "&WorkPoint=" + WorkPoint + "&" + Math.random(),
  109. width: "500px",
  110. height: "660px",
  111. callBack: function (iframeId) {
  112. top.frames[iframeId].submitForm();
  113. },
  114. btnClose: function (iframeId) {
  115. top.frames[iframeId].dessubmitForm();
  116. }
  117. });
  118. }
  119. }
  120. function btn_UPload() {
  121. $("#FileUp").click();
  122. }
  123. function btnUpLoad(up) {
  124. debugger;
  125. // var JSDateDay = $("#txt_JSDate").val();
  126. var form = new FormData(document.getElementById("form1"));
  127. $.ajax({
  128. url: "/KBSSRM/InvMaintenance/UploadFile?" + Math.random() ,
  129. type: "post",
  130. data: form,
  131. contentType: false,
  132. processData: false,
  133. success: function (data) {
  134. var obj = eval('(' + data + ')');
  135. alert(obj.mass);
  136. $.currentWindow().$("#gridList").trigger("reloadGrid");
  137. },
  138. error: function (aa) {
  139. alert("上传失败:" + aa);
  140. }
  141. });
  142. document.getElementById("FileUp").value = "";
  143. }
  144. function btn_ExportAll() {
  145. var postData = "&keyValue=1";
  146. if ($("#txt_InvCode").val() != null && $("#txt_InvCode").val() != "") {
  147. postData = "&InvCode=" + $("#txt_InvCode").val()
  148. }
  149. if ($("#txt_InvName").val() != null && $("#txt_InvName").val() != "") {
  150. postData += "&InvName=" + $("#txt_InvName").val()
  151. }
  152. if ($("#txt_VenCode").val() != null && $("#txt_VenCode").val() != "") {
  153. postData += "&VenCode=" + $("#txt_VenCode").val()
  154. }
  155. if ($("#txt_VenName").val() != null && $("#txt_VenName").val() != "") {
  156. postData += "&VenName=" + $("#txt_VenName").val()
  157. }
  158. $.download("/KBSSRM/InvMaintenance/ExportAll" + "?" + Math.random(), postData, 'post');
  159. }
  160. </script>
  161. <form id="form1">
  162. <iframe id="ifrm" src="" width="0" height="0"></iframe>
  163. <div class="topPanel" style="height:60px">
  164. <div class="toolbar">
  165. <div class="btn-group">
  166. <input id="FileUp" name="FileUp" type="file" style="display:none;" accept=".csv, application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" onchange="btnUpLoad(this)" />
  167. @* <a id="NF-CreateCartonNo" authorize="yes" style="margin-left:3px;" class="btn btn-primary" onclick="btnCreate()"><i class="fa fa-pencil-square-o"></i>维护</a>*@
  168. <a id="NF-updateInv" authorize="yes" style="margin-left:3px;" class="btn btn-warning" onclick="btn_update()"><i class="fa fa-pencil-square-o"></i>维护</a>
  169. <a id="NF-UPload" authorize="yes" style="margin-left:3px;" class="btn btn-danger" onclick="btn_UPload()"><i class="fa fa-pencil-square-o"></i>导入</a>
  170. <a id="NF-ExportAll" authorize="yes" style="margin-left:3px;" class="btn btn-primary" onclick="btn_ExportAll()"><i class="fa fa-pencil-square-o"></i>导出</a>
  171. <a href="~/File/Stack/物料维护导入模板.xlsx" id="NF-IntroductionMould" authorize="yes" class="btn btn-primary dropdown-text"><i class="fa fa-file-excel-o"></i>导入模板下载</a>
  172. @*<a id="NF-Print" authorize="yes" style="margin-left:3px;" class="btn btn-primary" onclick="btnPrint()"><i class="fa fa-pencil-square-o"></i>打印</a>*@
  173. @*<a class="btn btn-primary" style="margin-left:3px;" onclick="$.reload()"><span class="glyphicon glyphicon-refresh"></span></a>*@
  174. </div>
  175. @*<div class="btn-group" style="display:block;padding-left:2px;">
  176. <a class="btn btn-primary" id="downPrintControl" href="~/PrintActivex.exe">点击下载打印组件</a>
  177. </div>*@
  178. <script>$('.toolbar').authorizeButton()</script>
  179. </div>
  180. <div class="search">
  181. <table>
  182. <tr>
  183. <td>
  184. <label>物料编码:</label>
  185. </td>
  186. <td>
  187. <div class="input-group">
  188. <input id="txt_InvCode" type="text" class="form-control" placeholder="物料编码" style="width: 120px;">
  189. </div>
  190. </td>
  191. <td>&nbsp;&nbsp;&nbsp;</td>
  192. <td>
  193. <label>物料名称:</label>
  194. </td>
  195. <td>
  196. <div class="input-group">
  197. <input id="txt_InvName" type="text" class="form-control" placeholder="物料名称" style="width: 120px;">
  198. </div>
  199. </td>
  200. <td>&nbsp;&nbsp;&nbsp;</td>
  201. <td>
  202. <label>供应商编码:</label>
  203. </td>
  204. <td>
  205. <div class="input-group">
  206. <input id="txt_VenCode" type="text" class="form-control" placeholder="供应商编码" style="width: 120px;">
  207. </div>
  208. </td>
  209. <td>&nbsp;&nbsp;&nbsp;</td>
  210. <td>
  211. <label>供应商名称:</label>
  212. </td>
  213. <td>
  214. <div class="input-group">
  215. <input id="txt_VenName" type="text" class="form-control" placeholder="供应商名称" style="width: 120px;">
  216. </div>
  217. </td>
  218. <td>&nbsp;&nbsp;&nbsp;</td>
  219. <td>
  220. <span class="input-group-btn">
  221. <button id="btn_search" type="button" class="btn btn-primary"><i class="fa fa-search"></i></button>
  222. <button id="btn btn-info" type="button" style="margin-left:3px;" class="btn btn-primary" onclick="$.reload()"><i class=" glyphicon glyphicon-refresh"></i></button>
  223. </span>
  224. </td>
  225. </tr>
  226. </table>
  227. </div>
  228. </div>
  229. <div class="gridPanel">
  230. <table id="gridList"></table>
  231. <div id="gridPager"></div>
  232. </div>
  233. </form>