editOutStock.jsp 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437
  1. <%@ page language="java" contentType="text/html;charset=GBK" pageEncoding="GBK"%>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  3. <html>
  4. <head>
  5. <meta http-equiv="Content-Type" content="text/html; charset=GBK">
  6. <title>出库单编辑</title>
  7. <link href="main.css" rel="stylesheet" type="text/css"></link>
  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. <script src="${pageContext.request.contextPath}/liger/lib/json2.js" type="text/javascript"></script>
  11. <script src="${pageContext.request.contextPath}/liger/lib/ligerUI/js/core/base.js" type="text/javascript"></script>
  12. <script src="${pageContext.request.contextPath}/liger/lib/ligerUI/js/plugins/ligerDialog.js" type="text/javascript"></script>
  13. <script src="${pageContext.request.contextPath}/liger/lib/ligerUI/js/plugins/ligerGrid.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="${pageContext.request.contextPath}/liger/lib/ligerUI/js/plugins/ligerTextBox.js" type="text/javascript"></script>
  16. <script src="${pageContext.request.contextPath}/liger/lib/ligerUI/js/plugins/ligerCheckBox.js" type="text/javascript"></script>
  17. <script src="${pageContext.request.contextPath}/liger/lib/ligerUI/js/plugins/ligerComboBox.js" type="text/javascript"></script>
  18. <script src="${pageContext.request.contextPath}/liger/lib/ligerUI/js/plugins/ligerSpinner.js" type="text/javascript"></script>
  19. <script type="text/javascript" src="/shares/js/constant.js"></script>
  20. <script type="text/javascript" src="/shares/js/common.js"></script>
  21. <script type="text/javascript" src="/shares/js/yw/erp2/erpCommon.js"></script>
  22. <script type="text/javascript" src="/shares/js/yw/erp2/stock/outstock/outStock.js"></script>
  23. <script type="text/javascript" src="/shares/js/yw/erp2/common/control/deptLookup.js"></script>
  24. <script type="text/javascript" src="/shares/js/yw/erp2/common/control/productLookup.js"></script>
  25. <script type="text/javascript">
  26. var outStockDetailData = ${requestScope.Rows};
  27. var locationobjs;
  28. $(function() {
  29. checkFowOnOff("${requestScope.flowIsOpen}","${requestScope.flowOnOff}", "对不起,出库单登记流程未配置,请通知流程管理员配置后,再提交!");
  30. $("#outs_batch_num").focus();
  31. closeAndReloadList();
  32. $(f_initGrid);
  33. loadTypeTree("selectbutton", {
  34. type : "detpusersingle",
  35. backId : "outs_operater",
  36. backName : "outs_operater_name",
  37. tab : 1
  38. });
  39. loadTypeTree("receiveButton", {
  40. type : "detpusersingle",
  41. backId : "receive_user_id",
  42. backName : "receive_user_name",
  43. tab : 1
  44. });
  45. var outsid = "${requestScope.outStock.outs_id}";
  46. if(outsid != null && outsid != ''){
  47. if("${requestScope.outStock.outs_depot_id}" != "" && typeof ("${requestScope.outStock.outs_depot_id}") != "undefined"){
  48. $("#outs_depot_id_").val("${requestScope.outStock.outs_depot_id}");
  49. $("#outs_depot_id").attr("disabled",true);
  50. }
  51. if("${requestScope.outStock.outs_location_id}" != "" && typeof ("${requestScope.outStock.outs_location_id}") != "undefined"){
  52. $("#outs_location_id_").val("");
  53. $("#outs_location_id").attr("disabled",true);
  54. }
  55. $("#outs_outstock_date").ligerDateEditor({
  56. labelAlign : 'left',
  57. width : 160,
  58. format :"yyyy-MM-dd",
  59. initValue : '${requestScope.outStock.outs_outstock_date }'
  60. });
  61. }else{
  62. $("#outs_outstock_date").ligerDateEditor({
  63. labelAlign : 'left',
  64. width : 160,
  65. format :"yyyy-MM-dd",
  66. initValue : '${requestScope.datestr }'
  67. });
  68. }
  69. var selectDepotid = "${requestScope.outStock.outs_depot_id}";
  70. if (selectDepotid != null && selectDepotid != "") {
  71. $("#outs_depot_id").val(selectDepotid);
  72. }
  73. selectlocationid = "${requestScope.outStock.outs_location_id}";
  74. if (selectlocationid != null && selectlocationid != "") {
  75. getLocations();
  76. }
  77. var selectOutstype = "${requestScope.outStock.outs_type}";
  78. if (selectOutstype != null && selectOutstype != "") {
  79. $("#outs_type").val(selectOutstype);
  80. }
  81. });
  82. function closeAndReloadList(){
  83. var isAddSucc = "${requestScope.isAddSucc}";
  84. if(isAddSucc == "true"){
  85. var tabid = getCurrentTabId();
  86. var listTabid = 'outStockAction.do?task=toList';
  87. if(window.parent.tab.isTabItemExist(listTabid)){
  88. window.parent.f_selectTab(listTabid);
  89. window.parent.f_reloadTab(listTabid);
  90. }else{
  91. window.parent.f_addTab(listTabid, '出库列表', 'outStockAction.do?task=toList');
  92. }
  93. window.parent.f_closeTab(tabid);
  94. }
  95. }
  96. function getLocations(selectlocationid){
  97. $(f_initGrid);
  98. $("#outs_location_id").empty();
  99. $('#outs_location_id').append("<option value=''>--请选择--</option> ");
  100. var outs_depot_id_val=$('#outs_depot_id').val();
  101. $.ajax({
  102. url:"takingStockAction.do?date="+new Date()+"&task=getLocations",
  103. type:"post",
  104. dataType:"json",
  105. data:"takings_depot_id="+ $("#outs_depot_id").val(),
  106. success:callback
  107. });
  108. }
  109. function callback(json){
  110. locationobjs = json;
  111. if(locationobjs.length == 0){
  112. $("#selectloc").hide();
  113. }else{
  114. $("#selectloc").show();
  115. for(var i=0;i<locationobjs.length;i++){
  116. $('#outs_location_id').append("<option value='"+locationobjs[i].location_id+"'>"+locationobjs[i].location_name+"</option>");
  117. }
  118. $("#outs_location_id").val(selectlocationid);
  119. }
  120. }
  121. var pids = "";
  122. function isSelDepot(){
  123. var outs_depot_id_val=$('#outs_depot_id').val();
  124. if(outs_depot_id_val == ""){
  125. $.ligerDialog.warn("请先选择仓库 !");
  126. }else{
  127. if(locationobjs != null && locationobjs != "" && locationobjs.length > 0){
  128. var outs_location_id_val = $('#outs_location_id').val();
  129. if(outs_location_id_val == ""){
  130. $.ligerDialog.warn("请先选择库位 !");
  131. }else{
  132. openProductLookup();
  133. // f_import();
  134. }
  135. }else{
  136. openProductLookup();
  137. // f_import();
  138. }
  139. }
  140. }
  141. function hasDetails(){
  142. getData();
  143. var jsonDataVal = $("#jsonData").val();
  144. if (jsonDataVal.length > 2) {
  145. if($("#outs_depot_id").val()!= null && $("#outs_depot_id").val()!= ""){
  146. $("#outs_depot_id_").val($("#outs_depot_id").val());
  147. $("#outs_depot_id").attr("disabled",true);
  148. }
  149. if($("#outs_location_id").val()!= null && $("#outs_location_id").val()!= ""){
  150. $("#outs_location_id_").val($("#outs_location_id").val());
  151. $("#outs_location_id").attr("disabled",true);
  152. }
  153. }else{
  154. $("#outs_depot_id").attr("disabled",false);
  155. $("#outs_location_id").attr("disabled",false);
  156. }
  157. }
  158. function isSelDepotForMark(){
  159. var outs_depot_id_val=$('#outs_depot_id').val();
  160. if(outs_depot_id_val == ""){
  161. $.ligerDialog.warn("请先选择仓库 !");
  162. }else{
  163. if(locationobjs != null && locationobjs != "" && locationobjs.length > 0){
  164. var outs_location_id_val = $('#outs_location_id').val();
  165. if(outs_location_id_val == ""){
  166. $.ligerDialog.warn("请先选择库位 !");
  167. }else{
  168. searchProByMark();
  169. }
  170. }else{
  171. searchProByMark();
  172. }
  173. }
  174. }
  175. function checkForm() {
  176. var rs = $.validate({
  177. name : "outs_operater_name",
  178. model : [ {
  179. type : "require",
  180. msg : "仓管员不能为空!"
  181. } ]
  182. });
  183. rs = $.validate({
  184. name : "outs_outstock_date",
  185. model : [ {
  186. type : "require",
  187. msg : "出库日期不能为空!"
  188. } ]
  189. }) && rs;
  190. rs = $.validate({
  191. name : "outs_depot_id",
  192. model : [ {
  193. type : "require",
  194. msg : "仓库不能为空!"
  195. } ]
  196. }) && rs;
  197. if (document.getElementById("selectloc").style.display != "none") {
  198. rs = $.validate({
  199. name : "outs_location_id",
  200. model : [ {
  201. type : "require",
  202. msg : "库位不能为空!"
  203. } ]
  204. }) && rs;
  205. }
  206. rs = $.validate({
  207. name : "outs_type",
  208. model : [ {
  209. type : "require",
  210. msg : "出库类别不能为空!"
  211. } ]
  212. }) && rs;
  213. rs = $.validate({
  214. name : "outs_deptname",
  215. model : [ {
  216. type : "require",
  217. msg : "领用部门不能为空!",
  218. msgField : "outs_deptButton"
  219. } ]
  220. }) && rs;
  221. rs = $.validate({
  222. name : "receive_user_name",
  223. model : [ {
  224. type : "require",
  225. msg : "领用人不能为空!",
  226. msgField : "receiveButton"
  227. } ]
  228. }) && rs;
  229. if (rs) {
  230. getData();
  231. var flag = isSelected();
  232. if (flag) {
  233. var jsonarr = eval('(' + $("#jsonData").val() + ')');
  234. for ( var i = 0; i < jsonarr.length; i++) {
  235. if (jsonarr[i].outsd_product_count <= 0) {
  236. $.ligerDialog.warn(jsonarr[i].product_name + "的出库数量必须大于0!");
  237. return false;
  238. }
  239. /* if (jsonarr[i].outsd_totalprice <= 0) {
  240. $.ligerDialog.warn(jsonarr[i].product_name + "-"
  241. + jsonarr[i].product_num + "的金额必须大于0!");
  242. return false;
  243. } */
  244. if (jsonarr[i].product_is_serial == 1
  245. && jsonarr[i].serialcount != jsonarr[i].outsd_product_count) {
  246. $.ligerDialog.warn(jsonarr[i].product_name
  247. + "的序列号选择数量与出库数量不匹配!");
  248. return false;
  249. }
  250. }
  251. return true;
  252. }
  253. return false;
  254. }
  255. return false;
  256. }
  257. // 保存
  258. function btnSaveOut() {
  259. if (checkForm()) {
  260. $("#outstock_save").attr('disabled', true);
  261. $("#outStockForm").submit();
  262. }
  263. }
  264. </script>
  265. </head>
  266. <body>
  267. <%@ include file="/include/message.jsp"%>
  268. <form id="outStockForm" action="outStockAction.do" method="post">
  269. <div id="title" class="form-button">
  270. <c:if test="${requestScope.outStock.outs_id==null}">
  271. <input id="outstock_save" name="outstock_save" type="button" class="l-button" value="保存" onclick="btnSaveOut();" />
  272. <input type="button" value="关闭" class="l-button" onclick="closeWindow();"/>
  273. </c:if>
  274. <c:if test="${requestScope.outStock.outs_id!=null}">
  275. <input id="outstock_save" name="outstock_save" type="button" class="l-button" value="保存" onclick="btnSaveOut();"/>
  276. <input type="button" value="关闭" class="l-button" onclick="closeWindow();"/>
  277. </c:if>
  278. </div>
  279. <div class="container-layout">
  280. <div class="forum-container">
  281. <center>
  282. <table class="l-table-edit line">
  283. <tr>
  284. <th colspan="4">出库单信息</th>
  285. </tr>
  286. <tr>
  287. <td class="l-table-edit-text">出库单号<FONT COLOR="red">*</FONT>:
  288. </td>
  289. <td class="l-table-edit-td">
  290. <jsp:include page="/yw/erp2/include/codeReadonly.jsp">
  291. <jsp:param name="name" value="outs_num"/>
  292. <jsp:param name="value" value="${requestScope.outStock.outs_num }"/>
  293. </jsp:include>
  294. </td>
  295. <td class="l-table-edit-text">批次号:
  296. </td>
  297. <td class="l-table-edit-td">
  298. <input type="text" id="outs_batch_num" name="outs_batch_num" value="${requestScope.outStock.outs_batch_num }" style="width:150px">
  299. </td>
  300. </tr>
  301. <tr>
  302. <td class="l-table-edit-text">仓库<FONT COLOR="red">*</FONT>:</td>
  303. <td class="l-table-edit-td">
  304. <select id="outs_depot_id" name="outs_depot_id" class="short-text" onchange="getLocations()" style="width:150px;">
  305. <option value="">--请选择--</option>
  306. <c:forEach items="${depotlist}" var="depotlist">
  307. <option value="${depotlist.depot_id}" >${depotlist.depot_name}</option>
  308. </c:forEach>
  309. </select>
  310. <span id="selectloc" style="display:none;">
  311. <select id="outs_location_id" name="outs_location_id" class="short-text" >
  312. <option value=''>--请选择--</option>
  313. </select>
  314. </span>
  315. </td>
  316. <td class="l-table-edit-text">仓管员<FONT COLOR="red">*</FONT>:
  317. </td>
  318. <td class="l-table-edit-td">
  319. <input type="hidden" name="outs_operater" id="outs_operater" readonly="readonly" value="${requestScope.outStock.outs_operater }" />
  320. <input type="text" id="outs_operater_name" name="outs_operater_name" style="width: 120px" readonly="readonly" value="${requestScope.outStock.outs_operater_name }" />
  321. <input type="button" class="l-button" id="selectbutton" value="选择人员" />
  322. </td>
  323. </tr>
  324. <tr>
  325. <td class="l-table-edit-text">出库类别<FONT COLOR="red">*</FONT>:</td>
  326. <td class="l-table-edit-td">
  327. <select name="outs_type" id="outs_type" style="width:150px">
  328. <option value=''>--请选择--</option>
  329. <c:forEach items="${outstypelist}" var="outstype">
  330. <option value="${outstype.dvalue}" >${outstype.dname}</option>
  331. </c:forEach>
  332. </select>
  333. </td>
  334. <td class="l-table-edit-text">出库日期<FONT COLOR="red">*</FONT>:
  335. </td>
  336. <td class="l-table-edit-td">
  337. <input type="text" id="outs_outstock_date" name="outs_outstock_date" value="" style="width:150px">
  338. </td>
  339. </tr>
  340. <tr>
  341. <td class="l-table-edit-text">领用部门<FONT COLOR="red">*</FONT>:</td>
  342. <td class="l-table-edit-td">
  343. <input type="hidden" id="outs_dept" name="outs_dept" value="${requestScope.outStock.outs_dept}" />
  344. <input type="text" id="outs_deptname" name="outs_deptname" readonly="readonly" style="width: 130px" value="${requestScope.outStock.outs_deptname}" />
  345. <!-- <input type="button" class="l-button" value="请选择" id="outs_deptButton" name="outs_deptButton" onclick="f_choseDept({outs_dept:'outs_dept',outs_deptname:'outs_deptname'});"/> -->
  346. <input type="button" class="l-button" value="请选择" id="outs_deptButton" name="outs_deptButton" onclick="deptLookup({width:400, height:450, outs_dept:'outs_dept',outs_deptname:'outs_deptname'});"/>
  347. </td>
  348. <td class="l-table-edit-text">领用人<FONT COLOR="red">*</FONT>:</td>
  349. <td class="l-table-edit-td">
  350. <input type="hidden" name="receive_user_id" id="receive_user_id" value="${requestScope.outStock.receive_user_id}" />
  351. <input type="text" id="receive_user_name" name="receive_user_name" readonly="readonly" value="${requestScope.outStock.receive_user_name}" />
  352. <input type="button" class="l-button" id="receiveButton" value="选择人员" />
  353. </td>
  354. </tr>
  355. <tr>
  356. <td class="l-table-edit-text">备注:
  357. </td>
  358. <td class="l-table-edit-td">
  359. <input type="text" id="outs_remark" name="outs_remark" value="${requestScope.outStock.outs_remark }" style="width:80%">
  360. </td>
  361. <td class="l-table-edit-text">库存量:</td>
  362. <td class="l-table-edit-td">
  363. <input type="text" id="outStock_count" name="outStock_count" style="border-style: none;" readonly="readonly" />
  364. </td>
  365. </tr>
  366. <tr>
  367. <th colspan="4">出库明细</th>
  368. </tr>
  369. <tr>
  370. <td colspan="4">
  371. <!-- 明细 start -->
  372. <div style="padding-top:5px;">
  373. <a class="l-button" style="width:100px;float:left; margin-left:10px;" onclick="isSelDepot()">选择存货</a>
  374. <!-- <a class="l-button" style="width:100px;float:left; margin-left:10px;" onclick="f_importSaleInvoice();">选择发货单</a> -->
  375. <a class="l-button" style="width:100px;float:left; margin-left:10px;" onclick="isSelDepotForMark();">条码扫描</a>
  376. <a class="l-button" style="width:120px;float:left; margin-left:10px;" onclick="deleteRow()">删除选择的行</a>
  377. </div>
  378. <div class="l-clear"></div>
  379. <div id="maingrid" style="margin-top:5px"></div>
  380. <div style="display:none;">
  381. </div>
  382. <!-- 明细 end -->
  383. </td>
  384. </tr>
  385. </table>
  386. <input type="hidden" id="jsonData" name="jsonData" value="">
  387. <c:if test="${requestScope.outStock.flow_id!=0}">
  388. <input type="hidden" id="flow_id" name="flow_id" value="${requestScope.outStock.flow_id}">
  389. </c:if>
  390. <c:if test="${requestScope.outStock.flow_id==0}">
  391. <input type="hidden" id="flow_id" name="flow_id" >
  392. </c:if>
  393. <input type="hidden" id="state" name="state" value="${state}"> <%-- 审核状态5,代表不需要流程引擎插件 --%>
  394. <input type="hidden" id="outs_id" name="outs_id" value="${requestScope.outStock.outs_id }">
  395. <input type="hidden" id="outsd_product_count" name="outsd_product_count" value="1">
  396. <input type="hidden" id="tabid" name="tabid" value="${param.tabid }">
  397. <input type="hidden" id="check_status" name="check_status" value="${requestScope.outStock.check_status}">
  398. <input type="hidden" id="unit_id" name="unit_id" value="${requestScope.outStock.unit_id }">
  399. <input type="hidden" id="task" name="task" value="doEditOutStock">
  400. <input type="hidden" name="outs_status" id="outs_status" value="1">
  401. <input type="hidden" id="check_user_id" name="check_user_id" value="${requestScope.outStock.check_user_id}">
  402. <input type="hidden" id="out_deleted" name="out_deleted" value="${requestScope.outStock.out_deleted }">
  403. <input type="hidden" id="outs_depot_id_" name="outs_depot_id_" value="">
  404. <input type="hidden" id="outs_location_id_" name="outs_location_id_" value="">
  405. <!-- 流程ID -->
  406. <input type="hidden" id="tmodelId" name="tmodelId" value="${requestScope.tmodel.tmodelId }">
  407. <input type="hidden" id="modelId" name="modelId" value="${requestScope.fmodel.modelId }">
  408. <input type="hidden" id="flowTheme" name="flowTheme" value="${requestScope.flowTheme}"/>
  409. </center>
  410. </div>
  411. </div>
  412. </form>
  413. </body>
  414. </html>