productLookupPacking.jsp 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300
  1. <%@ page contentType="text/html;charset=GBK"%>
  2. <%@ taglib uri="/WEB-INF/tlds/author.tld" prefix="h"%>
  3. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  4. <HEAD>
  5. <TITLE>存货管理(用于成品配货,选择货物信息)</TITLE>
  6. <script type=text/javascript src="${pageContext.request.contextPath }/liger/lib/jquery/jquery-1.5.2.min.js"></script>
  7. <link href="${pageContext.request.contextPath}/main.css" rel="stylesheet" type="text/css" />
  8. <script type="text/javascript" src="/shares/js/constant.js"></script>
  9. <script type="text/javascript" src="/shares/js/common.js"></script>
  10. <script type="text/javascript" src="/shares/js/yw/erp2/finishproduct/productTypeTree.js"></script>
  11. <link href="./liger/lib/ligerUI/skins/${sessionScope.css}/css/ligerui-all.css" rel="stylesheet" type="text/css"></link>
  12. <script src="./liger/lib/ligerUI/js/core/base.js" type="text/javascript"></script>
  13. <script src="./liger/lib/ligerUI/js/plugins/ligerLayout.js" type="text/javascript"></script>
  14. <script src="${pageContext.request.contextPath}/liger/lib/ligerUI/js/ligerui.all.js" type="text/javascript"></script>
  15. <script type="text/javascript">
  16. var pidArr = new Array();
  17. var rows = new Array(); // 先声明一维
  18. $(function() {
  19. $("#layout1").ligerLayout({
  20. leftWidth : 250,
  21. height : '99%'
  22. });
  23. });
  24. function addProduct() {
  25. var selectProductType = $("#selectProductType").val();
  26. if (selectProductType == "1") {
  27. alert("根目录无法上传存货!");
  28. return;
  29. }
  30. window.parent.f_addTab('addProduct', '新增存货',
  31. 'productMgrAction.do?task=toEditProduct&ptype_id='
  32. + selectProductType + '&tabid=' + getCurrentTabId());
  33. }
  34. function editProduct(product_id) {
  35. window.parent.f_addTab('editProduct', '编辑存货',
  36. 'productMgrAction.do?task=toEditProduct&product_id='
  37. + product_id + '&tabid=' + getCurrentTabId());
  38. }
  39. function viewProduct(product_id) {
  40. window.parent.f_addTab('viewProduct', '查看存货',
  41. 'productMgrAction.do?task=viewProduct&product_id=' + product_id
  42. + '&tabid=' + getCurrentTabId());
  43. }
  44. function delProduct(product_id) {
  45. var selectProductType = $("#selectProductType").val();
  46. if (confirm("确定要删除吗?")) {
  47. $.ajax({
  48. type : "POST",
  49. url : "productMgrAction.do?task=delProduct",
  50. data : {
  51. "product_id" : product_id
  52. },
  53. timeout : 10000,
  54. cache : false,
  55. dataType : "json",
  56. success : function(data) {
  57. var success = data.success;
  58. if (success != undefined) {
  59. if (success == 1) {
  60. $.ligerDialog.success("删除成功。");
  61. } else if (success == 0) {
  62. $.ligerDialog.error("删除失败。");
  63. } else if (success == 3) {
  64. $.ligerDialog.warn("有库存不能删除!");
  65. }
  66. } else {
  67. showAjaxError(null, data.error);
  68. }
  69. loadProductList();
  70. },
  71. error : showAjaxError
  72. });
  73. }
  74. }
  75. function f_reload() {
  76. var manager = $("#productGrid").ligerGetGridManager();
  77. manager.loadData();
  78. }
  79. var grid = null;
  80. function loadProductList(params) {
  81. var selectProductType = document.getElementById("selectProductType").value;
  82. var columns = [ {
  83. display : '存货编码',
  84. name : 'product_num',
  85. width : 120
  86. }, {
  87. display : '存货名称',
  88. name : 'product_name',
  89. width : 120
  90. }, {
  91. display : '存货分类',
  92. name : 'product_ptype_name',
  93. width : 120
  94. }, {
  95. display : '规格型号',
  96. name : 'product_standard_all',
  97. width : 120,
  98. render : function(row) {
  99. return row.product_standard + row.product_mode;
  100. }
  101. }, {
  102. display : '序列管理',
  103. name : 'product_is_serial_name',
  104. render : function(row) {
  105. if (row.product_is_serial == "0") {
  106. return "<font color='green'>"+row.product_is_serial_name+"</font>";
  107. } else if (row.product_is_serial == "1") {
  108. return "<font color='blue'>"+row.product_is_serial_name+"</font>";
  109. }
  110. }
  111. } ];
  112. if ("${requestScope.depot_id}" != "") {
  113. columns.push({
  114. display : '库存数量',
  115. name : 'sockt_count'
  116. });
  117. }
  118. grid = $("#productGrid")
  119. .ligerGrid(
  120. {
  121. columns : columns,
  122. pageSize : 20,
  123. pageSizeOptions :[20,30,40,50],
  124. url : 'productMgrLookup.do?task=productLookupPackingList&depot_id=${requestScope.depot_id}&location_id=${requestScope.location_id}&ptype_id='
  125. + selectProductType
  126. +'&type=${type}'
  127. + '&time='
  128. + new Date().getTime() + params,
  129. pageParmName : 'p', //页索引参数名,(提交给服务器)
  130. pagesizeParmName : 'pSize', //页记录数参数名,(提交给服务器)
  131. width : '99.9%',
  132. height : '99.4%',
  133. checkbox : true,
  134. isChecked : f_isChecked,
  135. onCheckRow : f_onCheckRow,
  136. onCheckAllRow : f_onCheckAllRow
  137. });
  138. $("#pageloading").hide();
  139. if ("${checkbox}" == 'false' || "${checkbox}" == '') {
  140. $(".l-grid-hd-cell-btn-checkbox").css("display", "none"); //隱藏checkAll
  141. }
  142. }
  143. function f_select() {
  144. // return grid.getCheckedRows();
  145. return rows;
  146. }
  147. function f_isChecked(rowdata) {
  148. for ( var i = 0; i < pidArr.length; i++) {
  149. if (rowdata.product_id == pidArr[i]) {
  150. rows.push(rowdata);
  151. return true;
  152. }
  153. }
  154. return false;
  155. }
  156. function f_onCheckRow(checked, rowdata, rowindex) {
  157. if (checked) { //判断是否选中该行
  158. if(inArray(rowdata.product_id, pidArr)<0){ //判断数组中是否存在该数组
  159. pidArr.push(rowdata.product_id); //不存在添加
  160. rows.push(rowdata);
  161. }
  162. }else{
  163. if(inArray(rowdata.product_id, pidArr)>=0){
  164. pidArr.splice(inArray(rowdata.product_id, pidArr),1);//存在删除
  165. rows.splice(inArray(rowdata, rows),1);//存在删除
  166. }
  167. }
  168. }
  169. function f_onCheckAllRow(checked, grid) {
  170. for (var rowid in this.records){
  171. if (checked) { //判断是否选中该行
  172. if(inArray(this.records[rowid].product_id, pidArr)<0){ //判断数组中是否存在该数组
  173. pidArr.push(this.records[rowid].product_id); //不存在添加
  174. rows.push(this.records[rowid]);
  175. }
  176. }else{
  177. if(inArray(this.records[rowid].product_id, pidArr)>=0){
  178. pidArr.splice(inArray(this.records[rowid].product_id, pidArr),1);//存在删除
  179. rows.splice(inArray(this.records[rowid], rows),1);//存在删除
  180. }
  181. }
  182. }
  183. }
  184. //查询
  185. function searchByKword() {
  186. var product_num = $("#product_num").val();
  187. var s = "";
  188. if (product_num != "" && typeof (product_num) != "undefined") {
  189. s += "&product_num=" + encodeURI(encodeURI(product_num));
  190. }
  191. var product_name = $("#product_name").val();
  192. if (product_name != "" && typeof (product_name) != "undefined") {
  193. s += "&product_name=" + encodeURI(encodeURI(product_name));
  194. }
  195. var gridManager = $("#productGrid").ligerGetGridManager();
  196. if(gridManager)
  197. gridManager.setOptions({newPage:1});
  198. loadProductList(s);
  199. }
  200. //新增存货关闭弹出层
  201. function addProductTop() {
  202. var selectProductType = $("#selectProductType").val();
  203. if (selectProductType == "1") {
  204. alert("根目录无法新增存货!");
  205. return;
  206. }
  207. window.parent.f_addTab('addProduct', '新增存货',
  208. 'productMgrAction.do?task=toEditProduct&ptype_id='
  209. + selectProductType + '&tabid=' + getCurrentTabId());
  210. window.parent.$(".l-dialog,.l-window-mask").remove(); //关闭弹出层
  211. }
  212. </script>
  213. <style type="text/css">
  214. body {
  215. padding: 5px;
  216. margin: 0;
  217. }
  218. #layout1 {
  219. width: 99.5%;
  220. margin: 0;
  221. padding: 0;
  222. }
  223. .l-button {
  224. margin-left: 1px;
  225. }
  226. .l-layout-left {
  227. overflow-y: auto;
  228. }
  229. </style>
  230. </HEAD>
  231. <BODY>
  232. <%@ include file="/include/button.jsp"%>
  233. <%@ include file="/include/message.jsp"%>
  234. <div class="l-content">
  235. <form name="userRoleForm" method="post">
  236. <input type="hidden" name="type" id="type" value="${type}"/>
  237. <input type="hidden" name="selectProductType" id="selectProductType" />
  238. <div id="layout1">
  239. <div position="left" title="存货类别" class="user-tree-style">
  240. <ul id="productTypeTree" class="tree" style="margin-top: 3px;">
  241. </div>
  242. <c:if test="${empty requestScope.depot_id}">
  243. <div position="center" id="center" title="存货列表">
  244. </c:if>
  245. <c:if test="${!empty requestScope.depot_id}">
  246. <div position="center" id="center" title="存货列表(${requestScope.depot_name })">
  247. </c:if>
  248. <%-- <h:isAuthor key="/productMgrAction?task=taskDoEditProduct"> --%>
  249. <!-- <div id="deptBtn" style="text-align:left;"> -->
  250. <!-- <input type="button" value="新增" class="l-button" onclick="addProductTop();" id="addProductBtn" /> -->
  251. <!-- </div> -->
  252. <%-- </h:isAuthor> --%>
  253. <div class="default_search" style="margin: 0;">
  254. <ul style="float: left;">
  255. <li style="float: left; height: 25px; line-height: 25px; margin: 0; padding-top: 2px;">存货编码:</li>
  256. <li style="float: left; height: 25px; line-height: 25px; margin: 0; padding-top: 2px;">
  257. <input type="text" name="product_num" id="product_num" />
  258. </li>
  259. </ul>
  260. <ul style=" float: left;">
  261. <li style="float: left; height: 25px; line-height: 25px; margin: 0; padding-top: 2px;">存货名称:</li>
  262. <li style="float: left; height: 25px; line-height: 25px; margin: 0; padding-top: 2px;">
  263. <input type="text" name="product_name" id="product_name" />
  264. </li>
  265. </ul>
  266. <ul style="float: left;">
  267. <li style="float: left; height: 25px; line-height: 25px; margin: 0; padding-top: 2px;">
  268. <input type="button" class='l-button' name="search" onclick="searchByKword()" value="查询" />
  269. </li>
  270. </ul>
  271. </div>
  272. <div style="overflow: hidden; clear: both;">
  273. <div id="productGrid" style="margin: 0; padding: 0"></div>
  274. </div>
  275. </div>
  276. </div>
  277. </form>
  278. </div>
  279. </BODY>
  280. </HTML>