'feat():完成HPSC002附件上传'

parent ba9092e4
package com.baosight.hpjx.hp.sc.service; package com.baosight.hpjx.hp.sc.service;
import cn.hutool.core.bean.BeanUtil;
import com.baosight.hpjx.hp.sc.domain.THPSC002; import com.baosight.hpjx.hp.sc.domain.THPSC002;
import com.baosight.iplat4j.core.ei.EiBlock; import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant; import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo; import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException; import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.impl.ServiceBase; import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.iplat4j.core.service.soa.XLocalManager;
import com.baosight.iplat4j.core.web.threadlocal.UserSession; import com.baosight.iplat4j.core.web.threadlocal.UserSession;
import java.math.BigDecimal; import java.math.BigDecimal;
...@@ -37,6 +39,12 @@ public class ServiceHPSC002 extends ServiceBase { ...@@ -37,6 +39,12 @@ public class ServiceHPSC002 extends ServiceBase {
public EiInfo query(EiInfo inInfo) { public EiInfo query(EiInfo inInfo) {
/* 调用EI查询方法.*/ /* 调用EI查询方法.*/
EiInfo outInfo = super.query(inInfo, "HPSC002.query", new THPSC002()); EiInfo outInfo = super.query(inInfo, "HPSC002.query", new THPSC002());
//调用本地服务
// EiInfo eiInfo_update = new EiInfo();
// eiInfo_update.set(EiConstant.serviceName, "HPSC002");
// eiInfo_update.set(EiConstant.methodName, "delete");
// EiBlock eiBlock_update = new EiBlock(EiConstant.resultBlock);
// EiInfo outInfo_update = XLocalManager.call(eiInfo_update);
return outInfo; return outInfo;
} }
...@@ -59,13 +67,14 @@ public class ServiceHPSC002 extends ServiceBase { ...@@ -59,13 +67,14 @@ public class ServiceHPSC002 extends ServiceBase {
BigDecimal unitWt = hppz002.getUnitWt(); BigDecimal unitWt = hppz002.getUnitWt();
DecimalFormat decimalFormat = new DecimalFormat("#.000"); DecimalFormat decimalFormat = new DecimalFormat("#.000");
BigDecimal totalWt = new BigDecimal(decimalFormat.format(Math.round(num.multiply(unitWt).floatValue()))); BigDecimal totalWt = new BigDecimal(decimalFormat.format(Math.round(num.multiply(unitWt).floatValue())));
hppz002.setDelStatus(1);
hppz002.setTotalWt(totalWt); hppz002.setTotalWt(totalWt);
hppz002.setCreatedBy(UserSession.getUserId()); hppz002.setCreatedBy(UserSession.getUserId());
hppz002.setCreatedTime(sdf.format(new Date())); hppz002.setCreatedTime(sdf.format(new Date()));
hppz002.setUpdatedBy(null); hppz002.setUpdatedBy(null);
hppz002.setUpdatedTime(null); hppz002.setUpdatedTime(null);
this.dao.insert("HPSC002.insert", hppz002.toMap()); this.dao.insert("HPSC002.insert", hppz002.toMap());
if(!hppz002.getParentPrdtCode().equals("root")){ if (!hppz002.getParentPrdtCode().equals("root")) {
this.checkTreeNodeLeaf(new Long(hppz002.getParentPrdtCode())); this.checkTreeNodeLeaf(new Long(hppz002.getParentPrdtCode()));
} }
} }
...@@ -120,8 +129,10 @@ public class ServiceHPSC002 extends ServiceBase { ...@@ -120,8 +129,10 @@ public class ServiceHPSC002 extends ServiceBase {
for (int i = 0; i < eiBlock.getRowCount(); i++) { for (int i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i); Map<?, ?> map = eiBlock.getRow(i);
hppz002.fromMap(map); hppz002.fromMap(map);
this.dao.delete("HPSC002.delete", hppz002.toMap()); this.dao.delete("HPSC002.delete", hppz002.toMap());
this.checkTreeNodeLeaf(new Long(hppz002.getParentPrdtCode()));
//TODO 删除时 修改树结构
this.checkTreeNodeLeaf(new Long(hppz002.getId()));
} }
} catch (PlatException e) { } catch (PlatException e) {
eiInfo.setStatus(EiConstant.STATUS_FAILURE); eiInfo.setStatus(EiConstant.STATUS_FAILURE);
...@@ -130,7 +141,6 @@ public class ServiceHPSC002 extends ServiceBase { ...@@ -130,7 +141,6 @@ public class ServiceHPSC002 extends ServiceBase {
logError("删除失败!", e.getMessage()); logError("删除失败!", e.getMessage());
return eiInfo; return eiInfo;
} }
eiInfo.setStatus(EiConstant.STATUS_SUCCESS); eiInfo.setStatus(EiConstant.STATUS_SUCCESS);
eiInfo.setMsg("删除成功!"); eiInfo.setMsg("删除成功!");
return eiInfo; return eiInfo;
...@@ -141,30 +151,93 @@ public class ServiceHPSC002 extends ServiceBase { ...@@ -141,30 +151,93 @@ public class ServiceHPSC002 extends ServiceBase {
//1 获取参数 //1 获取参数
String pEname = inInfo.getCellStr(EiConstant.queryBlock, 0, "node"); String pEname = inInfo.getCellStr(EiConstant.queryBlock, 0, "node");
Map queryMap = new HashMap(); Map queryMap = new HashMap();
queryMap.put("pEname",pEname); queryMap.put("pEname", pEname);
//2 查询节点 //2 查询节点
List rows = dao.query("HPSC002.queryTree", queryMap); List rows = dao.query("HPSC002.queryTree", queryMap);
//3 增加节点block块 //3 增加节点block块
EiInfo outInfo = new EiInfo(); EiInfo outInfo = new EiInfo();
EiBlock outBlock = outInfo.addBlock(pEname); EiBlock outBlock = outInfo.addBlock(BeanUtil.isEmpty(pEname) ? "" : pEname);
outBlock.addRows(rows); outBlock.addRows(rows);
return outInfo; return outInfo;
} }
/** /**
* 修改父级节点的LEAF状态为1 * 修改父级节点的LEAF状态为1
*
* @param id * @param id
*/ */
public void checkTreeNodeLeaf(Long id) { public void checkTreeNodeLeaf(Long id) {
EiInfo eiInfo = new EiInfo();
//1 获取参数 //1 获取参数
Map queryMap = new HashMap(); Map queryMap = new HashMap();
queryMap.put("id", id); queryMap.put("id", id);
queryMap.put("leaf", "0"); List rows = this.dao.query("HPSC002.queryTreeNodeByParentPrtdCode", queryMap);
//2 查询节点 if(rows.size() > 0){
queryMap.put("leaf", "0");
}else{
queryMap.put("leaf", "1");
}
this.dao.update("HPSC002.updateTreeNodeLeaf", queryMap); this.dao.update("HPSC002.updateTreeNodeLeaf", queryMap);
} }
/**
* 审核 反审.
*/
public EiInfo check(EiInfo eiInfo) {
THPSC002 hppz002 = new THPSC002();
EiBlock eiBlock = eiInfo.getBlock(EiConstant.resultBlock);
try {
for (int i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
hppz002.fromMap(map);
Map sqlMap = new HashMap();
sqlMap.put("id",hppz002.getId());
if(hppz002.getStatus() == 0){
sqlMap.put("status",1);
}else{
sqlMap.put("status",0);
}
this.dao.update("HPSC002.check", hppz002.toMap());
}
} catch (PlatException e) {
eiInfo.setStatus(EiConstant.STATUS_FAILURE);
eiInfo.setMsg("删除失败,原因参见详细错误描述!");
eiInfo.setDetailMsg(e.getMessage());
logError("删除失败!", e.getMessage());
return eiInfo;
}
eiInfo.setStatus(EiConstant.STATUS_SUCCESS);
eiInfo.setMsg("删除成功!");
return eiInfo;
}
/**
* 审核 反审.
*/
public EiInfo bindDocIdById(EiInfo eiInfo) {
THPSC002 hppz002 = new THPSC002();
EiBlock eiBlock = eiInfo.getBlock(EiConstant.resultBlock);
try {
for (int i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
hppz002.fromMap(map);
Map sqlMap = new HashMap();
sqlMap.put("id",hppz002.getId());
sqlMap.put("filePath1",hppz002.getFilePath1());
this.dao.update("HPSC002.bindDocIdById", hppz002.toMap());
}
} catch (PlatException e) {
eiInfo.setStatus(EiConstant.STATUS_FAILURE);
eiInfo.setMsg("删除失败,原因参见详细错误描述!");
eiInfo.setDetailMsg(e.getMessage());
logError("删除失败!", e.getMessage());
return eiInfo;
}
eiInfo.setStatus(EiConstant.STATUS_SUCCESS);
eiInfo.setMsg("删除成功!");
return eiInfo;
}
} }
package com.baosight.hpjx.hp.sc.service;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceBase;
/**
*
*/
public class ServiceHPSC099 extends ServiceBase {
/**
* 画面初始化.
*/
public EiInfo initLoad(EiInfo inInfo) {
return inInfo;
}
/**
* 附件上传.
*/
public EiInfo form(EiInfo inInfo) {
return inInfo;
}
}
...@@ -68,8 +68,17 @@ ...@@ -68,8 +68,17 @@
REMARK as "remark" <!-- 备注 --> REMARK as "remark" <!-- 备注 -->
FROM hpjx.t_hpsc002 WHERE 1=1 FROM hpjx.t_hpsc002 WHERE 1=1
AND PARENT_PRDT_CODE NOT IN ('root') AND PARENT_PRDT_CODE NOT IN ('root')
<isNotEmpty prepend=" AND " property="id"> <isNotEmpty prepend=" AND " property="parentPrdtCode">
ID = #id# PARENT_PRDT_CODE = #parentPrdtCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="prdtName">
PRDT_NAME LIKE CONCAT('%',CONCAT( #prdtName#,'%'))
</isNotEmpty>
<isNotEmpty prepend=" AND " property="projName">
PROJ_NAME LIKE CONCAT('%',CONCAT( #projName#,'%'))
</isNotEmpty>
<isNotEmpty prepend=" AND " property="status">
STATUS = #status#
</isNotEmpty> </isNotEmpty>
<dynamic prepend="ORDER BY"> <dynamic prepend="ORDER BY">
<isEmpty property="orderBy"> <isEmpty property="orderBy">
...@@ -84,6 +93,9 @@ ...@@ -84,6 +93,9 @@
<isNotEmpty prepend=" AND " property="id"> <isNotEmpty prepend=" AND " property="id">
ID = #id# ID = #id#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="parentPrdtCode">
PARENT_PRDT_CODE = #parentPrdtCode#
</isNotEmpty>
</select> </select>
<!-- <!--
...@@ -249,8 +261,10 @@ ...@@ -249,8 +261,10 @@
<select id="queryTree" resultClass="java.util.HashMap"> <select id="queryTree" resultClass="java.util.HashMap">
SELECT SELECT
ID as "nodeId", ID as "nodeId",
PRDT_CODE as "prdtCode", <!-- 项目编码 -->
PROJ_CODE as "projCode", <!-- 项目编码 --> PROJ_CODE as "projCode", <!-- 项目编码 -->
PROJ_NAME as projName,<!-- 项目名称 --> PRDT_name as "prdtName", <!-- 项目编码 -->
PROJ_NAME as "projName",<!-- 项目名称 -->
ID as "label", <!-- 名产品编码--> ID as "label", <!-- 名产品编码-->
PRDT_NAME as "text", <!-- 产品名称 --> PRDT_NAME as "text", <!-- 产品名称 -->
PARENT_PRDT_CODE as "pId", <!-- 父节点编码 --> PARENT_PRDT_CODE as "pId", <!-- 父节点编码 -->
...@@ -268,7 +282,49 @@ ...@@ -268,7 +282,49 @@
ORDER BY CREATED_TIME DESC ORDER BY CREATED_TIME DESC
</select> </select>
<select id="queryTreeNodeByParentPrtdCode" resultClass="java.util.HashMap">
SELECT
ID as "id",
COMPANY_CODE as "companyCode", <!-- 企业编码 预留 -->
DEPT_CODE as "deptCode", <!-- 部门编码 预留 -->
PROJ_CODE as "projCode", <!-- 项目编码 -->
PROJ_NAME as "projName", <!-- 项目名称 -->
PARENT_PRDT_CODE as "parentPrdtCode", <!-- 父节点-产品编码 -->
PARENT_PRDT_NAME as "parentPrdtName", <!-- 父节点-产品名称 -->
TYPE as "type", <!-- 类别 -->
LEAF as "leaf", <!-- 是否有叶子节点 -->
SORT as "sort", <!-- 排序字段 -->
ICON as "icon", <!-- 图片地址 -->
PRDT_CODE as "prdtCode", <!-- 产品编码 -->
PRDT_NAME as "prdtName", <!-- 产品名称 -->
NUM as "num", <!-- 数量 -->
UNIT_WT as "unitWt", <!-- 单重 -->
TOTAL_WT as "totalWt", <!-- 总重 -->
FILE_PATH1 as "filePath1", <!-- 文件地址1 -->
FILE_PATH2 as "filePath2", <!-- 文件地址2 -->
FILE_PATH3 as "filePath3", <!-- 文件地址3 -->
FILE_PATH4 as "filePath4", <!-- 文件地址4 -->
FILE_PATH5 as "filePath5", <!-- 文件地址5 -->
STATUS as "status", <!-- 状态 0-未审核,1-已审核 -->
DEL_STATUS as "delStatus", <!-- 状态 1未删除,0已删除 -->
CREATED_BY as "createdBy", <!-- 创建人 -->
CREATED_TIME as "createdTime", <!-- 创建时间 -->
UPDATED_BY as "updatedBy", <!-- 更新人 -->
UPDATED_TIME as "updatedTime", <!-- 更新时间 -->
REMARK as "remark" <!-- 备注 -->
FROM hpjx.t_hpsc002 WHERE PARENT_PRDT_CODE = #id#
</select>
<update id="updateTreeNodeLeaf"> <update id="updateTreeNodeLeaf">
UPDATE hpjx.t_hpsc002 SET LEAF = #leaf# WHERE ID = #id# UPDATE hpjx.t_hpsc002 SET LEAF = #leaf# WHERE ID = #id#
</update> </update>
<update id="check">
UPDATE hpjx.t_hpsc002 SET status = #status# WHERE ID = #id#
</update>
<update id="bindDocIdById">
UPDATE hpjx.t_hpsc002 SET FILE_PATH1 = #filePath1# WHERE ID = #id#
</update>
</sqlMap> </sqlMap>
\ No newline at end of file
...@@ -10,48 +10,67 @@ ...@@ -10,48 +10,67 @@
<EF:EFPage title="物料清单"> <EF:EFPage title="物料清单">
<EF:EFRegion id="inqu" title="查询条件"> <EF:EFRegion id="inqu" title="查询条件">
<div class="row"> <div class="row">
<EF:EFInput ename="custType" cname="客商类型:" row="0"/> <EF:EFInput ename="projName" cname="项目名称" blockId="inqu_status" row="0"/>
<EF:EFSelect cname="分类:" optionLabel="全部" blockId="inqu_status" ename="custClassify" row="0"> <EF:EFInput ename="prdtName" cname="产品名称" blockId="inqu_status" row="0"/>
<EF:EFOption label="供应商" value="1"/> <EF:EFSelect cname="状态" optionLabel="全部" blockId="inqu_status" ename="status" row="0">
<EF:EFOption label="客户" value="2"/> <EF:EFOption label="未审核" value="0"/>
</EF:EFSelect> <EF:EFOption label="已审核" value="1"/>
<EF:EFSelect cname="状态:" optionLabel="全部" blockId="inqu_status" ename="status" row="0">
<EF:EFOption label="启用" value="1"/>
<EF:EFOption label="停用" value="0"/>
</EF:EFSelect> </EF:EFSelect>
</div> </div>
<EF:EFInput ename="parentPrdtCode" blockId="inqu_status" hidden="true"/>
<EF:EFButton ename="QUERY" cname="查询" row="1" class="btn-align-right"></EF:EFButton> <EF:EFButton ename="QUERY" cname="查询" row="1" class="btn-align-right"></EF:EFButton>
</EF:EFRegion> </EF:EFRegion>
<div id="splitter" class="i-fit-height" style="display: inline"> <div id="splitter" class="i-fit-height" style="display: inline">
<div id="left-pane" class="i-fit-height" style="width: 20%;float:left;"> <div id="left-pane" class="i-fit-height" style="width: 20%;float:left;">
<EF:EFRegion id="projTree" title="BOM结构图" fitHeight="true"> <EF:EFRegion id="projTree" title="BOM结构图" fitHeight="true">
<EF:EFTree id="materialTree" valueField="label" textField="text" hasChildren="leaf" <EF:EFTree id="materialTree"
serviceName="HPSC002" methodName="queryTreeNode"> valueField="label"
textField="text"
hasChildren="leaf"
serviceName="HPSC002"
methodName="queryTreeNode">
</EF:EFTree> </EF:EFTree>
</EF:EFRegion> </EF:EFRegion>
</div> </div>
<div id="right-pane" class="i-fit-height" style="width: 80%;float: right"> <div id="right-pane" class="i-fit-height" style="width: 80%;float: right">
<EF:EFRegion id="result" title="明细信息" > <EF:EFRegion id="result" title="明细信息">
<EF:EFGrid blockId="result" autoDraw="no" > <EF:EFGrid blockId="result" autoDraw="no" checkMode="single">
<EF:EFColumn ename="id" cname="主键" hidden="true"/> <EF:EFColumn ename="id" cname="主键" hidden="true"/>
<EF:EFColumn enable="false" ename="projCode" cname="项目编码"/> <EF:EFColumn enable="false" ename="projCode" cname="项目编码"/>
<EF:EFColumn enable="false" ename="projName" cname="项目名称"/> <EF:EFColumn enable="false" ename="projName" cname="项目名称"/>
<EF:EFColumn ename="prdtCode" required="true" cname="产品编码"/> <EF:EFColumn ename="prdtCode" required="true" cname="产品编码"/>
<EF:EFColumn ename="prdtName" required="true" cname="产品名称"/> <EF:EFColumn ename="prdtName" required="true" cname="产品名称"/>
<EF:EFColumn enable="false" ename="parentPrdtCode" hidden="true" cname="上级产品名称"/> <EF:EFColumn enable="false" ename="parentPrdtCode" hidden="true" cname="上级产品名称"/>
<EF:EFColumn enable="false" ename="parentPrdtName" cname="上级产品名称"/> <EF:EFColumn enable="false" ename="parentPrdtName" cname="上级产品名称"/>
<EF:EFColumn ename="num" required="true" cname="数量"/> <EF:EFColumn ename="num" required="true" cname="数量"/>
<EF:EFColumn ename="unitWt" required="true" format="{0:N3}" cname="单重"/> <EF:EFColumn ename="unitWt" required="true" format="{0:N3}" cname="单重"/>
<EF:EFColumn enable="false" format="{0:N3}" ename="totalWt" cname="总重"/> <EF:EFColumn enable="false" format="{0:N3}" ename="totalWt" cname="总重"/>
<EF:EFComboColumn enable="false" ename="status" align="center"
columnTemplate="#=textField#" optionLabel=" "
itemTemplate="#=textField#" textField="textField"
valueField="valueField" cname="审核状态">
<EF:EFOption label="未审核" value="0"></EF:EFOption>
<EF:EFOption label="已审核" value="1"></EF:EFOption>
</EF:EFComboColumn>
<EF:EFComboColumn enable="false" ename="delStatus" align="center"
columnTemplate="#=textField#" optionLabel=" "
itemTemplate="#=textField#" textField="textField"
valueField="valueField" cname="删除标识">
<EF:EFOption label="" value="1"></EF:EFOption>
<EF:EFOption label="删除" value="0"></EF:EFOption>
</EF:EFComboColumn>
<EF:EFColumn ename="operator" cname="操作" width="200" readonly="false"/>
</EF:EFGrid> </EF:EFGrid>
</EF:EFRegion> </EF:EFRegion>
</div> </div>
</div> </div>
<%-- EEDM8010页面加载时,不会加载EEDM6000 (lazyload="true") --%>
<EF:EFWindow id="uploadFile" url="${ctx}/web/HPSC099" lazyload="true" refresh="true">
</EF:EFWindow>
</EF:EFPage> </EF:EFPage>
<script> <script>
var ctx = "${ctx}"; let ctx="${ctx}";
</script> </script>
<script src="${ctx}/HP/SC/HPSC002.js"></script> <script src="${ctx}/HP/SC/HPSC002.js"></script>
\ No newline at end of file
$(function () {
IPLATUI.EFUpload = {
uploadFile: {
success: function(e) {
$("#fileDocId").val(e.response.docId);
NotificationUtil("附件上传成功");
console.log($("#fileDocId").val())
},
}
};
});
\ No newline at end of file
<!DOCTYPE html>
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="EF" tagdir="/WEB-INF/tags/EF" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<head>
<%-- <link rel="stylesheet" href="${ctx}/css/simulatedOperation.css"/>--%>
</head>
<EF:EFPage title="附件上传">
<EF:EFRegion id="result">
<EF:EFUpload blockId="result" ename="uploadFile" docTag="hk_file11" path="A"/>
</EF:EFRegion>
<EF:EFInput ename="fileDocId" cname="" hidden="true"/>
</EF:EFPage>
<script>
var ctx = "${ctx}";
</script>
<script src="${ctx}/HP/SC/HPSC099.js"></script>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment