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.

930 lines
38 KiB

1 year 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. /*.ui-jqgrid tr.jqgrow td {
  13. white-space: normal !important;
  14. height: auto;
  15. }*/
  16. </style>
  17. <script src="~/Content/js/CommonReport/CommonReport.js"></script>
  18. <script>
  19. debugger;
  20. // var Menu = decodeURI($.request("Menu"));
  21. var mold = $.request("mold");
  22. //var _MenuCaption = "";
  23. var _MenuTag = "";
  24. var _MenuID = "";//菜单ID
  25. var _SourceID = "";//数据源ID
  26. var _sqlTxt = "";//加上参数的sql
  27. var _sqlTxt_Condition = new Array();//加上过滤条件的sql
  28. var _sqlTxt_AddCondition = "";//加上过滤条件的sql
  29. var _IsExistsDataSource = "";
  30. var _DBName = "";//s数据库
  31. var _Cols = new Array();//列
  32. var _ReportName = "";
  33. var _Filter = "";
  34. var _TempName = "";
  35. var _footerrow = false;//是否有合计项
  36. var _footercols = new Array();//合计项
  37. var _formatcols = new Array();//个性化项
  38. var _formatcols_Row = new Array();//个性化项的行
  39. var _Mergercols = new Array();//合并项
  40. var _XCol = "";
  41. var dataRR = "";
  42. var _HiddenCols = new Array();
  43. $(function () {
  44. debugger;
  45. //1、获取当前页菜单名
  46. GetMenuID();
  47. //2、获取菜单设置
  48. GetMenu();
  49. //gridList();
  50. $(window).resize(function () {
  51. $("#gridList").setGridWidth($(window).width() * 0.99);
  52. $("#gridList").setGridWidth(document.body.clientWidth * 0.99);
  53. $("#gridList").setGridHeight($(window).height() - 132);
  54. $("#gridList").setGridHeight(document.body.clientHeight - 132);
  55. });
  56. });
  57. //1、获取当前页菜单名
  58. function GetMenuID() {
  59. debugger;
  60. var cc = self.frameElement.getAttribute('id');
  61. _MenuID = cc.replace("iframe", "");
  62. //_MenuTag = $.request("MenuTag");
  63. //$.ajax({
  64. // url: "/SystemManage/CommonReport/GetMenuID?MenuTag=" + _MenuTag + "&" + Math.random(),
  65. // dataType: "json",
  66. // async: false,
  67. // success: function (data) {
  68. // if (data != false && data != null && data.length > 0) {
  69. // _MenuID = data[0].MenuID;
  70. // }
  71. // else {
  72. // alert("获取菜单ID异常,请查看菜单配置并刷新:" + data);
  73. // }
  74. // },
  75. // error: function (aa) {
  76. // alert("异常:" + aa.responseText);
  77. // }
  78. //});
  79. }
  80. //2、获取菜单设置 URL 列 等
  81. function GetMenu() {
  82. debugger;
  83. $.ajax({
  84. url: "/SystemManage/CommonReport/GetMenu?MenuID=" + _MenuID + "&" + Math.random(),
  85. dataType: "json",
  86. async: false,
  87. success: function (data) {
  88. if (data != false && data != null) {
  89. _sqlTxt = data.sqlTxt;
  90. _sqlTxt_AddCondition = data.sqlTxt;
  91. _DBName = data.DBName;
  92. _SourceID = data.SourceID;
  93. _IsExistsDataSource = data.IsExistsDataSource;
  94. _ReportName = data.ReportName;
  95. _XCol = data.XCol;
  96. _Mergercols = eval(data.Mergercols);
  97. _formatcols = data.formatcols;
  98. _TempName = data.TempName;
  99. _footerrow = data.footerrow;
  100. _footercols = eval(data.footercols);
  101. _Cols = SetCols(eval(data.Cols));
  102. _HiddenCols = eval(data.HiddenCols);
  103. btn_Filter();
  104. }
  105. else {
  106. alert("获取菜单栏位等信息异常。" + data);
  107. }
  108. },
  109. error: function (aa) {
  110. alert("异常:" + aa.responseText);
  111. }
  112. });
  113. }
  114. //个性化栏位背景色
  115. function addCellAttr(rowId, val, rawObject, cm, rdata) {
  116. var rr = ' id=\'' + cm.name + '' + rowId + "\' ";
  117. var formatList = Getformatcol(_formatcols, cm.name);//获取format所有条件
  118. if (formatList != null && formatList.length > 0) {
  119. for (var i = 0; i < formatList.length; i++) {
  120. var formatcol = formatList[i];//条件
  121. var IsRow = false;
  122. if (formatcol.AllRowFlag) {
  123. IsRow = true;
  124. var rr = {
  125. rowid: rowId - 1,
  126. backgroundcolor: formatcol.Color,
  127. }
  128. }
  129. var FormatDataType = formatcol.DataType;
  130. var LogStr = GetLogStringByNum(parseInt(formatcol.LogStr));
  131. if (FormatDataType != "日期型") {
  132. switch (LogStr) {
  133. case "等于": if (val == formatcol.SValue) {
  134. if (IsRow) { _formatcols_Row.push(rr); }
  135. else { rr += "style='background-color:" + formatcol.Color + "'"; return rr; }
  136. }
  137. break;
  138. case "不等于": if (val != formatcol.SValue) {
  139. if (IsRow) { _formatcols_Row.push(rr); }
  140. else { rr += "style='background-color:" + formatcol.Color + "'"; return rr; }
  141. }
  142. break;
  143. case "小于": if (val < formatcol.SValue) {
  144. if (IsRow) { _formatcols_Row.push(rr); }
  145. else { rr += "style='background-color:" + formatcol.Color + "'"; return rr; }
  146. }
  147. break;
  148. case "大于": if (val > formatcol.SValue) {
  149. if (IsRow) { _formatcols_Row.push(rr); }
  150. else { rr += "style='background-color:" + formatcol.Color + "'"; return rr; }
  151. }
  152. break;
  153. case "小于等于": if (val <= formatcol.SValue) {
  154. if (IsRow) { _formatcols_Row.push(rr); }
  155. else { rr += "style='background-color:" + formatcol.Color + "'"; return rr; }
  156. }
  157. break;
  158. case "大于等于": if (val >= formatcol.SValue) {
  159. if (IsRow) { _formatcols_Row.push(rr); }
  160. else { rr += "style='background-color:" + formatcol.Color + "'"; return rr; }
  161. }
  162. break;
  163. case "范围内": if (val >= formatcol.SValue && val <= formatcol.DValue) {
  164. if (IsRow) { _formatcols_Row.push(rr); }
  165. else { rr += "style='background-color:" + formatcol.Color + "'"; return rr; }
  166. }
  167. break;
  168. case "范围外": if (val < formatcol.SValue || val > formatcol.DValue) {
  169. if (IsRow) { _formatcols_Row.push(rr); }
  170. else { rr += "style='background-color:" + formatcol.Color + "'"; return rr; }
  171. }
  172. break;
  173. case "包含": if (val.indexOf(formatcol.SValue) != -1) {
  174. if (IsRow) { _formatcols_Row.push(rr); }
  175. else { rr += "style='background-color:" + formatcol.Color + "'"; return rr; }
  176. }
  177. break;
  178. case "头部包含": if (val.indexOf(formatcol.SValue) == 0) {
  179. if (IsRow) { _formatcols_Row.push(rr); }
  180. else { rr += "style='background-color:" + formatcol.Color + "'"; return rr; }
  181. }
  182. break;
  183. case "尾部包含": if (val.indexOf(formatcol.SValue) == formatcol.length - val.length) {
  184. if (IsRow) { _formatcols_Row.push(rr); }
  185. else { rr += "style='background-color:" + formatcol.Color + "'"; return rr; }
  186. }
  187. break;
  188. case "不包含": if (val.indexOf(formatcol.SValue) == -1) {
  189. if (IsRow) { _formatcols_Row.push(rr); }
  190. else { rr += "style='background-color:" + formatcol.Color + "'"; return rr; }
  191. }
  192. break;
  193. }
  194. }
  195. else {
  196. //日期型
  197. if (val.length >= 10) {
  198. var VV = val.substring(0, 10);
  199. switch (LogStr) {
  200. case "等于":
  201. if (VV == formatcol.SValue) {
  202. if (IsRow) { _formatcols_Row.push(rr); }
  203. else { rr += "style='background-color:" + formatcol.Color + "'"; return rr; }
  204. }
  205. break;
  206. case "不等于": if (VV != formatcol.SValue) {
  207. if (IsRow) { _formatcols_Row.push(rr); }
  208. else { rr += "style='background-color:" + formatcol.Color + "'"; return rr; }
  209. }
  210. break;
  211. case "小于":
  212. if (VV < formatcol.SValue) {
  213. if (IsRow) { _formatcols_Row.push(rr); }
  214. else { rr += "style='background-color:" + formatcol.Color + "'"; return rr; }
  215. }
  216. break;
  217. case "大于": if (VV > formatcol.SValue) {
  218. if (IsRow) { _formatcols_Row.push(rr); }
  219. else { rr += "style='background-color:" + formatcol.Color + "'"; return rr; }
  220. }
  221. break;
  222. case "小于等于": if (VV <= formatcol.SValue) {
  223. if (IsRow) { _formatcols_Row.push(rr); }
  224. else { rr += "style='background-color:" + formatcol.Color + "'"; return rr; }
  225. }
  226. break;
  227. case "大于等于": if (VV >= formatcol.SValue) {
  228. if (IsRow) { _formatcols_Row.push(rr); }
  229. else { rr += "style='background-color:" + formatcol.Color + "'"; return rr; }
  230. }
  231. break;
  232. case "范围内": if (VV >= formatcol.SValue && VV <= formatcol.DValue) {
  233. if (IsRow) { _formatcols_Row.push(rr); }
  234. else { rr += "style='background-color:" + formatcol.Color + "'"; return rr; }
  235. }
  236. break;
  237. case "范围外": if (VV < formatcol.SValue || VV > formatcol.DValue) {
  238. if (IsRow) { _formatcols_Row.push(rr); }
  239. else { rr += "style='background-color:" + formatcol.Color + "'"; return rr; }
  240. }
  241. break;
  242. }
  243. }
  244. }
  245. }
  246. }
  247. return rr;
  248. }
  249. //个性化栏位背景色
  250. function addCellAttr_ID(rowId, val, rawObject, cm, rdata) {
  251. var rr = ' id=\'' + cm.name + '' + rowId + "\' ";
  252. return rr;
  253. }
  254. function Getformatcol(formatcols, colname) {
  255. var formatList = new Array();
  256. if (formatcols != null && formatcols.length > 0) {
  257. for (var i = 0; i < formatcols.length; i++) {
  258. if (formatcols[i].ColFiledName == colname) {
  259. formatList.push(formatcols[i]);
  260. }
  261. }
  262. }
  263. return formatList;
  264. }
  265. //生成colModel
  266. function SetCols(datacols) {
  267. var cols = new Array();
  268. if (datacols != null && datacols.length > 0) {
  269. for (var i = 0; i < datacols.length; i++) {
  270. var ColCaption = datacols[i].ColCaption;
  271. var ColFiledName = datacols[i].ColFiledName;
  272. var DataType = datacols[i].DataType;
  273. var DataTypeStr = GetDataTypeByNum(DataType);
  274. var ColWidth = datacols[i].ColWidth;
  275. var DeciamlNum = datacols[i].DeciamlNum;
  276. var sortable = datacols[i].sortable;
  277. var ColMerFlag = datacols[i].ColMerFlag;
  278. var IsFormat = datacols[i].IsFormat;
  279. var obj = new Array();
  280. if (IsFormat == "1") {
  281. obj = {
  282. label: ColCaption,
  283. name: ColFiledName,
  284. width: ColWidth,
  285. align: "left",
  286. sortable: sortable,
  287. cellattr: addCellAttr,
  288. }
  289. }
  290. else {
  291. obj = {
  292. label: ColCaption,
  293. name: ColFiledName,
  294. width: ColWidth,
  295. align: "left",
  296. sortable: sortable,
  297. cellattr: addCellAttr_ID,
  298. }
  299. }
  300. switch (DataTypeStr) {
  301. case "数值型":
  302. var Formatoptions = new { decimalPlaces: DeciamlNum };
  303. obj.push({ formatter: "number" });
  304. obj.push({ formatoptions: Formatoptions });
  305. break;
  306. case "字符型":
  307. case "日期型":
  308. case "布尔值":
  309. break;
  310. }
  311. //if (IsFormat) {
  312. // obj.push({ cellattr: addCellAttr });
  313. //}
  314. cols.push(obj);
  315. }
  316. var collast = { label: "", name: "", width: "20", align: "left", sortable: false };
  317. cols.push(collast);
  318. }
  319. return cols;
  320. }
  321. function gridList() {
  322. document.getElementById("gridPanel").innerHTML = ' <table id="gridList"></table> <div id="gridPager"></div>';//重置grid
  323. _formatcols_Row = new Array();
  324. var $gridList = $("#gridList");
  325. var condion = new Array();
  326. if (_sqlTxt_Condition != undefined && _sqlTxt_Condition.length > 0) {
  327. condion = _sqlTxt_Condition;
  328. }
  329. $gridList.dataGrid({
  330. //url: "/SystemManage/CommonReport/GetGridJson",
  331. url: "/SystemManage/CommonReport/GetGridJsonNew",
  332. height: $(window).height() - 132,
  333. // postData: { sqlTxt: _sqlTxt_AddCondition, DBName: _DBName, TempName: _TempName },
  334. postData: { MenuID: _MenuID, sqlTxt_Condition: JSON.stringify(condion), DBName: _DBName, TempName: _TempName },
  335. colModel: _Cols,
  336. pager: "#gridPager",
  337. //sortname: ' ',
  338. //sortorder: ' ',
  339. sortname: _XCol,
  340. sortorder: ' ',
  341. viewrecords: true,
  342. multiselect: true,//开启选中行
  343. footerrow: _footerrow,
  344. gridComplete: function () {
  345. var strIds = $("#gridList").jqGrid("getDataIDs");
  346. if (_formatcols_Row.length > 0) {
  347. for (var i = 0; i < _formatcols_Row.length; i++) {
  348. $("#" + strIds[_formatcols_Row[i].rowid] + " td").css("background-color", _formatcols_Row[i].backgroundcolor);
  349. }
  350. }
  351. //$("#"+ids[ii]+ " td").css("background-color","red");
  352. //合并行
  353. if (_Mergercols != undefined && _Mergercols.length > 0) {
  354. for (var i = 0; i < _Mergercols.length; i++) {
  355. Merger("gridList", _Mergercols[i]);
  356. }
  357. }
  358. //合计
  359. if (_footerrow == true) {
  360. var footerData = {};
  361. for (var i = 0; i < _footercols.length; i++) {
  362. var total = 0;
  363. for (var j = 0; j < strIds.length; j++) {
  364. var qty = $("#gridList").jqGrid("getCell", strIds[j], _footercols[i]);
  365. if (qty != "") {
  366. total += parseInt(qty);
  367. }
  368. }
  369. footerData[_footercols[i]] = total;
  370. }
  371. $("#gridList").footerData('set', footerData);
  372. $("#gridList").footerData('set', { "rn": "合计" });
  373. }
  374. //隐藏列(不可见/无权限)
  375. if (_HiddenCols != null && _HiddenCols.length > 0) {
  376. for (var j = 0; j < _HiddenCols.length; j++) {
  377. $("#gridList").setGridParam().hideCol(_HiddenCols[j].ColFiledName);
  378. }
  379. }
  380. },
  381. loadError: function (data) {
  382. alert("异常:");
  383. }
  384. });
  385. $("#btn_search").click(function () {
  386. $gridList.jqGrid('setGridParam', {
  387. //sqlTxt: _sqlTxt_AddCondition, DBName: _DBName, TempName: _TempName
  388. MenuID: _MenuID, sqlTxt_Condition: JSON.stringify(condion), DBName: _DBName, TempName: _TempName
  389. }).trigger('reloadGrid');
  390. });
  391. }
  392. //过滤
  393. function btn_Filter() {
  394. $.modalOpenYC({
  395. id: "Filer",
  396. title: "过滤条件",
  397. url: "/SystemManage/CommonReport/Filter?MenuID=" + _MenuID + "&SourceID=" + _SourceID + "&" + Math.random(),
  398. width: "800px",
  399. height: "570px",
  400. //btn: ['确认', '关闭'],
  401. callBack: function (iframeId) {
  402. _sqlTxt_Condition = eval(top.frames[iframeId].submitForm());
  403. //_sqlTxt_AddCondition = _sqlTxt;
  404. if (_sqlTxt_Condition != undefined) {
  405. // if (_sqlTxt_Condition.length > 0) {
  406. // for (var i = 0; i < _sqlTxt_Condition.length; i++) {
  407. // _sqlTxt_AddCondition = ReplaceALL(_sqlTxt_AddCondition, _sqlTxt_Condition[i].CIndex, _sqlTxt_Condition[i].Content);
  408. // }
  409. // }
  410. top.frames[iframeId].Close();
  411. gridList();
  412. }
  413. }
  414. });
  415. }
  416. //数据源
  417. function btn_DataSource() {
  418. $.modalOpen({
  419. id: "DataSource",
  420. title: "数据源",
  421. url: "/SystemManage/CommonReport/DataSource?MenuID=" + _MenuID,//+ "&" + Math.random(),
  422. width: "1300px",
  423. height: "570px",
  424. btn: ['确认', '关闭'],
  425. callBack: function (iframeId) {
  426. dataRR = top.frames[iframeId].submitForm();
  427. if (dataRR == "Error")
  428. { }
  429. else {
  430. GetMenu();
  431. }
  432. }
  433. });
  434. }
  435. //列设置
  436. function btn_Cols() {
  437. if (_IsExistsDataSource != "1") {
  438. alert("请先设置数据源");
  439. }
  440. else {
  441. $.modalOpen({
  442. id: "Cols",
  443. title: "列设置",
  444. url: "/SystemManage/CommonReport/Cols?SourceID=" + _SourceID + "&MenuID=" + _MenuID + "&" + Math.random(),
  445. width: "1300px",
  446. height: "570px",
  447. btn: ['确认', '关闭'],
  448. callBack: function (iframeId) {
  449. top.frames[iframeId].submitForm();
  450. GetMenu();
  451. }
  452. });
  453. }
  454. }
  455. //个性化设置
  456. function btn_GridFormat() {
  457. if (_IsExistsDataSource != "1") {
  458. alert("请先设置数据源");
  459. }
  460. else {
  461. $.modalOpen({
  462. id: "GridFormat",
  463. title: "个性化设置",
  464. url: "/SystemManage/CommonReport/GridFormat?SourceID=" + _SourceID + "&" + Math.random(),
  465. width: "800px",
  466. height: "570px",
  467. btn: null,
  468. callBack: function (iframeId) {
  469. GetMenu();
  470. }
  471. });
  472. }
  473. }
  474. //多表头设置
  475. function btn_GridHeader() {
  476. if (_IsExistsDataSource != "1") {
  477. alert("请先设置数据源");
  478. }
  479. else {
  480. $.modalOpen({
  481. id: "GridHeader",
  482. title: "多表头设置",
  483. url: "/SystemManage/CommonReport/GridHeader?SourceID=" + _SourceID + "&" + Math.random(),
  484. width: "1300px",
  485. height: "570px",
  486. btn: ['确认', '关闭'],
  487. callBack: function (iframeId) {
  488. top.frames[iframeId].submitForm();
  489. GetMenu();
  490. }
  491. });
  492. }
  493. }
  494. //清空本菜单所有数据源相关设置
  495. function btn_Clear() {
  496. $.deleteForm({
  497. url: "/SystemManage/CommonReport/ClearAll?" + Math.random(),
  498. param: { MenuID: _MenuID },
  499. success: function () {
  500. _SourceID = "";//数据源ID
  501. _sqlTxt = "";//加上参数的sql
  502. _sqlTxt_AddCondition = "";//加上过滤条件的sql
  503. _TempName = "";
  504. _IsExistsDataSource = "";
  505. _DBName = "";//s数据库
  506. _Cols = new Array();//列
  507. _Filter = "";
  508. _footerrow = false;//是否有合计项
  509. _footercols = new Array();//合计项
  510. _formatcols = new Array();//个性化项
  511. _formatcols_Row = new Array();//个性化项的行
  512. _Mergercols = new Array();//合并项
  513. document.getElementById("gridPanel").innerHTML = ' <table id="gridList"></table> <div id="gridPager"></div>';
  514. },
  515. error: function (aa) {
  516. //alert("异常", aa.responseText);
  517. $.modalAlertNew("WMS00015", aa.responseText);
  518. }
  519. });
  520. }
  521. function btn_ExportAll() {
  522. var condion = new Array();
  523. if (_sqlTxt_Condition != undefined && _sqlTxt_Condition.length > 0) {
  524. condion = _sqlTxt_Condition;
  525. }
  526. //var data = "&sqlTxt=" + encodeURIComponent(_sqlTxt_AddCondition) + "&DBName=" + _DBName + "&TempName=" + _TempName + "&MenuID=" + _MenuID;
  527. var data = "&sqlTxt=" + encodeURIComponent(JSON.stringify(condion)) + "&DBName=" + _DBName + "&TempName=" + _TempName + "&MenuID=" + _MenuID + "&XCol=" + _XCol;
  528. $.download("/SystemManage/CommonReport/ExportAllNew?" + Math.random(), data, 'post');
  529. }
  530. function btn_WatchPanel() {
  531. var condion = new Array();
  532. if (_sqlTxt_Condition != undefined && _sqlTxt_Condition.length > 0) {
  533. condion = _sqlTxt_Condition;
  534. }
  535. $.modalOpen({
  536. id: "WatchPanel",
  537. title: _ReportName + "看板显示",
  538. url: "/SystemManage/CommonReport/WatchPanel?_MenuID=" + _MenuID + "&_sqlTxt_Condition=" + escape(JSON.stringify(condion)) + "&TempName=" + escape(_TempName) + "&" + Math.random(),
  539. width: "1300px",
  540. height: "570px",
  541. btn: null,
  542. callBack: function (iframeId) {
  543. top.frames[iframeId].submitForm();
  544. GetMenu();
  545. }
  546. });
  547. }
  548. //角色显示栏位
  549. function btn_ColsVisible() {
  550. $.modalOpen({
  551. id: "ColsVisible",
  552. title: _ReportName + " 角色显示栏位",
  553. url: "/SystemManage/CommonReport/ColsVisible?MenuID=" + _MenuID + "&IsCommon=Y&Cols=&" + Math.random(),
  554. width: "1000px",
  555. height: "570px",
  556. btn: null,
  557. callBack: function (iframeId) {
  558. alert("111");
  559. GetMenu();
  560. }
  561. });
  562. }
  563. //新增类型
  564. function btn_Create() {
  565. debugger;
  566. $.modalOpen({
  567. id: "ICSConfigurationAdd",
  568. title: "新增容器",
  569. url: "/WMS/BasicSettings/ICSContainerAdd" + "?" + Math.random(),
  570. width: "500px",
  571. height: "400px",
  572. callBack: function (iframeId) {
  573. top.frames[iframeId].submitForm();
  574. }
  575. });
  576. }
  577. function btn_Binding() {
  578. debugger;
  579. $.modalOpen({
  580. id: "ICSConfigurationABinding",
  581. title: "绑定容器",
  582. url: "/WMS/BasicSettings/ICSContainerBinding" + "?" + Math.random(),
  583. width: "1000px",
  584. height: "800px",
  585. callBack: function (iframeId) {
  586. top.frames[iframeId].submitForm();
  587. }
  588. });
  589. }
  590. //删除库位
  591. //function btn_Delete() {
  592. // debugger;
  593. // var objArr = '';
  594. // var objList = $("#gridList").jqGrid('getGridParam', 'selarrrow');
  595. // for (var i = 0; i < objList.length; i++) {
  596. // var rowId = objList[i];
  597. // var rowData = $("#gridList").jqGrid('getRowData', rowId);
  598. // objArr += "'" + rowData.ID + "',";
  599. // }
  600. // if (objArr == '') {
  601. // $.modalAlertNew("WMS00021");
  602. // return;
  603. // }
  604. // debugger;
  605. // $.deleteForm({
  606. // url: "/WMS/BasicSettings/DeleteICSContainer" + "?" + Math.random(),
  607. // param: { keyValue: JSON.stringify(objArr) },
  608. // success: function () {
  609. // $.currentWindow().$("#gridList").trigger("reloadGrid");
  610. // }
  611. // })
  612. //}
  613. //解绑容器
  614. function btn_Delete() {
  615. debugger;
  616. var objArr = '';
  617. var objList = $("#gridList").jqGrid('getGridParam', 'selarrrow');
  618. for (var i = 0; i < objList.length; i++) {
  619. var rowId = objList[i];
  620. var rowData = $("#gridList").jqGrid('getRowData', rowId);
  621. objArr += "'" + rowData.ID + "',";
  622. var obj = {
  623. ContainerCode: rowData.ContainerCODE,
  624. User: rowData.MUSER,
  625. WorkPoint: rowData.WorkPoint,
  626. MTime: rowData.MTIME,
  627. Type:"5"
  628. };
  629. }
  630. if (objArr == '') {
  631. $.modalAlertNew("WMS00021");
  632. return;
  633. }
  634. $.submitForm({
  635. url: "/WMS/BasicSettings/DeleteICSContainer" + "?" + Math.random(),
  636. param: { keyValue: JSON.stringify(obj) },
  637. success: function () {
  638. $.currentWindow().$("#gridList").trigger("reloadGrid");
  639. }
  640. })
  641. }
  642. //修改类型
  643. function btn_Update() {
  644. debugger;
  645. var ids = $("#gridList").jqGrid('getGridParam', 'selarrrow'); //获取 多行数据
  646. if (ids.length != 1) {
  647. $.modalAlertNew("WMS00006");
  648. return;
  649. }
  650. for (var i in ids) {
  651. var rowData = jQuery("#gridList").jqGrid("getRowData", ids[i]);
  652. //ID
  653. var ID = rowData.ID;
  654. var ContainerID = rowData.ContainerID;
  655. var ContainerCODE = rowData.ContainerCODE;
  656. var ContainerName = rowData.ContainerName;
  657. var Memo = rowData.Memo;
  658. var InventoryMixed = rowData.InventoryMixed;
  659. var ProjectMixed = rowData.ProjectMixed;
  660. var BatchMixed = rowData.BatchMixed;
  661. var Multiplex = rowData.Multiplex;
  662. var ContainerType = rowData.ContainerType;
  663. $.modalOpen({
  664. id: "Details",
  665. title: "修改",
  666. url: "/WMS/BasicSettings/ICSContainerAdd?ID=" + ID + "&ContainerID=" + ContainerID + "&ContainerCODE=" + ContainerCODE + "&ContainerName=" + encodeURI(encodeURI(ContainerName)) + "&Memo=" + encodeURI(encodeURI(Memo)) + "&InventoryMixed=" + encodeURI(encodeURI(InventoryMixed)) + "&ProjectMixed=" + encodeURI(encodeURI(ProjectMixed)) + "&BatchMixed=" + encodeURI(encodeURI(BatchMixed)) + "&Multiplex=" + encodeURI(encodeURI(Multiplex)) + "&ContainerType=" + encodeURI(encodeURI(ContainerType)) + "&" + Math.random(),
  667. width: "500px",
  668. height: "400px",
  669. callBack: function (iframeId) {
  670. top.frames[iframeId].submitForm();
  671. }
  672. });
  673. }
  674. }
  675. //打印库位
  676. //function btn_Print() {
  677. // debugger;
  678. // var objArr = '';
  679. // var objList = $("#gridList").jqGrid('getGridParam', 'selarrrow');
  680. // //if (objList.length != 1) {
  681. // // $.modalAlert("一次只能打印一个送货单!");
  682. // // return;
  683. // //}
  684. // for (var i = 0; i < objList.length; i++) {
  685. // var rowId = objList[i];
  686. // var rowData = $("#gridList").jqGrid('getRowData', rowId);
  687. // objArr += "'" + rowData.ID + "',";
  688. // }
  689. // var strPrintData;
  690. // var bIsInstallPrintControl;
  691. // var strPrintControlCookie;
  692. // $.ajax({
  693. // url: "/WMS/BasicSettings/PrintStack",
  694. // type: "post",
  695. // data: { keyValue: JSON.stringify(objArr) },
  696. // dataType: "json",
  697. // async: false,
  698. // success: function (data) {
  699. // strPrintData = data.strPrintData_1;
  700. // bIsInstallPrintControl = data.bIsInstallPrintControl_1;
  701. // strPrintControlCookie = data.strPrintControlCookie_1;
  702. // }
  703. // });
  704. // if (strPrintData != '') {
  705. // var test = "ChuLinPrint:" + strPrintData;
  706. // $("#ifrm")[0].src = "ChuLinPrint:" + strPrintData;
  707. // }
  708. // if (bIsInstallPrintControl == 'False') {
  709. // if (confirm("检测到打印控件未安装,您是否下载安装?")) {
  710. // $("#downPrintControl").click();
  711. // }
  712. // }
  713. // if (bIsInstallPrintControl == 'True') {
  714. // var strPrintControlCookie = strPrintControlCookie;
  715. // if (strPrintControlCookie != '') { //延时3秒后再次检测打印控件是否安装
  716. // setTimeout("checkPrintControlInstall()", 8000);
  717. // function checkPrintControlInstall() {
  718. // $.ajax({
  719. // url: "/SRM/ASNManage/IsCheckInstall?checkInstall=" + strPrintControlCookie,
  720. // dataType: "json",
  721. // async: false,
  722. // success: function (strResult) {
  723. // if (strResult.indexOf("PrintControlInstall") == -1) {
  724. // if (confirm("检测到打印控件未安装,您是否下载安装?")) {
  725. // $("#downPrintControl").click();
  726. // }
  727. // }
  728. // }
  729. // });
  730. // }
  731. // }
  732. // }
  733. // $("#btn_search").click();
  734. //}
  735. function btn_Print() {
  736. debugger;
  737. //var mold = 'FP0001'; //条码打印
  738. var objArr = '';
  739. var arr = [];
  740. var objList = $("#gridList").jqGrid('getGridParam', 'selarrrow');
  741. for (var i = 0; i < objList.length; i++) {
  742. var rowId = objList[i];
  743. var rowData = $("#gridList").jqGrid('getRowData', rowId);
  744. objArr += "'" + rowData.ID + "',";
  745. }
  746. objArr = objArr.slice(0, objArr.length - 1);
  747. if (objArr == "") {
  748. $.modalAlertNew("WMS00110");
  749. return;
  750. }
  751. objArr = "" + objArr + "|";
  752. arr.push(objArr);
  753. $.modalOpen({
  754. id: "PrintLot",
  755. title: "打印",
  756. url: "/WMS/Print/PrintView?Arguments=" + encodeURI(encodeURI(arr)) + "&mold=" + mold + "&" + Math.random(),
  757. width: "550px",
  758. height: "1000px",
  759. callBack: function (iframeId) {
  760. top.frames[iframeId].submitForm();
  761. }
  762. });
  763. }
  764. //导入
  765. function btn_Introduction() {
  766. debugger;
  767. $("#FileUp").click();
  768. }
  769. function btn_Clike() {
  770. $.ClickOperate();
  771. }
  772. function UpLoadFile(fileinfo) { //点击确定按钮的时候
  773. debugger;
  774. var files = fileinfo.files;
  775. var fileURL = fileinfo.value;
  776. var fileName = files[0].name;
  777. if (fileName != null && fileName != "") {
  778. var data = new FormData();
  779. jQuery.each(jQuery('#FileUp')[0].files, function (i, file) {
  780. data.append('file-' + i, file);
  781. });
  782. //var info = document.getElementById("form1");
  783. //var formData = new FormData(info);
  784. $.modalConfirm("确定上传文件吗?", function (r) {
  785. if (r) {
  786. $.ajax({
  787. url: "/WMS/BasicSettings/Import" + "?" + Math.random() + "&fileURL=" + fileURL + "",
  788. type: "post",
  789. data: "",
  790. contentType: false,
  791. processData: false,
  792. success: function (data) {
  793. if (data != "" && data != "获取文件失败" && data != "上传文件失败") {
  794. $.modalAlertNew("WMS00014");
  795. $.currentWindow().$("#gridList").trigger("reloadGrid");
  796. }
  797. else {
  798. $.modalAlertNew("WMS00015", data);
  799. }
  800. },
  801. error: function (aa) {
  802. $.modalAlertNew("WMS00016", aa);
  803. }
  804. });
  805. }
  806. });
  807. }
  808. }
  809. </script>
  810. <iframe id="ifrm" src="" width="0" height="0"></iframe>
  811. <div class="topPanel">
  812. <div class="toolbar">
  813. <div class="btn-group">
  814. </div>
  815. <div class="btn-group">
  816. <a class="btn btn-primary" style="margin-left:3px;" onclick="$.reload()"><span class="glyphicon glyphicon-refresh"></span></a>
  817. <a id="NF-Seach" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_Filter()"><i class="fa fa-pencil-square-o"></i>过滤</a>
  818. <a id="NF-Create" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_Create()"><i class="fa fa-pencil-square-o"></i>新增</a>
  819. <a id="NF-Delete" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_Delete()"><i class="fa fa-pencil-square-o"></i>删除</a>
  820. <a id="NF-Update" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_Update()"><i class="fa fa-pencil-square-o"></i>修改</a>
  821. <a id="NF-Binding" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_Binding()"><i class="fa fa-pencil-square-o"></i>绑定</a>
  822. <a id="NF-ExportAll" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_ExportAll()"><i class="fa fa-download"></i>全部导出</a>
  823. <a id="NF-Print" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_Print()"><i class="fa fa-print"></i>打印</a>
  824. <a href="~/File/Stack/库位资料导入模板.xlsx" id="NF-IntroductionMould" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_IntroductionMould()"><i class="fa fa-file-excel-o"></i>导入模板下载</a>
  825. <a id="NF-Introduction" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_Introduction()">导入</a>
  826. <a id="NF-Clike" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_Clike()"><i class="fa fa-eject"></i>...</a>
  827. @*<a id="NF-GridHeader" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_GridHeader()"><i class="fa fa-list-alt"></i>多表头设置</a>*@
  828. </div>
  829. <div class="operates">
  830. <ul class="nav nav-pills">
  831. @*<li><a class="btn btn-primary" onclick="$.reload()"><span class="glyphicon glyphicon-refresh"></span></a></li>*@
  832. <li><a class="btn btn-primary dropdown-text" onclick="btn_Filter()"><i class="fa fa-filter"></i>过滤</a></li>
  833. <li><a id="NF-DataSource" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_DataSource()"><i class="fa fa-database"></i>设置数据源</a></li>
  834. <li><a id="NF-Cols" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_Cols()"><i class="fa fa-text-width"></i>列设置</a></li>
  835. <li class="split"></li>
  836. <li><a id="NF-GridFormat" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_GridFormat()"><i class="fa fa-bars"></i>个性化设置</a></li>
  837. <li class="split"></li>
  838. <li><a id="NF-Clear" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_Clear()"><i class="fa fa-times"></i>清空本菜单所有设置</a></li>
  839. <li><a id="NF-WatchPanel" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_WatchPanel()"><i class="fa fa-download"></i>看板显示</a></li>
  840. <li><a id="NF-ColsVisible" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_ColsVisible()"><i class="fa fa-user"></i>角色显示栏位</a></li>
  841. </ul>
  842. <a href="javascript:;" class="close"></a>
  843. </div>
  844. <script>$('.toolbar').authorizeButton()</script>
  845. </div>
  846. </div>
  847. <div class="gridPanel" id="gridPanel">
  848. <table id="gridList"></table>
  849. <div id="gridPager"></div>
  850. </div>