Commit 0232928a by liulei

移动端接口优化、产品模板需求

parent 55135f43
...@@ -252,6 +252,50 @@ public enum DdynamicEnum { ...@@ -252,6 +252,50 @@ public enum DdynamicEnum {
FACTORY_CODE_BLOCK_ID("factory_code_block_id","factoryCode","factoryName","HPXS001.queryFactoryCode"), FACTORY_CODE_BLOCK_ID("factory_code_block_id","factoryCode","factoryName","HPXS001.queryFactoryCode"),
/** /**
* 模块:巡检填报APP下拉
* 用途:巡检填报APP下拉查询
* 编写:ll
*/
APP_MAP_BLOCK_FACTORY("app_map_block_factory","factoryCode","factoryName","HPMT002.queryFactory"),
/**
* 模块:巡检填报APP下拉
* 用途:巡检填报APP下拉查询
* 编写:ll
*/
APP_MAP_BLOCK_ORG_NO("app_map_block_org_no","orgNo","orgName","HPMT002.queryOrgNo"),
/**
* 模块:巡检填报APP下拉
* 用途:巡检填报APP下拉查询
* 编写:ll
*/
APP_MAP_BLOCK_PROJCODE("app_map_block_projcode","projCode","projName","HPMT002.queryProjCode"),
/**
* 模块:巡检填报APP下拉
* 用途:巡检填报APP下拉查询
* 编写:ll
*/
APP_MAP_BLOCK_PRDTCODE("app_map_block_prdtcode","prdtCode","prdtName","HPMT002.queryPrdtCode"),
/**
* 模块:巡检填报APP下拉
* 用途:巡检填报APP下拉查询
* 编写:ll
*/
APP_MAP_BLOCK_PARTCODE("app_map_block_partcode","partCode","partName","HPMT002.queryPartCode"),
/**
* 模块:巡检填报APP下拉
* 用途:巡检填报APP下拉查询
* 编写:ll
*/
APP_MAP_BLOCK_PRODTASKNO("app_map_block_prodtaskno","prodTaskNo","prodorderNo","HPMT002.queryProdTaskNo");
FACTORY_CODE_BLOCK_ID("factory_code_block_id","factoryCode","factoryName","HPXS001.queryFactoryCode"),
/**
* 模块:工人管理 * 模块:工人管理
* 用途:工人管理下拉框 * 用途:工人管理下拉框
* 编写:wwl * 编写:wwl
......
...@@ -48,8 +48,7 @@ public class ServiceHPMT001 extends ServiceBase { ...@@ -48,8 +48,7 @@ public class ServiceHPMT001 extends ServiceBase {
* @return * @return
*/ */
public EiInfo pmOverview(EiInfo inInfo) { public EiInfo pmOverview(EiInfo inInfo) {
Map queryMap = EiInfoUtils.getFirstRow(inInfo); String queryMonth = inInfo.getString("queryMonth");
String queryMonth = MapUtils.getString(queryMap, "queryMonth");
String companyCode = UserSessionUtils.getCompanyCode(); String companyCode = UserSessionUtils.getCompanyCode();
if (StrUtil.isEmpty(companyCode)) { if (StrUtil.isEmpty(companyCode)) {
inInfo.setMsg("账号异常"); inInfo.setMsg("账号异常");
...@@ -86,8 +85,7 @@ public class ServiceHPMT001 extends ServiceBase { ...@@ -86,8 +85,7 @@ public class ServiceHPMT001 extends ServiceBase {
* @return * @return
*/ */
public EiInfo pmBenchmarking(EiInfo inInfo) { public EiInfo pmBenchmarking(EiInfo inInfo) {
Map queryMap = EiInfoUtils.getFirstRow(inInfo); String queryMonth = inInfo.getString("queryMonth");
String queryMonth = MapUtils.getString(queryMap, "queryMonth");
String companyCode = UserSessionUtils.getCompanyCode(); String companyCode = UserSessionUtils.getCompanyCode();
if (StrUtil.isEmpty(companyCode)) { if (StrUtil.isEmpty(companyCode)) {
inInfo.setMsg("账号异常"); inInfo.setMsg("账号异常");
......
package com.baosight.hpjx.hp.mt.service; package com.baosight.hpjx.hp.mt.service;
import cn.hutool.core.util.PageUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.baosight.hpjx.common.DdynamicEnum; import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.core.constant.CommonConstant; import com.baosight.hpjx.core.constant.CommonConstant;
...@@ -64,29 +65,57 @@ public class ServiceHPMT002 extends ServiceBase { ...@@ -64,29 +65,57 @@ public class ServiceHPMT002 extends ServiceBase {
* @return * @return
*/ */
public EiInfo pmProject(EiInfo inInfo) { public EiInfo pmProject(EiInfo inInfo) {
Map queryMap = EiInfoUtils.getFirstRow(inInfo); String projName = inInfo.getString("projName");
int offset = inInfo.getInt("offset");//当前页
int pageSize = inInfo.getInt("pageSize");//每页条数
String companyCode = UserSessionUtils.getCompanyCode(); String companyCode = UserSessionUtils.getCompanyCode();
if (StrUtil.isEmpty(companyCode)) { if (StrUtil.isEmpty(companyCode)) {
inInfo.setMsg("账号异常"); inInfo.setMsg("账号异常");
} }
Map sqlMap = new HashMap(); Map sqlMap = new HashMap();
sqlMap.put("companyCode", companyCode); sqlMap.put("companyCode", companyCode);
sqlMap.put("projName", projName);
List count = this.dao.query("HPMT002.pmProjectCount", sqlMap);
offset=(offset-1)*pageSize;
sqlMap.put("offset", offset);
sqlMap.put("pageSize", pageSize);
List<Map> rows = this.dao.query("HPMT002.pmProject", sqlMap); List<Map> rows = this.dao.query("HPMT002.pmProject", sqlMap);
EiInfo outInfo = new EiInfo(); EiInfo outInfo = new EiInfo();
EiBlock eiBlock = new EiBlock(EiConstant.resultBlock); EiBlock eiBlock = new EiBlock(EiConstant.resultBlock);
eiBlock.setRows(rows); eiBlock.setRows(rows);
outInfo.setBlock(eiBlock); outInfo.setBlock(eiBlock);
outInfo.set("count",count.get(0));
return outInfo; return outInfo;
} }
/** /**
* 生产管理-项⽬跟踪总数
*
* @param inInfo
* @return
*/
public EiInfo pmProjectCount(EiInfo inInfo) {
String projName = inInfo.getString("projName");
String companyCode = UserSessionUtils.getCompanyCode();
if (StrUtil.isEmpty(companyCode)) {
inInfo.setMsg("账号异常");
}
Map sqlMap = new HashMap();
sqlMap.put("companyCode", companyCode);
sqlMap.put("projName", projName);
int count = this.dao.count("HPMT002.pmProjectCount", sqlMap);
inInfo.set("count", count);
return inInfo;
}
/**
* 生产管理-质量分析报表 * 生产管理-质量分析报表
* *
* @param inInfo * @param inInfo
* @return * @return
*/ */
public EiInfo pmQuality(EiInfo inInfo) { public EiInfo pmQuality(EiInfo inInfo) {
Map queryMap = EiInfoUtils.getFirstRow(inInfo); String queryMonth = inInfo.getString("queryMonth");
String companyCode = UserSessionUtils.getCompanyCode(); String companyCode = UserSessionUtils.getCompanyCode();
if (StrUtil.isEmpty(companyCode)) { if (StrUtil.isEmpty(companyCode)) {
inInfo.setMsg("账号异常"); inInfo.setMsg("账号异常");
...@@ -109,18 +138,27 @@ public class ServiceHPMT002 extends ServiceBase { ...@@ -109,18 +138,27 @@ public class ServiceHPMT002 extends ServiceBase {
*/ */
public EiInfo pmQualityList(EiInfo inInfo) { public EiInfo pmQualityList(EiInfo inInfo) {
String status = inInfo.getString("status"); String status = inInfo.getString("status");
String projName = inInfo.getString("projName");
int offset = inInfo.getInt("offset");//当前页
int pageSize = inInfo.getInt("pageSize");//每页条数
String companyCode = UserSessionUtils.getCompanyCode(); String companyCode = UserSessionUtils.getCompanyCode();
if (StrUtil.isEmpty(companyCode)) { if (StrUtil.isEmpty(companyCode)) {
inInfo.setMsg("账号异常"); inInfo.setMsg("账号异常");
} }
Map sqlMap = new HashMap(); Map sqlMap = new HashMap();
sqlMap.put("companyCode", companyCode); sqlMap.put("companyCode", companyCode);
sqlMap.put("projName", projName);
sqlMap.put("status", status); sqlMap.put("status", status);
List count = this.dao.query("HPMT002.pmQualityCount", sqlMap);
offset=(offset-1)*pageSize;
sqlMap.put("offset", offset);
sqlMap.put("pageSize", pageSize);
List<Map> rows = this.dao.query("HPMT002.pmQualityList", sqlMap); List<Map> rows = this.dao.query("HPMT002.pmQualityList", sqlMap);
EiInfo outInfo = new EiInfo(); EiInfo outInfo = new EiInfo();
EiBlock eiBlock = new EiBlock(EiConstant.resultBlock); EiBlock eiBlock = new EiBlock(EiConstant.resultBlock);
eiBlock.setRows(rows); eiBlock.setRows(rows);
outInfo.setBlock(eiBlock); outInfo.setBlock(eiBlock);
outInfo.set("count", count.get(0));
return outInfo; return outInfo;
} }
...@@ -180,7 +218,7 @@ public class ServiceHPMT002 extends ServiceBase { ...@@ -180,7 +218,7 @@ public class ServiceHPMT002 extends ServiceBase {
String prodCode = inInfo.getString("projCode");//项目id String prodCode = inInfo.getString("projCode");//项目id
String orgNo = inInfo.getString("orgNo");//生产组id String orgNo = inInfo.getString("orgNo");//生产组id
String inventCode = inInfo.getString("inventCode");//部件id String inventCode = inInfo.getString("inventCode");//部件id
String subInventCode = inInfo.getString("subInventCode");//件id String subInventCode = inInfo.getString("subInventCode");//件id
String companyCode = UserSessionUtils.getCompanyCode(); String companyCode = UserSessionUtils.getCompanyCode();
if (StrUtil.isEmpty(companyCode)) { if (StrUtil.isEmpty(companyCode)) {
inInfo.setMsg("账号异常"); inInfo.setMsg("账号异常");
...@@ -194,13 +232,15 @@ public class ServiceHPMT002 extends ServiceBase { ...@@ -194,13 +232,15 @@ public class ServiceHPMT002 extends ServiceBase {
sqlMap.put("subInventCode", subInventCode); sqlMap.put("subInventCode", subInventCode);
EiInfo outInfo = new EiInfo(); EiInfo outInfo = new EiInfo();
TEDCM01 tedcm01 = new TEDCM01(); TEDCM01 tedcm01 = new TEDCM01();
CommonMethod.initBlock(outInfo, Arrays.asList(DdynamicEnum.FACTORY_RECORD_BLOCK_ID), null, false); CommonMethod.initBlock(outInfo, Arrays.asList(DdynamicEnum.APP_MAP_BLOCK_FACTORY), null, false);
CommonMethod.initBlock(outInfo, Arrays.asList(DdynamicEnum.PROJ_PRODQUERY_BLOCK_ID), sqlMap, false); CommonMethod.initBlock(outInfo, Arrays.asList(DdynamicEnum.APP_MAP_BLOCK_PROJCODE), sqlMap, false);
CommonMethod.initBlock(outInfo, Arrays.asList(DdynamicEnum.PROJ_QUERYPROD_BLOCK_ID), sqlMap, false); CommonMethod.initBlock(outInfo, Arrays.asList(DdynamicEnum.APP_MAP_BLOCK_PRDTCODE), sqlMap, false);
CommonMethod.initBlock(outInfo, Arrays.asList(DdynamicEnum.INVENT_RECORD_BLOCK_ID), sqlMap, false); CommonMethod.initBlock(outInfo, Arrays.asList(DdynamicEnum.APP_MAP_BLOCK_ORG_NO), sqlMap, false);
CommonMethod.initBlock(outInfo, Arrays.asList(DdynamicEnum.GROUP_PRO_BLOCK_ID), sqlMap, false); CommonMethod.initBlock(outInfo, Arrays.asList(DdynamicEnum.APP_MAP_BLOCK_PARTCODE), sqlMap, false);
CommonMethod.initBlock(outInfo, Arrays.asList(DdynamicEnum.SUB_INVENT_RECORD_BLOCK_ID), sqlMap, false);
CommonMethod.initBlock(outInfo, Arrays.asList(DdynamicEnum.POOR_TYPE_BLOCK_ID), null, false); CommonMethod.initBlock(outInfo, Arrays.asList(DdynamicEnum.POOR_TYPE_BLOCK_ID), null, false);
if(subInventCode!=null&&!subInventCode.equals("")){
CommonMethod.initBlock(outInfo, Arrays.asList(DdynamicEnum.APP_MAP_BLOCK_PRODTASKNO), sqlMap, false);
}
return outInfo; return outInfo;
} }
......
...@@ -38,8 +38,20 @@ ...@@ -38,8 +38,20 @@
PARENT_ID = hpjx.T_HPSC003.PLAN_INFO_NO PARENT_ID = hpjx.T_HPSC003.PLAN_INFO_NO
) AS "num" <!-- 计划数量 --> ) AS "num" <!-- 计划数量 -->
FROM hpjx.T_HPSC003 WHERE COMPANY_CODE= #companyCode# FROM hpjx.T_HPSC003 WHERE COMPANY_CODE= #companyCode#
<isNotEmpty prepend=" AND " property="projName">
PROJ_NAME LIKE CONCAT('%', #projName#, '%')
</isNotEmpty>
order by STATUS,PLAN_COMPLETION_DATE
limit #offset#, #pageSize#
</select>
<select id="pmProjectCount" resultClass="int">
SELECT
COUNT(*)
FROM hpjx.T_HPSC003 WHERE COMPANY_CODE= #companyCode#
<isNotEmpty prepend=" AND " property="projName">
PROJ_NAME LIKE CONCAT('%', #projName#, '%')
</isNotEmpty>
</select> </select>
<select id="pmQuality" resultClass="java.util.HashMap"> <select id="pmQuality" resultClass="java.util.HashMap">
...@@ -48,7 +60,11 @@ ...@@ -48,7 +60,11 @@
COUNT(POOR_TYPE) AS POOR_TYPE_NUM,<!-- 单种不良品类数量 --> COUNT(POOR_TYPE) AS POOR_TYPE_NUM,<!-- 单种不良品类数量 -->
CONCAT( FORMAT(COUNT(POOR_TYPE)/ ( CONCAT( FORMAT(COUNT(POOR_TYPE)/ (
SELECT COUNT(*) FROM hpjx.t_hpzl001 WHERE SELECT COUNT(*) FROM hpjx.t_hpzl001 WHERE
COMPANY_CODE=#companyCode# )* 100,2),'%') AS NUM, COMPANY_CODE=#companyCode#
<isNotEmpty prepend=" AND " property="queryMonth">
SUBSTR(CREATED_TIME,1,6) = #queryMonth#
</isNotEmpty>
and SUBSTR(CREATED_TIME,1,6) = #queryMonth# )* 100,2),'%') AS NUM,
ITEM_CNAME AS ITEM_CNAME ITEM_CNAME AS ITEM_CNAME
FROM hpjx.t_hpzl001 A LEFT JOIN ( FROM hpjx.t_hpzl001 A LEFT JOIN (
SELECT SELECT
...@@ -58,6 +74,9 @@ ...@@ -58,6 +74,9 @@
WHERE CODESET_CODE = 'hpjx.hpjx.poorType' WHERE CODESET_CODE = 'hpjx.hpjx.poorType'
) B ON A.POOR_TYPE =B.ITEM_CODE ) B ON A.POOR_TYPE =B.ITEM_CODE
WHERE COMPANY_CODE= #companyCode# AND DELETE_FLAG =0 WHERE COMPANY_CODE= #companyCode# AND DELETE_FLAG =0
<isNotEmpty prepend=" AND " property="queryMonth">
SUBSTR(CREATED_TIME,1,6) = #queryMonth#
</isNotEmpty>
GROUP BY POOR_TYPE GROUP BY POOR_TYPE
</select> </select>
...@@ -88,6 +107,21 @@ ...@@ -88,6 +107,21 @@
WHERE CODESET_CODE = 'hpjx.hpjx.poorType' WHERE CODESET_CODE = 'hpjx.hpjx.poorType'
) B ON A.POOR_TYPE =B.ITEM_CODE ) B ON A.POOR_TYPE =B.ITEM_CODE
WHERE COMPANY_CODE= #companyCode# AND STATUS=#status# AND DELETE_FLAG =0 WHERE COMPANY_CODE= #companyCode# AND STATUS=#status# AND DELETE_FLAG =0
<isNotEmpty prepend=" AND " property="projName">
PROJ_NAME LIKE CONCAT('%', #projName#, '%')
</isNotEmpty>
order by STATUS
limit #offset#, #pageSize#
</select>
<select id="pmQualityCount" resultClass="int">
SELECT
COUNT(*)
FROM hpjx.t_hpzl001
WHERE COMPANY_CODE= #companyCode# AND STATUS=#status# AND DELETE_FLAG =0
<isNotEmpty prepend=" AND " property="projName">
PROJ_NAME LIKE CONCAT('%', #projName#, '%')
</isNotEmpty>
</select> </select>
<select id="pmQualityDetail" resultClass="java.util.HashMap"> <select id="pmQualityDetail" resultClass="java.util.HashMap">
...@@ -121,6 +155,7 @@ ...@@ -121,6 +155,7 @@
) B ON A.POOR_TYPE =B.ITEM_CODE ) B ON A.POOR_TYPE =B.ITEM_CODE
WHERE COMPANY_CODE= #companyCode# WHERE COMPANY_CODE= #companyCode#
AND DELETE_FLAG = 0 AND ID = #id# AND DELETE_FLAG = 0 AND ID = #id#
order by STATUS
</select> </select>
<insert id="insert"> <insert id="insert">
...@@ -162,4 +197,116 @@ ...@@ -162,4 +197,116 @@
SELECT CHG_NAME FROM iplat.TEUDM02 where DOC_ID=#docId# SELECT CHG_NAME FROM iplat.TEUDM02 where DOC_ID=#docId#
</select> </select>
<select id="queryFactory" resultClass="java.util.HashMap">
SELECT DISTINCT
B.FACTORY_CODE as "factoryCode",
B.FACTORY_NAME as "factoryName"
FROM HPJX.`t_hpsc005` A LEFT JOIN (
SELECT * FROM HPJX.`t_hpsc005a` WHERE COMPANY_CODE=#companyCode#
) B ON A.PROD_ORDER_NO=B.PROD_ORDER_NO WHERE A.COMPANY_CODE=#companyCode#
AND A.STATUS IN('1','2') AND B.NUM!=B.COMPLETE_NUM
</select>
<select id="queryOrgNo" resultClass="java.util.HashMap">
SELECT DISTINCT
B.ORG_NO as "orgNo",
B.ORG_NAME as "orgName"
FROM HPJX.`t_hpsc005` A LEFT JOIN (
SELECT * FROM HPJX.`t_hpsc005a` WHERE COMPANY_CODE=#companyCode#
) B ON A.PROD_ORDER_NO=B.PROD_ORDER_NO WHERE A.COMPANY_CODE=#companyCode#
AND A.STATUS IN('1','2') AND B.NUM!=B.COMPLETE_NUM
<isNotEmpty prepend=" AND " property="factoryCode">
B.FACTORY_CODE = #factoryCode#
</isNotEmpty>
</select>
<select id="queryProjCode" resultClass="java.util.HashMap">
SELECT DISTINCT
A.PROJ_CODE as "projCode",
A.PROJ_NAME as "projName"
FROM HPJX.`t_hpsc005` A LEFT JOIN (
SELECT * FROM HPJX.`t_hpsc005a` WHERE COMPANY_CODE=#companyCode#
) B ON A.PROD_ORDER_NO=B.PROD_ORDER_NO WHERE A.COMPANY_CODE=#companyCode#
AND A.STATUS IN('1','2') AND B.NUM!=B.COMPLETE_NUM
<isNotEmpty prepend=" AND " property="factoryCode">
B.FACTORY_CODE = #factoryCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="orgNo">
B.ORG_NO = #orgNo#
</isNotEmpty>
</select>
<select id="queryPrdtCode" resultClass="java.util.HashMap">
SELECT DISTINCT
A.PRDT_CODE as "prdtCode",
CONCAT(A.PRDT_NAME,'-',A.PRDT_SPEC) as "prdtName"
FROM HPJX.`t_hpsc005` A LEFT JOIN (
SELECT * FROM HPJX.`t_hpsc005a` WHERE COMPANY_CODE=#companyCode#
) B ON A.PROD_ORDER_NO=B.PROD_ORDER_NO WHERE A.COMPANY_CODE=#companyCode#
AND A.STATUS IN('1','2') AND B.NUM!=B.COMPLETE_NUM
<isNotEmpty prepend=" AND " property="factoryCode">
B.FACTORY_CODE = #factoryCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="orgNo">
B.ORG_NO = #orgNo#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="prodCode">
A.PROJ_CODE = #prodCode#
</isNotEmpty>
</select>
<select id="queryPartCode" resultClass="java.util.HashMap">
SELECT DISTINCT
A.PART_CODE as "partCode",
CONCAT(A.PART_NAME,'-',A.PART_SPEC) as "partName"
FROM HPJX.`t_hpsc005` A LEFT JOIN (
SELECT * FROM HPJX.`t_hpsc005a` WHERE COMPANY_CODE=#companyCode#
) B ON A.PROD_ORDER_NO=B.PROD_ORDER_NO WHERE A.COMPANY_CODE=#companyCode#
AND A.STATUS IN('1','2') AND B.NUM!=B.COMPLETE_NUM
<isNotEmpty prepend=" AND " property="factoryCode">
B.FACTORY_CODE = #factoryCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="orgNo">
B.ORG_NO = #orgNo#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="prodCode">
A.PROJ_CODE = #prodCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="parentPrdtCode">
A.PRDT_CODE = #parentPrdtCode#
</isNotEmpty>
</select>
<select id="queryProdTaskNo" resultClass="java.util.HashMap">
SELECT DISTINCT
B.PROD_TASK_NO as "prodTaskNo",
B.PROD_ORDER_NO as "prodorderNo"
FROM HPJX.`t_hpsc005` A LEFT JOIN (
SELECT * FROM HPJX.`t_hpsc005a` WHERE COMPANY_CODE=#companyCode#
) B ON A.PROD_ORDER_NO=B.PROD_ORDER_NO WHERE A.COMPANY_CODE=#companyCode#
AND A.STATUS IN('1','2') AND B.NUM!=B.COMPLETE_NUM
<isNotEmpty prepend=" AND " property="factoryCode">
B.FACTORY_CODE = #factoryCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="orgNo">
B.ORG_NO = #orgNo#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="prodCode">
A.PROJ_CODE = #prodCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="parentPrdtCode">
A.PRDT_CODE = #parentPrdtCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="subInventCode">
A.PART_CODE = #subInventCode#
</isNotEmpty>
LIMIT 1
</select>
</sqlMap> </sqlMap>
package com.baosight.hpjx.hp.pz.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.security.UserSessionUtils;
import com.baosight.hpjx.hp.pz.domain.HPPZ015;
import com.baosight.hpjx.hp.pz.domain.HPPZ015;
import com.baosight.hpjx.hp.pz.domain.HPPZ015A;
import com.baosight.hpjx.hp.pz.tools.HPPZTools;
import com.baosight.hpjx.hp.sc.domain.HPSC001;
import com.baosight.hpjx.hp.sc.domain.HPSC002;
import com.baosight.hpjx.hp.sc.tools.HPSCTools;
import com.baosight.hpjx.util.AssertUtils;
import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.iplat4j.core.web.threadlocal.UserSession;
import jdk.nashorn.internal.ir.IfNode;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
*
*/
public class ServiceHPPZ015 extends ServiceBase {
/**
* 画面初始化.
*/
@OperationLogAnnotation(operModul = "产品模板",operType = "查询",operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) {
HPPZ015 hppz015 = new HPPZ015();
EiInfo outInfo = super.initLoad(inInfo, hppz015);
outInfo.addBlock(EiConstant.resultBlock).addBlockMeta(hppz015.eiMetadata);
return inInfo;
}
/**
* 查询操作.
*/
@OperationLogAnnotation(operModul = "产品模板",operType = "查询",operDesc = "查询")
@Override
public EiInfo query(EiInfo inInfo) {
/* 调用EI查询方法.*/
EiInfo outInfo = super.query(inInfo, "HPPZ015.query", new HPPZ015());
return outInfo;
}
/**
* 新增操作.
*/
@OperationLogAnnotation(operModul = "产品模板",operType = "新增",operDesc = "新增")
@Override
public EiInfo insert(EiInfo inInfo) {
HashMap map = new HashMap();
map.put("projCode",inInfo.getString("projCode"));
List<HPPZ015> query = this.dao.query("HPPZ015.query", map);
if (query.size() > 0) {
inInfo.setStatus(EiConstant.STATUS_FAILURE);
inInfo.setMsg("该产品模板已存在,生成失败!");
logError("生成产品模板失败","该产品模板已存在");
return inInfo;
}
HPSC001 hpsc001 = HPSCTools.HpSc001.get(inInfo.getString("projCode"));
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try {
HPPZ015 HPPZ015 = new HPPZ015();
HPPZ015.setId(hpsc001.getId());
HPPZ015.setProjCode(inInfo.getString("projCode"));
HPPZ015.setTemplateName(inInfo.getString("templateName"));
HPPZ015.setCreatedBy(UserSession.getUserId());
HPPZ015.setCompanyCode(UserSession.getUserId());
HPPZ015.setCreatedName(UserSession.getLoginName());
HPPZ015.setCreatedTime(sdf.format(new Date()));
HPPZ015.setUpdatedBy(null);
HPPZ015.setUpdatedTime(null);
this.dao.insert("HPPZ015.insert", HPPZ015.toMap());
//模板物料清单
map.put("companyCode", UserSessionUtils.getCompanyCode());
this.dao.insert("HPPZ015A.insertMb", map);
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsg("生成产品模板成功!");
} catch (PlatException e) {
e.printStackTrace();
inInfo.setStatus(EiConstant.STATUS_FAILURE);
inInfo.setMsg("生成产品模板失败!原因参见详细错误描述!");
inInfo.setDetailMsg(e.getMessage());
logError("生成产品模板失败", e.getMessage());
return inInfo;
}
return inInfo;
}
/**
* 新增操作.
*/
@OperationLogAnnotation(operModul = "产品模板",operType = "新增",operDesc = "物料生成")
public EiInfo assign(EiInfo inInfo) {
HashMap map = new HashMap();
map.put("projCode",inInfo.getString("projCode"));
try {
//模板清单
List<HPPZ015A> hppz015AList = this.dao.query("HPPZ015A.queryById",map);
if (hppz015AList.size()==0) {
inInfo.setStatus(EiConstant.STATUS_FAILURE);
inInfo.setMsg("生成物料清单失败!该模板物料清单不存在!");
return inInfo;
}
//生成清单
HPPZTools.HpPz015A.chekParentId(hppz015AList);
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsg("生成物料清单成功!");
} catch (PlatException e) {
e.printStackTrace();
inInfo.setStatus(EiConstant.STATUS_FAILURE);
inInfo.setMsg("生成物料清单板失败!原因参见详细错误描述!");
inInfo.setDetailMsg(e.getMessage());
logError("生成物料清单失败", e.getMessage());
return inInfo;
}
return inInfo;
}
/**
* 修改操作.
*/
@OperationLogAnnotation(operModul = "产品模板",operType = "修改",operDesc = "修改")
public EiInfo update(EiInfo inInfo) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try {
HPPZ015 HPPZ015 = new HPPZ015();
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
for (int i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
HPPZ015.fromMap(map);
HPPZ015.setUpdatedBy(UserSession.getUserId());
HPPZ015.setUpdatedTime(sdf.format(new Date()));
this.dao.update("HPPZ015.update", HPPZ015.toMap());
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsg("修改成功!");
} catch (PlatException e) {
inInfo.setStatus(EiConstant.STATUS_FAILURE);
inInfo.setMsg("操作失败!原因参见详细错误描述!");
inInfo.setDetailMsg(e.getMessage());
logError("修改失败", e.getMessage());
return inInfo;
}
return query(inInfo);
}
/**
* 删除操作.
*/
@OperationLogAnnotation(operModul = "产品模板",operType = "删除",operDesc = "删除")
public EiInfo delete(EiInfo eiInfo) {
HPPZ015 HPPZ015 = new HPPZ015();
EiBlock eiBlock = eiInfo.getBlock(EiConstant.resultBlock);
try {
for (int i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
HPPZ015.fromMap(map);
this.dao.delete("HPPZ015.delete", HPPZ015.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;
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-2.dtd"> <!-- table information
Generate time : 2024-03-11 9:59:34
Version : 1.0
schema : hpjx
tableName : T_HPPZ015
ID BIGINT NOT NULL primarykey,
COMPANY_CODE VARCHAR,
DEP_CODE VARCHAR,
PROJ_CODE VARCHAR,
TEMPLATE_CODE VARCHAR,
TEMPLATE_NAME VARCHAR,
REMARK VARCHAR,
DELETE_FLAG TINYINT,
CREATED_BY VARCHAR,
CREATED_NAME VARCHAR,
CREATED_TIME VARCHAR,
UPDATED_BY VARCHAR,
UPDATED_TIME VARCHAR,
UPDATED_NAME VARCHAR
-->
<sqlMap namespace="HPPZ015">
<sql id="condition">
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="projCode">
PROJ_CODE = #projCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="templateCode">
TEMPLATE_CODE = #templateCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="templateName">
TEMPLATE_NAME LIKE CONCAT('%', #templateName#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="remark">
REMARK = #remark#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="deleteFlag">
DELETE_FLAG = #deleteFlag#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdBy">
CREATED_BY = #createdBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdName">
CREATED_NAME = #createdName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdTime">
CREATED_TIME = #createdTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedBy">
UPDATED_BY = #updatedBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedTime">
UPDATED_TIME = #updatedTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedName">
UPDATED_NAME = #updatedName#
</isNotEmpty>
</sql>
<select id="query" parameterClass="java.util.HashMap"
resultClass="com.baosight.hpjx.hp.pz.domain.HPPZ015">
SELECT
ID as "id", <!-- ID -->
COMPANY_CODE as "companyCode", <!-- 企业编码 预留 -->
DEP_CODE as "depCode", <!-- 部门编码 预留 -->
PROJ_CODE as "projCode", <!-- 项目编码 -->
TEMPLATE_CODE as "templateCode", <!-- 产品代码 -->
TEMPLATE_NAME as "templateName", <!-- 产品名称 -->
REMARK as "remark", <!-- 备注 -->
DELETE_FLAG as "deleteFlag", <!-- 是否删除0:否1.是 -->
CREATED_BY as "createdBy", <!-- 创建人 -->
CREATED_NAME as "createdName", <!-- 创建人名称 -->
CREATED_TIME as "createdTime", <!-- 创建时间 -->
UPDATED_BY as "updatedBy", <!-- 修改人 -->
UPDATED_TIME as "updatedTime", <!-- 修改人名称 -->
UPDATED_NAME as "updatedName" <!-- 修改时间 -->
FROM ${hpjxSchema}.T_HPPZ015 WHERE 1=1
<include refid="condition" />
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
ID asc
</isEmpty>
</dynamic>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hpjxSchema}.T_HPPZ015 WHERE 1=1
<include refid="condition" />
</select>
<!--
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="projCode">
PROJ_CODE = #projCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="templateCode">
TEMPLATE_CODE = #templateCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="templateName">
TEMPLATE_NAME = #templateName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="remark">
REMARK = #remark#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="deleteFlag">
DELETE_FLAG = #deleteFlag#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdBy">
CREATED_BY = #createdBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdName">
CREATED_NAME = #createdName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdTime">
CREATED_TIME = #createdTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedBy">
UPDATED_BY = #updatedBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedTime">
UPDATED_TIME = #updatedTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedName">
UPDATED_NAME = #updatedName#
</isNotEmpty>
-->
<insert id="insert">
INSERT INTO ${hpjxSchema}.T_HPPZ015 (ID, <!-- ID -->
COMPANY_CODE, <!-- 企业编码 预留 -->
DEP_CODE, <!-- 部门编码 预留 -->
PROJ_CODE, <!-- 项目编码 -->
TEMPLATE_CODE, <!-- 产品代码 -->
TEMPLATE_NAME, <!-- 产品名称 -->
REMARK, <!-- 备注 -->
DELETE_FLAG, <!-- 是否删除0:否1.是 -->
CREATED_BY, <!-- 创建人 -->
CREATED_NAME, <!-- 创建人名称 -->
CREATED_TIME, <!-- 创建时间 -->
UPDATED_BY, <!-- 修改人 -->
UPDATED_TIME, <!-- 修改人名称 -->
UPDATED_NAME <!-- 修改时间 -->
)
VALUES (#id#, #companyCode#, #depCode#, #projCode#, #templateCode#, #templateName#, #remark#, #deleteFlag#, #createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedTime#, #updatedName#)
</insert>
<delete id="delete">
DELETE FROM ${hpjxSchema}.T_HPPZ015 WHERE
ID = #id#
</delete>
<update id="update">
UPDATE ${hpjxSchema}.T_HPPZ015
SET
COMPANY_CODE = #companyCode#, <!-- 企业编码 预留 -->
DEP_CODE = #depCode#, <!-- 部门编码 预留 -->
PROJ_CODE = #projCode#, <!-- 项目编码 -->
TEMPLATE_CODE = #templateCode#, <!-- 产品代码 -->
TEMPLATE_NAME = #templateName#, <!-- 产品名称 -->
REMARK = #remark#, <!-- 备注 -->
DELETE_FLAG = #deleteFlag#, <!-- 是否删除0:否1.是 -->
CREATED_BY = #createdBy#, <!-- 创建人 -->
CREATED_NAME = #createdName#, <!-- 创建人名称 -->
CREATED_TIME = #createdTime#, <!-- 创建时间 -->
UPDATED_BY = #updatedBy#, <!-- 修改人 -->
UPDATED_TIME = #updatedTime#, <!-- 修改人名称 -->
UPDATED_NAME = #updatedName# <!-- 修改时间 -->
WHERE
ID = #id#
</update>
</sqlMap>
...@@ -7,6 +7,9 @@ import com.baosight.hpjx.core.dao.DaoUtils; ...@@ -7,6 +7,9 @@ import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.constant.HPConstant; import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.constant.HPSqlConstant; import com.baosight.hpjx.hp.constant.HPSqlConstant;
import com.baosight.hpjx.hp.pz.domain.*; import com.baosight.hpjx.hp.pz.domain.*;
import com.baosight.hpjx.hp.sc.domain.HPSC002;
import com.baosight.hpjx.hp.sc.tools.HPSCTools;
import com.baosight.hpjx.hp.pz.domain.*;
import com.baosight.hpjx.util.AssertUtils; import com.baosight.hpjx.util.AssertUtils;
import com.baosight.hpjx.util.MapUtils; import com.baosight.hpjx.util.MapUtils;
import com.baosight.hpjx.util.ObjectUtils; import com.baosight.hpjx.util.ObjectUtils;
...@@ -14,12 +17,15 @@ import com.baosight.hpjx.util.StringUtils; ...@@ -14,12 +17,15 @@ import com.baosight.hpjx.util.StringUtils;
import com.baosight.iplat4j.core.data.DaoEPBase; import com.baosight.iplat4j.core.data.DaoEPBase;
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.web.threadlocal.UserSession;
import com.baosight.iplat4j.ed.util.SequenceGenerator; import com.baosight.iplat4j.ed.util.SequenceGenerator;
import org.apache.commons.beanutils.BeanUtils; import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode; import java.math.RoundingMode;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -569,4 +575,124 @@ public class HPPZTools { ...@@ -569,4 +575,124 @@ public class HPPZTools {
} }
} }
/**
* HPSC002公共DAO定义
*
* @author:songx
* @date:2024/2/4,10:17
*/
public static class HpPz015A {
/**
* 查询
*
* @param prdtCode
* @return
*/
public static HPPZ015A getByPrdt(String prdtCode) {
AssertUtils.isEmpty(prdtCode, "部件编码不能为空");
Map queryMap = new HashMap();
queryMap.put("prdtCode", prdtCode);
List<HPPZ015A> results = DaoBase.getInstance().query("HPPZ015A.query", queryMap);
AssertUtils.isNull(results, String.format("部件编码[%s]信息不存在", prdtCode));
return results.get(0);
}
/**
* 查询节点
*
* @param id
* @return
*/
public static HPPZ015A get(Long id) {
AssertUtils.isNull(id, "节点ID不能为空");
Map queryMap = new HashMap();
queryMap.put("id", id);
List<HPPZ015A> results = DaoBase.getInstance().query("HPPZ015A.queryEntityByParentPrtdCode", queryMap);
AssertUtils.isNull(results, String.format("节点ID[%s]信息不存在", id));
return results.get(0);
}
/**
* 查询叶子节点
*
* @param parentId
* @return
*/
public static List<HPPZ015A> queryByParent(String parentId) {
AssertUtils.isEmpty(parentId, "节点ID不能为空");
Map queryMap = new HashMap();
queryMap.put("parentId", parentId);
return DaoBase.getInstance().query("HPPZ015A.queryEntityByParentPrtdCode", queryMap);
}
public static List queryTreeNodeByParentPrtdCode(String id) {
AssertUtils.isEmpty(id, "节点ID不能为空");
Map queryMap = new HashMap();
queryMap.put("id", id);
return DaoBase.getInstance().query("HPPZ015A.queryTreeNodeByParentPrtdCode", queryMap);
}
/**
* 查询叶子节点
*
* @param hppz015AList
* @return
*/
public static void chekParentId(List<HPPZ015A> hppz015AList) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
Long root = null;
Long prdtId = null;
Long prdtId_new = null;
//处理root
for (int i = 0; i<hppz015AList.size(); i++) {
if(hppz015AList.get(i).getLv().equals("1")){
HPSC002 hpsc002 = new HPSC002();
hpsc002.fromMap(hppz015AList.get(i).toMap());
hpsc002.setCreatedName(UserSession.getUserId());
hpsc002.setUpdatedTime(sdf.format(new Date()));
hpsc002.setStatus(CommonConstant.YesNo.NO_0);
hpsc002.setDelStatus(CommonConstant.YesNo.NO_0);
DaoBase.getInstance().insert("HPSC002.insert", hpsc002);
HPSC002 byProjCode = HPSCTools.HpSc002.getByProjCode(hpsc002.getProjCode());
root=byProjCode.getId();
break;
}
}
//处理部件
for (int i = 0; i<hppz015AList.size(); i++) {
if(hppz015AList.get(i).getLv().equals("2")){
prdtId=hppz015AList.get(i).getId();//旧
HPSC002 hpsc002 = new HPSC002();
hpsc002.setParentId(root.toString());
hpsc002.fromMap(hppz015AList.get(i).toMap());
hpsc002.setCreatedName(UserSession.getUserId());
hpsc002.setUpdatedTime(sdf.format(new Date()));
hpsc002.setStatus(CommonConstant.YesNo.NO_0);
hpsc002.setDelStatus(CommonConstant.YesNo.NO_0);
DaoBase.getInstance().insert("HPSC002.insert", hpsc002);
HPSC002 byProjCode = HPSCTools.HpSc002.getByProjCode(hpsc002.getProjCode());
prdtId_new=byProjCode.getId();
for (int j = 0; j<hppz015AList.size(); j++) {
if(hppz015AList.get(i).getLv().equals("3")) {
if(hppz015AList.get(j).getParentId().equals(prdtId)){
HPSC002 hpsc002_lv = new HPSC002();
hpsc002_lv.setParentId(prdtId_new.toString());
hpsc002_lv.fromMap(hppz015AList.get(i).toMap());
hpsc002_lv.setCreatedName(UserSession.getUserId());
hpsc002_lv.setUpdatedTime(sdf.format(new Date()));
hpsc002_lv.setStatus(CommonConstant.YesNo.NO_0);
hpsc002_lv.setDelStatus(CommonConstant.YesNo.NO_0);
DaoBase.getInstance().insert("HPSC002.insert", hpsc002_lv);
}
}
}
}
}
}
}
} }
package com.baosight.hpjx.hp.sc.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.hp.pz.domain.HPPZ015;
import com.baosight.hpjx.hp.sc.domain.HPSC005C;
import com.baosight.hpjx.hp.sc.tools.HPSCTools;
import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.EiInfoUtils;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.MapUtils;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceBase;
import java.util.Arrays;
import java.util.Map;
/**
* @author:songx
* @date:2024/2/6,10:39
*/
public class ServiceHPSC002C extends ServiceBase {
/**
* 画面初始化
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "产品模板",operType = "查询",operDesc = "物料清单选择-产品模板-初始化")
public EiInfo initLoad(EiInfo inInfo) {
try {
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPPZ015().eiMetadata);
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
/**
* 查询操作.
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "产品模板",operType = "查询",operDesc = "物料清单选择-产品模板-查询")
@Override
public EiInfo query(EiInfo inInfo) {
try {
Map queryRow = EiInfoUtils.getFirstRow(inInfo);
inInfo = super.query(inInfo, HPPZ015.QUERY, new HPPZ015());
} catch (Throwable e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
}
...@@ -181,17 +181,17 @@ public class HPSCTools { ...@@ -181,17 +181,17 @@ public class HPSCTools {
/** /**
* 查询 * 查询
* *
* @param projName * @param id
* @return * @return
*/ */
public static HPSC001 getId(String projName) { public static HPSC001 getId(String id) {
AssertUtils.isEmpty(projName, "项目编码不能为空"); AssertUtils.isEmpty(id, "项目编码不能为空");
String companyCode = UserSessionUtils.getCompanyCode(); String companyCode = UserSessionUtils.getCompanyCode();
Map queryMap = new HashMap(); Map queryMap = new HashMap();
queryMap.put("projName", projName); queryMap.put("id", id);
queryMap.put("companyCode", companyCode); queryMap.put("companyCode", companyCode);
List<HPSC001> results = DaoBase.getInstance().query("HPSC001.queryProjCode", queryMap); List<HPSC001> results = DaoBase.getInstance().query("HPSC001.queryProjCode", queryMap);
AssertUtils.isNull(results.get(0).getProjCode(), String.format("项目名[%s]信息不存在", projName)); AssertUtils.isNull(results.get(0).getProjCode(), String.format("项目名[%s]信息不存在", id));
return results.get(0); return results.get(0);
} }
...@@ -249,6 +249,21 @@ public class HPSCTools { ...@@ -249,6 +249,21 @@ public class HPSCTools {
} }
/** /**
* 查询
*
* @param projCode
* @return
*/
public static HPSC002 getByProjCode(String projCode) {
AssertUtils.isEmpty(projCode, "项目编码不能为空");
Map queryMap = new HashMap();
queryMap.put("projCode", projCode);
List<HPSC002> results = DaoBase.getInstance().query("HPSC002.query", queryMap);
AssertUtils.isNull(results, String.format("项目编码[%s]信息不存在", projCode));
return results.get(0);
}
/**
* 查询节点 * 查询节点
* *
* @param id * @param id
......
$(function () {
$("#QUERY").on("click", function () {
resultGrid.dataSource.page(1);
});
IPLATUI.EFGrid.result = {
pageable: {
pageSize: 20,
pageSizes: [10, 20, 50, 70, 100],
},
columns: [
{
field: "operator",
template: function (item) {
let template = '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" ' +
'onclick="jump(' + item.id + ')" >物料清单</a>';
return template;
}
}
],
}
});
function jump(id) {
var herf= ctx + "\\web\\"+ "HPPZ015A?inqu_status-0-projId=" + id;
window.open(herf);
}
<!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="inqu" title="查询条件"><%-- type="query" efRegionShowClear="true" efRegionSave="true"--%>
<div class="row"> <%-- blockId="inqu_status" row="0" --%>
<EF:EFInput blockId="inqu_status" ename="templateName" cname="模板名称:" colWidth="4" row="0"/>
<EF:EFInput blockId="inqu_status" ename="createdName" cname="创建人:" colWidth="4" row="0"/>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="记录集">
<EF:EFGrid blockId="result" autoDraw="no">
<EF:EFColumn ename="id" cname="主键" hidden="true"/>
<EF:EFColumn ename="projCode" cname="项目编码" hidden="true"/>
<EF:EFColumn ename="operator" cname="操作" enable="false" width="120" align="center"/>
<EF:EFColumn ename="templateName" cname="模板名称" enable="false" width="120" align="center"/>
<EF:EFColumn ename="createdBy" enable="false" cname="创建人"/>
<EF:EFColumn ename="createdTime" dateFormat="yyyy-MM-dd HH:mm:ss" enable="false" cname="创建时间"/>
<EF:EFColumn ename="updatedBy" enable="false" cname="修改人"/>
<EF:EFColumn ename="updatedTime" dateFormat="yyyy-MM-dd HH:mm:ss" enable="false" cname="修改时间"/>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
<script>
var ctx = "${ctx}";
</script>
<script src="${ctx}/HP/PZ/HPPZ015.js"></script>
\ 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="inqu" title="查询条件">
<div class="row">
<EF:EFSelect cname="部件名称" ename="inqu_status-0-prdtCode" colWidth="3" filter="contains" defultValue="">
<EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="invent_name_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
</div>
<%-- <EF:EFButton ename="QUERY" cname="查询" row="1" class="btn-align-right"></EF:EFButton>--%>
</EF:EFRegion>
<div id="splitter" class="i-fit-height" style="display: inline">
<div id="left-pane" class="i-fit-height" style="width: 20%;float:left;">
<EF:EFRegion id="projTree" title="BOM结构图" fitHeight="true">
<EF:EFTree id="materialTree"
valueField="label"
textField="text"
hasChildren="leaf"
serviceName="HPPZ015A"
methodName="queryTreeNode">
</EF:EFTree>
</EF:EFRegion>
</div>
<div id="right-pane" class="i-fit-height" style="width: 80%;float: right">
<EF:EFRegion id="result" title="明细信息">
<EF:EFGrid blockId="result" autoDraw="override">
<EF:EFColumn ename="id" cname="主键" hidden="true"/>
<EF:EFColumn ename="level" cname="层级" hidden="true"/>
<EF:EFColumn ename="projCode" cname="项目编码" enable="false" hidden="true"/>
<EF:EFColumn ename="projName" cname="项目名称" enable="false" hidden="true"/>
<EF:EFComboColumn ename="prdtType" cname="部件类型" align="center" required="true"
filter="contains" width="90" enable="false" hidden="true">
<EF:EFOptions blockId="codeset_code_block_id" valueField="valueField" textField="textField"/>
</EF:EFComboColumn>
<EF:EFColumn ename="prdtCode" cname="部件编码" hidden='true'/>
<EF:EFColumn ename="prdtName" cname="部件名称" width="140" align="center" maxLength="50"
required="true"/>
<EF:EFColumn ename="length" cname="长(MM)" width="80" format="{0:N3}" maxLength="12" displayType="0.000"
data-regex="/^-?[0-9]{1,9}([.][0-9]{1,3})?$/"
data-errorprompt="请输入数字,该值最大可设置9位整数和3位小数!"/>
<EF:EFColumn ename="width" cname="宽(MM)" width="80" format="{0:N3}" maxLength="12" displayType="0.000"
data-regex="/^-?[0-9]{1,9}([.][0-9]{1,3})?$/"
data-errorprompt="请输入数字,该值最大可设置9位整数和3位小数!"/>
<EF:EFColumn ename="thick" cname="厚(MM)" width="80" format="{0:N3}" maxLength="12" displayType="0.000"
data-regex="/^-?[0-9]{1,9}([.][0-9]{1,3})?$/"
data-errorprompt="请输入数字,该值最大可设置9位整数和3位小数!"/>
<EF:EFColumn enable="false" ename="parentId" hidden="true" cname="上级部件名称"/>
<EF:EFColumn enable="false" ename="parentPrdtName" hidden="true" cname="上级部件名称"/>
<EF:EFColumn ename="unitWt" format="{0:N3}" cname="单重(T)" maxLength="15" displayType="0.000"
data-regex="/^-?[0-9]{1,12}([.][0-9]{1,3})?$/"
data-errorprompt="请输入数字,该值最大可设置12位整数和3位小数!"
required="true"/>
</EF:EFGrid>
</EF:EFRegion>
</div>
</div>
</EF:EFPage>
<script>
let ctx="${ctx}";
</script>
<script src="${ctx}/HP/SC/HPSC012.js"></script>
...@@ -420,10 +420,115 @@ $(function () { ...@@ -420,10 +420,115 @@ $(function () {
window.location.href = href; window.location.href = href;
}); });
/**
* 生成模板
*/
$("#GENERATE").on("click", function () {
var projCode = IPLATUI.EFTree.materialTree.selectTreeNode.projCode;
if (projCode === undefined) {
IPLAT.alert({
message: '<b>请选择项目列表</b>',
okFn: function (e) {
},
title: '提示'
});
}else {
IPLAT.confirm({
message: '<b>模板名称:<red>*<red></b> <input id="generateName" name="generateName" ' +
'class="k-textbox" with="30px" required="true" />',
okFn: function (e) {
var generateName = $("#generateName").val();
if (generateName === "") {
message("模板名称不能为空!");
} else {
generateMode(projCode, generateName);
}
},
cancelFn: function (e) {
IPLAT.NotificationUtil('取消该操作');
},
title: '生成物料清单模板确认',
minWidth: 300
});
}
});
// 模板选择
$("#ASSIGN").on("click", assign);
/**
* 物料生成
*/
function assign() {
var projCode = IPLATUI.EFTree.materialTree.selectTreeNode.projCode;
if (projCode === undefined) {
IPLAT.alert({
message: '<b>请选择项目列表</b>',
okFn: function (e) {
},
title: '提示'
});
}else {
JSColorbox.open({
href: "HPSC002C?methodName=initLoad",
title: "<div style='text-align: center;'>选择产品模板</div>",
width: "70%",
height: "70%",
callbackName: function (row) {
var info = new EiInfo()
info.set("id", row.id);
info.set("projCode", row.projCode);
/* EiCommunicator.send("HPPZ015", "assign", info, {
onSuccess: function (ei) {
if (ei["status"] == -1) {
NotificationUtil(ei, "error");
} else {
NotificationUtil({
msg: ei.msg
});
// 刷新列表
resultGrid.dataSource.page(1);
// 关闭弹窗
JSColorbox.close();
}
}, onFail: function (ei) {
}
}, {async: false});*/
}
});
}
}
function generateMode(projCode,generateName) {
const inEiInfo = new EiInfo();
inEiInfo.set("projCode", projCode);
inEiInfo.set("templateName", generateName);
EiCommunicator.send('HPPZ015', 'insert', inEiInfo, {
onSuccess(response) {
if(response.status === -1) {
IPLAT.NotificationUtil(response.msg, "error");
}
else {
IPLAT.NotificationUtil(response.msg);
}
},
onFail(errorMessage, status, e) {
NotificationUtil("执行失败!", e.message);
}
},
{
async: false
}
);
}
// 关闭事件 // 关闭事件
IPLATUI.EFWindow = { IPLATUI.EFWindow = {
"uploadFile": { "uploadFile": {
close: function (e) { close: function (e) {
var tree = $("#materialTree").data("kendoTreeView");
let $iframe = uploadFileWindow.element.children("iframe"); let $iframe = uploadFileWindow.element.children("iframe");
let iframejQuery = $iframe[0].contentWindow.$; // 子窗口中的jQuery对象 let iframejQuery = $iframe[0].contentWindow.$; // 子窗口中的jQuery对象
let uploadFile = iframejQuery("#fileDocId").val(); let uploadFile = iframejQuery("#fileDocId").val();
...@@ -541,6 +646,7 @@ function check(id, auditStatus) { ...@@ -541,6 +646,7 @@ function check(id, auditStatus) {
); );
} }
/** /**
* 删除 * 删除
*/ */
...@@ -631,3 +737,4 @@ function updateTree() { ...@@ -631,3 +737,4 @@ function updateTree() {
$(function () {
// 查询
$("#QUERY").on("click", query);
IPLATUI.EFGrid = {
"result": {
pageable: {
input: true,
numeric: false,
pageSize: 15,
position: 'top',
pageSizes: [15, 50, 100, 200]
},
columns: []
}
}
$("#CONFIRM").on("click", function () {
let rows = resultGrid.getCheckedRows()
console.log(rows)
if (rows.length != 1) {
message("请选择一条数据 ");
return;
}
let row = rows[0];
let isInput= decodeURI(window.location.href.split("&")[1]);
if(isInput==="isInput"){
parent.JSColorbox.setValueCallback(row);
return;
};
JSUtils.confirm("确定选择改模板吗? ", {
ok: function () {
parent.JSColorbox.setValueCallback(row);
}
});
});
$('input[name="inqu_status-0-factoryCode"]').change(function () {
var inInfo=new EiInfo();
var factoryCode=$("#inqu_status-0-factoryCode").val();
var orgType = $('#inqu_status-0-orgType').val();
inInfo.set("inqu_status-0-parentOrgId",factoryCode);
inInfo.set("inqu_status-0-orgType",orgType);
EiCommunicator.send("HPXSOrg", "queryGroupComboBox", inInfo, {
onSuccess: function (ei) {
var input=$("#inqu_status-0-groupCode");
dataEdition=ei.getBlock("group_record_block_id").getMappedRows();
input.kendoDropDownList({
valuePrimitive: true,
dataTextField: "textField",
dataValueField: "valueField",
optionLabel:"请选择",
dataSource: dataEdition,
template: "#=textField#"
});
}, onFail: function (ei) {
}
}, {async: false});
});
});
$(window).load(function () {
// 查询
query();
});
let query = function () {
resultGrid.dataSource.page(1);
}
\ 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}"/>
<EF:EFPage title="产品模板">
<EF:EFRegion id="inqu" title="查询条件">
<EF:EFInput cname="组类型" ename="orgType" blockId="inqu_status" row="0" type="hidden"/>
<div class="row">
<EF:EFInput blockId="inqu_status" ename="templateName" cname="模板名称:" colWidth="4" row="0"/>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="明细信息">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true" checkMode="single,row">
<EF:EFColumn ename="id" cname="主键" hidden="true"/>
<EF:EFColumn ename="projCode" cname="项目编码" hidden="true"/>
<EF:EFColumn ename="templateName" cname="模板名称" enable="false" width="120" align="center"/>
<EF:EFColumn ename="createdBy" enable="false" cname="创建人"/>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
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