addfeedstorageemployeeout.jsp 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
  2. <html>
  3. <head>
  4. <%@ include file="../common/header.jsp" %>
  5. <script type="text/javascript" src="${contextPath }/js/calendar/WdatePicker.js"></script>
  6. <script type="text/javascript">
  7. $(document).ready(function (){
  8. $("#BusinessDate").bind("click", function() {WdatePicker({maxDate:'%y-%M-%d'});});
  9. var fsType = "${fsType}";
  10. if(fsType==1){
  11. $("#cowClassTr").hide();
  12. }else{
  13. $("#cowClassTr").show();
  14. }
  15. });
  16. function updateFeedStorage(){
  17. //提交之前验证保存记录之前是否有入库记录、有的话可以保存
  18. var type = $("#type").val();
  19. var feedstorageId = $("#feedstorageId").val();
  20. var feedId = $("#feedId").val();
  21. var fsType = $("#fsType").val();
  22. var CCID = $("#CCID").val();
  23. var OperateWeight = $("#OperateWeight").val();
  24. var BusinessDate = $("#BusinessDate").val();
  25. var Remark = $("#Remark").val();
  26. if(BusinessDate.length == 0){
  27. alert("【出库日期】必填");
  28. $("#BusinessDate").focus();
  29. return false;
  30. }
  31. if(feedId.length == 0){
  32. alert("【饲料名称】必选");
  33. $("#feedId").focus();
  34. return false;
  35. }
  36. if(fsType==2){
  37. if(CCID.length == 0){
  38. alert("【畜牧类别】必选");
  39. $("#CCID").focus();
  40. return false;
  41. }
  42. }
  43. var g = /^-?\d+\.?\d{0,2}$/;
  44. if(OperateWeight.length == 0){
  45. alert("【操作重量】必填");
  46. $("#OperateWeight").focus();
  47. return false;
  48. }else if(!g.test(OperateWeight)){
  49. alert("【操作重量】必须为数字,小数点不超过两位");
  50. $("#OperateWeight").focus();
  51. return false;
  52. }
  53. $.ajax({
  54. async: false,
  55. type: "post",
  56. dataType:"json", //返回类型json
  57. data: "feedstorageId="+feedstorageId+"&feedId="+feedId+"&fsType="+fsType+"&OperateWeight="+OperateWeight+"&BusinessDate="+BusinessDate+"&Remark="+Remark+"&type="+type+"&CCID="+CCID,
  58. url: "${contextPath }/admin/feedstorage/savefeedstorageemployeeout.html",
  59. error: function(){alert("系统错误");},
  60. success: function(json){
  61. if(json.status == "success"){
  62. parent.hsClose();
  63. }else if(json.status == "businessError"){
  64. alert(BusinessDate+"日期当时的库存"+json.theoryweight+",不可出库,会导致当时库存为负数");
  65. }else if(json.status == "error"){
  66. alert("出库导致现有库存为负数,现有库存"+json.theoryweight);
  67. }else if(json.status=="empty"){
  68. alert(BusinessDate+"日期当时,该饲料未有入库记录,不能出库");
  69. }
  70. }
  71. });
  72. }
  73. </script>
  74. </head>
  75. <body style="background-color: #E0E0E0">
  76. <div>
  77. <div class="navfrm">
  78. <span>当前位置:新增${fsTypeStr }</span>
  79. </div>
  80. <input type="hidden" id="feedstorageId" name="feedstorageId" value="${map.FeedStorageId }" />
  81. <input type="hidden" id="type" name="type" value="${type }" ></input>
  82. <table cellspacing="1" cellpadding="1" border="0" style="width: 99%;" class="tabsty">
  83. <tbody>
  84. <tr style="height:30px;" class="greb">
  85. <td style="text-align:right;"><span style="color: red">* </span>操作类型:</td>
  86. <td>
  87. <input type="hidden" id="fsType" name="fsType" value="${fsType}"/>
  88. <select disabled="disabled">
  89. <option>${fsTypeStr }</option>
  90. </select>
  91. </td>
  92. </tr>
  93. <tr style="height:30px;" class="greb">
  94. <td style="text-align:right;"><span style="color: red">* </span>出库日期:</td>
  95. <td><input id="BusinessDate" name="BusinessDate" value="${map.BusinessDate }" /></td>
  96. </tr>
  97. <tr style="height:30px;" class="greb">
  98. <td style="text-align:right;"><span style="color: red">* </span>饲料名称:</td>
  99. <td>
  100. <select id="feedId">
  101. <option></option>
  102. <c:forEach items="${feeds }" var="feed">
  103. <option value="${feed.ID }" <c:if test="${feed.ID == map.FeedId}">selected="selected"</c:if>>
  104. <c:out value="${feed.FNAME }" />
  105. </option>
  106. </c:forEach>
  107. </select>
  108. </td>
  109. </tr>
  110. <tr id="cowClassTr" style="height:30px;" class="greb">
  111. <td style="text-align:right;"><span style="color: red">* </span>畜牧类别:</td>
  112. <td>
  113. <select id="CCID">
  114. <option></option>
  115. <c:forEach items="${cowClassList }" var="cowClass">
  116. <option value="${cowClass.ID }" <c:if test="${cowClass.ID == map.CCID}">selected="selected"</c:if>>
  117. <c:out value="${cowClass.CLASSNAME }" />
  118. </option>
  119. </c:forEach>
  120. </select>
  121. </td>
  122. </tr>
  123. <tr style="height:30px;" class="greb">
  124. <td style="text-align:right;"><span style="color: red">* </span>操作重量:</td>
  125. <td><input id="OperateWeight" name="OperateWeight" value="${map.OperateWeight }" /></td>
  126. </tr>
  127. <tr style="height:30px;" class="greb">
  128. <td style="text-align:right;">原因:</td>
  129. <td><input id="Remark" name="Remark" value="${map.Remark }" /></td>
  130. </tr>
  131. <tr style="height:30px;" class="greb">
  132. <td></td>
  133. <td>
  134. <input id="smbut" type="button" value="保存" onclick="updateFeedStorage();" class="inputbutton" style="height:30px;width:70px;font-size:12px;">&nbsp;&nbsp;&nbsp;
  135. </td>
  136. </tr>
  137. </tbody>
  138. </table>
  139. </div>
  140. </body>
  141. </html>