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

876 lines
34 KiB

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