This commit is contained in:
liuz 2018-06-15 10:27:43 +08:00
commit 2b8c7d98f4
4 changed files with 183 additions and 0 deletions

View File

@ -0,0 +1,67 @@
<%@ 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("LM_DISTRIBUTOR_TO_PRODUCT");
ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request);
String distributorId = CurPage.getParameter("DISTRIBUTOR_ID");
dwTemp.Style="1"; //--设置为Grid风格--
dwTemp.ReadOnly = "1"; //只读模式
dwTemp.setPageSize(10);
dwTemp.genHTMLObjectWindow(distributorId);
//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 = "<%=CurUser.getUserID()%>@~<%=CurUser.getOrgID()%>@~<%=StringFunction.getTodayNow()%>@~<%=distributorId%>@~";
AsDialog.OpenSelector("DistributeProductList","distributorid,<%=distributorId%>","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;
}
//alert(sReturn);
Return =Return+sReturn;
sParams = "CarBrandId="+Return;
//alert(sParams);
/*
CarBrandId=admin@~
8009002@~
2018/06/12 15:03:50@~
7c7624a558594bff8387ca6949982b21@~
00303ba448074b0792bd465dd2359b7c@
*/
var sReturnInfo = RunJavaMethodTrans("com.tenwa.apzl.saveunioncar.saveUnionCarUtil","saveLmDistributorToProduct",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","deleteLmDistributorToProduct","unionId="+unionId);
if(sReturnInfo=="success"){
alert("删除成功!");
}
reloadSelf();
}
</script>
<%@ include file="/Frame/resources/include/include_end.jspf"%>

View File

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

View File

@ -0,0 +1,40 @@
<%@ 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("LM_DISTRIBUTOR_LIST");
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[][] = {
{"false","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""},
{"false","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""},
{"false","","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 = "";
AsControl.OpenView(sUrl,'','_self','');
}
function afterSearch(){
for(var i=0;i<getRowCount(0);i++){
if(getObj(0,i,"EDIT")!=null){
getObj(0,i,"EDIT").innerHTML='<a class="box" style="text-align:center;" onclick="showCar(\''+getItemValue(0,i,"ID")+'\')" style={color:#000;text-decoration:underline;}><font color="blue">&nbsp&nbsp&nbsp&nbsp&nbsp编辑</font></ a>';
}
};
}
function showCar(id){
var sUrl="/Tenwa/Apzl/PortalToCarType/LmProductDistributorCar.jsp";
var param="distributorId="+id;
AsDialog.PopView(sUrl,param,"dialogWidth=800px;dialogHeight=480px;resizable=no;scrollbars=no;status:yes;maximize:no;help:no;",function(){reloadSelf();},"配置产品");
}
</script>
<%@ include file="/Frame/resources/include/include_end.jspf"%>

View File

@ -4,6 +4,7 @@ import java.util.List;
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.limit.LA_LIMIT_ELEMENT;
@ -117,6 +118,56 @@ public String getCarBrandId() {
}
return "error";
}
public String saveLmDistributorToProduct(JBOTransaction tx)throws Exception {
/*
CarBrandId=admin@~
8009002@~
2018/06/12 15:03:50@~
7c7624a558594bff8387ca6949982b21@~
00303ba448074b0792bd465dd2359b7c@
*/
String[] params = CarBrandId.split("@~");
String updateUserID = params[0];
String updateOrgId = params[1];
String updateTime = params[2];
String distributorId = params[3];
String productid=params[4];
int lle=0;
BizObjectManager Lmcheck = JBOFactory.getBizObjectManager(LM_DISTRIBUTOR_TO_PRODUCT.CLASS_NAME,tx);
BizObject obcheck=Lmcheck.createQuery("DISTRIBUTOR_ID=:DISTRIBUTOR_ID and PRODUCT_ID=:PRODUCT_ID")
.setParameter("DISTRIBUTOR_ID", distributorId).setParameter("PRODUCT_ID",productid).getSingleResult(false);
if(Lmcheck!=null){
return "error";
}
int i;
try{
for(i=4;i<params.length;i++){
String PortalToCarId=UUID.randomUUID().toString().replaceAll("-", "");
String brandid = params[i];
BizObjectManager Lmpc = JBOFactory.getBizObjectManager(LM_DISTRIBUTOR_TO_PRODUCT.CLASS_NAME,tx);
BizObject NewLmpc = Lmpc.newObject();
NewLmpc.setAttributeValue("id", PortalToCarId);
NewLmpc.setAttributeValue("product_id", brandid);
NewLmpc.setAttributeValue("distributor_id", distributorId);
NewLmpc.setAttributeValue("inputUserID", updateUserID);
NewLmpc.setAttributeValue("inputOrgId", updateOrgId);
NewLmpc.setAttributeValue("inputTime", updateTime);
NewLmpc.setAttributeValue("updateUserID", updateUserID);
NewLmpc.setAttributeValue("updateOrgId", updateOrgId);
NewLmpc.setAttributeValue("updateTime", updateTime);
Lmpc.saveObject(NewLmpc);
}
}catch(Exception e){
e.printStackTrace();
tx.rollback();
}
if(lle>=0){
return "success";
}
return "error";
}
/**
* 删除经销商车型关联表的关联
* @param tx
@ -128,6 +179,11 @@ public String getCarBrandId() {
Lmpc.createQuery("delete from o where id = :id").setParameter("id",unionId).executeUpdate();
return "success";
}
public String deleteLmDistributorToProduct(JBOTransaction tx)throws Exception {
BizObjectManager Lmpc = JBOFactory.getBizObjectManager(LM_DISTRIBUTOR_TO_PRODUCT.CLASS_NAME,tx);
Lmpc.createQuery("delete from o where id = :id").setParameter("id",unionId).executeUpdate();
return "success";
}
/**
* 删除渠道机构车型关联表的关联
* @param tx