listDepot.jsp 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404
  1. <%@ page language="java" contentType="text/html;charset=GBK"
  2. pageEncoding="GBK"%>
  3. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  4. <html>
  5. <head>
  6. <meta http-equiv="Content-Type" content="text/html;charset=GBK">
  7. <title>仓库列表</title>
  8. <link
  9. href="${pageContext.request.contextPath }/liger/lib/ligerUI/skins/${sessionScope.css}/css/ligerui-all.css"
  10. rel="stylesheet" type="text/css" />
  11. <script
  12. src="${pageContext.request.contextPath }/liger/lib/jquery/jquery-1.3.2.min.js"
  13. type="text/javascript"></script>
  14. <script
  15. src="${pageContext.request.contextPath }/liger/lib/ligerUI/js/core/base.js"
  16. type="text/javascript"></script>
  17. <script
  18. src="${pageContext.request.contextPath }/liger/lib/ligerUI/js/plugins/ligerGrid.js"
  19. type="text/javascript"></script>
  20. <link href="${pageContext.request.contextPath}/main.css"
  21. rel="stylesheet" type="text/css" />
  22. <script type="text/javascript" src="/shares/js/constant.js"></script>
  23. <script type="text/javascript" src="/shares/js/common.js"></script>
  24. <script src="${pageContext.request.contextPath }/liger/lib/ligerUI/js/ligerui.all.js" type="text/javascript"></script>
  25. <script type="text/javascript">
  26. var grid = null;
  27. function loadDepotList(params) {
  28. var checkbox = false;
  29. if ("${checkbox}" == 'false' || "${checkbox}" == '') {
  30. checkbox = false;
  31. } else {
  32. checkbox = true;
  33. }
  34. var columns = [
  35. // { display: '序号', name: 'sordernum', width: 100 },
  36. {
  37. display : '仓库编号',
  38. name : 'depot_num',
  39. width : 120
  40. }, {
  41. display : '仓库名称',
  42. name : 'depot_name',
  43. width : 320
  44. }, {
  45. display : '仓库管理员',
  46. name : 'depot_keeper_name',
  47. width : 100
  48. }, {
  49. display : '仓库类型',
  50. name : 'depot_type',
  51. width : 100,
  52. render : function (row){
  53. // alert(row.apply_status_name);
  54. if(row.depot_type=='D')
  55. return "仓库";
  56. if(row.depot_type=='G')
  57. return "货场";
  58. if(row.depot_type=='W')
  59. return "车间";
  60. }
  61. },
  62. /*{
  63. display : '是否设置库位',
  64. name : 'depot_isset_area_name',
  65. width : 100
  66. },*/
  67. {
  68. display : '仓库状态',
  69. name : 'depot_status_name',
  70. width : 100
  71. } ];
  72. if ("${requestScope.lookup }" == "") {
  73. columns
  74. .push({
  75. display : '操作',
  76. isAllowHide : false,
  77. width:120,
  78. render : function(row) {
  79. var html = "";
  80. if(row.depot_status == 'unuse'){
  81. html += '<a href=\"#\" onclick=\"startDepot('+ row.depot_id+',\''+ row.depot_isset_area + '\')\">启用</a>&nbsp;';
  82. html += '<a href=\"#\" onclick=\"addTab(\'editDepot\'+getCurrentTabId(), \'修改仓库信息\', \'${pageContext.request.contextPath }/depotAction.do?task=toEditDepot&depot_id='
  83. + row.depot_id
  84. + '&tabid='
  85. + getCurrentTabId() + '\',true,true);\">编辑</a>&nbsp;';
  86. html += '<a href=\"#\" onclick=\"delDepot('+ row.depot_id + ')\">删除</a>&nbsp;';
  87. }
  88. if(row.depot_status == 'onuse'){
  89. html += '<a href=\"#\" onclick=\"stopDepot('+ row.depot_id + ')\">停用</a>&nbsp;';
  90. }
  91. return html;
  92. }
  93. });
  94. }
  95. grid = $("#maingrid4")
  96. .ligerGrid(
  97. {
  98. columns : columns,
  99. pageSize : 20,
  100. url : 'depotAction.do?task=getDepotList&lookup=${lookup}&time='
  101. + new Date().getTime() + params,
  102. pageParmName : 'p', //页索引参数名,(提交给服务器)
  103. pagesizeParmName : 'pSize', //页记录数参数名,(提交给服务器)
  104. width : '99.9%',
  105. height : '99%',
  106. checkbox : checkbox
  107. });
  108. $("#pageloading").hide();
  109. }
  110. $(function() {
  111. loadDepotList();
  112. });
  113. function searchByKword() {
  114. var depot_num = document.getElementById("depot_num");//仓库编号
  115. var depot_name = document.getElementById("depot_name");//仓库编号
  116. var depot_type = document.getElementById("depot_type");//仓库类型
  117. var s = "";
  118. if (depot_num.value != "" && typeof (depot_num.value) != "undefined") {
  119. s += "&depot_num=" + encodeURI(encodeURI(depot_num.value));
  120. }
  121. if (depot_name.value != "" && typeof (depot_name.value) != "undefined") {
  122. s += "&depot_name=" + encodeURI(encodeURI(depot_name.value));
  123. }
  124. if (depot_type.value != "" && typeof (depot_type.value) != "undefined") {
  125. s += "&depot_type=" + depot_type.value;
  126. }
  127. $(function() {
  128. loadDepotList(s);
  129. });
  130. }
  131. function f_select() {
  132. var rows = grid.getCheckedRows();
  133. return rows;
  134. }
  135. function addDepot(){
  136. addTab('addDepot'+getCurrentTabId(), '新增仓库', 'depotAction.do?task=toEditDepot&tabid=' + getCurrentTabId(),true,true);
  137. }
  138. function delDepot(depot_id) {
  139. if (confirm("确定要删除吗?")) {
  140. /* $.ajax({
  141. type : "POST",
  142. url : "depotAction.do?task=queryLocNPro",
  143. data : {
  144. "depot_id" : depot_id
  145. },
  146. timeout : 10000,
  147. cache : false,
  148. dataType : "json",
  149. success:function(msg){
  150. if(msg > 0){
  151. if (confirm("仓库中还有在用库位,是否确认删除?")) {
  152. $.ajax({
  153. type : "POST",
  154. url : "depotAction.do?task=doDelDepot",
  155. data : {
  156. "depot_id" : depot_id
  157. },
  158. timeout : 10000,
  159. cache : false,
  160. dataType : "json",
  161. success : function(data) {
  162. var success = data.success;
  163. if (success != undefined) {
  164. $.ligerDialog.success("删除成功");
  165. } else {
  166. showAjaxError(null, data.error);
  167. }
  168. loadDepotList();
  169. },
  170. error : showAjaxError
  171. });
  172. }
  173. }else{
  174. $.ajax({
  175. type : "POST",
  176. url : "depotAction.do?task=doDelDepot",
  177. data : {
  178. "depot_id" : depot_id
  179. },
  180. timeout : 10000,
  181. cache : false,
  182. dataType : "json",
  183. success : function(data) {
  184. var success = data.success;
  185. if (success != undefined) {
  186. $.ligerDialog.success("删除成功");
  187. } else {
  188. showAjaxError(null, data.error);
  189. }
  190. loadDepotList();
  191. },
  192. error : showAjaxError
  193. });
  194. }
  195. },
  196. error : showAjaxError
  197. });
  198. */
  199. $.ajax({
  200. type : "POST",
  201. url : "depotAction.do?task=queryInNOut",
  202. data : {
  203. "depot_id" : depot_id
  204. },
  205. timeout : 10000,
  206. cache : false,
  207. dataType : "json",
  208. success:function(msg){
  209. if(msg > 0){
  210. addError("该仓库有过出入库操作,不允许删除!");
  211. }else{
  212. $.ajax({
  213. type : "POST",
  214. url : "depotAction.do?task=doDelDepot",
  215. data : {
  216. "depot_id" : depot_id
  217. },
  218. timeout : 10000,
  219. cache : false,
  220. dataType : "json",
  221. success : function(data) {
  222. var success = data.success;
  223. if (success != undefined) {
  224. $.ligerDialog.success("删除成功");
  225. } else {
  226. showAjaxError(null, data.error);
  227. }
  228. loadDepotList();
  229. },
  230. error : showAjaxError
  231. });
  232. }
  233. },
  234. error : showAjaxError
  235. });
  236. }
  237. }
  238. function stopDepot(depot_id) {
  239. if (confirm("确定要停用吗?")) {
  240. $.ajax({
  241. type : "POST",
  242. url : "depotAction.do?task=queryPro&depot_id="+depot_id,
  243. data : "",
  244. timeout : 10000,
  245. cache : false,
  246. //dataType : "json",
  247. success:function(msg){
  248. if(msg > 0){
  249. addError("该仓库还有存货,不允许停用!");
  250. }else{
  251. $.ajax({
  252. type : "POST",
  253. url : "depotAction.do?task=stopDepot",
  254. data : {
  255. "depot_id" : depot_id
  256. },
  257. timeout : 10000,
  258. cache : false,
  259. //dataType : "json",
  260. success : function(data) {
  261. if (data > 0) {
  262. $.ligerDialog.success("停用成功!");
  263. } else {
  264. addError("停用失败!");
  265. }
  266. loadDepotList();
  267. },
  268. error : showAjaxError
  269. });
  270. }
  271. },
  272. error : showAjaxError
  273. });
  274. }
  275. }
  276. function startDepot(depot_id,depot_isset_area) {
  277. if (confirm("确定要启用吗?")) {
  278. if(depot_isset_area == "yes"){
  279. $.ajax({
  280. type : "POST",
  281. url : "depotAction.do?task=queryLocNPro",
  282. data : {
  283. "depot_id" : depot_id
  284. },
  285. timeout : 10000,
  286. cache : false,
  287. dataType : "json",
  288. success:function(msg){
  289. if(msg <= 0){
  290. addError("该仓库已设置库位,但未添加库位或库位未启用,无法启用仓库!");
  291. }else{
  292. $.ajax({
  293. type : "POST",
  294. url : "depotAction.do?task=startDepot",
  295. data : {
  296. "depot_id" : depot_id
  297. },
  298. timeout : 10000,
  299. cache : false,
  300. dataType : "json",
  301. success : function(data) {
  302. if (data > 0) {
  303. $.ligerDialog.success("启用成功!");
  304. } else {
  305. addError("启用失败!");
  306. }
  307. loadDepotList();
  308. },
  309. error : showAjaxError
  310. });
  311. }
  312. },
  313. error : showAjaxError
  314. });
  315. }else{
  316. $.ajax({
  317. type : "POST",
  318. url : "depotAction.do?task=startDepot",
  319. data : {
  320. "depot_id" : depot_id
  321. },
  322. timeout : 10000,
  323. cache : false,
  324. dataType : "json",
  325. success : function(data) {
  326. if (data > 0) {
  327. $.ligerDialog.success("启用成功!");
  328. } else {
  329. addError("启用失败!");
  330. }
  331. loadDepotList();
  332. },
  333. error : showAjaxError
  334. });
  335. }
  336. }
  337. }
  338. </script>
  339. <style type="text/css">
  340. #deptBtn2 {
  341. width: 100%;
  342. background: #eef7fe;
  343. height: 35px;
  344. padding-top: 3px
  345. }
  346. </style>
  347. </head>
  348. <body>
  349. <%@ include file="/include/message.jsp"%>
  350. <div class="container-layout">
  351. <div id="deptBtn2" class="form-button">
  352. <input type="button" value="新增" class="l-button" onclick="addDepot();" id="addDepotBtn">
  353. </div>
  354. <div class="default_search" style="margin: 0;">
  355. <ul class="list_search">
  356. <li class="title">仓库编号:</li>
  357. <li class="text"><input type="text" name="depot_num" id="depot_num">
  358. </li>
  359. </ul>
  360. <ul class="list_search">
  361. <li class="title">仓库名称:</li>
  362. <li class="text"><input type="text" name="depot_name" id="depot_name">
  363. </li>
  364. </ul>
  365. <ul class="list_search">
  366. <li class="title">仓库类型:</li>
  367. <li class="text">
  368. <select id="depot_type" name="depot_type" style="width:160px;">
  369. <option value="" selected="selected">-请选择-</option>
  370. <c:forEach items="${depotTypeList}" var="item">
  371. <option
  372. <c:if test="${item.dvalue eq requestScope.depot.depot_type}">
  373. selected="selected"
  374. </c:if>
  375. value="${item.dvalue }" >
  376. ${item.dname }
  377. </option>
  378. </c:forEach>
  379. </select>
  380. </li>
  381. </ul>
  382. <ul>
  383. <li class="search-button"><input type="button" class='l-button'
  384. name="search" onclick="searchByKword()" value="查询" /></li>
  385. </ul>
  386. </div>
  387. <div id="searchbar">
  388. <div style="overflow: hidden; clear: both;">
  389. <div id="maingrid4" style="margin: 0; padding: 0"></div>
  390. </div>
  391. </div>
  392. </div>
  393. </body>
  394. </html>