新增按钮
$vm.open(‘com.golden.bdp.wms.storage.owneroutEdit’,null,’new’);
修改按钮
var row = mainTable.getRow(); // 获取当前选择的记录
if (!row) {
gUtil.error(‘请选择需要编辑的记录’);
return;
}
var param = {OWNEROUT_BILLCODE:row.OWNEROUT_BILLCODE,
FEE_OPTCODE:row.OWNEROUT_BILLCODE,FEE_BILLTYPE:row.BILLTYPE_CODE,
WORKERS_OPTCODE:row.RECEIVING_BILLCODE};
$vm.open(‘com.golden.bdp.wms.storage.owneroutEdit’,param,’edit’);
删除按钮
var row = mainTable.getRow();
if (!row){
$.alert(‘请选择需要删除的记录’);
return;
}
gUtil.confirm(‘是否确认删除当前选择的记录?’,function(){
var param = {OWNEROUT_BILLCODE:row.OWNEROUT_BILLCODE,BILLTYPE_CODE:row.BILLTYPE_CODE};
gUtil.request(‘com.golden.bdp.wms.storage.owneroutDel’,param,function(result){
mainTable.deleteRow(row);
detailTable.clearData();
gUtil.alert(‘删除成功’);
});
});
创建服务组件
//查询明细
#set($detailList=$vs.dbTools.list(‘select * from storage_ownerout_detail t where t.OWNEROUT_BILLCODE=#{OWNEROUT_BILLCODE}’,$form));
#if(null==$detailList || $detailList.size()<0)
$vs.exception.throwException(‘明细记录已经不存在’);
#end
//需要回写数据
#set($list=$vs.util.newList());
#foreach($row in $detailList)
#if($row.OWNEROUT_DETAIL_STATE>=1)
$vs.exception.throwException('明细记录已经被下级引用不允许删除');
#end
//封装需要回写的
#if($row.OWNEROUT_DETAIL_OPTCODE && $row.OWNEROUT_DETAIL_OPTBATCH && $row.OWNEROUT_DETAIL_BILLTYPE)
#set($backBean=$vs.util.newMap());
#set($backBean.billcode=$row.OWNEROUT_DETAIL_OPTCODE);
#set($backBean.billbatch=$row.OWNEROUT_DETAIL_OPTBATCH);
#set($backBean.prebilltypeCode=$row.OWNEROUT_DETAIL_BILLTYPE);
#set($backBean.dataFlag='3');//删除
$list.add($backBean);
#end
#end
//删除主表
#set($where=$vs.util.newMap());
#set($where.OWNEROUT_BILLCODE=$form.OWNEROUT_BILLCODE);
#set($count=$vs.dbTools.delete(‘storage_ownerout’,$where));
#if ($count eq 0) // 判断条件
$vs.exception.throwException(‘该记录已经不存在’);
#end
//删除明细
#set($count=$vs.dbTools.delete(‘storage_ownerout_detail’,$where));
#if ($count eq 0) // 判断条件
$vs.exception.throwException(‘明细记录已经不存在’);
#end
//调用回写方法
#if(null!=$list && $list.size()>0)
#set($proc=$vs.proc.find('com.golden.bdp.wms.updateBackNum'));
$proc.updateOptBacknum($form.BILLTYPE_CODE, $list);
#end
//删除费用
#set($feewhere=$vs.util.newMap());
#set($feewhere.FEE_OPTCODE=$form.OWNEROUT_BILLCODE);
#set($feewhere.FEE_BILLTYPE=$form.BILLTYPE_CODE);
$vs.dbTools.delete(‘storage_fee’,$feewhere);
//删除工作量
#set($workwhere=$vs.util.newMap());
#set($workwhere.WORKERS_OPTCODE=$form.OWNEROUT_BILLCODE);
#set($workwhere.WORKERS_BILLTYPE=$form.BILLTYPE_CODE);
$vs.dbTools.delete(‘BASIC_WORKERS’,$workwhere);