editStockRemove.jsp 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411
  1. <%@ page language="java" contentType="text/html;charset=GBK" pageEncoding="GBK"%>
  2. <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
  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 href="${pageContext.request.contextPath }/liger/lib/ligerUI/skins/${sessionScope.css}/css/ligerui-all.css" rel="stylesheet" type="text/css" />
  9. <script src="${pageContext.request.contextPath }/liger/lib/jquery/jquery-1.3.2.min.js" type="text/javascript"></script>
  10. <link href="${pageContext.request.contextPath }/main.css" rel="stylesheet" type="text/css" />
  11. <script type="text/javascript" src="/shares/js/constant.js"></script>
  12. <script type="text/javascript" src="/shares/js/common.js"></script>
  13. <script src="${pageContext.request.contextPath }/liger/lib/ligerUI/js/core/base.js" type="text/javascript"></script>
  14. <script src="${pageContext.request.contextPath }/liger/lib/ligerUI/js/plugins/ligerDateEditor.js" type="text/javascript"></script>
  15. <script src="/shares/xheditor/xheditor-1.1.14/xheditor-1.1.14-zh-cn.min.js" type="text/javascript"></script>
  16. <!-- 选择窗口需要加载的js文件 start-->
  17. <script src="${pageContext.request.contextPath}/liger/lib/json2.js" type="text/javascript"></script>
  18. <script src="${pageContext.request.contextPath}/liger/lib/ligerUI/js/plugins/ligerDialog.js" type="text/javascript"></script>
  19. <script src="${pageContext.request.contextPath}/liger/lib/ligerUI/js/plugins/ligerGrid.js" type="text/javascript"></script>
  20. <script src="${pageContext.request.contextPath}/liger/lib/ligerUI/js/plugins/ligerTextBox.js" type="text/javascript"></script>
  21. <script src="${pageContext.request.contextPath}/liger/lib/ligerUI/js/plugins/ligerCheckBox.js" type="text/javascript"></script>
  22. <script src="${pageContext.request.contextPath}/liger/lib/ligerUI/js/plugins/ligerComboBox.js" type="text/javascript"></script>
  23. <script src="${pageContext.request.contextPath}/liger/lib/ligerUI/js/plugins/ligerSpinner.js" type="text/javascript"></script>
  24. <script type="text/javascript" src="/shares/js/yw/erp/stockRemove.js"></script>
  25. <script type="text/javascript">
  26. var stockRemoveDetailData = ${requestScope.Rows };
  27. var task = "${requestScope.task}";
  28. var locationobjs;
  29. $(f_initGrid);
  30. $(function() {
  31. $("#stock_remove_title").focus();
  32. closeAndReloadList();
  33. loadTypeTree("usertree", {
  34. type : "singleuser",
  35. tab : "1,2",
  36. backId : "stock_remove_user",
  37. backName : "stock_remove_user_name"
  38. });
  39. $("#stock_remove_date").ligerDateEditor({
  40. showTime : true,
  41. labelAlign : 'left',
  42. showTime : false,
  43. format :"yyyy-MM-dd",
  44. initValue : '${requestScope.stockRemove.stock_remove_date_str }'
  45. });
  46. var selectFromDepot = "${requestScope.stockRemove.stock_remove_from_depot}";
  47. if (selectFromDepot != null && selectFromDepot != "") {
  48. $("#stock_remove_from_depot").val(selectFromDepot);
  49. }
  50. var selectFromLocation = "${requestScope.stockRemove.stock_remove_from_location}";
  51. if (selectFromLocation != null && selectFromLocation != "") {
  52. getLocations("stock_remove_from_depot",
  53. "stock_remove_from_location");
  54. }
  55. ;
  56. var selectToDepot = "${requestScope.stockRemove.stock_remove_to_depot}";
  57. if (selectToDepot != null && selectToDepot != "") {
  58. $("#stock_remove_to_depot").val(selectToDepot);
  59. }
  60. var selectToLocation = "${requestScope.stockRemove.stock_remove_to_location}";
  61. if (selectToLocation != null && selectToLocation != "") {
  62. getLocations("stock_remove_to_depot", "stock_remove_to_location");
  63. }
  64. hasDetails();
  65. });
  66. function getLocations(depot, location) {
  67. $("#" + location).empty();
  68. $('#' + location).append("<option value=''>--请选择--</option> ");
  69. var depot_val = $('#' + depot).val();
  70. $
  71. .ajax({
  72. url : "locationAction.do?date=" + new Date()
  73. + "&task=getLocations",
  74. type : "post",
  75. dataType : "json",
  76. data : "depot_id=" + $("#" + depot).val(),
  77. success : function(data) {
  78. locationobjs = data;
  79. if (locationobjs.length == 0) {
  80. if (depot == "stock_remove_from_depot")
  81. $("#selectloc1").hide();
  82. else
  83. $("#selectloc2").hide();
  84. } else {
  85. if (depot == "stock_remove_from_depot")
  86. $("#selectloc1").show();
  87. else
  88. $("#selectloc2").show();
  89. for ( var i = 0; i < locationobjs.length; i++) {
  90. $('#' + location).append(
  91. "<option value='"+locationobjs[i].location_id+"'>"
  92. + locationobjs[i].location_name
  93. + "</option>");
  94. }
  95. if (depot == "stock_remove_from_depot")
  96. $("#" + location)
  97. .val(
  98. "${requestScope.stockRemove.stock_remove_from_location}");
  99. else
  100. $("#" + location)
  101. .val(
  102. "${requestScope.stockRemove.stock_remove_to_location}");
  103. }
  104. ;
  105. hasDetails();
  106. }
  107. });
  108. }
  109. function closeAndReloadList(){
  110. var isAddSucc = "${requestScope.isAddSucc}";
  111. if(isAddSucc == "true"){
  112. var tabid = getCurrentTabId();
  113. var listTabid = 'stockRemoveAction.do?task=toListStockRemove';
  114. if(window.parent.tab.isTabItemExist(listTabid)){
  115. window.parent.f_selectTab(listTabid);
  116. window.parent.f_reloadTab(listTabid);
  117. }else{
  118. window.parent.f_addTab(listTabid, '库存调拨单', 'stockRemoveAction.do?task=toListStockRemove');
  119. }
  120. window.parent.f_closeTab(tabid);
  121. }
  122. }
  123. function isSelDepot() {
  124. var stock_remove_depot_val = $('#stock_remove_from_depot').val();
  125. if (stock_remove_depot_val == "") {
  126. $.ligerDialog.warn("请先选择转出仓库 !");
  127. } else {
  128. if (locationobjs != null && locationobjs != ""
  129. && locationobjs.length > 0) {
  130. var stock_remove_location_val = $('#stock_remove_from_location')
  131. .val();
  132. if (stock_remove_location_val == "") {
  133. $.ligerDialog.warn("请先选择库位 !");
  134. } else {
  135. f_import();
  136. }
  137. } else {
  138. f_import();
  139. }
  140. }
  141. }
  142. function checkForm() {
  143. var rs = $.validate({
  144. name : "stock_remove_num",
  145. model : [ {
  146. type : "require",
  147. msg : "调拨单号不能为空!"
  148. } ]
  149. });
  150. var rs = $.validate({
  151. name : "stock_remove_title",
  152. model : [ {
  153. type : "require",
  154. msg : "调拨主题不能为空!"
  155. } ]
  156. });
  157. rs = $.validate({
  158. name : "stock_remove_user_name",
  159. model : [ {
  160. type : "require",
  161. msg : "调拨人不能为空!"
  162. } ]
  163. }) && rs;
  164. rs = $.validate({
  165. name : "stock_remove_date",
  166. model : [ {
  167. type : "require",
  168. msg : "调拨日期不能为空!"
  169. } ]
  170. }) && rs;
  171. rs = $.validate({
  172. name : "stock_remove_from_depot",
  173. model : [ {
  174. type : "require",
  175. msg : "转出仓库不能为空!"
  176. } ]
  177. }) && rs;
  178. if (document.getElementById("selectloc1").style.display != "none") {
  179. rs = $.validate({
  180. name : "stock_remove_from_location",
  181. model : [ {
  182. type : "require",
  183. msg : "库位不能为空!"
  184. } ]
  185. }) && rs;
  186. }
  187. rs = $.validate({
  188. name : "stock_remove_to_depot",
  189. model : [ {
  190. type : "require",
  191. msg : "转入仓库不能为空!"
  192. } ]
  193. }) && rs;
  194. if (document.getElementById("selectloc2").style.display != "none") {
  195. rs = $.validate({
  196. name : "stock_remove_to_location",
  197. model : [ {
  198. type : "require",
  199. msg : "库位不能为空!"
  200. } ]
  201. }) && rs;
  202. }
  203. if ($("#stock_remove_from_depot").val() != ""
  204. && $("#stock_remove_to_depot").val() != "") {
  205. if (($("#stock_remove_from_depot").val() == $(
  206. "#stock_remove_to_depot").val())
  207. && ($("#stock_remove_from_location").val() == $(
  208. "#stock_remove_to_location").val())) {
  209. $.ligerDialog.warn("转出仓库和转入仓库不能相同 !");
  210. rs = false;
  211. }
  212. }
  213. if (rs) {
  214. getData();
  215. if(isSelected()){
  216. return true;
  217. }
  218. return false;
  219. }
  220. return false;
  221. }
  222. function hasDetails() {
  223. getData();
  224. var jsonDataVal = $("#jsonData").val();
  225. if (jsonDataVal.length > 2) {
  226. if ($("#stock_remove_from_depot").val() != null
  227. && $("#stock_remove_from_depot").val() != "") {
  228. $("#stock_remove_from_depot_").val(
  229. $("#stock_remove_from_depot").val());
  230. $("#stock_remove_from_depot").attr("disabled", true);
  231. }
  232. if ($("#stock_remove_from_location").val() != null
  233. && $("#stock_remove_from_location").val() != "") {
  234. $("#stock_remove_from_location_").val(
  235. $("#stock_remove_from_location").val());
  236. $("#stock_remove_from_location").attr("disabled", true);
  237. }
  238. ;
  239. } else {
  240. $("#stock_remove_from_depot").attr("disabled", false);
  241. $("#stock_remove_from_location").attr("disabled", false);
  242. }
  243. ;
  244. }
  245. function savestock_remove() {
  246. getData();
  247. var myfrom = document.getElementById("myfrom");
  248. myfrom.action = "stockRemoveAction.do";
  249. $("#task").val("doEdit");
  250. }
  251. function createstock_removetock() {
  252. var myfrom = document.getElementById("myfrom");
  253. myfrom.action = "stockRemovetockAction.do";
  254. $("#task").val("add");
  255. }
  256. //保存
  257. function btnSaveRemove(){
  258. if(checkForm()){
  259. $("#btnSave").attr({"disabled":"disabled"});
  260. $("#myfrom").submit();
  261. }
  262. }
  263. </script>
  264. <style type="text/css">
  265. .file-style {
  266. width: 550px;
  267. }
  268. .file-style input[type='file'] {
  269. width: 385px;
  270. height: 24px;
  271. line-height: 22px;
  272. vertical-align: bottom;
  273. background-color: #fff;
  274. border: 1px solid #cccccc;
  275. margin-top: 2px;
  276. margin-bottom: 2px;
  277. }
  278. </style>
  279. </head>
  280. <body>
  281. <form action="stockRemoveAction.do" id="myfrom" name="myfrom" method="post">
  282. <div id="title" class="form-button">
  283. <input id="btnSave" type="button" class="l-button" value="保存" onclick="btnSaveRemove();" />
  284. <input type="button" value="关闭" class="l-button" onclick="closeWindow();" />
  285. </div>
  286. <div class="container-layout">
  287. <div class="forum-container">
  288. <center>
  289. <table class="l-table-edit line">
  290. <tr>
  291. <th colspan="4">基本信息</th>
  292. </tr>
  293. <tr>
  294. <td class="l-table-edit-text" width="15%">调拨单号<FONT
  295. COLOR="red">*</FONT>:
  296. </td>
  297. <td class="l-table-edit-td" width="35%">
  298. <jsp:include page="/yw/erp/include/codeReadonly.jsp">
  299. <jsp:param name="name" value="stock_remove_num" />
  300. <jsp:param name="value" value="${requestScope.stockRemove.stock_remove_num}" />
  301. </jsp:include>
  302. </td>
  303. <td class="l-table-edit-text" width="15%">主题<FONT
  304. COLOR="red">*</FONT>:
  305. </td>
  306. <td class="l-table-edit-td" width="35%"><input type="text"
  307. id="stock_remove_title" name="stock_remove_title"
  308. value="${requestScope.stockRemove.stock_remove_title}" /></td>
  309. </tr>
  310. <tr>
  311. <td class="l-table-edit-text" width="15%">调拨日期<FONT
  312. COLOR="red">*</FONT>:
  313. </td>
  314. <td class="l-table-edit-td" width="35%"><input type="text"
  315. id="stock_remove_date" name="stock_remove_date"
  316. readonly="readonly"
  317. value="${requestScope.stockRemove.stock_remove_date }" /> <input
  318. type="hidden" name="stock_remove_date"
  319. id="stock_remove_date_hidden" value="" /></td>
  320. <td class="l-table-edit-text">调拨人<FONT COLOR="red">*</FONT>:
  321. </td>
  322. <td class="l-table-edit-td"><input type="hidden"
  323. name="stock_remove_user" id="stock_remove_user"
  324. value="${requestScope.stockRemove.stock_remove_user}" /> <input
  325. type="text" id="stock_remove_user_name"
  326. name="stock_remove_user_name" readonly="readonly"
  327. value="${requestScope.stockRemove.stock_remove_user_name}" /> <input
  328. type="button" name="usertree" id="usertree" value="选择"
  329. class="l-button" /><br /></td>
  330. </tr>
  331. <tr>
  332. <td class="l-table-edit-text">转出仓库<FONT COLOR="red">*</FONT>:
  333. </td>
  334. <td class="l-table-edit-td"><select
  335. id="stock_remove_from_depot" name="stock_remove_from_depot"
  336. class="short-text"
  337. onchange="getLocations('stock_remove_from_depot','stock_remove_from_location')">
  338. <option value="">--请选择--</option>
  339. <c:forEach items="${depotlist}" var="depotlist">
  340. <option value="${depotlist.depot_id}">${depotlist.depot_name}</option>
  341. </c:forEach>
  342. </select> <span id="selectloc1" style="display: none;"> <select
  343. id="stock_remove_from_location"
  344. name="stock_remove_from_location" class="short-text">
  345. <option value=''>--请选择--</option>
  346. </select>
  347. </span></td>
  348. <td class="l-table-edit-text">转入仓库<FONT COLOR="red">*</FONT>:
  349. </td>
  350. <td class="l-table-edit-td"><select
  351. id="stock_remove_to_depot" name="stock_remove_to_depot"
  352. class="short-text"
  353. onchange="getLocations('stock_remove_to_depot','stock_remove_to_location')">
  354. <option value="">--请选择--</option>
  355. <c:forEach items="${depotlist}" var="depotlist">
  356. <option value="${depotlist.depot_id}">${depotlist.depot_name}</option>
  357. </c:forEach>
  358. </select> <span id="selectloc2" style="display: none;"> <select
  359. id="stock_remove_to_location" name="stock_remove_to_location"
  360. class="short-text">
  361. <option value=''>--请选择--</option>
  362. </select>
  363. </span></td>
  364. </tr>
  365. <tr>
  366. <td class="l-table-edit-text">备注</td>
  367. <td class="l-table-edit-td" colspan="3"><textarea
  368. name="stock_remove_remark" cols="120" rows="2">${requestScope.stockRemove.stock_remove_remark }</textarea>
  369. </td>
  370. </tr>
  371. <tr>
  372. <th colspan="4">调拨明细</th>
  373. </tr>
  374. <tr>
  375. <td colspan="4"><a class="l-button"
  376. style="width: 100px; float: left; margin-left: 10px;"
  377. onclick="isSelDepot()">选择存货</a> <a class="l-button"
  378. style="width: 100px; float: left; margin-left: 10px;"
  379. onclick="deleteRow()">删除选择的行</a></td>
  380. </tr>
  381. </table>
  382. <input type="hidden" id="jsonData" name="jsonData" value="">
  383. <input type="hidden" id="unit_id" name="unit_id" value="${requestScope.stockRemove.unit_id }">
  384. <input type="hidden" id="tabid" name="tabid" value="${param.tabid }">
  385. <input type="hidden" id="task" name="task" value="doEdit">
  386. <input type="hidden" id="stock_remove_id" name="stock_remove_id" value="${requestScope.stockRemove.stock_remove_id}">
  387. <input type="hidden" id="stock_remove_from_depot_" name="stock_remove_from_depot_" value="${requestScope.stockRemove.stock_remove_from_depot}">
  388. <input type="hidden" id="stock_remove_from_location_" name="stock_remove_from_location_" value="${requestScope.stockRemove.stock_remove_from_location}">
  389. </center>
  390. </div>
  391. <div id="maingrid" style="margin: 0; padding: 0"></div>
  392. </div>
  393. </form>
  394. <%@ include file="/include/message.jsp"%>
  395. </body>
  396. </html>