更新经销商导入

This commit is contained in:
liuzhao 2018-11-22 20:54:13 +08:00
parent b3a4dba5a6
commit b17a60646c
11 changed files with 336 additions and 23 deletions

View File

@ -8,7 +8,7 @@
String sPrevUrl = CurPage.getParameter("PrevUrl");
if(sPrevUrl == null) sPrevUrl = "";
String distributor_id = CurPage.getParameter("distributor_id");
String sTempletNo = "DistributorAccountFirstTrialInfo";//--Ä£°åºÅ--
String sTempletNo = "DistributorAccountImportInfo";//--模板号--
ASObjectModel doTemp = new ASObjectModel(sTempletNo);
//doTemp.setColTips("", "²âÊÔ");
ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request);
@ -28,5 +28,49 @@
var distributor_id = "<%=distributor_id%>";
AsControl.OpenView("/Tenwa/Lease/DistributorManage/DistributorApproval/DistributorAccountFirstTrialList.jsp", "distributor_no="+distributor_id,"_self","");
}
var province="";
// 选择省份
function selectProvinceCode(){
AsDialog.OpenSelector("selectProvinceCode","","dialogWidth=" + parseInt(window.screen.width * 0.4) + "px dialogHeight=" + parseInt(window.screen.height * 0.5) + "px",
function(sReturn){
if(!sReturn||sReturn=="_CANCEL_"||sReturn=="")
{
//alert(getHtmlMessage('1'));//请选择一条信息!
return;
}
sReturn = sReturn.split("@");
// alert(sReturn[1]);
setItemValue(0,0,"provinceInfo",sReturn[1]);
setItemValue(0,0,"district","");
province=sReturn[0];
setCertType();
},"请选择省份",'');
}
// 选择市区
function selectCityCode(){
//alert("参数:"+province);
if(province=="" || province==null){
alert("请先选择省份。");
return;
}else{
AsDialog.OpenSelector("selectCityCode","province,"+province,"dialogWidth=" + parseInt(window.screen.width * 0.4) + "px dialogHeight=" + parseInt(window.screen.height * 0.5) + "px",
function(sReturn){
if(!sReturn||sReturn=="_CANCEL_"||sReturn=="")
{
//alert(getHtmlMessage('1'));//请选择一条信息!
return;
}
sReturn = sReturn.split("@");
// alert(sReturn[1]);
setItemValue(0,0,"district",sReturn[1]);
},"请选择地区",'');
}
}
</script>
<%@ include file="/Frame/resources/include/include_end.jspf"%>

View File

@ -17,7 +17,7 @@
String sButtons[][] = {
//{"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""},
{"true","All","Button","返回","返回列表","returnList()","","","","btn_icon_return"},
{"true","","Button","ÏêÇé","ÏêÇé","viewAndEdit()","","","","btn_icon_detail",""},
{"true","","Button","ÐÞ¸Ä","ÐÞ¸Ä","viewAndEdit()","","","","btn_icon_detail",""},
{"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0,'alert(getRowCount(0))')","","","","btn_icon_delete",""},
};
%><%@include file="/Frame/resources/include/ui/include_list.jspf"%>

View File

@ -18,7 +18,7 @@
{"true","","Button","修改","修改","viewAndEdit()","","","","btn_icon_detail",""},
{"true","","Button","导入Excel","导入Excel","importExcel()","","","","btn_icon_import"},
{"true","","Button","模版下载","模版下载","DistributorDownload()","","","","btn_icon_down",""},
{"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0,'alert(getRowCount(0))')","","","","btn_icon_delete",""},
//{"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0,'alert(getRowCount(0))')","","","","btn_icon_delete",""},
};
%><%@include file="/Frame/resources/include/ui/include_list.jspf"%>
<iframe name="MyAtt" src="<%=com.amarsoft.awe.util.Escape.getBlankJsp(sWebRootPath,"正在下载附件,请稍候...")%>" style="background-color: blue" width=100% height=100% frameborder=0 hspace=0 vspace=0 marginwidth=0 marginheight=0 scrolling="no">

View File

@ -8,7 +8,7 @@
String sPrevUrl = CurPage.getParameter("PrevUrl");
if(sPrevUrl == null) sPrevUrl = "";
String sTempletNo = "DistributorInfoIBatchmportInfo";//--Ä£°åºÅ--
String sTempletNo = "DistributorInfoImportInfoNew";//--模板号--
ASObjectModel doTemp = new ASObjectModel(sTempletNo);
//doTemp.setColTips("", "²âÊÔ");
ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request);
@ -27,5 +27,95 @@
function returnList(){
AsControl.OpenView("/Tenwa/Lease/DistributorManage/DistributorApproval/DistributorInfoImportfirstTrial.jsp", "","_self","");
}
//请选择经销商名称
function selectcompany(){
AsDialog.OpenSelector("SelectCompany","","dialogWidth=" + parseInt(window.screen.width * 0.4) + "px dialogHeight=" + parseInt(window.screen.height * 0.6) + "px",function(sReturn){
if(!sReturn||sReturn=="_CANCEL_"){
alert(getHtmlMessage('1'));//请选择一条信息!
return;
}
sReturn = sReturn.split("@");//"@"表示了向页面添加数据时的连续性
setItemValue(0,getRow(),"SUBSIDIARY_COMPANY",sReturn[0]);//向页面的框中添加数据
},"请选择经销商");
}
var province="";//定义一个全局变量
// 选择省份
function selectProvinceCode(){
AsDialog.OpenSelector("selectProvinceCode","","dialogWidth=" + parseInt(window.screen.width * 0.4) + "px dialogHeight=" + parseInt(window.screen.height * 0.5) + "px",
function(sReturn){
if(!sReturn||sReturn=="_CANCEL_"||sReturn==""){
//alert(getHtmlMessage('1'));//请选择一条信息!
return;
}
sReturn = sReturn.split("@");
// alert(sReturn[1]);
setItemValue(0,0,"provinces",sReturn[1]);
province=sReturn[0];
setItemValue(0,0,"DISTRIBUTOR_ADDRESSNAME","");
setItemValue(0,0,"DISTRIBUTOR_ADDRESS","");
setCertType();
},"请选择省份",'');
}
// 选择市区
function selectCityCode(){
//alert("参数:"+province);
if(province=="" || province==null){
alert("请先选择省份。");
return;
}else{
AsDialog.OpenSelector("selectCityCode","province,"+province,"dialogWidth=" + parseInt(window.screen.width * 0.4) + "px dialogHeight=" + parseInt(window.screen.height * 0.5) + "px",
function(sReturn){
if(!sReturn||sReturn=="_CANCEL_"||sReturn==""){
//alert(getHtmlMessage('1'));//请选择一条信息!
return;
}
sReturn = sReturn.split("@");
setItemValue(0,0,"DISTRIBUTOR_ADDRESS",sReturn[0]);//地区区号
setItemValue(0,0,"DISTRIBUTOR_ADDRESSNAME",sReturn[1]);//地区
},"请选择地区",'');
}
}
//组织机构验证码的的校验
function Checkfield(){
var businessLicenseNo = getItemValue(0,getRow(0),"BUSINESS_LICENSE_NO");
if(businessLicenseNo==""){
//alert("组织机构代码不能为空!");
return true;
}
if(checkORGRight(businessLicenseNo)){
return true;
}else{
setErrorTips("BUSINESS_LICENSE_NO","组织机构代码格式不正确!");
//AsDebug.alert("提示","组织机构代码格式不正确!");
return false;
}
}
//校验经销商编号是否唯一
function Uniquenesscheck(){
var DISTRIBUTOR_CODING = getItemValue(0,0,'DISTRIBUTOR_CODING');
var sReturnInfo = RunJavaMethodTrans("com.tenwa.customer.controller.group.CustomerGroupCompanyController","distributor_basic","DISTRIBUTOR_CODING="+DISTRIBUTOR_CODING);
if("false" ==sReturnInfo){
AsDebug.alert("提示","经销商编码已存在,请重新输入!!!");
return false;
}else{
return true;
}
}
function checktel(){
var LINKMAN_TEL = getItemValue(0,getRow(0),"LINKMAN_TEL");
if(LINKMAN_TEL==""){
return true;
}
var phone = /^[1][3,4,5,7,8][0-9]{9}$/;
if(phone.test(LINKMAN_TEL)){
setErrorTips("LINKMAN_TEL","");
return true;
}else{
setErrorTips("LINKMAN_TEL","手机号格式不正确!");
//alert("手机号格式不正确!");
return false;
}
}
</script>
<%@ include file="/Frame/resources/include/include_end.jspf"%>

View File

@ -18,7 +18,7 @@
{"true","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""},
{"true","","Button","导入Excel","导入Excel","importExcel()","","","","btn_icon_import"},
{"true","","Button","模版下载","模版下载","DistributorDownload()","","","","btn_icon_down",""},
{"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0,'alert(getRowCount(0))')","","","","btn_icon_delete",""},
//{"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0,'alert(getRowCount(0))')","","","","btn_icon_delete",""},
};
%><%@include file="/Frame/resources/include/ui/include_list.jspf"%>
<iframe name="MyAtt" src="<%=com.amarsoft.awe.util.Escape.getBlankJsp(sWebRootPath,"正在下载附件,请稍候...")%>" style="background-color: blue" width=100% height=100% frameborder=0 hspace=0 vspace=0 marginwidth=0 marginheight=0 scrolling="no">

View File

@ -8,7 +8,7 @@
String sPrevUrl = CurPage.getParameter("PrevUrl");
if(sPrevUrl == null) sPrevUrl = "";
String sTempletNo = "DistributorInfoIBatchmportInfo";//--模板号--
String sTempletNo = "DistributorInfoImportInfoNew";//--模板号--
ASObjectModel doTemp = new ASObjectModel(sTempletNo);
//doTemp.setColTips("", "²âÊÔ");
ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request);
@ -17,8 +17,8 @@
dwTemp.genHTMLObjectWindow(CurPage.getParameter("ID"));
String sButtons[][] = {
{"true","All","Button","保存","保存所有修改","as_save(0)","","","",""},
//{"true","All","Button","返回","返回列表","returnList()","","","","btn_icon_return"}
//{"true","All","Button","保存","保存所有修改","as_save(0)","","","",""},
{"true","All","Button","返回","返回列表","returnList()","","","","btn_icon_return"}
//{String.valueOf(!com.amarsoft.are.lang.StringX.isSpace(sPrevUrl)),"All","Button","·µ»Ø","·µ»ØÁбí","returnList()","","","",""}
};
sButtonPosition = "north";
@ -27,5 +27,95 @@
function returnList(){
AsControl.OpenView("/Tenwa/Lease/DistributorManage/DistributorApproval/DistributorInfoImportRecheck.jsp", "","_self","");
}
//请选择经销商名称
function selectcompany(){
AsDialog.OpenSelector("SelectCompany","","dialogWidth=" + parseInt(window.screen.width * 0.4) + "px dialogHeight=" + parseInt(window.screen.height * 0.6) + "px",function(sReturn){
if(!sReturn||sReturn=="_CANCEL_"){
alert(getHtmlMessage('1'));//请选择一条信息!
return;
}
sReturn = sReturn.split("@");//"@"表示了向页面添加数据时的连续性
setItemValue(0,getRow(),"SUBSIDIARY_COMPANY",sReturn[0]);//向页面的框中添加数据
},"请选择经销商");
}
var province="";//定义一个全局变量
// 选择省份
function selectProvinceCode(){
AsDialog.OpenSelector("selectProvinceCode","","dialogWidth=" + parseInt(window.screen.width * 0.4) + "px dialogHeight=" + parseInt(window.screen.height * 0.5) + "px",
function(sReturn){
if(!sReturn||sReturn=="_CANCEL_"||sReturn==""){
//alert(getHtmlMessage('1'));//请选择一条信息!
return;
}
sReturn = sReturn.split("@");
// alert(sReturn[1]);
setItemValue(0,0,"provinces",sReturn[1]);
province=sReturn[0];
setItemValue(0,0,"DISTRIBUTOR_ADDRESSNAME","");
setItemValue(0,0,"DISTRIBUTOR_ADDRESS","");
setCertType();
},"请选择省份",'');
}
// 选择市区
function selectCityCode(){
//alert("参数:"+province);
if(province=="" || province==null){
alert("请先选择省份。");
return;
}else{
AsDialog.OpenSelector("selectCityCode","province,"+province,"dialogWidth=" + parseInt(window.screen.width * 0.4) + "px dialogHeight=" + parseInt(window.screen.height * 0.5) + "px",
function(sReturn){
if(!sReturn||sReturn=="_CANCEL_"||sReturn==""){
//alert(getHtmlMessage('1'));//请选择一条信息!
return;
}
sReturn = sReturn.split("@");
setItemValue(0,0,"DISTRIBUTOR_ADDRESS",sReturn[0]);//地区区号
setItemValue(0,0,"DISTRIBUTOR_ADDRESSNAME",sReturn[1]);//地区
},"请选择地区",'');
}
}
//组织机构验证码的的校验
function Checkfield(){
var businessLicenseNo = getItemValue(0,getRow(0),"BUSINESS_LICENSE_NO");
if(businessLicenseNo==""){
//alert("组织机构代码不能为空!");
return true;
}
if(checkORGRight(businessLicenseNo)){
return true;
}else{
setErrorTips("BUSINESS_LICENSE_NO","组织机构代码格式不正确!");
//AsDebug.alert("提示","组织机构代码格式不正确!");
return false;
}
}
//校验经销商编号是否唯一
function Uniquenesscheck(){
var DISTRIBUTOR_CODING = getItemValue(0,0,'DISTRIBUTOR_CODING');
var sReturnInfo = RunJavaMethodTrans("com.tenwa.customer.controller.group.CustomerGroupCompanyController","distributor_basic","DISTRIBUTOR_CODING="+DISTRIBUTOR_CODING);
if("false" ==sReturnInfo){
AsDebug.alert("提示","经销商编码已存在,请重新输入!!!");
return false;
}else{
return true;
}
}
function checktel(){
var LINKMAN_TEL = getItemValue(0,getRow(0),"LINKMAN_TEL");
if(LINKMAN_TEL==""){
return true;
}
var phone = /^[1][3,4,5,7,8][0-9]{9}$/;
if(phone.test(LINKMAN_TEL)){
setErrorTips("LINKMAN_TEL","");
return true;
}else{
setErrorTips("LINKMAN_TEL","手机号格式不正确!");
//alert("手机号格式不正确!");
return false;
}
}
</script>
<%@ include file="/Frame/resources/include/include_end.jspf"%>

View File

@ -19,7 +19,8 @@
{"true","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""},
{"true","","Button","经销商账户","经销商账户","distributorAccount()","","","","",""},
{"true","","Button","提交申请","提交申请","submitFirstTrial()","","","","",""},
{"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0,'alert(getRowCount(0))')","","","","btn_icon_delete",""},
{"true","","Button","删除","删除","dodelete()","","","","",""},
//{"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0,'alert(getRowCount(0))')","","","","btn_icon_delete",""},
};
%><%@include file="/Frame/resources/include/ui/include_list.jspf"%>
<script type="text/javascript">
@ -69,5 +70,27 @@
}
AsControl.OpenView(sUrl,'ID=' +sPara ,'_self','');
}
function dodelete(){
if(confirm('确定要删除吗?')){
var sParm = getItemValueArray(0,"DISTRIBUTOR_NO");
//alert(sParm);
if(typeof(sParm) == "undefined" || sParm.length == 0 )
{
alert("请选择删除的数据!");
return;
}
var distributorNo = "";
for(var i = 0;i < sParm.length; i++){
distributorNo += sParm[i] +"@";
}
distributorNo = distributorNo.substr(0,distributorNo.length-1);
//alert(ids);
spara = "distributorNo="+distributorNo+",CurUserID=<%=CurUser.getUserID()%>";
var returnValue = AsControl.RunJavaMethodTrans("com.tenwa.apzl.distributor.DistributorImportManager","dodelete",spara);
alert(returnValue);
reloadSelf();
}
}
</script>
<%@ include file="/Frame/resources/include/include_end.jspf"%>

View File

@ -4,10 +4,14 @@ import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Map;
import jbo.app.tenwa.customer.DISTRIBUTOR_INFO;
import com.amarsoft.are.jbo.BizObject;
import com.amarsoft.are.jbo.JBOFactory;
import com.amarsoft.are.jbo.JBOTransaction;
import com.amarsoft.awe.util.Transaction;
import com.amarsoft.context.ASUser;
import com.tenwa.comm.exception.BusinessException;
import com.tenwa.flow.util.FlowUtil;
public class DistributorImportCallback extends BaseImportExcelCallBack{
@ -15,20 +19,32 @@ public class DistributorImportCallback extends BaseImportExcelCallBack{
public void run(ASUser CurUser, BizObject importObject,
Map<String, String> model, Integer rowIndex, JBOTransaction tx,
Transaction Sqlca) throws Exception {
//获取经销商编号
String distributorNo=FlowUtil.getDistributorSerialNumber(tx);
SimpleDateFormat df = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");//设置日期格式
String userId = CurUser.getUserID().toString();
String orgId = CurUser.getOrgID().toString();
importObject.setAttributeValue("distributor_no", distributorNo).toString();
//导入状态:初审(firstTrial)
importObject.setAttributeValue("import_status", "firstTrial").toString();
//登记时间
importObject.setAttributeValue("INPUTTIME",df.format(new Date()));
//登记人
importObject.setAttributeValue("inputuserid",userId);
//登记部门
importObject.setAttributeValue("inputorgid",orgId);
//判断该经销商是否已经存在
String distributor_coding = importObject.getAttribute("distributor_coding").toString();
BizObject distributorInfo = JBOFactory.createBizObjectQuery(DISTRIBUTOR_INFO.CLASS_NAME, "distributor_coding=:distributor_coding")
.setParameter("distributor_coding", distributor_coding).getSingleResult(false);
if(distributorInfo==null){
//获取经销商编号
String distributorNo=FlowUtil.getDistributorSerialNumber(tx);
SimpleDateFormat df = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");//设置日期格式
String userId = CurUser.getUserID().toString();
String orgId = CurUser.getOrgID().toString();
importObject.setAttributeValue("distributor_no", distributorNo).toString();
//导入状态:初审(firstTrial)
importObject.setAttributeValue("import_status", "firstTrial").toString();
//登记时间
importObject.setAttributeValue("INPUTTIME",df.format(new Date()));
//登记人
importObject.setAttributeValue("inputuserid",userId);
//登记部门
importObject.setAttributeValue("inputorgid",orgId);
}else{
throw new BusinessException("该经销商编码"+distributor_coding+"已经存在!");
}
}
}

View File

@ -1,5 +1,6 @@
package com.tenwa.apzl.distributor;
import jbo.app.tenwa.customer.DISTRIBUTOR_ACCOUNT;
import jbo.app.tenwa.customer.DISTRIBUTOR_INFO;
import com.amarsoft.are.jbo.BizObject;
@ -10,6 +11,7 @@ import com.amarsoft.are.jbo.JBOTransaction;
public class DistributorImportManager {
private String Ids;
private String distributorNo;
public String getIds() {
return Ids;
@ -18,6 +20,15 @@ public class DistributorImportManager {
public void setIds(String ids) {
Ids = ids;
}
public String getDistributorNo() {
return distributorNo;
}
public void setDistributorNo(String distributorNo) {
this.distributorNo = distributorNo;
}
/**
* Ìá½»¾­ÏúÉ̳õÉó
* @param tx
@ -126,4 +137,43 @@ public class DistributorImportManager {
}
}
/**
* 关联删除
* 经销商信息表和经销商账户表
* @param tx
* @return
*/
public String dodelete(JBOTransaction tx){
String[] distributorNo = this.getDistributorNo().split("@");
BizObjectManager distributorInfoManager=null;
BizObjectManager distributorAccountManager=null;
String returnMsg="";
try {
distributorAccountManager = JBOFactory.getBizObjectManager(DISTRIBUTOR_ACCOUNT.CLASS_NAME, tx);
distributorInfoManager = JBOFactory.getBizObjectManager(DISTRIBUTOR_INFO.CLASS_NAME, tx);
for (int i = 0; i < distributorNo.length; i++) {
//删除从表经销商账户表
String distributor_No = distributorNo[i];
distributorAccountManager.createQuery("delete from O where distributor_id=:distributor_no")
.setParameter("distributor_no", distributor_No).executeUpdate();
//删除经销商表
distributorInfoManager.createQuery("delete from O where distributor_no=:distributor_no")
.setParameter("distributor_no", distributor_No).executeUpdate();
}
returnMsg = "删除成功";
return returnMsg;
} catch (JBOException e1) {
e1.printStackTrace();
return "删除失败!";
}finally{
if(tx !=null){
try {
tx.commit();
} catch (JBOException e) {
e.printStackTrace();
}
}
}
}
}