经销商区域维护

This commit is contained in:
amarsoft 2018-06-18 22:02:48 +08:00
parent b7da16a3ef
commit 6bce0a823a
9 changed files with 273 additions and 2 deletions

View File

@ -0,0 +1,31 @@
<%@ page contentType="text/html; charset=GBK"%>
<%@ include file="/Frame/resources/include/include_begin_info.jspf"%><%
String sTempletNo = "DistrictInfoRegister";//--模板号--
ASObjectModel doTemp = new ASObjectModel(sTempletNo);
ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request);
dwTemp.Style = "2";//freeform
dwTemp.genHTMLObjectWindow(CurPage.getParameter("id"));
String sButtons[][] = {
{"true","All","Button","确定","注册区域信息","saveRecord()","","","","btn_icon_submit"},
{"true","All","Button","取消","取消","goBack()","","","","btn_icon_close"},
};
sButtonPosition = "south";
%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%>
<script type="text/javascript">
//保存
function saveRecord(){
var districtcode = getItemValue(0,getRow(0),'district_code');
var sReturnInfo = RunJavaMethodTrans("com.tenwa.customer.controller.group.CustomerGroupCompanyController","checkCode","group_name="+districtcode);
if(sReturnInfo == "false"){
alert("区域编码已存在");
return;
}
as_save("myiframe0","parent.AsDialog.ClosePage()");
}
function goBack(){
parent.AsDialog.ClosePage();
}
</script>
<%@ include file="/Frame/resources/include/include_end.jspf"%>

View File

@ -0,0 +1,37 @@
<%@ page contentType="text/html; charset=GBK"%>
<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><%
/*
Author: undefined 2018-06-06
Content:
History Log:
*/
ASObjectModel doTemp = new ASObjectModel("COUNTRY_DISTRICT_INFO");
ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request);
dwTemp.Style="1"; //--设置为Grid风格--
dwTemp.ReadOnly = "1"; //只读模式
dwTemp.setPageSize(10);
dwTemp.genHTMLObjectWindow("");
//0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标CSS层叠样式 10、风格
String sButtons[][] = {
{"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""},
{"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"%>
<script type="text/javascript">
function newRecord(){
var sUrl = "/Tenwa/Apzl/DistributorToArea/DistributorCustomerGroupCompanyRegister.jsp";
AsDialog.PopView(sUrl,"","resizable=yes;dialogWidth=500px;dialogHeight=200px;center:yes;status:no;statusbar:no",function(sReturnValue){
reloadSelf();
},"新增集团");
}
function viewAndEdit(){
var sUrl="/Tenwa/Apzl/DistributorToArea/LmProductDistributorCar.jsp";
var districtno=getItemValue(0,getRow(0),'district_code');
var sPara = "districtno="+districtno;
AsDialog.PopView(sUrl,sPara,"dialogWidth=800px;dialogHeight=500px;resizable=no;scrollbars=no;status:yes;maximize:no;help:no;",function(){reloadSelf();},"配置经销商");
}
</script>
<%@ include file="/Frame/resources/include/include_end.jspf"%>

View File

@ -0,0 +1,65 @@
<%@ page contentType="text/html; charset=GBK"%>
<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><%
/*
Author: undefined 2018-06-06
Content:
History Log:
*/
ASObjectModel doTemp = new ASObjectModel("DISTRICT_DISTRIBUTOR_RELATION");
ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request);
String districtcode = CurPage.getParameter("district_code");
dwTemp.Style="1"; //--设置为Grid风格--
dwTemp.ReadOnly = "1"; //只读模式
dwTemp.setPageSize(10);
dwTemp.genHTMLObjectWindow(districtcode);
//0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标CSS层叠样式 10、风格
String sButtons[][] = {
{"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""},
{"false","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""},
{"true","","Button","删除","删除","asDelete()","","","","btn_icon_delete",""},
};
%><%@include file="/Frame/resources/include/ui/include_list.jspf"%>
<script type="text/javascript">
function newRecord(){
var Return = "<%=districtcode%>@~";
AsDialog.OpenSelector("DistributeProductList","","dialogWidth=" + parseInt(window.screen.width * 0.8) + "px dialogHeight=" + parseInt(window.screen.height * 0.6) + "px",function(sReturn){
if(!sReturn||sReturn=="_CANCEL_"||sReturn=="_NONE_"){
//alert(getHtmlMessage('1'));//请选择一条信息!
return;
}
Return =Return+sReturn;
sParams = "CarBrandId="+Return;
/*
CarBrandId=admin@~
8009002@~
2018/06/12 15:03:50@~
7c7624a558594bff8387ca6949982b21@~
00303ba448074b0792bd465dd2359b7c@
*/
var sReturnInfo = RunJavaMethodTrans("com.tenwa.apzl.saveunioncar.saveUnionCarUtil","saveLmDistributorToDistrict",sParams);
if(sReturnInfo=="error"){
alert("该经销商已绑定!");
}
reloadSelf();
},"请选择经销商");
}
function viewAndEdit(){
var sUrl = "";
var sPara = getItemValue(0,getRow(0),'SerialNo');
if(typeof(sPara)=="undefined" || sPara.length==0 ){
alert("参数不能为空!");
return ;
}
AsControl.OpenView(sUrl,'SerialNo=' +sPara ,'_self','');
}
function asDelete(){
var unionId = getItemValue(0,getRow(0),"ID");
//alert(unionId);
var sReturnInfo = RunJavaMethodTrans("com.tenwa.apzl.saveunioncar.saveUnionCarUtil","deleteLmDistributorToDistrict","unionId="+unionId);
if(sReturnInfo=="success"){
alert("删除成功!");
}
reloadSelf();
}
</script>
<%@ include file="/Frame/resources/include/include_end.jspf"%>

View File

@ -0,0 +1,32 @@
<%@ page contentType="text/html; charset=GBK"%>
<%@ include file="/Frame/resources/include/include_begin_info.jspf"%><%
/*
Author: undefined 2018-06-06
Content: 示例详情页面
History Log:
*/
String sPrevUrl = CurPage.getParameter("PrevUrl");
if(sPrevUrl == null) sPrevUrl = "";
String sTempletNo = "LmDistrictInfo";//--模板号--
ASObjectModel doTemp = new ASObjectModel(sTempletNo);
ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request);
dwTemp.Style = "2";//freeform
dwTemp.ReadOnly = "1";//只读模式
dwTemp.genHTMLObjectWindow(CurPage.getParameter("district_code"));
String sButtons[][] = {
//{"true","All","Button","保存","保存所有修改","save()","","","",""},
//{"true","All","Button","返回","返回列表","returnList()","","","",""}
};
sButtonPosition = "south";
%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%>
<script type="text/javascript">
/* function save(){
as_save("myiframe0","returnList()");
} */
function returnList(){
AsControl.OpenView("/Tenwa/Apzl/productCar/LmProductCarList.jsp", "","_self","");
}
</script>
<%@ include file="/Frame/resources/include/include_end.jspf"%>

View File

@ -0,0 +1,21 @@
<%@ page contentType="text/html; charset=GBK"%><%@
include file="/IncludeBegin.jsp"%><%
/*
页面说明: 示例上下联动框架页面
*/
String districtno = CurPage.getParameter("districtno");
%><%@include file="/Resources/CodeParts/Frame02.jsp"%>
<script type="text/javascript">
mytoptd.height=200;
OpenList();
OpenInfo();
function OpenList(){
AsControl.OpenView("/Tenwa/Apzl/DistributorToArea/LmProductCarInfo.jsp","district_code=<%=districtno%>","rightup");
}
function OpenInfo(){
AsControl.OpenView("/Tenwa/Apzl/DistributorToArea/LmDistributorToproductList.jsp","district_code=<%=districtno%>","rightdown");
}
</script>
<%@ include file="/IncludeEnd.jsp"%>

View File

@ -38,10 +38,10 @@
*/
var sReturnInfo = RunJavaMethodTrans("com.tenwa.apzl.saveunioncar.saveUnionCarUtil","saveLmDistributorToProduct",sParams);
if(sReturnInfo=="error"){
alert("该产品已绑定!");
alert("该经销商已绑定!");
}
reloadSelf();
},"请选择产品");
},"请选择经销商");
}
function viewAndEdit(){
var sUrl = "";

View File

@ -224,6 +224,26 @@
</managerProperties>
</manager>
</class>
<class name="DISTRICT_DISTRIBUTOR_RELATION" label="" keyAttributes="ID">
<attributes>
<attribute name="ID" label="主键" type="STRING" length="40"/>
<attribute name="DISTRICT_CODE" label="区域编号" type="STRING" length="32"/>
<attribute name="DISTRICT_NAME" label="区域名称" type="STRING" length="32"/>
<attribute name="DISTRICT_ID" label="区域ID" type="STRING" length="32"/>
<attribute name="DISTRIBUTOR_ID" label="经销商ID" type="STRING" length="32"/>
<attribute name="DISTRIBUTOR_NO" label="机构" type="STRING" length="32"/>
<attribute name="DISTRIBUTOR_NAME" label="借方余额" type="DOUBLE" length="20" scale="2"/>
<attribute name="ITEM2" label="扩展属性2" type="STRING" length="10"/>
<attribute name="ITEM3" label="扩展属性3" type="STRING" length="10"/>
<attribute name="ITEM4" label="扩展属性4" type="STRING" length="10"/>
</attributes>
<manager>
<managerProperties>
<property name="table" value="district_distributor_relation" />
<property name="createKey" value="true" />
</managerProperties>
</manager>
</class>
</package>
<package name="jbo.com.tenwa.entity.comm.officetempalte" >
<class name="BF_PARAMCONFIG" label="参数配置" keyAttributes="ID">

View File

@ -6,6 +6,7 @@ import java.util.UUID;
import jbo.app.tenwa.customer.LM_DISTRIBUTOR_TO_CAR;
import jbo.app.tenwa.customer.LM_DISTRIBUTOR_TO_PRODUCT;
import jbo.app.tenwa.customer.LM_PORTAL_TO_CAR;
import jbo.com.tenwa.entity.comm.own.DISTRICT_DISTRIBUTOR_RELATION;
import jbo.com.tenwa.limit.LA_LIMIT_ELEMENT;
import com.amarsoft.are.jbo.BizObject;
@ -168,6 +169,52 @@ public String getCarBrandId() {
}
return "error";
}
public String saveLmDistributorToDistrict(JBOTransaction tx)throws Exception {
/*
CarBrandId=admin@~
8009002@~
2018/06/12 15:03:50@~
7c7624a558594bff8387ca6949982b21@~
00303ba448074b0792bd465dd2359b7c@
*/
String[] params = CarBrandId.split("@~");
String DISTRICT_CODE = params[0];
//String DISTRICT_NAME = params[1];
//String DISTRIBUTOR_ID = params[1];
//String DISTRIBUTOR_NO = params[3];
//String DISTRIBUTOR_NAME = params[4];
//String productid=params[4];
int lle=0;
int i;
try{
BizObjectManager Lmcheck = JBOFactory.getBizObjectManager(DISTRICT_DISTRIBUTOR_RELATION.CLASS_NAME,tx);
for(i=1;i<params.length;i++){
String DISTRIBUTOR_ID = params[i];
BizObject obcheck=Lmcheck.createQuery("DISTRIBUTOR_ID=:DISTRIBUTOR_ID and DISTRICT_CODE=:DISTRICT_CODE")
.setParameter("DISTRIBUTOR_ID", DISTRIBUTOR_ID).setParameter("DISTRICT_CODE",DISTRICT_CODE).getSingleResult(false);
if(obcheck!=null){
return "error";
}
String PortalToCarId=UUID.randomUUID().toString().replaceAll("-", "");
BizObjectManager Lmpc = JBOFactory.getBizObjectManager(DISTRICT_DISTRIBUTOR_RELATION.CLASS_NAME,tx);
BizObject NewLmpc = Lmpc.newObject();
NewLmpc.setAttributeValue("ID", PortalToCarId);
NewLmpc.setAttributeValue("DISTRICT_CODE", DISTRICT_CODE);
//NewLmpc.setAttributeValue("DISTRICT_NAME", DISTRICT_NAME);
NewLmpc.setAttributeValue("DISTRIBUTOR_ID", DISTRIBUTOR_ID);
//NewLmpc.setAttributeValue("DISTRIBUTOR_NO", DISTRIBUTOR_NO);
//NewLmpc.setAttributeValue("DISTRIBUTOR_NAME", DISTRIBUTOR_NAME);
Lmpc.saveObject(NewLmpc);
}
}catch(Exception e){
e.printStackTrace();
tx.rollback();
}
if(lle>=0){
return "success";
}
return "error";
}
/**
* 删除经销商车型关联表的关联
* @param tx
@ -184,6 +231,11 @@ public String getCarBrandId() {
Lmpc.createQuery("delete from o where id = :id").setParameter("id",unionId).executeUpdate();
return "success";
}
public String deleteLmDistributorToDistrict(JBOTransaction tx)throws Exception {
BizObjectManager Lmpc = JBOFactory.getBizObjectManager(DISTRICT_DISTRIBUTOR_RELATION.CLASS_NAME,tx);
Lmpc.createQuery("delete from o where id = :id").setParameter("id",unionId).executeUpdate();
return "success";
}
/**
* 删除渠道机构车型关联表的关联
* @param tx

View File

@ -2,6 +2,7 @@ package com.tenwa.customer.controller.group;
import jbo.app.tenwa.customer.CUSTOMER_GROUP_COMPANY;
import jbo.app.tenwa.customer.DISTRIBUTOR_GROUP_COMPANY;
import jbo.com.tenwa.entity.comm.own.COUNTRY_DISTRICT_INFO;
import com.amarsoft.are.jbo.BizObject;
import com.amarsoft.are.jbo.BizObjectManager;
@ -91,4 +92,16 @@ public class CustomerGroupCompanyController {
return "false";
}
}
public String checkCode(JBOTransaction tx)throws Exception{
BizObjectManager bom = JBOFactory.getBizObjectManager(COUNTRY_DISTRICT_INFO.CLASS_NAME);
tx.join(bom);
//查询该区域编号是否已存在
BizObject CUSTOMER_GROUP_COMPANY = bom.createQuery("district_code=:district_code").setParameter("district_code",group_name).getSingleResult(false);
if(CUSTOMER_GROUP_COMPANY != null){
return "false";
}else{
return "success";
}
}
}