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.

934 lines
37 KiB

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