123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147 |
- <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
- <html>
- <head>
- <%@ include file="../common/header.jsp" %>
- <script type="text/javascript" src="${contextPath }/js/calendar/WdatePicker.js"></script>
- <script type="text/javascript">
- $(document).ready(function (){
- $("#BusinessDate").bind("click", function() {WdatePicker({maxDate:'%y-%M-%d'});});
-
- var fsType = "${fsType}";
- if(fsType==1){
- $("#cowClassTr").hide();
- }else{
- $("#cowClassTr").show();
- }
- });
-
- function updateFeedStorage(){
- //提交之前验证保存记录之前是否有入库记录、有的话可以保存
- var type = $("#type").val();
- var feedstorageId = $("#feedstorageId").val();
- var feedId = $("#feedId").val();
- var fsType = $("#fsType").val();
- var CCID = $("#CCID").val();
- var OperateWeight = $("#OperateWeight").val();
- var BusinessDate = $("#BusinessDate").val();
- var Remark = $("#Remark").val();
-
-
- if(BusinessDate.length == 0){
- alert("【出库日期】必填");
- $("#BusinessDate").focus();
- return false;
- }
- if(feedId.length == 0){
- alert("【饲料名称】必选");
- $("#feedId").focus();
- return false;
- }
- if(fsType==2){
- if(CCID.length == 0){
- alert("【畜牧类别】必选");
- $("#CCID").focus();
- return false;
- }
- }
- var g = /^-?\d+\.?\d{0,2}$/;
- if(OperateWeight.length == 0){
- alert("【操作重量】必填");
- $("#OperateWeight").focus();
- return false;
- }else if(!g.test(OperateWeight)){
- alert("【操作重量】必须为数字,小数点不超过两位");
- $("#OperateWeight").focus();
- return false;
- }
-
- $.ajax({
- async: false,
- type: "post",
- dataType:"json", //返回类型json
- data: "feedstorageId="+feedstorageId+"&feedId="+feedId+"&fsType="+fsType+"&OperateWeight="+OperateWeight+"&BusinessDate="+BusinessDate+"&Remark="+Remark+"&type="+type+"&CCID="+CCID,
- url: "${contextPath }/admin/feedstorage/savefeedstorageemployeeout.html",
- error: function(){alert("系统错误");},
- success: function(json){
- if(json.status == "success"){
- parent.hsClose();
- }else if(json.status == "businessError"){
- alert(BusinessDate+"日期当时的库存"+json.theoryweight+",不可出库,会导致当时库存为负数");
- }else if(json.status == "error"){
- alert("出库导致现有库存为负数,现有库存"+json.theoryweight);
- }else if(json.status=="empty"){
- alert(BusinessDate+"日期当时,该饲料未有入库记录,不能出库");
- }
- }
- });
- }
-
- </script>
- </head>
- <body style="background-color: #E0E0E0">
- <div>
- <div class="navfrm">
- <span>当前位置:新增${fsTypeStr }</span>
- </div>
- <input type="hidden" id="feedstorageId" name="feedstorageId" value="${map.FeedStorageId }" />
- <input type="hidden" id="type" name="type" value="${type }" ></input>
- <table cellspacing="1" cellpadding="1" border="0" style="width: 99%;" class="tabsty">
- <tbody>
- <tr style="height:30px;" class="greb">
- <td style="text-align:right;"><span style="color: red">* </span>操作类型:</td>
- <td>
- <input type="hidden" id="fsType" name="fsType" value="${fsType}"/>
- <select disabled="disabled">
- <option>${fsTypeStr }</option>
- </select>
- </td>
- </tr>
- <tr style="height:30px;" class="greb">
- <td style="text-align:right;"><span style="color: red">* </span>出库日期:</td>
- <td><input id="BusinessDate" name="BusinessDate" value="${map.BusinessDate }" /></td>
- </tr>
- <tr style="height:30px;" class="greb">
- <td style="text-align:right;"><span style="color: red">* </span>饲料名称:</td>
- <td>
- <select id="feedId">
- <option></option>
- <c:forEach items="${feeds }" var="feed">
- <option value="${feed.ID }" <c:if test="${feed.ID == map.FeedId}">selected="selected"</c:if>>
- <c:out value="${feed.FNAME }" />
- </option>
- </c:forEach>
- </select>
- </td>
- </tr>
- <tr id="cowClassTr" style="height:30px;" class="greb">
- <td style="text-align:right;"><span style="color: red">* </span>畜牧类别:</td>
- <td>
- <select id="CCID">
- <option></option>
- <c:forEach items="${cowClassList }" var="cowClass">
- <option value="${cowClass.ID }" <c:if test="${cowClass.ID == map.CCID}">selected="selected"</c:if>>
- <c:out value="${cowClass.CLASSNAME }" />
- </option>
- </c:forEach>
- </select>
- </td>
- </tr>
- <tr style="height:30px;" class="greb">
- <td style="text-align:right;"><span style="color: red">* </span>操作重量:</td>
- <td><input id="OperateWeight" name="OperateWeight" value="${map.OperateWeight }" /></td>
- </tr>
- <tr style="height:30px;" class="greb">
- <td style="text-align:right;">原因:</td>
- <td><input id="Remark" name="Remark" value="${map.Remark }" /></td>
- </tr>
- <tr style="height:30px;" class="greb">
- <td></td>
- <td>
- <input id="smbut" type="button" value="保存" onclick="updateFeedStorage();" class="inputbutton" style="height:30px;width:70px;font-size:12px;">
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- </body>
- </html>
|