Commit 201a113f by 宋祥

1.厂区管理

2.出库单打印
parent cabb2d63
...@@ -138,6 +138,23 @@ ...@@ -138,6 +138,23 @@
<artifactId>lowcode-plugin</artifactId> <artifactId>lowcode-plugin</artifactId>
<version>1.0.8</version> <version>1.0.8</version>
</dependency> </dependency>
<!-- okhttp -->
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>4.11.0</version>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib</artifactId>
<version>1.6.20</version>
</dependency>
<!-- excel -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>5.2.3</version>
</dependency>
</dependencies> </dependencies>
<build> <build>
......
...@@ -107,7 +107,20 @@ public enum DdynamicEnum { ...@@ -107,7 +107,20 @@ public enum DdynamicEnum {
* 编写:yk * 编写:yk
*/ */
USER_BLOCK_ID("user_block_id","loginName","userName","HPXSUser.queryComboBox"), USER_BLOCK_ID("user_block_id","loginName","userName","HPXSUser.queryComboBox"),
/**
* 模块:厂区管理
* 用途:厂区管理下拉框
* 编写:songx
*/
FACTORY_RECORD_BLOCK_ID("factory_record_block_id","factoryCode","factoryName","HPPZ011.queryComboBox"),
/**
* 模块:组管理
* 用途:组管理下拉框
* 编写:songx
*/
GROUP_RECORD_BLOCK_ID("group_record_block_id","groupCode","groupName","HPPZ011.queryGroupComboBox"),
//------------------------------------生产管理----------------------------------- //------------------------------------生产管理-----------------------------------
/** /**
...@@ -115,10 +128,19 @@ public enum DdynamicEnum { ...@@ -115,10 +128,19 @@ public enum DdynamicEnum {
* 用途:项目档案下拉框 * 用途:项目档案下拉框
* 编写:wwl * 编写:wwl
*/ */
PROJ_RECORD_BLOCK_ID("proj_record_block_id","projCode","projName","HPSC001.queryComboBox"); PROJ_RECORD_BLOCK_ID("proj_record_block_id","projCode","projName","HPSC001.queryComboBox"),
//------------------------------------用户管理-----------------------------------
/** 将结果集放入的块名 */
/**
* 模块:组织机构
* 用途:项目档案下拉框
* 编写:wwl
*/
ORG_RECORD_BLOCK_ID("org_record_block_id","orgId","orgCname","HPXSOrg.queryComboBox");
/** 将结果集放入的块名 */
private final String blockId; private final String blockId;
/** 字段名 */ /** 字段名 */
private final String value; private final String value;
......
package com.baosight.hpjx.core.api;
import com.alibaba.fastjson.JSONObject;
import com.baosight.hpjx.util.Base64Utils;
import com.baosight.hpjx.util.FileUtils;
import com.baosight.hpjx.util.HttpUtils;
import java.io.IOException;
import java.net.URLEncoder;
import java.util.HashMap;
import java.util.Map;
import lombok.extern.slf4j.Slf4j;
/**
* @author:songx
* @date:2024/1/29,9:16
*/
@Slf4j
public class BaiDuApi {
// 鉴权接口
private static final String TOKEN_URL = "https://aip.baidubce.com/oauth/2.0/token";
// 标准版接口地址
private static final String BASIC_URL = "https://aip.baidubce.com/rest/2.0/ocr/v1/general_basic";
// 办公文档版接口地址
private static final String OFFICE_URL = "https://aip.baidubce.com/rest/2.0/ocr/v1/doc_analysis_office";
// Api Key
private static final String API_KEY = "dkXgTCScKjfMmL7oCzAIFdgZ";
// Secret Key
private static final String SECRET_KEY = "xP5V9k23KBNHOyzc0rYkm00GdQMMxvEh";
/**
* 获取TOKEN
*
* @return
*/
public static String getToken() {
return SingletonHolder.TOKEN;
}
/**
* 刷新TOKEN
*
* @return
*/
public static void refreshToken() {
SingletonHolder.refresh();
}
public static void main(String[] args) throws IOException {
// String filePath = "e:/10001.jpg";
String filePath = "e:/新年贺词.pdf";
docAnalysisOffice(filePath);
}
/**
* 解析办公文档
*
* @param filePath 本地文件地址
*/
public static void docAnalysisOffice(String filePath) throws IOException {
byte[] fileBytes = FileUtils.readByBytes(filePath);
String fileBase64 = Base64Utils.encode(fileBytes);
String fileEncoder = URLEncoder.encode(fileBase64, "UTF-8");
String param = "pdf_file_num=2&image=" + fileEncoder;
Map<String, String> header = new HashMap<>();
header.put("Content-Type", "application/x-www-form-urlencoded");
String url = OFFICE_URL + "?access_token=" + getToken();
String result = HttpUtils.post(url, header, param, HttpUtils.FORM_MEDIA_TYPE);
log.info("result->{}", result);
}
/**
* 静态内部类用于初始化
*
* @author:songx
* @date:2022/5/9,15:48
*/
private static class SingletonHolder {
/**
* 默认DAO
*/
private static String TOKEN = "24.717d5b52074bdf31d0377a4afa6c97d6.2592000.1709101017.282335-48528257";//getToken();
/**
* 获取TOKEN
*
* @return
* @throws IOException
*/
private static String getToken() {
try {
String url = String.format("%s?client_id=%s&client_secret=%s&grant_type=client_credentials",
TOKEN_URL, API_KEY, SECRET_KEY);
String result = HttpUtils.post(url);
JSONObject resultJson = JSONObject.parseObject(result);
return resultJson.getString("access_token");
} catch (Exception e) {
log.error("获取百度API的TOKEN失败:{}", e.getMessage(), e);
}
return null;
}
/**
* 刷新TOKEN
*
* @return
*/
public static void refresh() {
TOKEN = getToken();
}
}
}
/*
* 武汉理工数字传播工程有限公司源代码,版权归武汉理工数字传播工程有限公司所有.
* 项目名称 : pcloud-common
* 创建日期 : 2017年3月3日
* 修改历史 :
* 1. [2017年3月3日]创建文件 by xnxqs
*/
package com.baosight.hpjx.core.constant;
/**
* 与操作系统 有关的一些常量.
*
* @author:songx
* @date:2019/12/12,16:32
*/
public class OSConstant {
/**
* 文件夹分隔符,不同OS下分隔符不同
*/
public final static String SEPARATOR = System.getProperty("file.separator");
/**
* 程序运行目录
*/
public final static String USER_DIR = System.getProperty("user.dir");
/**
* 逗号
*/
public final static String COMMA = ",";
/**
* 程序运行目录
*/
public final static String DOWN_DIR = USER_DIR + SEPARATOR + "download";
}
...@@ -14,6 +14,10 @@ public class HPConstant { ...@@ -14,6 +14,10 @@ public class HPConstant {
*/ */
public class SequenceId { public class SequenceId {
// 组编码
public static final String GROUP_CODE = "GROUP_CODE";
// 厂区编码
public static final String FACTORY_CODE = "FACTORY_CODE";
// 企业编码 // 企业编码
public static final String COMPANY_CODE = "COMPANY_CODE"; public static final String COMPANY_CODE = "COMPANY_CODE";
//项目档案编号 //项目档案编号
......
...@@ -176,4 +176,16 @@ public class HPSqlConstant { ...@@ -176,4 +176,16 @@ public class HPSqlConstant {
public static final String QUERY = "HPPZ010.query"; public static final String QUERY = "HPPZ010.query";
} }
/**
* HPPZ011 SQL 定义
*
* @author:songx
* @date:2024/1/18,17:17
*/
public class HPPZ011 {
// 查询
public static final String GET = "HPPZ011.get";
}
} }
...@@ -28,7 +28,6 @@ public class HPKC003 extends DaoEPBase { ...@@ -28,7 +28,6 @@ public class HPKC003 extends DaoEPBase {
public static final String FIELD_DOCUMENT_DATE = "documentDate"; /* 单据日期*/ public static final String FIELD_DOCUMENT_DATE = "documentDate"; /* 单据日期*/
public static final String FIELD_PROD_NO = "prodNo"; /* 生产入库单号*/ public static final String FIELD_PROD_NO = "prodNo"; /* 生产入库单号*/
public static final String FIELD_PROD_NO_OLD = "prodNoOld"; /* 生产入库单号(旧)*/ public static final String FIELD_PROD_NO_OLD = "prodNoOld"; /* 生产入库单号(旧)*/
public static final String FIELD_PRODUCTION_ORDER_NO = "productionOrderNo"; /* 生产订单号*/ public static final String FIELD_PRODUCTION_ORDER_NO = "productionOrderNo"; /* 生产订单号*/
public static final String FIELD_WH_CODE = "whCode"; /* 仓库编码*/ public static final String FIELD_WH_CODE = "whCode"; /* 仓库编码*/
public static final String FIELD_WH_NAME = "whName"; /* 仓库名称*/ public static final String FIELD_WH_NAME = "whName"; /* 仓库名称*/
...@@ -47,14 +46,12 @@ public class HPKC003 extends DaoEPBase { ...@@ -47,14 +46,12 @@ public class HPKC003 extends DaoEPBase {
public static final String FIELD_UPDATED_NAME = "updatedName"; /* 修改人名称*/ public static final String FIELD_UPDATED_NAME = "updatedName"; /* 修改人名称*/
public static final String FIELD_DELETE_FLAG = "deleteFlag"; /* 是否删除0:否1.是*/ public static final String FIELD_DELETE_FLAG = "deleteFlag"; /* 是否删除0:否1.是*/
public static final String COL_ID = "ID"; public static final String COL_ID = "ID";
public static final String COL_COMPANY_CODE = "COMPANY_CODE"; /* 企业编码 预留*/ public static final String COL_COMPANY_CODE = "COMPANY_CODE"; /* 企业编码 预留*/
public static final String COL_DEP_CODE = "DEP_CODE"; /* 部门编码*/ public static final String COL_DEP_CODE = "DEP_CODE"; /* 部门编码*/
public static final String COL_DOCUMENT_DATE = "DOCUMENT_DATE"; /* 单据日期*/ public static final String COL_DOCUMENT_DATE = "DOCUMENT_DATE"; /* 单据日期*/
public static final String COL_PROD_NO = "PROD_NO"; /* 生产入库单号*/ public static final String COL_PROD_NO = "PROD_NO"; /* 生产入库单号*/
public static final String COL_PROD_NO_OLD = "PROD_NO_OLD"; /* 生产入库单号*/ public static final String COL_PROD_NO_OLD = "PROD_NO_OLD"; /* 生产入库单号*/
public static final String COL_PRODUCTION_ORDER_NO = "PRODUCTION_ORDER_NO"; /* 生产订单号*/ public static final String COL_PRODUCTION_ORDER_NO = "PRODUCTION_ORDER_NO"; /* 生产订单号*/
public static final String COL_WH_CODE = "WH_CODE"; /* 仓库编码*/ public static final String COL_WH_CODE = "WH_CODE"; /* 仓库编码*/
public static final String COL_WH_NAME = "WH_NAME"; /* 仓库名称*/ public static final String COL_WH_NAME = "WH_NAME"; /* 仓库名称*/
...@@ -72,7 +69,13 @@ public class HPKC003 extends DaoEPBase { ...@@ -72,7 +69,13 @@ public class HPKC003 extends DaoEPBase {
public static final String COL_UPDATED_TIME = "UPDATED_TIME"; /* 更新时间*/ public static final String COL_UPDATED_TIME = "UPDATED_TIME"; /* 更新时间*/
public static final String COL_UPDATED_NAME = "UPDATED_NAME"; /* 修改人名称*/ public static final String COL_UPDATED_NAME = "UPDATED_NAME"; /* 修改人名称*/
public static final String COL_DELETE_FLAG = "DELETE_FLAG"; /* 存货类型*/ public static final String COL_DELETE_FLAG = "DELETE_FLAG"; /* 存货类型*/
public static final String QUERY = "HPKC003.query";
public static final String COUNT = "HPKC003.count";
public static final String INSERT = "HPKC003.insert";
public static final String UPDATE = "HPKC003.update";
public static final String DELETE = "HPKC003.delete";
private Long id = null; private Long id = null;
private String companyCode = " "; /* 企业编码 预留*/ private String companyCode = " "; /* 企业编码 预留*/
private String depCode = " "; /* 部门编码*/ private String depCode = " "; /* 部门编码*/
......
...@@ -88,10 +88,9 @@ public class ServiceHPKC003 extends ServiceBase { ...@@ -88,10 +88,9 @@ public class ServiceHPKC003 extends ServiceBase {
fKc003.setInventName(HPPZTools.getPz004ByCode(fKc003.getInventCode()).getInventName()); fKc003.setInventName(HPPZTools.getPz004ByCode(fKc003.getInventCode()).getInventName());
// 生成入库单号 // 生成入库单号
fKc003.setProdNo(SequenceGenerator.getNextSequence(HPConstant.SequenceId.HPKC003_PROD_NO)); fKc003.setProdNo(SequenceGenerator.getNextSequence(HPConstant.SequenceId.HPKC003_PROD_NO));
DaoUtils.insert("HPKC003.insert", fKc003); DaoUtils.insert(HPKC003.INSERT, fKc003);
//同步生产计划 //同步生产计划
DaoUtils.update("HPSC004.update",this.synchronousPlan(fKc003)); DaoUtils.update(HPSC004.UPDATE,this.synchronousPlan(fKc003));
// 修改库存 // 修改库存
HPKCTools.updateStock(fKc003.getWhCode(), fKc003.getInventRecordId(), fKc003.getAmount(), HPKCTools.updateStock(fKc003.getWhCode(), fKc003.getInventRecordId(), fKc003.getAmount(),
fKc003.getWeight()); fKc003.getWeight());
......
package com.baosight.hpjx.hp.pz.service;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.pz.domain.HPPZ011;
import com.baosight.hpjx.hp.pz.tools.HPPZTools;
import com.baosight.hpjx.util.AssertUtils;
import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.LogUtils;
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.ed.util.SequenceGenerator;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 厂区管理
*
* @author:songx
* @date:2024/1/18,17:15
*/
public class ServiceHPPZ011 extends ServiceBase {
/**
* 画面初始化
*
* @param inInfo
* @return
*/
public EiInfo initLoad(EiInfo inInfo) {
try {
Map queryMap = new HashMap();
queryMap.put("orgType", "dept");
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.ORG_RECORD_BLOCK_ID), queryMap);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.GROUP_RECORD_BLOCK_ID), null);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPPZ011().eiMetadata);
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
/**
* 查询数据列表
*
* @param inInfo
* @return
*/
@Override
public EiInfo query(EiInfo inInfo) {
try {
inInfo = super.query(inInfo, HPPZ011.QUERY, new HPPZ011());
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
/**
* 保存操作.
*
* @param inInfo
* @return
*/
public EiInfo save(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 数据校验
this.checkSaveData(resultRows);
// 写入数据
for (Map resultRow : resultRows) {
HPPZ011 fPz011 = new HPPZ011();
fPz011.fromMap(resultRow);
if (fPz011.getId() == null || fPz011.getId() == 0) {
this.add(fPz011);
} else {
this.modify(fPz011);
}
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
/**
* 校验保存的数据
*
* @param resultRows
*/
private void checkSaveData(List<Map> resultRows) {
// 数据校验
for (int i = 0; i < resultRows.size(); i++) {
HPPZ011 fPz011 = new HPPZ011();
fPz011.fromMap(resultRows.get(i));
AssertUtils.isEmpty(fPz011.getFactoryName(), "厂区名称不能为空");
AssertUtils.isEmpty(fPz011.getGroupCode(), "生产组名不能为空");
}
}
/**
* 新增企业信息
*
* @param fPz011
*/
private void add(HPPZ011 fPz011) {
// 校验厂区名是否存在
HPPZ011 dbPz011 = HPPZTools.getPz011ByName(fPz011.getFactoryName());
if (dbPz011 != null) {
fPz011.setFactoryCode(dbPz011.getFactoryCode());
} else {
// 生成厂区编码
fPz011.setFactoryCode(SequenceGenerator.getNextSequence(HPConstant.SequenceId.FACTORY_CODE));
}
fPz011.setDeleteFlag(CommonConstant.YesNo.NO_0);
DaoUtils.insert(HPPZ011.INSERT, fPz011);
}
/**
* 修改数据
*
* @param fPz011
*/
private void modify(HPPZ011 fPz011) {
DaoUtils.update(HPPZ011.UPDATE, fPz011);
}
/**
* 删除操作
*
* @param inInfo
* @return
*/
public EiInfo delete(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
for (int i = 0; i < resultRows.size(); i++) {
HPPZ011 fPz011 = new HPPZ011();
fPz011.fromMap(resultRows.get(i));
DaoUtils.update(HPPZ011.DELETE, fPz011);
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据删除成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "修改失败");
}
return inInfo;
}
/**
* @param inInfo
* @return
*/
public EiInfo queryComboBox(EiInfo inInfo) {
try {
List<DdynamicEnum> list = new ArrayList<>();
list.add(DdynamicEnum.FACTORY_RECORD_BLOCK_ID);
CommonMethod.initBlock(inInfo, list, new HashMap<>(), false);
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "查询厂区失败");
}
return inInfo;
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd">
<sqlMap namespace="HPPZ011">
<sql id="column">
ID as "id",
COMPANY_CODE as "companyCode", <!-- 企业编码 预留 -->
DEP_CODE as "depCode", <!-- 部门编码 预留 -->
CREATED_BY as "createdBy", <!-- 创建人 -->
CREATED_NAME as "createdName", <!-- 创建人名称 -->
CREATED_TIME as "createdTime", <!-- 创建时间 -->
UPDATED_BY as "updatedBy", <!-- 更新人 -->
UPDATED_NAME as "updatedName", <!-- 更新人名称 -->
UPDATED_TIME as "updatedTime", <!-- 更新时间 -->
FACTORY_CODE as "factoryCode", <!-- 厂区编码 -->
FACTORY_NAME as "factoryName", <!-- 厂区名称 -->
GROUP_CODE as "groupCode", <!-- 生产组编码 -->
GROUP_NAME as "groupName", <!-- 生产组名称 -->
GROUP_TYPE as "groupType" <!-- 组类型 -->
</sql>
<sql id="condition">
AND DELETE_FLAG = 0
<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="factoryCode">
FACTORY_CODE = #factoryCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="groupCode">
GROUP_CODE = #groupCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="groupName">
GROUP_NAME LIKE CONCAT('%', #groupName#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="groupType">
GROUP_TYPE = #groupType#
</isNotEmpty>
</sql>
<sql id="getCondition">
<isNotEmpty prepend=" AND " property="factoryName">
FACTORY_NAME = #factoryName#
</isNotEmpty>
</sql>
<sql id="queryCondition">
<isNotEmpty prepend=" AND " property="factoryName">
FACTORY_NAME LIKE CONCAT('%', #factoryName#, '%')
</isNotEmpty>
</sql>
<sql id="order">
<dynamic prepend="ORDER BY">
<isNotEmpty property="order">
$orderBy$
</isNotEmpty>
<isEmpty property="order">
ID ASC
</isEmpty>
</dynamic>
</sql>
<select id="query" resultClass="com.baosight.hpjx.hp.pz.domain.HPPZ011">
SELECT
<include refid="column"/>
FROM ${hpjxSchema}.T_HPPZ011
WHERE 1=1
<include refid="condition"/>
<include refid="queryCondition"/>
<include refid="order"/>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hpjxSchema}.T_HPPZ011 WHERE 1=1
<include refid="condition"/>
<include refid="queryCondition"/>
</select>
<!-- 精确查询 -->
<select id="get" resultClass="com.baosight.hpjx.hp.pz.domain.HPPZ011">
SELECT
<include refid="column"/>
FROM ${hpjxSchema}.T_HPPZ011
WHERE 1=1
<include refid="getCondition"/>
</select>
<insert id="insert">
INSERT INTO ${hpjxSchema}.T_HPPZ011 (
COMPANY_CODE, <!-- 企业编码 预留 -->
DEP_CODE, <!-- 部门编码 预留 -->
FACTORY_CODE, <!-- 厂区编码 -->
FACTORY_NAME, <!-- 厂区名称 -->
GROUP_CODE, <!-- 生产组编码 -->
GROUP_NAME, <!-- 生产组名称 -->
GROUP_TYPE, <!-- 组类型 -->
CREATED_BY, <!-- 创建人 -->
CREATED_NAME, <!-- 创建人名称 -->
CREATED_TIME, <!-- 创建时间 -->
DELETE_FLAG
) VALUES (
#companyCode#, #depCode#, #factoryCode#, #factoryName#, #groupCode#, #groupName#,
#groupType#, #createdBy#, #createdName#, #createdTime#, #deleteFlag#
)
</insert>
<!-- 逻辑删除 -->
<delete id="delete">
UPDATE ${hpjxSchema}.T_HPPZ011 SET DELETE_FLAG = 1 WHERE ID = #id#
</delete>
<update id="update">
UPDATE ${hpjxSchema}.T_HPPZ011
SET
FACTORY_NAME = #factoryName#, <!-- 厂区名称 -->
GROUP_CODE = #groupCode#, <!-- 组编码 -->
GROUP_NAME = #groupName#, <!-- 组名称 -->
GROUP_TYPE = #groupType#, <!-- 组类型 -->
UPDATED_BY = #updatedBy#, <!-- 更新人 -->
UPDATED_NAME = #updatedName#, <!-- 更新人名称 -->
UPDATED_TIME = #updatedTime# <!-- 更新时间 -->
WHERE ID = #id#
</update>
<!-- 厂区下拉框 -->
<select id="queryComboBox" parameterClass="java.util.HashMap" resultClass="java.util.HashMap">
SELECT DISTINCT
FACTORY_CODE as "factoryCode", <!-- 厂区编码 -->
FACTORY_NAME as "factoryName" <!-- 厂区名称 -->
FROM ${hpjxSchema}.T_HPPZ011
WHERE DELETE_FLAG = 0
<include refid="condition"/>
ORDER BY FACTORY_CODE ASC
</select>
<!-- 生产组拉框 -->
<select id="queryGroupComboBox" parameterClass="java.util.HashMap" resultClass="java.util.HashMap">
SELECT DISTINCT
A.GROUP_CODE as "groupCode", <!-- 组编码 -->
B.ORG_CNAME as "groupName" <!-- 组名称 -->
FROM ${hpjxSchema}.T_HPPZ011 A, ${platSchema}.TXSOG01 B
WHERE A.DELETE_FLAG = 0
AND A.GROUP_CODE = B.ORG_ID
<isNotEmpty prepend=" AND " property="factoryCode">
A.FACTORY_CODE = #factoryCode#
</isNotEmpty>
ORDER BY A.GROUP_CODE ASC
</select>
</sqlMap>
...@@ -2,9 +2,11 @@ package com.baosight.hpjx.hp.pz.tools; ...@@ -2,9 +2,11 @@ package com.baosight.hpjx.hp.pz.tools;
import com.baosight.hpjx.core.constant.CommonConstant; import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoBase; import com.baosight.hpjx.core.dao.DaoBase;
import com.baosight.hpjx.hp.constant.HPSqlConstant;
import com.baosight.hpjx.hp.pz.domain.HPPZ004;
import com.baosight.hpjx.hp.pz.domain.HPPZ007; import com.baosight.hpjx.hp.pz.domain.HPPZ007;
import com.baosight.hpjx.hp.pz.domain.HPPZ009; import com.baosight.hpjx.hp.pz.domain.HPPZ009;
import com.baosight.hpjx.hp.pz.domain.HPPZ004; import com.baosight.hpjx.hp.pz.domain.HPPZ011;
import com.baosight.hpjx.util.AssertUtils; import com.baosight.hpjx.util.AssertUtils;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
...@@ -122,6 +124,20 @@ public class HPPZTools { ...@@ -122,6 +124,20 @@ public class HPPZTools {
} }
/** /**
* 查询厂区信息
*
* @param factoryName
* @return
*/
public static HPPZ011 getPz011ByName(String factoryName) {
AssertUtils.isEmpty(factoryName, "厂区名称不能为空");
Map queryMap = new HashMap();
queryMap.put("factoryName", factoryName);
List<HPPZ011> dbPz011s = DaoBase.getInstance().query(HPSqlConstant.HPPZ011.GET, queryMap);
return CollectionUtils.isEmpty(dbPz011s) ? null : dbPz011s.get(0);
}
/**
* 企业是否启用 * 企业是否启用
* *
* @param companyCode * @param companyCode
......
...@@ -98,11 +98,11 @@ public class HPSC004 extends DaoEPBase { ...@@ -98,11 +98,11 @@ public class HPSC004 extends DaoEPBase {
public static final String COL_REMARK = "REMARK"; /* 备注*/ public static final String COL_REMARK = "REMARK"; /* 备注*/
public static final String COL_INVENT_RECORD_ID = "INVENT_RECORD_ID"; public static final String COL_INVENT_RECORD_ID = "INVENT_RECORD_ID";
public static final String QUERY = "t_hpsc004.query"; public static final String QUERY = "HPSC004.query";
public static final String COUNT = "t_hpsc004.count"; public static final String COUNT = "HPSC004.count";
public static final String INSERT = "t_hpsc004.insert"; public static final String INSERT = "HPSC004.insert";
public static final String UPDATE = "t_hpsc004.update"; public static final String UPDATE = "HPSC004.update";
public static final String DELETE = "t_hpsc004.delete"; public static final String DELETE = "HPSC004.delete";
private Long id = new Long(0); private Long id = new Long(0);
private String companyCode = " "; /* 企业编码 预留*/ private String companyCode = " "; /* 企业编码 预留*/
...@@ -495,9 +495,9 @@ public class HPSC004 extends DaoEPBase { ...@@ -495,9 +495,9 @@ public class HPSC004 extends DaoEPBase {
} }
/** /**
* set the prdtCode - 产品编码. * set the prdtType - 产品编码.
* *
* @param prdtCode - 产品编码 * @param prdtType - 产品编码
*/ */
public void setPrdtType(Integer prdtType) { public void setPrdtType(Integer prdtType) {
this.prdtType = prdtType; this.prdtType = prdtType;
...@@ -662,6 +662,7 @@ public class HPSC004 extends DaoEPBase { ...@@ -662,6 +662,7 @@ public class HPSC004 extends DaoEPBase {
public void setFilePath5(String filePath5) { public void setFilePath5(String filePath5) {
this.filePath5 = filePath5; this.filePath5 = filePath5;
} }
/** /**
* get the planCommentDate - 计划开始时间. * get the planCommentDate - 计划开始时间.
* @return the planCommentDate * @return the planCommentDate
......
package com.baosight.hpjx.hp.sc.service; package com.baosight.hpjx.hp.sc.service;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.common.HPConstants; import com.baosight.hpjx.common.HPConstants;
import com.baosight.hpjx.core.dao.DaoUtils; 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.sc.domain.HPSC003; import com.baosight.hpjx.hp.sc.domain.HPSC003;
import com.baosight.hpjx.hp.sc.domain.HPSC004; import com.baosight.hpjx.hp.sc.domain.HPSC004;
import com.baosight.hpjx.hp.sc.domain.HPSC005; import com.baosight.hpjx.hp.sc.domain.HPSC005;
import com.baosight.hpjx.util.CommonMethod;
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.service.soa.XLocalManager;
import com.baosight.iplat4j.core.util.DateUtil;
import com.baosight.iplat4j.core.web.threadlocal.UserSession; import com.baosight.iplat4j.core.web.threadlocal.UserSession;
import com.baosight.iplat4j.ed.util.SequenceGenerator; import com.baosight.iplat4j.ed.util.SequenceGenerator;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
/** /**
* *
*/ */
public class ServiceHPSC003 extends ServiceBase { public class ServiceHPSC003 extends ServiceBase {
/**
/** * 画面初始化.
* 画面初始化. *
*/ * @param inInfo
public EiInfo initLoad(EiInfo inInfo) { * @return
HPSC003 HPSC003 = new HPSC003(); */
EiInfo outInfo = super.initLoad(inInfo, HPSC003); public EiInfo initLoad(EiInfo inInfo) {
outInfo.addBlock(EiConstant.resultBlock).addBlockMeta(HPSC003.eiMetadata); CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.FACTORY_RECORD_BLOCK_ID), null);
return inInfo; HPSC003 HPSC003 = new HPSC003();
} EiInfo outInfo = super.initLoad(inInfo, HPSC003);
outInfo.addBlock(EiConstant.resultBlock).addBlockMeta(HPSC003.eiMetadata);
return inInfo;
}
/** /**
* 查询操作. * 查询操作.
......
...@@ -4,38 +4,38 @@ ...@@ -4,38 +4,38 @@
Version : 1.0 Version : 1.0
schema : hpjx schema : hpjx
tableName : T_HPSC004 tableName : T_HPSC004
ID BIGINT NOT NULL primarykey, ID BIGINT NOT NULL primarykey,
COMPANY_CODE VARCHAR NOT NULL, COMPANY_CODE VARCHAR NOT NULL,
DEPT_CODE VARCHAR NOT NULL, DEPT_CODE VARCHAR NOT NULL,
PROJ_CODE VARCHAR, PROJ_CODE VARCHAR,
PROJ_NAME VARCHAR, PROJ_NAME VARCHAR,
PARENT_ID VARCHAR, PARENT_ID VARCHAR,
PARENT_PRDT_NAME VARCHAR, PARENT_PRDT_NAME VARCHAR,
TYPE VARCHAR NOT NULL, TYPE VARCHAR NOT NULL,
LEAF VARCHAR NOT NULL, LEAF VARCHAR NOT NULL,
SORT VARCHAR NOT NULL, SORT VARCHAR NOT NULL,
ICON VARCHAR NOT NULL, ICON VARCHAR NOT NULL,
PRDT_CODE VARCHAR, PRDT_CODE VARCHAR,
PRDT_NAME VARCHAR, PRDT_NAME VARCHAR,
NUM INTEGER NOT NULL, NUM INTEGER NOT NULL,
UNIT_WT DECIMAL NOT NULL, UNIT_WT DECIMAL NOT NULL,
TOTAL_WT DECIMAL NOT NULL, TOTAL_WT DECIMAL NOT NULL,
FILE_PATH1 VARCHAR, FILE_PATH1 VARCHAR,
FILE_PATH2 VARCHAR, FILE_PATH2 VARCHAR,
FILE_PATH3 VARCHAR, FILE_PATH3 VARCHAR,
FILE_PATH4 VARCHAR, FILE_PATH4 VARCHAR,
FILE_PATH5 VARCHAR, FILE_PATH5 VARCHAR,
PLAN_COMMENT_DATE VARCHAR, PLAN_COMMENT_DATE VARCHAR,
PLAN_COMPLETION_DATE VARCHAR, PLAN_COMPLETION_DATE VARCHAR,
ACTUAL_COMPLETION_DATE VARCHAR, ACTUAL_COMPLETION_DATE VARCHAR,
ACTUAL_COMPLETION_NUM INTEGER, ACTUAL_COMPLETION_NUM INTEGER,
ACTUAL_COMPLETION_UNIT_WT DECIMAL, ACTUAL_COMPLETION_UNIT_WT DECIMAL,
STATUS TINYINT, STATUS TINYINT,
DEL_STATUS TINYINT, DEL_STATUS TINYINT,
CREATED_BY VARCHAR, CREATED_BY VARCHAR,
CREATED_TIME DATETIME, CREATED_TIME DATETIME,
UPDATED_BY VARCHAR, UPDATED_BY VARCHAR,
UPDATED_TIME DATETIME, UPDATED_TIME DATETIME,
REMARK VARCHAR REMARK VARCHAR
--> -->
<sqlMap namespace="HPSC004"> <sqlMap namespace="HPSC004">
...@@ -151,7 +151,7 @@ ...@@ -151,7 +151,7 @@
<select id="query" parameterClass="java.util.HashMap" <select id="query" parameterClass="java.util.HashMap"
resultClass="com.baosight.hpjx.hp.sc.domain.HPSC004"> resultClass="com.baosight.hpjx.hp.sc.domain.HPSC004">
SELECT SELECT
ID as "id", ID as "id",
COMPANY_CODE as "companyCode", <!-- 企业编码 预留 --> COMPANY_CODE as "companyCode", <!-- 企业编码 预留 -->
DEPT_CODE as "deptCode", <!-- 部门编码 预留 --> DEPT_CODE as "deptCode", <!-- 部门编码 预留 -->
PROJ_CODE as "projCode", <!-- 项目编码 --> PROJ_CODE as "projCode", <!-- 项目编码 -->
...@@ -343,7 +343,11 @@ ...@@ -343,7 +343,11 @@
UPDATED_TIME, <!-- 更新时间 --> UPDATED_TIME, <!-- 更新时间 -->
REMARK <!-- 备注 --> REMARK <!-- 备注 -->
) )
VALUES (#id#, #companyCode#, #deptCode#, #projCode#, #projName#, #parentId#, #parentPrdtName#, #type#, #leaf#, #sort#, #icon#,#inventRecordId#, #prdtType#, #prdtCode#, #prdtName#, #num#, #unitWt#, #totalWt#, #filePath1#, #filePath2#, #filePath3#, #filePath4#, #filePath5#, #planCommentDate#, #planCompletionDate#, #actualCompletionDate#, #actualCompletionNum#, #actualCompletionUnitWt#, #status#, #delStatus#, #createdBy#, #createdTime#, #updatedBy#, #updatedTime#, #remark#) VALUES (#id#, #companyCode#, #deptCode#, #projCode#, #projName#, #parentId#,
#parentPrdtName#, #type#, #leaf#, #sort#, #icon#,#inventRecordId#,
#prdtType#, #prdtCode#, #prdtName#, #num#, #unitWt#, #totalWt#,
#filePath1#, #filePath2#, #filePath3#, #filePath4#, #filePath5#,
#planCommentDate#, #planCompletionDate#, #actualCompletionDate#, #actualCompletionNum#, #actualCompletionUnitWt#, #status#, #delStatus#, #createdBy#, #createdTime#, #updatedBy#, #updatedTime#, #remark#)
</insert> </insert>
<delete id="delete"> <delete id="delete">
......
package com.baosight.hpjx.hp.xs.domain;
import java.io.Serializable;
/**
* @author:songx
* @date:2024/1/15,14:50
*/
public class Org implements Serializable {
/**
* 组织ID
*/
private String orgId;
/**
* 组织英文名
*/
private String orgEname;
/**
* 组织中文名
*/
private String orgCname;
/**
* 组织类型
*/
private String orgType;
/**
* 父级组织ID
*/
private String parentOrgId;
public String getOrgId() {
return orgId;
}
public void setOrgId(String orgId) {
this.orgId = orgId;
}
public String getOrgEname() {
return orgEname;
}
public void setOrgEname(String orgEname) {
this.orgEname = orgEname;
}
public String getOrgCname() {
return orgCname;
}
public void setOrgCname(String orgCname) {
this.orgCname = orgCname;
}
public String getOrgType() {
return orgType;
}
public void setOrgType(String orgType) {
this.orgType = orgType;
}
public String getParentOrgId() {
return parentOrgId;
}
public void setParentOrgId(String parentOrgId) {
this.parentOrgId = parentOrgId;
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd">
<sqlMap namespace="HPXSOrg">
<sql id="condition">
<isNotEmpty prepend=" AND " property="orgEname">
ORG_ENAME = #orgEname#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="orgCname">
ORG_CNAME LIKE CONCAT('%', #orgCname#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="orgId">
ORG_ID = #orgId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="orgIds">
ORG_ID IN <iterate close=")" open="(" conjunction="," property="orgIds">#orgIds[]#</iterate>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="orgType">
ORG_TYPE = #orgType#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="parentOrgId">
PARENT_ORG_ID = #parentOrgId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
</sql>
<sql id="order">
<dynamic prepend="ORDER BY">
<isNotEmpty property="order">
$orderBy$
</isNotEmpty>
<isEmpty property="order">
ORG_ID ASC
</isEmpty>
</dynamic>
</sql>
<!-- 查询组织信息 -->
<select id="query" resultClass="com.baosight.hpjx.hp.xs.domain.Org">
SELECT
ORG_ID as "orgId",
ORG_ENAME as "orgEname",
ORG_CNAME as "orgCname",
ORG_TYPE as "orgType",
PARENT_ORG_ID as "parentOrgId"
FROM ${platSchema}.TXSOG01
WHERE 1=1
<include refid="condition"/>
<include refid="order"/>
</select>
<!-- 统计用户 -->
<select id="count" resultClass="int">
SELECT COUNT(1)
FROM ${platSchema}.TXSOG01
WHERE 1=1
<include refid="condition"/>
</select>
<!-- 查询组织信息 -->
<select id="queryComboBox" parameterClass="java.util.HashMap" resultClass="java.util.HashMap">
SELECT
ORG_ID as "orgId",
ORG_CNAME as "orgCname"
FROM ${platSchema}.TXSOG01
WHERE 1=1
AND ORG_TYPE IN ('company', 'dept')
<include refid="condition"/>
<include refid="order"/>
</select>
</sqlMap>
package com.baosight.hpjx.util;
/**
* Base64 工具类
*
* @author:songx
* @date:2024/1/29,13:58
*/
public class Base64Utils {
private static final char last2byte = (char) Integer.parseInt("00000011", 2);
private static final char last4byte = (char) Integer.parseInt("00001111", 2);
private static final char last6byte = (char) Integer.parseInt("00111111", 2);
private static final char lead6byte = (char) Integer.parseInt("11111100", 2);
private static final char lead4byte = (char) Integer.parseInt("11110000", 2);
private static final char lead2byte = (char) Integer.parseInt("11000000", 2);
private static final char[] encodeTable = new char[]{'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L',
'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g',
'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1',
'2', '3', '4', '5', '6', '7', '8', '9', '+', '/'};
/**
* 编码
*
* @param from
* @return
*/
public static String encode(byte[] from) {
StringBuilder to = new StringBuilder((int) ((double) from.length * 1.34D) + 3);
int num = 0;
char currentByte = 0;
int i;
for (i = 0; i < from.length; ++i) {
for (num %= 8; num < 8; num += 6) {
switch (num) {
case 0:
currentByte = (char) (from[i] & lead6byte);
currentByte = (char) (currentByte >>> 2);
case 1:
case 3:
case 5:
default:
break;
case 2:
currentByte = (char) (from[i] & last6byte);
break;
case 4:
currentByte = (char) (from[i] & last4byte);
currentByte = (char) (currentByte << 2);
if (i + 1 < from.length) {
currentByte = (char) (currentByte | (from[i + 1] & lead2byte) >>> 6);
}
break;
case 6:
currentByte = (char) (from[i] & last2byte);
currentByte = (char) (currentByte << 4);
if (i + 1 < from.length) {
currentByte = (char) (currentByte | (from[i + 1] & lead4byte) >>> 4);
}
}
to.append(encodeTable[currentByte]);
}
}
if (to.length() % 4 != 0) {
for (i = 4 - to.length() % 4; i > 0; --i) {
to.append("=");
}
}
return to.toString();
}
}
...@@ -29,6 +29,7 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils { ...@@ -29,6 +29,7 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
public static final DateTimeFormatter DATE = DateTimeFormatter.ofPattern("yyyy-MM-dd"); public static final DateTimeFormatter DATE = DateTimeFormatter.ofPattern("yyyy-MM-dd");
public static final DateTimeFormatter SHORT_MONTH = DateTimeFormatter.ofPattern("yyyyMM"); public static final DateTimeFormatter SHORT_MONTH = DateTimeFormatter.ofPattern("yyyyMM");
public static final DateTimeFormatter YEAR_MONTH = DateTimeFormatter.ofPattern("yyyy-MM"); public static final DateTimeFormatter YEAR_MONTH = DateTimeFormatter.ofPattern("yyyy-MM");
public static final DateTimeFormatter CHINA_DATE = DateTimeFormatter.ofPattern("yyyy年MM月dd月");
/** /**
* 获取上个月的1号日期 * 获取上个月的1号日期
...@@ -79,6 +80,15 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils { ...@@ -79,6 +80,15 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
} }
/** /**
* 获取当前日期
*
* @return
*/
public static String chinaDate() {
return LocalDate.now().format(CHINA_DATE);
}
/**
* 获取日期字符串(yyyyMMdd) * 获取日期字符串(yyyyMMdd)
* *
* @return * @return
......
package com.baosight.hpjx.util;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.OutputStream;
import java.net.URLEncoder;
/**
* @author:songx
* @date:2024/1/31,10:36
*/
public class ExcelUtils {
/**
* 下载文件
*
* @param fileName 文件名
* @param workbook excel数据集
* @param response
*/
public static void download(String fileName, HSSFWorkbook workbook, HttpServletResponse response)
throws IOException {
if (workbook == null) {
return;
}
response.setContentType("application/vnd.ms-excel;charset=utf-8");
response.setHeader("Content-Disposition", "attachment;filename*=utf-8''"
+ URLEncoder.encode(fileName, "UTF-8"));
OutputStream os = response.getOutputStream();
workbook.write(os);
os.flush();
os.close();
}
}
package com.baosight.hpjx.util;
import org.springframework.web.bind.annotation.RequestMethod;
import java.io.IOException;
import java.util.Map;
import lombok.extern.slf4j.Slf4j;
import okhttp3.Headers;
import okhttp3.MediaType;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
/**
* httpclient
*
* @author:songx
* @date:2020/6/16,9:48
*/
@Slf4j
public class HttpUtils {
public static final MediaType JSON_MEDIA_TYPE = MediaType.get("application/json; charset=utf-8");
public static final MediaType FORM_MEDIA_TYPE = MediaType.get("application/x-www-form-urlencoded");
/**
* GET请求
*
* @param url
* @return
* @throws IOException
*/
public static String get(String url) throws IOException {
return get(url, null);
}
/**
* GET请求
*
* @param url
* @param header
* @return
* @throws IOException
*/
public static String get(String url, Map<String, String> header) throws IOException {
return request(RequestMethod.GET, url, header, null, JSON_MEDIA_TYPE);
}
/**
* POST请求
*
* @param url
* @return
* @throws IOException
*/
public static String post(String url) throws IOException {
return post(url, null, JSON_MEDIA_TYPE);
}
/**
* POST请求
*
* @param url
* @param param
* @return
* @throws IOException
*/
public static String post(String url, String param, MediaType mediaType) throws IOException {
return post(url, null, param, mediaType);
}
/**
* http请求(post)
*
* @param url
* @param header
* @param param
* @return
*/
public static String post(String url, Map<String, String> header, String param, MediaType mediaType)
throws IOException {
return request(RequestMethod.POST, url, header, param, mediaType);
}
/**
* 发送请求
*
* @param requestMethod 请求类型POST OR GET
* @param url
* @param header
* @param param
* @return
*/
private static String request(RequestMethod requestMethod, String url, Map<String, String> header, String param,
MediaType mediaType) throws IOException {
log.info("请求开始:{},{},{}", url, header, StringUtils.subStr(param, 500));
OkHttpClient okHttpClient = new OkHttpClient();
Request.Builder builder = new Request.Builder().url(url);
if (RequestMethod.POST.equals(requestMethod)) {
builder = builder.post(RequestBody.create(StringUtils.isBlank(param) ? "" : param, mediaType));
} else {
builder = builder.get();
}
if (MapUtils.isNotEmpty(header)) {
builder = builder.headers(Headers.of(header));
}
String result = okHttpClient.newCall(builder.build()).execute().body().string();
log.info("请求结束:{}", StringUtils.subStr(result, 500));
return result;
}
}
package com.baosight.hpjx.util;
import java.util.UUID;
/**
* String 工具类
*
* @author:songx
* @date:2022/8/10,14:17
*/
public class StringUtils extends org.apache.commons.lang3.StringUtils {
/**
* "" is true
* " " is true
* null is true
* "null" or "NULL" is true
*
* @param cs
* @return
*/
public static boolean isNullBlank(CharSequence cs) {
return isBlank(cs) || "null".equalsIgnoreCase(cs.toString());
}
/**
* "" is false
* " " is false
* null is false
* "null" or "NULL" is false
*
* @param cs
* @return
*/
public static boolean isNotNullBlank(CharSequence cs) {
return !isNullBlank(cs);
}
/**
* @param arg0
* @return
*/
public static boolean isNotNull(String arg0) {
if (null != arg0 && arg0.length() > 0) {
return true;
} else {
return false;
}
}
/**
* @param arg0
* @return
*/
public static boolean isNull(String arg0) {
if (null == arg0 || arg0.length() < 1) {
return true;
} else {
return false;
}
}
/**
* 字符串转boolean
*
* @param str
* @return
*/
public static boolean castToBoolean(String str) {
return Boolean.parseBoolean(str);
}
/**
* 字符串转Double
*
* @param str
* @return
*/
public static Double castToDouble(String str) {
Double value;
try {
value = Double.parseDouble(str);
} catch (Exception e) {
value = 0.0;
}
return value;
}
/**
* UUID
*
* @return
*/
public static String uuid() {
return UUID.randomUUID().toString().replaceAll("-", "");
}
/**
* 截取字符串
*
* @param str
* @param endIndex
* @return
*/
public static String subStr(String str, int endIndex) {
if (isBlank(str)) {
return str;
}
return str.length() > endIndex ? str.substring(0, endIndex) : str;
}
}
...@@ -157,7 +157,7 @@ public class SqlMapDaoLogProxy extends SqlMapDao { ...@@ -157,7 +157,7 @@ public class SqlMapDaoLogProxy extends SqlMapDao {
private void initParam(String name, Object parameters) { private void initParam(String name, Object parameters) {
// 查询登录用户信息时不设置企业编码,否则会形成死循环 // 查询登录用户信息时不设置企业编码,否则会形成死循环
// 仅限业务模块的查询需要设置企业编码 // 仅限业务模块的查询需要设置企业编码
if (name.startsWith("HPXS") || !name.startsWith("HP") || !(parameters instanceof Map)) { if (name.startsWith("HPXSUser") || !name.startsWith("HP") || !(parameters instanceof Map)) {
return; return;
} }
if (parameters == null) { if (parameters == null) {
......
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
</AsyncLogger> </AsyncLogger>
<logger name="org.springframework" level="ERROR" /> <logger name="org.springframework" level="ERROR" />
<logger name="org.thymeleaf" level="ERROR" /> <logger name="org.thymeleaf" level="ERROR" />
<Root level="WARN"> <Root level="INFO">
<AppenderRef ref="Console" /> <AppenderRef ref="Console" />
<AppenderRef ref="MyFile" /> <AppenderRef ref="MyFile" />
<AppenderRef ref="platLogAppender" /> <AppenderRef ref="platLogAppender" />
......
<!DOCTYPE html>
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ page import="com.baosight.hpjx.hp.kc.tools.CKExcelTools" %>
<%
try {
CKExcelTools.downloadFile(pageContext);
out.clear();
out = pageContext.pushBody();
} catch (Exception e) {
request.setAttribute("iplat_msgKey", "ES001");
request.setAttribute("iplat_msg", "出库单下载失败");
request.setAttribute("iplat_msgDetail", e.toString());
request.getRequestDispatcher("/EU/DM/EUDM30.jsp").forward(request, response);
}
%>
$(function () {
IPLATUI.EFGrid.result = {
pageable: {
pageSize: 20,
pageSizes: [10, 20, 50, 70, 100],
},
onSave: function (e) {
// 阻止默认请求,使用自定义保存
e.preventDefault();
save();
},
onDelete: function (e) {
// 阻止默认请求,使用自定义删除
e.preventDefault();
deleteFunc();
}
}
// 查询
$("#QUERY").on("click", query);
});
/**
* 页面加载时执行
*/
$(window).load(function () {
// 查询
query();
});
/**
* 查询
*/
let query = function () {
resultGrid.dataSource.page(1);
}
/**
* 保存
*/
let save = function () {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HPPZ011", "save", true);
}
});
}
/**
* 删除
*/
let deleteFunc = function () {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"删除\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HPPZ011", "delete", true);
}
});
}
<!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="查询条件">
<div class="row">
<EF:EFInput cname="厂区名称:" ename="factoryName" blockId="inqu_status" row="0" colWidth="3"/>
<EF:EFSelect cname="生产组名称" ename="groupCode" blockId="inqu_status" row="0" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="group_record_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="记录集">
<EF:EFGrid blockId="result" autoDraw="override" checkMode="row">
<EF:EFColumn ename="id" cname="主键" hidden="true"/>
<EF:EFColumn ename="factoryCode" cname="厂区编码" enable="false" width="120" align="center"/>
<EF:EFPopupColumn ename="factoryName" cname="厂区名称" width="120" popupType="ServiceGrid"
popupTitle="厂区列表" serviceName="HPPZ011" methodName="queryComboBox"
resultId="factory_record_block_id"
columnEnames="valueField,textField" columnCnames="厂区代码,厂区名称"
backFillColumnIds="valueField,textField" backFillFieldIds="factoryCode,factoryName"
valueField="textField" textField="textField" required="true"/>
<EF:EFComboColumn ename="groupCode" cname="生产组名称" width="120" align="center"
blockName="org_record_block_id" textField="textField" valueField="valueField"
columnTemplate="#=textField#" itemTemplate="#=textField#"
required="true">
</EF:EFComboColumn>
<EF:EFComboColumn ename="groupType" cname="组类型" width="100" align="center" required="true">
<EF:EFCodeOption codeName="hpjx.hppz.groupType"/>
</EF:EFComboColumn>
<EF:EFColumn ename="createdName" cname="创建人" enable="false" align="center"/>
<EF:EFColumn ename="createdTime" cname="创建时间" enable="false" width="140" align="center"
editType="datetime" parseFormats="['yyyyMMddHHmmss','yyyy-MM-dd HH:mm:ss']"/>
<EF:EFColumn ename="updatedName" cname="修改人" enable="false" align="center"/>
<EF:EFColumn ename="updatedTime" cname="修改时间" enable="false" width="140" align="center"
editType="datetime" parseFormats="['yyyyMMddHHmmss','yyyy-MM-dd HH:mm:ss']"/>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
...@@ -72,12 +72,12 @@ ...@@ -72,12 +72,12 @@
<EF:EFOption label="启用" value="1"/> <EF:EFOption label="启用" value="1"/>
</EF:EFComboColumn> </EF:EFComboColumn>
<EF:EFColumn enable="false" ename="num" readonly="true" cname="计划数量"/> <EF:EFColumn enable="false" ename="num" readonly="true" cname="计划数量"/>
<EF:EFColumn enable="false" ename="unitWt" readonly="true" cname="计划重量"/> <EF:EFColumn enable="false" ename="unitWt" readonly="true" cname="计划重量"/>
<EF:EFColumn ename="planCommentDate" required='true' cname="计划开始时间" editType="date" dateFormat="yyyy/MM/dd" width="150" <EF:EFColumn ename="planCommentDate" required='true' cname="计划开始时间" editType="date" dateFormat="yyyy/MM/dd"
/> width="150"/>
<EF:EFColumn ename="planCompletionDate" required='true' cname="计划结束时间" editType="date" dateFormat="yyyy/MM/dd" width="150" <EF:EFColumn ename="planCompletionDate" required='true' cname="计划结束时间" editType="date"
/> dateFormat="yyyy/MM/dd" width="150"/>
<EF:EFColumn ename="actualCompletionDate" cname="实际完成时间" editType="date" dateFormat="yyyy/MM/dd" width="150" <EF:EFColumn ename="actualCompletionDate" cname="实际完成时间" editType="date" dateFormat="yyyy/MM/dd" width="150"
enable="false"/> enable="false"/>
<EF:EFColumn enable="false" ename="actualCompletionNum" cname="实际完工数量" readonly="true"/> <EF:EFColumn enable="false" ename="actualCompletionNum" cname="实际完工数量" readonly="true"/>
<EF:EFColumn enable="false" ename="actualCompletionUnitWt" cname="实际完工重量" readonly="true"/> <EF:EFColumn enable="false" ename="actualCompletionUnitWt" cname="实际完工重量" readonly="true"/>
...@@ -90,4 +90,4 @@ ...@@ -90,4 +90,4 @@
<script> <script>
var ctx = "${ctx}"; var ctx = "${ctx}";
</script> </script>
<script src="${ctx}/HP/SC/HPSC003.js"></script> <script src="${ctx}/HP/SC/HPSC003.js"></script>
\ No newline at end of file
...@@ -6,20 +6,20 @@ ...@@ -6,20 +6,20 @@
<c:set var="ctx" value="${pageContext.request.contextPath}"/> <c:set var="ctx" value="${pageContext.request.contextPath}"/>
<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="orgCname" cname="组织名称" blockId="inqu_status" row="0"/> <EF:EFInput ename="factoryCname" cname="厂区名称" blockId="inqu_status" row="0"/>
</div> <EF:EFInput ename="groupName" cname="组织名称" blockId="inqu_status" row="0"/>
<%-- <EF:EFButton ename="QUERY" cname="查询" row="1" class="btn-align-right"></EF:EFButton>--%> </div>
</EF:EFRegion> </EF:EFRegion>
<EF:EFRegion id="result" title="明细信息"> <EF:EFRegion id="result" title="明细信息">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true" checkMode="single,row"> <EF:EFGrid blockId="result" autoDraw="override" isFloat="true" checkMode="single,row">
<EF:EFColumn ename="orgId" cname="内码" hidden="true"/> <EF:EFColumn ename="orgId" cname="内码" hidden="true"/>
<EF:EFColumn ename="orgEname" cname="组织编码" enable="false" width="130" align="center"/> <EF:EFColumn ename="orgEname" cname="组织编码" enable="false" width="130" align="center"/>
<EF:EFColumn cname="组织名称" ename="orgCname" width="100" readonly="false" align="center"/> <EF:EFColumn ename="orgCname" cname="组织名称" enable="false" width="130" align="center"/>
</EF:EFGrid> </EF:EFGrid>
</EF:EFRegion> </EF:EFRegion>
</EF:EFPage> </EF:EFPage>
<script> <script>
var ctx = "${ctx}"; var ctx = "${ctx}";
......
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