这里以jac_parts_wms项目中的基础管理——>仓库布局管理——>物料存放区域表(maintainWmsItemStoreAreaPage.xml)中的按库区存放为例。
点击图1中的按库位存放按钮弹出按库位存放页面(editWmsItemStoreAreaPage2.xml):
具体代码如下(editWmsItemStoreAreaPage2.xml):
<?xml version="1.0" encoding="UTF-8"?>
<pages>
<editPage id="editWmsItemStoreAreaPage2" title="editWmsItemStoreAreaPage2" entityClass="com.vtradex.wms.server.model.warehouse.WmsItemStoreArea" width="450" height="200" onClose="refreshParent">
<workflow/>
<initListeners/>
<inputUIs>
<hidden id="itemStoreArea.id" title="itemStoreArea.id" reserve="false"/>
<remote id="itemStoreArea.itemCode.id" title="itemStoreArea.itemCode" row="1" col="1" span="1" readOnly="false" required="true" reserve="false" forceOverride="true" focusUI="false" inVisible="false" multiple="false" manualEditable="true" displayColumn="3" percentSignPosition="both" displayedTableHead="序号,物料代码,物料名称">
<visibleExpression/>
<hql><![CDATA[ SELECT
item.id,
item.code,
item.name
from WmsItem item
WHERE 1=1
AND (item.code like :param OR item.name like :param)]]></hql>
<eventListeners/>
</remote>
<remote id="itemStoreArea.zone.id" title="itemStoreArea.zone" row="1" col="2" span="1" readOnly="false" required="false" reserve="false" forceOverride="true" focusUI="false" inVisible="false" multiple="false" manualEditable="true" displayColumn="3" percentSignPosition="both" displayedTableHead="序号,库区代码,库区名称">
<visibleExpression/>
<hql><![CDATA[SELECT
area.id,
area.code,
area.name
from WmsWarehouseArea area
WHERE 1=1
AND area.warehouse = #{SESSION_WAREHOUSE}
AND area.status = 'ENABLED'
AND (area.code like :param OR area.name like :param)]]></hql>
<eventListeners>
<eventListener id="itemStoreArea.location.id" index="1" refreshUI="true"/>
</eventListeners>
</remote>
<list id="itemStoreArea.location.id" title="itemStoreArea.location" row="2" col="1" span="1" readOnly="false" required="true" reserve="false" forceOverride="true" forceSpace="false" multiple="false" editModel="uneditable" inVisible="false">
<visibleExpression/>
<hql><![CDATA[SELECT
location.id,
location.code
from WmsLocation location
WHERE location.warehouseArea.id = ${itemStoreArea.zone.id}
AND location.warehouse = #{SESSION_WAREHOUSE}
AND location.lockCount = 'N'
AND location.locationStatus = 'EMPTY'
AND location.exceptionFlag = 'N'
ORDER BY location.id ASC
]]></hql>
<eventListeners/>
</list>
</inputUIs>
</editPage>
</pages>
以和瑞系统中的一个页面为例:
<?xml version="1.0" encoding="UTF-8"?>
<pages>
<editPage id="editVisitRecord" title="editVisitRecord" entityClass="com.yz.wms.server.model.opn.VisitRecord" width="660" height="330" onClose="refreshParent">
<workflow/>
<initListeners/>
<inputUIs>
<hidden id="visitrecord.id" reserve="false"/>
<remote id="visitrecord.driverInformation.id" title="visitrecord.driverInformation.id" row="1" col="1" span="1" readOnly="false" required="false" reserve="false" forceOverride="true" focusUI="false" inVisible="false" multiple="false" manualEditable="true" displayColumn="2" percentSignPosition="both" displayedTableHead="序号,姓名,车牌号,联系电话,家庭住址,所属班组">
<visibleExpression/>
<hql><![CDATA[SELECT
driverInformation.id,
driverInformation.name,
driverInformation.vehicleInfo.licensePlate,
driverInformation.phone,
driverInformation.presentAddress,
driverInformation.vehicleInfo.team.className
FROM DriverInformation driverInformation
LEFT JOIN driverInformation.vehicleInfo
LEFT JOIN driverInformation.vehicleInfo.team
WHERE
driverInformation.name LIKE :param OR
driverInformation.vehicleInfo.licensePlate LIKE :param OR
driverInformation.phone LIKE :param OR
driverInformation.vehicleInfo.team.className LIKE :param
]]></hql>
<eventListeners>
<eventListener id="visitrecord.application" index="2" refreshUI="false"/>
<eventListener id="visitrecord.licensePlate" index="3" refreshUI="false"/>
<eventListener id="visitrecord.phone" index="4" refreshUI="false"/>
<eventListener id="visitrecord.address" index="5" refreshUI="false"/>
<eventListener id="visitrecord.className" index="6" refreshUI="false"/>
</eventListeners>
</remote>
<text id="visitrecord.application" title="visitrecord.application" row="2" col="1" span="1" readOnly="true" required="true" editModel="uneditable" reserve="false" forceOverride="true" inVisible="false" trimSpace="true">
<visibleExpression/>
<hql/>
<eventListeners/>
</text>
<text id="visitrecord.licensePlate" title="visitrecord.licensePlate" row="2" col="2" span="1" readOnly="true" required="true" editModel="uneditable" reserve="false" forceOverride="true" inVisible="false" trimSpace="true">
<visibleExpression/>
<hql/>
<eventListeners/>
</text>
<text id="visitrecord.phone" title="visitrecord.phone" row="2" col="3" span="1" readOnly="true" required="true" editModel="uneditable" reserve="false" forceOverride="true" inVisible="false" trimSpace="true">
<visibleExpression/>
<hql/>
<eventListeners/>
</text>
<text id="visitrecord.className" title="visitrecord.className" row="3" col="1" span="1" readOnly="true" editModel="uneditable" required="false" reserve="false" forceOverride="true" inVisible="false" trimSpace="true">
<visibleExpression/>
<hql/>
<eventListeners/>
</text>
<text id="visitrecord.address" title="visitrecord.address" row="3" col="2" span="1" readOnly="true" required="true" editModel="uneditable" reserve="false" forceOverride="true" inVisible="false" trimSpace="true">
<visibleExpression/>
<hql/>
<eventListeners/>
</text>
<date id="visitrecord.visitTime" title="visitrecord.visitTime" pageLocale="false" row="3" col="3" span="1" readOnly="false" required="true" reserve="false" forceOverride="true" focusUI="false" inVisible="false" showTime="true" manualEditable="true" defaultCurrentDate="false">
<visibleExpression/>
<hql/>
<eventListeners/>
</date>
<list id="visitrecord.visitSubject" title="visitrecord.visitSubject" row="4" col="1" span="1" width="120"
readOnly="false" required="true" reserve="false" forceOverride="false"
forceSpace="false" multiple="false" inVisible="false">
<visibleExpression/>
<hql><![CDATA[SELECT e.enumValue, e.enumValue
FROM EnumType e
where e.enumType='走访主题']]></hql>
<eventListeners/>
</list>
<list id="visitrecord.psStandard" title="visitrecord.psStandard" row="4" col="2" span="1" width="120"
readOnly="false" required="true" reserve="false" forceOverride="false"
forceSpace="false" multiple="false" inVisible="false">
<visibleExpression/>
<hql><![CDATA[SELECT e.enumValue, e.enumValue
FROM EnumType e
where e.enumType='慰问品购置标准']]></hql>
<eventListeners/>
</list>
<text id="visitrecord.reason" title="visitrecord.reason" row="4" col="3" span="1" readOnly="false" required="true" reserve="false" forceOverride="true" inVisible="false" trimSpace="true">
<visibleExpression/>
<hql/>
<eventListeners/>
</text>
<text id="visitrecord.deskClerk" title="visitrecord.deskClerk" row="5" col="1" span="1" readOnly="false" required="false" reserve="false" forceOverride="true" inVisible="false" trimSpace="true">
<visibleExpression/>
<hql/>
<eventListeners/>
</text>
<text id="visitrecord.contentRecord" title="visitrecord.contentRecord" row="5" col="2" span="1" readOnly="false" required="false" reserve="false" forceOverride="true" inVisible="false" trimSpace="true">
<visibleExpression/>
<hql/>
<eventListeners/>
</text>
<text id="visitrecord.achievement" title="visitrecord.achievement" row="5" col="3" span="1" readOnly="false" required="false" reserve="false" forceOverride="true" inVisible="false" trimSpace="true">
<visibleExpression/>
<hql/>
<eventListeners/>
</text>
<text id="visitrecord.people" title="visitrecord.people" row="6" col="1" span="1" readOnly="false" required="false" reserve="false" forceOverride="true" inVisible="false" trimSpace="true">
<visibleExpression/>
<hql/>
<eventListeners/>
</text>
<textArea id="visitrecord.description" title="visitrecord.description" row="7" col="1" span="1" readOnly="false" required="false" reserve="false" forceOverride="true" focusUI="false" inVisible="false">
<visibleExpression/>
<hql/>
<eventListeners/>
</textArea>
</inputUIs>
</editPage>
</pages>
<?xml version="1.0" encoding="UTF-8"?>
<pages>
<editPage id="xx" title="xx" entityClass="com.server.model.xx" width="400" height="230" onClose="refreshParent">
<workflow/>
<initListeners/>
<inputUIs>
<hidden id="xx.id" title="xx.id" reserve="false"/>
<list id="xx.type" title="xx.type" row="1" col="2" span="1" width="118" readOnly="false" required="true" reserve="false" forceOverride="true" forceSpace="false" multiple="false" inVisible="false" enumType="WmsLocationType">
<visibleExpression/>
<hql><![CDATA[SELECT
enumerate.enumValue,
enumerate.enumValue From Enumerate enumerate
where enumerate.enumType = 'WmsLocationType' AND enumerate.enumValue NOT IN ('SPLIT')
order by enumerate.id]]></hql>
<eventListeners>
<eventListener id="xx.yy.id" refreshUI="true"/>
</eventListeners>
</list>
<remote id="xx.yy.id" title="xx.yy.id" row="2" col="2" span="1" readOnly="false" required="true" reserve="false" forceOverride="false" focusUI="false" inVisible="true" multiple="false" manualEditable="true" displayColumn="2" enumColumnType="WmsLocationType" percentSignPosition="both" displayedTableHead="ID,CODE,TYPE">
<visibleExpression><![CDATA[function x(){
if(${xx.type}=='SHIP'){
return true;
}else{
return false;
}
};x();]]></visibleExpression>
<hql><![CDATA[SELECT loc.id, loc.code, loc.type FROM WmsLocation loc
WHERE loc.code like :param
AND loc.warehouse = #{SESSION_WAREHOUSE}
AND loc.type = 'STORAGE'
ORDER BY loc.code]]></hql>
<eventListeners/>
</remote>
<separator id="s1" title="s1" row="3"/>
......
</inputUIs>
</editPage>
</pages>
<checkbox id="checkbox.yy" title="xx" row="1" col="2" span="1" readOnly="false" required="false" reserve="false" forceOverride="true" focusUI="true" inVisible="false">
<visibleExpression/>
<hql/>
<eventListeners>
<eventListener id="yy" index="1" refreshUI="true"/>
</eventListeners>
</checkbox>
<textArea id="textArea.xx" title="xx" pageLocale="false" row="2" col="1" span="2" readOnly="false" required="true" reserve="false" forceOverride="true" focusUI="false" inVisible="false" rows="3" cols="38">
<visibleExpression><![CDATA[${checkbox.yy}=='false' ]]></visibleExpression>
<hql/>
<eventListeners/>
</textArea>
<text id="yy" title="xx" row="9" col="1" span="1" readOnly="false" required="false" reserve="false" forceOverride="true" focusUI="false" inVisible="true" trimSpace="true">
<visibleExpression/>
<hql/>
<eventListeners/>
</text>
1-界面列配置
<column id="receivedQty" title="receivedQty" visible="true" horizonAlign="center" verticalAlign="middle"
color="red" inputUI="text" inputUIValidator="numberRequired" />
2-界面按钮配置
<tableCommit id="store" title="store" process="legProcess.store" enableType="multi" multiMapping="false" download="false" closeTransactional="false">
<enableExpression/>
<mappings>
</mappings>
<actions>
<action managerName="lfcsManager" methodName="modifyCarName" parameter="obj,tableValues"/>
</actions>
<forwards>
<forward name="refreshParent" newEnabled="true" editEnabled="true"/>
</forwards>
</tableCommit>
3-实现方法
/**接口定义加事务*/
@Transactional
void modifyCarName(BmsFeeData bf,List<String> values);
/**具体实现类*/
public void modifyCarName(BmsFeeData bf,List<String> values){
HibernateTransactionManager transactionManager = (HibernateTransactionManager)applicationContext.getBean("transactionManager");
Session session = transactionManager.getSessionFactory().getCurrentSession();
String sql ="update jac_scl_bms.bms_fee_data fd set fd.refer14 = ? where fd.id = ?";
if("null".equals(values.get(0))){
String hql = "SELECT od.product.class1 FROM OrderDetail od WHERE od.serialNo = :serialNo";
List<String> classes = commonDao.findByQuery(hql,
new String[]{"serialNo"}, new Object[]{bf.getVIN()});
for(String s : classes){
if(s==null){
continue;
}
SQLQuery squery = session.createSQLQuery(sql);
squery.setString(0, s);
squery.setLong(1, bf.getId());
squery.executeUpdate();
}
}else{
SQLQuery squery = session.createSQLQuery(sql);
squery.setString(0, values.get(0));
squery.setLong(1, bf.getId());
squery.executeUpdate();
}
}
图中的值“6”是maintain页面中查询字段的序号,如下图: