editTakingStockPlan.jsp 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375
  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 }/main.css" rel="stylesheet" type="text/css" />
  9. <link href="/shares/js/yw/master1/liger/skins/ynet/css/ligerui-all.css" rel="stylesheet" type="text/css" />
  10. <link href="/shares/css/yw/master1/reset.css" rel="stylesheet" type="text/css" />
  11. <script src="${pageContext.request.contextPath }/liger/lib/jquery/jquery-1.3.2.min.js" type="text/javascript"></script>
  12. <script type="text/javascript" src="/shares/js/constant.js"></script>
  13. <script type="text/javascript" src="/shares/js/common.js"></script>
  14. <script type="text/javascript" src="/shares/js/file.js"></script>
  15. <script src="${pageContext.request.contextPath }/liger/lib/ligerUI/js/core/base.js" type="text/javascript"></script>
  16. <script src="${pageContext.request.contextPath }/liger/lib/ligerUI/js/plugins/ligerDateEditor.js" type="text/javascript"></script>
  17. <script src="/shares/xheditor/xheditor-1.1.14/xheditor-1.1.14-zh-cn.min.js" type="text/javascript"></script>
  18. <!-- 选择窗口需要加载的js文件 start-->
  19. <script src="${pageContext.request.contextPath}/liger/lib/json2.js" type="text/javascript"></script>
  20. <script src="${pageContext.request.contextPath}/liger/lib/ligerUI/js/plugins/ligerDialog.js" type="text/javascript"></script>
  21. <script src="${pageContext.request.contextPath}/liger/lib/ligerUI/js/plugins/ligerGrid.js" type="text/javascript"></script>
  22. <script src="${pageContext.request.contextPath}/liger/lib/ligerUI/js/plugins/ligerTextBox.js" type="text/javascript"></script>
  23. <script src="${pageContext.request.contextPath}/liger/lib/ligerUI/js/plugins/ligerCheckBox.js" type="text/javascript"></script>
  24. <script src="${pageContext.request.contextPath}/liger/lib/ligerUI/js/plugins/ligerComboBox.js" type="text/javascript"></script>
  25. <script src="${pageContext.request.contextPath}/liger/lib/ligerUI/js/plugins/ligerSpinner.js" type="text/javascript"></script>
  26. <script type="text/javascript" src="/shares/js/yw/erp/takingStockPlan.js"></script>
  27. <link rel="stylesheet" type="text/css" href="/shares/css/yw/master1/win/jquery.jscrollpane.codrops1.css" />
  28. <!-- the mousewheel plugin -->
  29. <script type="text/javascript" src="/shares/js/yw/master1/jquery.mousewheel.js"></script>
  30. <!-- the jScrollPane script -->
  31. <script type="text/javascript" src="/shares/js/yw/master1/jquery.jscrollpane.min.js"></script>
  32. <script type="text/javascript" src="/shares/js/yw/master1/scroll-startstop.events.jquery.js"></script>
  33. <script type="text/javascript" src="/shares/js/yw/master1/scroll.js"></script>
  34. <style type="text/css">
  35. body {
  36. background:#fff;
  37. }
  38. </style>
  39. <script type="text/javascript">
  40. var takingDetailData = ${requestScope.Rows};
  41. var task = "${requestScope.task}";
  42. var locationobjs;
  43. var selectlocationid = "";
  44. $(f_initGrid);
  45. $(function() {
  46. $("input[type='text']:first").focus();
  47. loadTypeTree("usertree", {
  48. type : "singleuser",
  49. tab : "1,2",
  50. backId : "takings_principal",
  51. backName : "takings_principalname"
  52. });
  53. loadTypeTree("usertree2", {
  54. type : "singleuser",
  55. tab : "1,2",
  56. backId : "takings_operater",
  57. backName : "takings_operatername"
  58. });
  59. $("#takings_start_date").ligerDateEditor({
  60. showTime : true,
  61. labelAlign : 'left',
  62. showTime : false,
  63. width : 150,
  64. height : 21
  65. });
  66. $("#takings_end_date").ligerDateEditor({
  67. showTime : true,
  68. labelAlign : 'left',
  69. showTime : false,
  70. width : 150,
  71. height : 21
  72. });
  73. var selectDepotid = "${requestScope.takingStockPlan.takings_depot_id}";
  74. if (selectDepotid != null && selectDepotid != "") {
  75. $("#takings_depot_id").val(selectDepotid);
  76. }
  77. selectlocationid = "${requestScope.takingStockPlan.takings_location_id}";
  78. if (selectlocationid != null && selectlocationid != "") {
  79. getLocations();
  80. }
  81. hasDetails();
  82. });
  83. function getLocations(selectlocationid) {
  84. $("#takings_location_id").empty();
  85. $('#takings_location_id').append("<option value=''>--请选择--</option> ");
  86. var takings_depot_id_val = $('#takings_depot_id').val();
  87. $.ajax({
  88. url : "takingStockPlanAction.do?date=" + new Date()
  89. + "&task=getLocations",
  90. type : "post",
  91. dataType : "json",
  92. data : "takings_depot_id=" + $("#takings_depot_id").val(),
  93. success : callback
  94. });
  95. }
  96. function callback(json) {
  97. locationobjs = json;
  98. if (locationobjs.length == 0) {
  99. $("#selectloc").hide();
  100. } else {
  101. $("#selectloc").show();
  102. for ( var i = 0; i < locationobjs.length; i++) {
  103. $('#takings_location_id').append(
  104. "<option value='"+locationobjs[i].location_id+"'>"
  105. + locationobjs[i].location_name + "</option>");
  106. }
  107. $("#takings_location_id").val(selectlocationid);
  108. }
  109. }
  110. function isSelDepot() {
  111. var takings_depot_id_val = $('#takings_depot_id').val();
  112. var takings_location_id_val = "";
  113. if (takings_depot_id_val == "") {
  114. $.ligerDialog.warn("请先选择仓库 !");
  115. } else {
  116. if (locationobjs != null && locationobjs != ""
  117. && locationobjs.length > 0) {
  118. takings_location_id_val = $('#takings_location_id').val();
  119. if (takings_location_id_val == "") {
  120. $.ligerDialog.warn("请先选择库位 !");
  121. } else {
  122. f_import(takings_depot_id_val, takings_location_id_val);
  123. }
  124. } else {
  125. f_import(takings_depot_id_val, takings_location_id_val);
  126. }
  127. }
  128. }
  129. function checkForm() {
  130. var rs = $.validate({
  131. name : "takings_num",
  132. model : [ {
  133. type : "require",
  134. msg : "计划编号不能为空!"
  135. } ]
  136. });
  137. rs = $.validate({
  138. name : "takings_name",
  139. model : [ {
  140. type : "require",
  141. msg : "计划主题不能为空!"
  142. } ]
  143. }) && rs;
  144. rs = $.validate({
  145. name : "takings_principalname",
  146. model : [ {
  147. type : "require",
  148. msg : "负责人不能为空!"
  149. } ]
  150. }) && rs;
  151. rs = $.validate({
  152. name : "takings_operatername",
  153. model : [ {
  154. type : "require",
  155. msg : "盘点人不能为空!"
  156. } ]
  157. }) && rs;
  158. rs = $.validate({
  159. name : "takings_start_date",
  160. model : [ {
  161. type : "require",
  162. msg : "计划开始日期不能为空!"
  163. } ]
  164. }) && rs;
  165. rs = $.validate({
  166. name : "takings_end_date",
  167. model : [ {
  168. type : "require",
  169. msg : "计划完成日期不能为空!"
  170. }, {
  171. type : "date",
  172. min : $("#takings_start_date").val(),
  173. msg : "完成日期不能小于开始日期"
  174. } ]
  175. }) && rs;
  176. rs = $.validate({
  177. name : "takings_depot_id",
  178. model : [ {
  179. type : "require",
  180. msg : "仓库不能为空!"
  181. } ]
  182. }) && rs;
  183. if (document.getElementById("selectloc").style.display != "none") {
  184. rs = $.validate({
  185. name : "takings_location_id",
  186. model : [ {
  187. type : "require",
  188. msg : "库位不能为空!"
  189. } ]
  190. }) && rs;
  191. }
  192. if (rs) {
  193. getData();
  194. var flag = isSelected();
  195. if (flag) {
  196. return true;
  197. }
  198. return false;
  199. }
  200. return false;
  201. }
  202. function hasDetails() {
  203. getData();
  204. var jsonDataVal = $("#jsonData").val();
  205. if (jsonDataVal.length > 2) {
  206. if ($("#takings_depot_id").val() != null
  207. && $("#takings_depot_id").val() != "") {
  208. $("#takings_depot_id_").val($("#takings_depot_id").val());
  209. $("#takings_depot_id").attr("disabled", true);
  210. }
  211. if ($("#takings_location_id").val() != null
  212. && $("#takings_location_id").val() != "") {
  213. $("#takings_location_id_").val($("#takings_location_id").val());
  214. $("#takings_location_id").attr("disabled", true);
  215. }
  216. } else {
  217. $("#takings_depot_id").attr("disabled", false);
  218. $("#takings_location_id").attr("disabled", false);
  219. }
  220. }
  221. function saveTakingStockPlan() {
  222. if(checkForm()){
  223. $("#btnSave").attr({"disabled":"disabled"});
  224. $("#btnCreate").attr({"disabled":"disabled"});
  225. var myfrom = document.getElementById("myfrom");
  226. myfrom.action = "mtTakingStockPlanAction.do";
  227. $("#task").val("doEdit");
  228. $("#myfrom").submit();
  229. }
  230. }
  231. function createTakingStock() {
  232. if(checkForm()){
  233. $("#btnSave").attr({"disabled":"disabled"});
  234. $("#btnCreate").attr({"disabled":"disabled"});
  235. var myfrom = document.getElementById("myfrom");
  236. myfrom.action = "mtTakingStockPlanAction.do";
  237. $("#task").val("createTakingStock");
  238. $("#myfrom").submit();
  239. }
  240. }
  241. </script>
  242. </head>
  243. <body style="background: none; overflow: hidden;" ontouchmove="event.preventDefault();">
  244. <form action="mtTakingStockPlanAction.do" id="myfrom" name="myfrom" method="post">
  245. <div class="s_title b10 f6">
  246. <img src="/shares/images/master1/gg_ico.png" width="27" height="26" /> 编辑盘点计划
  247. <div class="article_title">
  248. <input class="art_back" style="width: 50px;" title="返回" name="" onclick="history.back(-1);" type="button" />
  249. <input class="art_sub" style="width: 50px;" title="保存盘点计划" name="" type="button" value="" onclick="saveTakingStockPlan()" />
  250. <input class="art_pan" title="生成盘点单" name="" type="button" value="" onclick="createTakingStock()" />
  251. </div>
  252. </div>
  253. <div id="jp-container" class="jp-container liuyan">
  254. <div class="forum-container">
  255. <center>
  256. <table class="l-table-edit">
  257. <tr>
  258. <th colspan="4">基本信息</th>
  259. </tr>
  260. <tr>
  261. <td class="l-table-edit-text" width="15%">盘点计划编号<FONT
  262. COLOR="red">*</FONT>:
  263. </td>
  264. <td class="l-table-edit-td" width="35%"><input type="text"
  265. id="takings_num" name="takings_num" value="${requestScope.takingStockPlan.takings_num}" />
  266. </td>
  267. <td class="l-table-edit-text" width="15%">主题<FONT
  268. COLOR="red">*</FONT>:
  269. </td>
  270. <td class="l-table-edit-td" width="35%"><input type="text"
  271. id="takings_name" name="takings_name"
  272. value="${requestScope.takingStockPlan.takings_name}" /></td>
  273. </tr>
  274. <tr>
  275. <td class="l-table-edit-text" width="15%">负责人<FONT
  276. COLOR="red">*</FONT>:
  277. </td>
  278. <td class="l-table-edit-td" width="35%"><input type="hidden"
  279. name="takings_principal" id="takings_principal"
  280. value="${requestScope.takingStockPlan.takings_principal}" /> <input
  281. type="text" id="takings_principalname" name="takings_principalname" readonly="readonly"
  282. value="${requestScope.takingStockPlan.takings_principalname }" />
  283. <input type="button" name="usertree" id="usertree" value="选择"
  284. class="l-button" /><br /></td>
  285. <td class="l-table-edit-text">盘点人<FONT COLOR="red">*</FONT>:
  286. </td>
  287. <td class="l-table-edit-td"><input type="hidden"
  288. name="takings_operater" id="takings_operater"
  289. value="${requestScope.takingStockPlan.takings_operater}" /> <input
  290. type="text" id="takings_operatername" name="takings_operatername" readonly="readonly"
  291. value="${requestScope.takingStockPlan.takings_operatername }" />
  292. <input type="button" name="usertree2" id="usertree2" value="选择"
  293. class="l-button" /><br /></td>
  294. </tr>
  295. <tr>
  296. <td class="l-table-edit-text">计划开始日期<FONT COLOR="red">*</FONT>:
  297. </td>
  298. <td class="l-table-edit-td"><input type="text"
  299. id="takings_start_date" name="takings_start_date"
  300. value="${requestScope.takingStockPlan.takings_start_date}"
  301. readonly="readonly" /> <input type="hidden"
  302. id="takings_start_date_prompt" name="takings_start_date"
  303. value="" /></td>
  304. <td class="l-table-edit-text">计划完成日期<FONT COLOR="red">*</FONT>:
  305. </td>
  306. <td class="l-table-edit-td">
  307. <input type="text" id="takings_end_date" name="takings_end_date"
  308. value="${requestScope.takingStockPlan.takings_end_date}"
  309. readonly="readonly" />
  310. <input type="hidden" id="takings_end_date_prompt" name="takings_end_date" value="" />
  311. </td>
  312. </tr>
  313. <tr>
  314. <td class="l-table-edit-text">仓库<FONT COLOR="red">*</FONT>:
  315. </td>
  316. <td class="l-table-edit-td"><select
  317. id="takings_depot_id" name="takings_depot_id" class="short-text"
  318. onchange="getLocations()">
  319. <option value="">--请选择--</option>
  320. <c:forEach items="${depotlist}" var="depotlist">
  321. <option value="${depotlist.depot_id}">${depotlist.depot_name}</option>
  322. </c:forEach>
  323. </select> <span id="selectloc" style="display: none;"> <select
  324. id="takings_location_id" name="takings_location_id"
  325. class="short-text">
  326. <option value=''>--请选择--</option>
  327. </select>
  328. </span></td>
  329. <td class="l-table-edit-text">备注:</td>
  330. <td class="l-table-edit-td">
  331. <input type="text" name="takings_remark" id="takings_remark" size="50"
  332. value ="${requestScope.takingStockPlan.takings_remark }"></input>
  333. </td>
  334. </tr>
  335. <tr>
  336. <th colspan="4">盘点明细</th>
  337. </tr>
  338. <tr>
  339. <td colspan="4">
  340. <a class="l-button" style="width: 100px; float: left; margin-left: 10px;" onclick="isSelDepot()">选择存货</a>
  341. <a class="l-button" style="width: 100px; float: left; margin-left: 10px;" onclick="onKeyAll()">添加全部存货</a>
  342. <a class="l-button" style="width: 120px; float: left; margin-left: 10px;" onclick="deleteRow()">删除选择的行</a></td>
  343. </tr>
  344. </table>
  345. <input type="hidden" id="jsonData" name="jsonData" value=""/>
  346. <input type="hidden" id="tabid" name="tabid" value="${param.tabid }"/>
  347. <input type="hidden" id="task" name="task" value="doEdit"/>
  348. <input type="hidden" id="takings_id" name="takings_id" value="${requestScope.takingStockPlan.takings_id}">
  349. <input type="hidden" id="takings_depot_id_" name="takings_depot_id_" value="${requestScope.takingStockPlan.takings_depot_id}"/>
  350. <input type="hidden" id="takings_location_id_" name="takings_location_id_" value="${requestScope.takingStockPlan.takings_location_id}"/>
  351. <input type="hidden" id="unit_id" name="unit_id" value="${requestScope.takingStockPlan.unit_id }">
  352. </center>
  353. </div>
  354. <div id="maingrid" style="margin: 0; padding: 0"></div>
  355. </div>
  356. </form>
  357. <%@ include file="/include/message.jsp"%>
  358. </body>
  359. </html>