法人客户新增时编号修改

This commit is contained in:
tangfutang 2018-09-04 21:00:10 +08:00
parent 6a8933bbc7
commit 2bad51cefa
2 changed files with 29 additions and 16 deletions

View File

@ -60,18 +60,20 @@ include file="/Frame/resources/include/ui/include_info.jspf"%>
if(!iV_all("0")) return;
if(!checkCertInfo(true)) return ;//检查证件格式
var custNum = getItemValue(0,getRow(),"CUSTOMER_NUM");
if(custNum==null||custNum==""){
/* if(custNum==null||custNum==""){
setErrorTips("CUSTOMER_NUM","请先客商编码!");
return;
}
} */
var certType=getItemValue(0,getRow(),"certtype");
var certId=getItemValue(0,getRow(),"certid");
var nationCode=getItemValue(0,getRow(),"nationcode");
var customerName=getItemValue(0,getRow(),"customername");
var status=getItemValue(0,getRow(),"status");
var sParams = "customernum="+custNum+",certType="+certType+",certId="+certId+",nationCode="+nationCode+",status="+status+",customerType=<%=customerType%>,customerName="+customerName+",userId=<%=CurUser.getUserID()%>,orgId=<%=CurUser.getOrgID()%>";
var sParams = "certType="+certType+",certId="+certId+",nationCode="+nationCode+",status="+status+",customerType=<%=customerType%>,customerName="+customerName+",userId=<%=CurUser.getUserID()%>,orgId=<%=CurUser.getOrgID()%>";
var message=RunJavaMethodTrans("com.tenwa.customer.controller.company.NewCustomerCompanyController","checkCustomerNum",sParams);
if(message!="SUCCESS"){
if(message.indexOf("@")>0){
sParams=sParams+",customernum="+message.split("@")[1];
}else if(message!="SUCCESS"){
alert(message);
return;
}

View File

@ -160,17 +160,10 @@ public class NewCustomerCompanyController{
return "FAIl@客户证件号码\""+certId+"\""+certfrom+"中已注册,不能重复注册!";
}else{
//获取编码规则
String serinum=FlowUtil.getCustomer_Id(tx);
String serin="";
if(serinum.length()<15){
for(int i=0;i<15-serinum.length();i++){
serin+="0";
}
}
//新增客户
BizObject newCustomer = custManager.newObject();
newCustomer.setAttributeValue("customerid", "APZLC"+serin+serinum);
// newCustomer.setAttributeValue("customerid", "APZLC"+serin+serinum);
newCustomer.setAttributeValue("nationcode", nationCode);
newCustomer.setAttributeValue("customername", customerName);
newCustomer.setAttributeValue("certtype", certType);
@ -178,7 +171,19 @@ public class NewCustomerCompanyController{
newCustomer.setAttributeValue("customertype", customerType);
newCustomer.setAttributeValue("inputuserid", userId);
newCustomer.setAttributeValue("inputorgid", orgId);
newCustomer.setAttributeValue("customer_num", customernum);
if(customernum!="" && customernum!=null && customernum.length()>0){
newCustomer.setAttributeValue("customer_num", customernum);
}else{
//获取编码规则
String serinum=FlowUtil.getCustomer_Id(tx);
String serin="";
if(serinum.length()<15){
for(int i=0;i<15-serinum.length();i++){
serin+="0";
}
}
newCustomer.setAttributeValue("customer_num", "APZLC"+serin+serinum);
}
newCustomer.setAttributeValue("inputtime", DateAssistant.getTodayNow());
custManager.saveObject(newCustomer);
if(!((certType==null||"".equals(certType))||((certId==null||"".equals(certId))))){
@ -238,9 +243,15 @@ public class NewCustomerCompanyController{
}
public String checkCustomerNum(JBOTransaction tx)throws Exception {
BizObjectManager custManager =JBOFactory.getFactory().getManager("jbo.app.tenwa.customer.CUSTOMER_INFO");
BizObject cus = custManager.createQuery("customer_num=:customenum").setParameter("customenum", customernum).getSingleResult(false);
BizObjectManager cltManager =JBOFactory.getFactory().getManager("jbo.app.tenwa.customer.CUSTOMER_LIST");
BizObject cus = custManager.createQuery("customername=:customername").setParameter("customername", customerName).getSingleResult(false);
if(cus!=null){
return "客商编码已存在,请重新选择或填写!!!";
return "客户名称已存在,请重新选择或填写!!!";
}else{
BizObject cl = cltManager.createQuery("cust_name=:custname").setParameter("custname", customerName).getSingleResult(false);
if(cl!=null){
return "customernum@"+cl.getAttribute("cust_id").getString();
}
}
return "SUCCESS";
}