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.

973 lines
39 KiB

  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. $.modalOpenYC({
  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 + "&XCol=" + _XCol;
  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: "ICSBoxesAdd",
  531. title: "新增周转箱",
  532. url: "/Boxes/BasicSettings/ICSBoxesAdd" + "?" + Math.random(),
  533. width: "600px",
  534. height: "600px",
  535. callBack: function (iframeId) {
  536. top.frames[iframeId].submitForm();
  537. }
  538. });
  539. }
  540. //删除周转箱
  541. function btn_Delete() {
  542. debugger;
  543. var objArr = '';
  544. var ICSASN = [];
  545. var objList = $("#gridList").jqGrid('getGridParam', 'selarrrow');
  546. for (var i = 0; i < objList.length; i++) {
  547. var rowId = objList[i];
  548. var rowData = $("#gridList").jqGrid('getRowData', rowId);
  549. //objArr += "'" + rowData.ID + "',";
  550. var obj = {
  551. ID: rowData.ID,
  552. BoxNumber: rowData.BoxNumber
  553. };
  554. ICSASN.push(obj);
  555. }
  556. if (rowData.ID == '') {
  557. $.modalAlertNew("WMS000112");
  558. return;
  559. }
  560. debugger;
  561. $.deleteForm({
  562. url: "/Boxes/BasicSettings/DeleteBoxes" + "?" + Math.random(),
  563. //param: { keyValue: JSON.stringify(objArr) },
  564. param: { keyValue: JSON.stringify(ICSASN) },
  565. success: function () {
  566. $.currentWindow().$("#gridList").trigger("reloadGrid");
  567. }
  568. })
  569. }
  570. //修改周转箱
  571. function btn_Update() {
  572. var ids = $("#gridList").jqGrid('getGridParam', 'selarrrow'); //获取 多行数据
  573. if (ids.length != 1) {
  574. $.modalAlertNew("WMS00006");
  575. return;
  576. }
  577. for (var i in ids) {
  578. var rowData = jQuery("#gridList").jqGrid("getRowData", ids[i]);
  579. //ID
  580. var ID = rowData.ID;
  581. //周转箱编码
  582. var BoxNumber = rowData.BoxNumber;
  583. //周转箱名称
  584. var BoxName = rowData.BoxName;
  585. //周转箱类型
  586. var Type = rowData.Type;
  587. var Version = rowData.Version;
  588. var Specification = rowData.Specification;
  589. var Describe = rowData.Describe;
  590. var FirstCleanCycle = rowData.FirstCleanCycle;
  591. var SecondCleanCycle = rowData.SecondCleanCycle;
  592. var ThirdCleanCycle = rowData.ThirdCleanCycle;
  593. $.modalOpen({
  594. id: "Details",
  595. title: "修改",
  596. url: "/Boxes/BasicSettings/ICSBoxesAdd?ID=" + ID + "&BoxNumber=" + BoxNumber + "&BoxName=" + encodeURI(encodeURI(BoxName)) + "&Type=" + Type + "&Version=" + Version + "&Specification=" + Specification + "&Describe=" + Describe + "&FirstCleanCycle=" + FirstCleanCycle + "&SecondCleanCycle=" + SecondCleanCycle + "&ThirdCleanCycle=" + ThirdCleanCycle + "&" + Math.random(),
  597. width: "600px",
  598. height: "600px",
  599. callBack: function (iframeId) {
  600. top.frames[iframeId].submitForm();
  601. }
  602. });
  603. }
  604. }
  605. //使用记录
  606. function btnRecord()
  607. {
  608. var ids = $("#gridList").jqGrid('getGridParam', 'selarrrow'); //获取 多行数据
  609. if (ids.length != 1) {
  610. $.modalAlertNew("WMS00077");
  611. return;
  612. }
  613. for (var i in ids) {
  614. var rowData = jQuery("#gridList").jqGrid("getRowData", ids[i]);
  615. //ID
  616. var ID = rowData.ID;
  617. //周转箱编码
  618. var BoxNumber = rowData.BoxNumber;
  619. //周转箱名称
  620. var BoxName = rowData.BoxName;
  621. //周转箱类型
  622. var Type = rowData.Type;
  623. var Version = rowData.Version;
  624. var Specification = rowData.Specification;
  625. var Describe = rowData.Describe;
  626. var FirstCleanCycle = rowData.FirstCleanCycle;
  627. var SecondCleanCycle = rowData.SecondCleanCycle;
  628. var ThirdCleanCycle = rowData.ThirdCleanCycle;
  629. $.modalOpen({
  630. id: "Details",
  631. title: "使用记录",
  632. url: "/Boxes/BasicSettings/ICSBoxesRecord?ID=" + ID + "&BoxNumber=" + BoxNumber + "&BoxName=" + encodeURI(encodeURI(BoxName)) + "&Type=" + Type + "&Version=" + Version + "&Specification=" + Specification + "&Describe=" + Describe + "&FirstCleanCycle=" + FirstCleanCycle + "&SecondCleanCycle=" + SecondCleanCycle + "&ThirdCleanCycle=" + ThirdCleanCycle + "&" + Math.random(),
  633. width: "800px",
  634. height: "800px",
  635. callBack: function (iframeId) {
  636. top.frames[iframeId].submitForm();
  637. }
  638. });
  639. }
  640. }
  641. //使用记录
  642. function btnAccount() {
  643. var ids = $("#gridList").jqGrid('getGridParam', 'selarrrow'); //获取 多行数据
  644. if (ids.length != 1) {
  645. $.modalAlertNew("WMS00077");
  646. return;
  647. }
  648. for (var i in ids) {
  649. var rowData = jQuery("#gridList").jqGrid("getRowData", ids[i]);
  650. //ID
  651. var ID = rowData.ID;
  652. //周转箱编码
  653. var BoxNumber = rowData.BoxNumber;
  654. //周转箱名称
  655. var BoxName = rowData.BoxName;
  656. //周转箱类型
  657. var Type = rowData.Type;
  658. var Version = rowData.Version;
  659. var Specification = rowData.Specification;
  660. var Describe = rowData.Describe;
  661. var FirstCleanCycle = rowData.FirstCleanCycle;
  662. var SecondCleanCycle = rowData.SecondCleanCycle;
  663. var ThirdCleanCycle = rowData.ThirdCleanCycle;
  664. $.modalOpen({
  665. id: "Details",
  666. title: "台账信息",
  667. url: "/Boxes/BasicSettings/ICSBoxesAccountRecord?ID=" + ID + "&BoxNumber=" + BoxNumber + "&BoxName=" + encodeURI(encodeURI(BoxName)) + "&Type=" + Type + "&Version=" + Version + "&Specification=" + Specification + "&Describe=" + Describe + "&FirstCleanCycle=" + FirstCleanCycle + "&SecondCleanCycle=" + SecondCleanCycle + "&ThirdCleanCycle=" + ThirdCleanCycle + "&" + Math.random(),
  668. width: "800px",
  669. height: "800px",
  670. callBack: function (iframeId) {
  671. top.frames[iframeId].submitForm();
  672. }
  673. });
  674. }
  675. }
  676. //打印库位
  677. function btn_Print() {
  678. debugger;
  679. var objArr = '';
  680. var objList = $("#gridList").jqGrid('getGridParam', 'selarrrow');
  681. //if (objList.length != 1) {
  682. // $.modalAlert("一次只能打印一个送货单!");
  683. // return;
  684. //}
  685. for (var i = 0; i < objList.length; i++) {
  686. var rowId = objList[i];
  687. var rowData = $("#gridList").jqGrid('getRowData', rowId);
  688. objArr += "'" + rowData.ID + "',";
  689. }
  690. var strPrintData;
  691. var bIsInstallPrintControl;
  692. var strPrintControlCookie;
  693. $.ajax({
  694. url: "/WMS/BasicSettings/PrintStack",
  695. type: "post",
  696. data: { keyValue: JSON.stringify(objArr) },
  697. dataType: "json",
  698. async: false,
  699. success: function (data) {
  700. strPrintData = data.strPrintData_1;
  701. bIsInstallPrintControl = data.bIsInstallPrintControl_1;
  702. strPrintControlCookie = data.strPrintControlCookie_1;
  703. }
  704. });
  705. if (strPrintData != '') {
  706. var test = "ChuLinPrint:" + strPrintData;
  707. $("#ifrm")[0].src = "ChuLinPrint:" + strPrintData;
  708. }
  709. if (bIsInstallPrintControl == 'False') {
  710. if (confirm("检测到打印控件未安装,您是否下载安装?")) {
  711. $("#downPrintControl").click();
  712. }
  713. }
  714. if (bIsInstallPrintControl == 'True') {
  715. var strPrintControlCookie = strPrintControlCookie;
  716. if (strPrintControlCookie != '') { //延时3秒后再次检测打印控件是否安装
  717. setTimeout("checkPrintControlInstall()", 8000);
  718. function checkPrintControlInstall() {
  719. $.ajax({
  720. url: "/SRM/ASNManage/IsCheckInstall?checkInstall=" + strPrintControlCookie,
  721. dataType: "json",
  722. async: false,
  723. success: function (strResult) {
  724. if (strResult.indexOf("PrintControlInstall") == -1) {
  725. if (confirm("检测到打印控件未安装,您是否下载安装?")) {
  726. $("#downPrintControl").click();
  727. }
  728. }
  729. }
  730. });
  731. }
  732. }
  733. }
  734. $("#btn_search").click();
  735. }
  736. //导入
  737. function btn_Introduction() {
  738. debugger;
  739. $("#FileUp").click();
  740. }
  741. function btn_UPload() {
  742. $("#FileUp").click();
  743. }
  744. function btnUpLoad(up) {
  745. var form = new FormData(document.getElementById("form1"));
  746. $.ajax({
  747. url: "/Boxes/BasicSettings/UploadFile?" + Math.random(),
  748. type: "post",
  749. data: form,
  750. contentType: false,
  751. processData: false,
  752. success: function (data) {
  753. if (data == "true" || data == true) {
  754. alert("导入成功");
  755. }
  756. else {
  757. alert(data);
  758. }
  759. },
  760. error: function (aa) {
  761. alert("导入失败:" + aa);
  762. }
  763. });
  764. }
  765. function btn_Clike() {
  766. $.ClickOperate();
  767. }
  768. function btnPrint() {
  769. debugger;
  770. var mold = 'KW00001';
  771. var objArr = '';
  772. var objArr2 = '';
  773. var arr = [];
  774. var objList = $("#gridList").jqGrid('getGridParam', 'selarrrow');
  775. for (var i = 0; i < objList.length; i++) {
  776. var rowId = objList[i];
  777. var rowData = $("#gridList").jqGrid('getRowData', rowId);
  778. objArr += "'" + rowData.ID + "',";
  779. objArr2 += "'" + rowData.LocationCode + "',";
  780. }
  781. objArr = objArr.slice(0, objArr.length - 1);
  782. objArr2 = objArr2.slice(0, objArr2.length - 1);
  783. objArr = "" + objArr + "|" + objArr2;
  784. // objArr = objArr.slice(0, objArr.length - 1);
  785. arr.push(objArr);
  786. // arr.push(objArr2);
  787. if (objArr == "") {
  788. $.modalAlertNew("WMS00101");
  789. return;
  790. }
  791. $.modalOpen({
  792. id: "PrintLot",
  793. title: "打印",
  794. url: "/WMS/Print/PrintView?Arguments=" + encodeURI(encodeURI(arr)) + "&mold=" + mold + "&" + Math.random(),
  795. width: "550px",
  796. height: "1000px",
  797. callBack: function (iframeId) {
  798. top.frames[iframeId].submitForm();
  799. }
  800. });
  801. }
  802. function UpLoadFile(fileinfo) { //点击确定按钮的时候
  803. debugger;
  804. var files = fileinfo.files;
  805. var fileURL = fileinfo.value;
  806. var fileName = files[0].name;
  807. if (fileName != null && fileName != "") {
  808. var data = new FormData();
  809. jQuery.each(jQuery('#FileUp')[0].files, function (i, file) {
  810. data.append('file-' + i, file);
  811. });
  812. //var info = document.getElementById("form1");
  813. //var formData = new FormData(info);
  814. $.modalConfirm("确定上传文件吗?", function (r) {
  815. if (r) {
  816. $.ajax({
  817. url: "/Boxes/BasicSettings/Import" + "?" + Math.random() + "&fileURL=" + fileURL + "",
  818. type: "post",
  819. data: "",
  820. contentType: false,
  821. processData: false,
  822. success: function (data) {
  823. if (data != "" && data != "获取文件失败" && data != "上传文件失败") {
  824. $.modalAlertNew("WMS00014");
  825. $.currentWindow().$("#gridList").trigger("reloadGrid");
  826. }
  827. else {
  828. $.modalAlertNew("WMS00015", data);
  829. }
  830. },
  831. error: function (aa) {
  832. $.modalAlertNew("WMS00016", aa);
  833. }
  834. });
  835. }
  836. });
  837. }
  838. }
  839. </script>
  840. <iframe id="ifrm" src="" width="0" height="0"></iframe>
  841. <form id="form1">
  842. <input id="CurrentSTNO" name="CurrentSTNO" type="hidden" />
  843. <div class="topPanel">
  844. <div class="toolbar">
  845. <div class="btn-group">
  846. </div>
  847. <div class="btn-group">
  848. <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)" />
  849. <a class="btn btn-primary" style="margin-left:3px;" onclick="$.reload()"><span class="glyphicon glyphicon-refresh"></span></a>
  850. <a id="NF-Create" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_Create()"><i class="fa fa-pencil-square-o"></i>新增</a>
  851. <a id="NF-Update" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_Update()"><i class="fa fa-pencil-square-o"></i>修改</a>
  852. <a id="NF-Delete" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_Delete()"><i class="fa fa-pencil-square-o"></i>删除</a>
  853. <a id="NF-ExportAll" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_ExportAll()"><i class="fa fa-download"></i>全部导出</a>
  854. <a href="~/File/Boxes/周转箱资料导入模板.xlsx" id="NF-IntroductionMould" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_IntroductionMould()"><i class="fa fa-file-excel-o"></i>导入模板下载</a>
  855. <a id="NF-Introduction" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_UPload()">导入</a>
  856. <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>
  857. <a id="NF-Record" authorize="yes" style="margin-left:3px;" class="btn btn-primary" onclick="btnRecord()"><i class="fa fa-pencil-square-o"></i>使用记录</a>
  858. <a id="NF-Account" authorize="yes" style="margin-left:3px;" class="btn btn-primary" onclick="btnAccount()"><i class="fa fa-pencil-square-o"></i>台账信息</a>
  859. <a id="NF-Clike" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_Clike()"><i class="fa fa-eject"></i>...</a>
  860. </div>
  861. <div class="operates">
  862. <ul class="nav nav-pills">
  863. <li><a class="btn btn-primary dropdown-text" onclick="btn_Filter()"><i class="fa fa-filter"></i>过滤</a></li>
  864. <li><a id="NF-DataSource" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_DataSource()"><i class="fa fa-database"></i>设置数据源</a></li>
  865. <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>
  866. <li class="split"></li>
  867. <li><a id="NF-GridFormat" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_GridFormat()"><i class="fa fa-bars"></i>个性化设置</a></li>
  868. <li class="split"></li>
  869. <li><a id="NF-Clear" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_Clear()"><i class="fa fa-times"></i>清空本菜单所有设置</a></li>
  870. <li><a id="NF-WatchPanel" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_WatchPanel()"><i class="fa fa-download"></i>看板显示</a></li>
  871. <li><a id="NF-ColsVisible" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_ColsVisible()"><i class="fa fa-user"></i>角色显示栏位</a></li>
  872. </ul>
  873. <a href="javascript:;" class="close"></a>
  874. </div>
  875. <script>$('.toolbar').authorizeButton()</script>
  876. </div>
  877. </div>
  878. <div class="gridPanel" id="gridPanel">
  879. <table id="gridList"></table>
  880. <div id="gridPager"></div>
  881. </div>
  882. </form>