<%@ page language="java" contentType="text/html; charset=utf-8"%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
<%@ taglib uri="/WEB-INF/c.tld" prefix="c"%>
<%@ taglib uri="/WEB-INF/page.tld" prefix="page"%>
<script type="text/javascript" src="includes/selection.js"></script>
<script type="text/javascript" src="includes/jquery-1.3.2.js"></script>
<script type="text/javascript">
function save()
{
var code = document.getElementById("code").value; //库房名称
var name = document.getElementById("name").value; //库房编码
var a=true;
//库区最大存储量数字验证
if (isNaN(document.getElementById("largest_inventory").value)) {
alert("最大存储量必须是数字");
document.getElementById("largest_inventory").focus();
return false;
}
if((insertStoreRoom.code.value!=""))
{
if((insertStoreRoom.name.value!=""))
{
if(insertStoreRoom.address.value!=""){
if(insertStoreRoom.largest_inventory.value!=""){
$.ajax({//验证库房编码或库房名称重复
url:"checkStoreRoomCodeAndName.do",
cache : false,
type : "post",
data : {"code":code,"name":name},
async:false,
dataType : "json",
success:function(result){
if(result==1){
alert("库房编码或库房名称重复");
a=false;
}
}
});
if(a){
var form = document.insertStoreRoom; //获取此元素
form.action="insertStoreRoom.do";
form.submit();
}else{
alert("重新填写数据");
return false;
}
}else{
alert("最大数据量不能为空");
}
}else{
alert("地址不能为空");
}
}
else
{
alert("库房名称不能为空");
}
}
else
{
alert("库房编码不能为空");
}
}
</script>
<html:javascript formName="storeRoomForm" staticJavascript="false" />
<html:form action="/insertStoreRoom" styleId="insertStoreRoom">
<table width=90% border=0 cellpadding=4 cellspacing=0>
<tr>
<td class="bluetext">
<bean:message key="travelApplication.site" />:
</td>
<td>
<html:select property="site_id">
<html:options collection="x_siteList" property="id" labelProperty="name"/>
</html:select>
</td>
</tr>
<tr>
<td class="bluetext">库房编码:</td>
<td><html:text property="code" /><span class="required">*</span></td>
</tr>
<tr>
<td class="bluetext">库房名称:</td>
<td><html:text property="name" /><span class="required">*</span></td>
</tr>
<tr>
<td class="bluetext">地址:</td>
<td><html:text property="address" styleId="address" /><span class="required">*</span></td>
</tr>
<tr>
<td width="15%" class="bluetext">时间:</td>
<td>
<html:text property="date" readonly="true" size="15" />
<a οnclick="event.cancelBubble=true;" href="javascript:showCalendar('dimg2',false,'date',null,null,'storeRoomForm')">
<img align="absmiddle" border="0" id="dimg2" src="images/datebtn.gif" /> </a>
</td>
</tr>
<tr>
<td class="bluetext">类型:</td>
<td><html:select property="type" >
<c:if test="${sessionScope.LOGIN_USER.locale=='en'}"><html:options collection = "x_STOREROOMTYPELIST" property = "enumCode" labelProperty = "engShortDescription"/>
</c:if>
<c:if test="${sessionScope.LOGIN_USER.locale!='en'}"><html:options collection = "x_STOREROOMTYPELIST" property = "enumCode" labelProperty = "chnShortDescription"/>
</c:if>
</html:select>
<span class="required">*</span></td>
</tr>
<%--<tr>
<td class="bluetext">安全库存:</td>
<td><html:text property="largest_inventory" /><span class="required">*</span></td>
</tr>
--%>
<tr>
<td class="bluetext">最大储存量</td>
<td><html:text property="largest_inventory"/><span class="required">*</span></td>
</tr>
<tr>
<td class="bluetext">状态:</td>
<td><html:select property="status">
<c:if test="${sessionScope.LOGIN_USER.locale=='zh'}">
<html:options collection="X_ENABLEDDISABLEDLIST"
property="enumCode" labelProperty="chnShortDescription" />
</c:if>
<c:if test="${sessionScope.LOGIN_USER.locale!='zh'}">
<html:options collection="X_ENABLEDDISABLEDLIST"
property="enumCode" labelProperty="engShortDescription" />
</c:if>
</html:select></td>
</tr>
<tr>
<td class="bluetext">备注:</td>
<td><html:textarea property="remark" cols="20" rows="3" /></td>
</tr>
</table>
<hr />
<div align="center">
<%--<html:submit><bean:message key="all.save" /></html:submit>
--%><input type="button" value="保存" οnclick="save()"/>
<input type="button" value="关闭" οnclick="window.close();"/>
</div>
</html:form>