产品配置

This commit is contained in:
amarsoft 2018-06-20 22:38:08 +08:00
parent 7c98103461
commit d04f4ff7ed
4 changed files with 233 additions and 4 deletions

View File

@ -0,0 +1,79 @@
<%@ page contentType="text/html; charset=GBK"%>
<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><%
/*
Author: undefined 2018-06-06
Content:
History Log:
*/
String typeno= CurPage.getParameter("TYPENO");
ASObjectModel doTemp = new ASObjectModel("lmproductdistrictList");
ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request);
dwTemp.Style="1"; //--设置为Grid风格--
dwTemp.ReadOnly = "1"; //只读模式
dwTemp.setPageSize(10);
dwTemp.genHTMLObjectWindow(typeno);
//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","区域信息维护","区域信息维护","Edit()","","","","btn_icon_detail",""},
{"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0,'')","","","","btn_icon_delete",""},
};
%><%@include file="/Frame/resources/include/ui/include_list.jspf"%>
<script type="text/javascript">
function newRecord(){
AsDialog.OpenSelector("selectDistrictForProduct","","dialogWidth=" + parseInt(window.screen.width * 0.3) + "px dialogHeight=" + parseInt(window.screen.height * 0.6) + "px",function(sReturn){
if(!sReturn||sReturn=="_CANCEL_"||sReturn=="_NONE_"){
//alert(getHtmlMessage('1'));//请选择一条信息!
return;
}
Return ="<%=typeno%>@~"+sReturn;
var sParams="CarBrandId="+Return;
var sReturnInfo = RunJavaMethodTrans("com.tenwa.apzl.saveunioncar.saveUnionCarUtil","saveLmDistrictToProduct",sParams);
if(sReturnInfo!="success"){
alert(sReturnInfo);
}
reloadSelf();
},"请选择区域");
}
<%-- function newRecord(){
var sUrl = "/Tenwa/Apzl/DistributorToArea/DistributorCustomerGroupCompanyRegister.jsp";
AsDialog.PopView(sUrl,"typeno=<%=typeno%>","resizable=yes;dialogWidth=500px;dialogHeight=200px;center:yes;status:no;statusbar:no",function(sReturnValue){
reloadSelf();
},"新增区域");
} --%>
/* function viewAndEdit(){
var disCode=getItemValue(0, getRow(0),"district_code");
AsDialog.OpenSelector("selectProvinceForDistrict","","dialogWidth=" + parseInt(window.screen.width * 0.3) + "px dialogHeight=" + parseInt(window.screen.height * 0.6) + "px",function(sReturn){
if(!sReturn||sReturn=="_CANCEL_"||sReturn=="_NONE_"){
//alert(getHtmlMessage('1'));//请选择一条信息!
return;
}
Return =disCode+"@~"+sReturn;
var sParams="CarBrandId="+Return;
var sReturnInfo = RunJavaMethodTrans("com.tenwa.apzl.saveunioncar.saveUnionCarUtil","saveLmDistributorToDistrict",sParams);
if(sReturnInfo!="success"){
alert(sReturnInfo);
}
reloadSelf();
},"请选择省份");
}
function afterSearch(){
for(var i=0;i<getRowCount(0);i++){
if(getObj(0,i,"doaction")!=null){
getObj(0,i,"doaction").innerHTML='<a class="box" style="text-align:center;" onclick="viewAndEdit()" style={color:#000;text-decoration:underline;}><font color="blue">&nbsp&nbsp&nbsp关联省份</font></ a>';
}
};
}
function Edit(){
var disCode=getItemValue(0, getRow(0),"district_code");
var sUrl = "/Tenwa/Apzl/DistributorToArea/EditProvince.jsp";
AsDialog.PopView(sUrl,"disCode="+disCode,"resizable=yes;dialogWidth=400px;dialogHeight=400px;center:yes;status:no;statusbar:no",function(sReturnValue){
reloadSelf();
},"维护省份");
} */
</script>
<%@ include file="/Frame/resources/include/include_end.jspf"%>

View File

@ -0,0 +1,79 @@
<%@ page contentType="text/html; charset=GBK"%>
<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><%
/*
Author: undefined 2018-06-06
Content:
History Log:
*/
String typeno= CurPage.getParameter("TYPENO");
ASObjectModel doTemp = new ASObjectModel("lmproductdistributorgroupList");
ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request);
dwTemp.Style="1"; //--设置为Grid风格--
dwTemp.ReadOnly = "1"; //只读模式
dwTemp.setPageSize(10);
dwTemp.genHTMLObjectWindow(typeno);
//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","区域信息维护","区域信息维护","Edit()","","","","btn_icon_detail",""},
{"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0,'')","","","","btn_icon_delete",""},
};
%><%@include file="/Frame/resources/include/ui/include_list.jspf"%>
<script type="text/javascript">
function newRecord(){
AsDialog.OpenSelector("selectdistributorgroupForProduct","","dialogWidth=" + parseInt(window.screen.width * 0.3) + "px dialogHeight=" + parseInt(window.screen.height * 0.6) + "px",function(sReturn){
if(!sReturn||sReturn=="_CANCEL_"||sReturn=="_NONE_"){
//alert(getHtmlMessage('1'));//请选择一条信息!
return;
}
Return ="<%=typeno%>@~"+sReturn;
var sParams="CarBrandId="+Return;
var sReturnInfo = RunJavaMethodTrans("com.tenwa.apzl.saveunioncar.saveUnionCarUtil","saveLmDistributorGroupToProduct",sParams);
if(sReturnInfo!="success"){
alert(sReturnInfo);
}
reloadSelf();
},"请选择集团");
}
<%-- function newRecord(){
var sUrl = "/Tenwa/Apzl/DistributorToArea/DistributorCustomerGroupCompanyRegister.jsp";
AsDialog.PopView(sUrl,"typeno=<%=typeno%>","resizable=yes;dialogWidth=500px;dialogHeight=200px;center:yes;status:no;statusbar:no",function(sReturnValue){
reloadSelf();
},"新增区域");
} --%>
/* function viewAndEdit(){
var disCode=getItemValue(0, getRow(0),"district_code");
AsDialog.OpenSelector("selectProvinceForDistrict","","dialogWidth=" + parseInt(window.screen.width * 0.3) + "px dialogHeight=" + parseInt(window.screen.height * 0.6) + "px",function(sReturn){
if(!sReturn||sReturn=="_CANCEL_"||sReturn=="_NONE_"){
//alert(getHtmlMessage('1'));//请选择一条信息!
return;
}
Return =disCode+"@~"+sReturn;
var sParams="CarBrandId="+Return;
var sReturnInfo = RunJavaMethodTrans("com.tenwa.apzl.saveunioncar.saveUnionCarUtil","saveLmDistributorToDistrict",sParams);
if(sReturnInfo!="success"){
alert(sReturnInfo);
}
reloadSelf();
},"请选择省份");
}
function afterSearch(){
for(var i=0;i<getRowCount(0);i++){
if(getObj(0,i,"doaction")!=null){
getObj(0,i,"doaction").innerHTML='<a class="box" style="text-align:center;" onclick="viewAndEdit()" style={color:#000;text-decoration:underline;}><font color="blue">&nbsp&nbsp&nbsp关联省份</font></ a>';
}
};
}
function Edit(){
var disCode=getItemValue(0, getRow(0),"district_code");
var sUrl = "/Tenwa/Apzl/DistributorToArea/EditProvince.jsp";
AsDialog.PopView(sUrl,"disCode="+disCode,"resizable=yes;dialogWidth=400px;dialogHeight=400px;center:yes;status:no;statusbar:no",function(sReturnValue){
reloadSelf();
},"维护省份");
} */
</script>
<%@ include file="/Frame/resources/include/include_end.jspf"%>

View File

@ -254,8 +254,8 @@
<attribute name="productid" label="产品id" type="STRING" length="32"/>
<attribute name="distributgroupid" label="经销商集团id" type="STRING" length="32"/>
<attribute name="productname" label="产品名称" type="STRING" length="32"/>
<attribute name="distributgroupname" label="经销商集团名称" type="STRING" length="10"/>
<attribute name="ITEM1" label="扩展属性1" type="STRING" length="10"/>
<attribute name="distributgroupname" label="经销商集团名称" type="STRING" length="500"/>
<attribute name="ITEM1" label="扩展属性1" type="STRING" length="500"/>
<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"/>
@ -273,8 +273,8 @@
<attribute name="productid" label="产品id" type="STRING" length="32"/>
<attribute name="districtid" label="区域id" type="STRING" length="32"/>
<attribute name="productname" label="产品名称" type="STRING" length="32"/>
<attribute name="districtname" label="区域名称" type="STRING" length="10"/>
<attribute name="ITEM1" label="扩展属性1" type="STRING" length="10"/>
<attribute name="districtname" label="区域名称" type="STRING" length="500"/>
<attribute name="ITEM1" label="扩展属性1" type="STRING" length="500"/>
<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"/>

View File

@ -7,6 +7,8 @@ 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.entity.comm.own.LM_PRODUCT_DISTRIBUTOR_GROUP;
import jbo.com.tenwa.entity.comm.own.LM_PRODUCT_DISTRICT;
import jbo.com.tenwa.limit.LA_LIMIT_ELEMENT;
import com.amarsoft.are.jbo.BizObject;
@ -240,4 +242,73 @@ public String getCarBrandId() {
Lmpc.createQuery("delete from o where id = :id").setParameter("id",unionId).executeUpdate();
return "success";
}
public String saveLmDistrictToProduct(JBOTransaction tx)throws Exception {
String[] params = CarBrandId.split("@~");
String typeno = params[0];
int lle=0;
int i;
try{
BizObjectManager Lmcheck = JBOFactory.getBizObjectManager(LM_PRODUCT_DISTRICT.CLASS_NAME,tx);
for(i=1;i<params.length;i++){
String areaid = params[i].split("@")[0];
String districtname = params[i].split("@")[1];
BizObject obcheck=Lmcheck.createQuery("productid=:productid and districtid=:districtid")
.setParameter("productid", typeno).setParameter("districtid",areaid).getSingleResult(false);
if(obcheck!=null){
return districtname+"已关联至该产品!";
}
String PortalToCarId=UUID.randomUUID().toString().replaceAll("-", "");
BizObjectManager Lmpc = JBOFactory.getBizObjectManager(LM_PRODUCT_DISTRICT.CLASS_NAME,tx);
BizObject NewLmpc = Lmpc.newObject();
NewLmpc.setAttributeValue("id", PortalToCarId);
NewLmpc.setAttributeValue("productid", typeno);
NewLmpc.setAttributeValue("districtid", areaid);
NewLmpc.setAttributeValue("districtname", districtname);
Lmpc.saveObject(NewLmpc);
}
}catch(Exception e){
e.printStackTrace();
tx.rollback();
}
if(lle>0){
return "error";
}
return "success";
}
public String saveLmDistributorGroupToProduct(JBOTransaction tx)throws Exception {
String[] params = CarBrandId.split("@~");
String typeno = params[0];
int lle=0;
int i;
try{
BizObjectManager Lmcheck = JBOFactory.getBizObjectManager(LM_PRODUCT_DISTRIBUTOR_GROUP.CLASS_NAME,tx);
for(i=1;i<params.length;i++){
String distributgroupid = params[i].split("@")[0];
String distributgroupname = params[i].split("@")[1];
BizObject obcheck=Lmcheck.createQuery("productid=:productid and distributgroupid=:districtid")
.setParameter("productid", typeno).setParameter("districtid",distributgroupid).getSingleResult(false);
if(obcheck!=null){
return distributgroupname+"已关联至该产品!";
}
String PortalToCarId=UUID.randomUUID().toString().replaceAll("-", "");
BizObjectManager Lmpc = JBOFactory.getBizObjectManager(LM_PRODUCT_DISTRIBUTOR_GROUP.CLASS_NAME,tx);
BizObject NewLmpc = Lmpc.newObject();
NewLmpc.setAttributeValue("id", PortalToCarId);
NewLmpc.setAttributeValue("productid", typeno);
NewLmpc.setAttributeValue("distributgroupid", distributgroupid);
NewLmpc.setAttributeValue("distributgroupname", distributgroupname);
Lmpc.saveObject(NewLmpc);
}
}catch(Exception e){
e.printStackTrace();
tx.rollback();
}
if(lle>0){
return "error";
}
return "success";
}
}