一个经销商只能有一个主账户
This commit is contained in:
parent
afc7efb67d
commit
a391f0ef3a
@ -17,13 +17,26 @@
|
||||
dwTemp.genHTMLObjectWindow(CurPage.getParameter("SerialNo"));
|
||||
|
||||
String sButtons[][] = {
|
||||
{"true","All","Button","保存","保存所有修改","as_save(0)","","","",""},
|
||||
{"true","All","Button","保存","保存所有修改","save()","","","",""},
|
||||
{"true","All","Button","·µ»Ø","·µ»ØÁбí","returnList()","","","","btn_icon_return"}
|
||||
//{String.valueOf(!com.amarsoft.are.lang.StringX.isSpace(sPrevUrl)),"All","Button","·µ»Ø","·µ»ØÁбí","returnList()","","","",""}
|
||||
};
|
||||
sButtonPosition = "north";
|
||||
%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%>
|
||||
<script type="text/javascript">
|
||||
function save(){
|
||||
var distributorNo = getItemValue(0,0,"DISTRIBUTOR_ID");
|
||||
var accountId = getItemValue(0,0,"ID");
|
||||
var isMain = getItemValue(0,0,"IS_MAIN");
|
||||
var sParams ="distributorNo="+distributorNo+",accountId="+accountId+",isMain="+isMain;
|
||||
var sReturnInfo = RunJavaMethodTrans("com.tenwa.apzl.comm.PartdeptDistribute","isMainAccount",sParams);
|
||||
if(sReturnInfo==""){
|
||||
as_save(0);
|
||||
}else{
|
||||
alert(sReturnInfo);
|
||||
}
|
||||
|
||||
}
|
||||
function returnList(){
|
||||
AsControl.OpenView("/Tenwa/Lease/DistributorManage/DistributorApproval/DistributorAccountImport.jsp", "","_self","");
|
||||
}
|
||||
|
||||
@ -18,7 +18,25 @@ public class PartdeptDistribute {
|
||||
private String contract_number;
|
||||
private String ids;
|
||||
private String distributorNo;
|
||||
private String accountId;
|
||||
private String isMain;
|
||||
|
||||
public String getIsMain() {
|
||||
return isMain;
|
||||
}
|
||||
|
||||
public void setIsMain(String isMain) {
|
||||
this.isMain = isMain;
|
||||
}
|
||||
|
||||
public String getAccountId() {
|
||||
return accountId;
|
||||
}
|
||||
|
||||
public void setAccountId(String accountId) {
|
||||
this.accountId = accountId;
|
||||
}
|
||||
|
||||
public String getDistributorNo() {
|
||||
return distributorNo;
|
||||
}
|
||||
@ -108,22 +126,32 @@ public class PartdeptDistribute {
|
||||
/**
|
||||
* 判断经销商账户主账户,只能存在一个主账户
|
||||
*/
|
||||
public String isMainAccount(){
|
||||
public String isMainAccount(JBOTransaction tx){
|
||||
String msg = "";
|
||||
try {
|
||||
List<String> list = new ArrayList<String>();
|
||||
String isMain = "";
|
||||
@SuppressWarnings("unchecked")
|
||||
List<BizObject> resultList = JBOFactory.createBizObjectQuery(DISTRIBUTOR_ACCOUNT.CLASS_NAME, "distributor_id=:distributor_id")
|
||||
.setParameter("distributor_id", this.distributorNo).getResultList(false);
|
||||
for (BizObject bo : resultList) {
|
||||
isMain=bo.getAttribute("is_main")==null?"":bo.getAttribute("is_main").toString();
|
||||
list.add(isMain);
|
||||
}
|
||||
if(list.contains("Y")==true){
|
||||
msg = "一个经销商只能有一个主账户";
|
||||
return msg;
|
||||
if("Y".equals(isMain)){
|
||||
|
||||
|
||||
List<String> list = new ArrayList<String>();
|
||||
String main = "";
|
||||
@SuppressWarnings("unchecked")
|
||||
List<BizObject> resultList = JBOFactory.createBizObjectQuery(DISTRIBUTOR_ACCOUNT.CLASS_NAME, "distributor_id=:distributor_id")
|
||||
.setParameter("distributor_id", this.distributorNo).getResultList(false);
|
||||
for (BizObject bo : resultList) {
|
||||
main=bo.getAttribute("is_main")==null?"":bo.getAttribute("is_main").toString();
|
||||
String accid = bo.getAttribute("ID").toString();
|
||||
//如果此账户是主账户则不参与判断
|
||||
if(!(accid.equals(accountId) && main.equals("Y"))){
|
||||
|
||||
list.add(main);
|
||||
}
|
||||
|
||||
}
|
||||
if(list.contains("Y")==true){
|
||||
msg = "一个经销商只能有一个主账户";
|
||||
}
|
||||
}
|
||||
return msg;
|
||||
} catch (JBOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user