Commit ced5cf4c by liulei

移动端接口优化

parent 097491c0
...@@ -127,6 +127,19 @@ public enum DdynamicEnum { ...@@ -127,6 +127,19 @@ public enum DdynamicEnum {
*/ */
FACTORY_GROUP_ECORD_BLOCK_ID("factory_group_ecord_block_id","factoryCode","factoryName","groupCode","groupName","HPPZ011.queryComboBoxAll"), FACTORY_GROUP_ECORD_BLOCK_ID("factory_group_ecord_block_id","factoryCode","factoryName","groupCode","groupName","HPPZ011.queryComboBoxAll"),
/**
* 模块:组管理
* 用途:组管理下拉框
* 编写:ll
*/
GROUP_PRO_BLOCK_ID("group_pro_block_id","groupCode","groupName","HPXSOrg.queryList"),
/**
* 模块:巡检移动端
* 用途:不良品类下拉
* 编写:ll
*/
POOR_TYPE_BLOCK_ID("poor_type_block_id","itemCode","itemCname","HPXSOrg.queryTedcm01"),
//------------------------------------生产管理----------------------------------- //------------------------------------生产管理-----------------------------------
/** /**
* 模块:项目档案 * 模块:项目档案
...@@ -164,8 +177,21 @@ public enum DdynamicEnum { ...@@ -164,8 +177,21 @@ public enum DdynamicEnum {
* 编写:wwl * 编写:wwl
*/ */
PROJ_PROD_BLOCK_ID("proj_prod_block_id","projCode","projName","HPSC005.queryProjComboBox"), PROJ_PROD_BLOCK_ID("proj_prod_block_id","projCode","projName","HPSC005.queryProjComboBox"),
/**
* 模块:项目档案(通过工厂、生产组)
* 用途:项目档案下拉框
* 编写:ll
*/
PROJ_PRODQUERY_BLOCK_ID("proj_prodQuery_block_id","projCode","projName","HPSC005.queryProjComboBox2"),
/**
* 模块:项目档案(通过工厂、生产组、项目号)
* 用途:移动端任务号、生产订单号
* 编写:ll
*/
PROJ_QUERYPROD_BLOCK_ID("proj_queryProd_block_id","prodOrderNo","prodTaskNo","HPSC005.queryProjComboBox2"),
//------------------------------------用户管理----------------------------------- //------------------------------------用户管理-----------------------------------
/** /**
...@@ -225,6 +251,9 @@ public enum DdynamicEnum { ...@@ -225,6 +251,9 @@ 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");
/** 将结果集放入的块名 */ /** 将结果集放入的块名 */
private final String blockId; private final String blockId;
/** 字段名 */ /** 字段名 */
......
...@@ -48,8 +48,16 @@ ...@@ -48,8 +48,16 @@
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# )* 100,2),'%') AS NUM,
FROM hpjx.t_hpzl001 WHERE COMPANY_CODE= #companyCode# AND DELETE_FLAG =0 ITEM_CNAME AS ITEM_CNAME
FROM hpjx.t_hpzl001 A LEFT JOIN (
SELECT
ITEM_CODE,
ITEM_CNAME
FROM iplat.TEDCM01
WHERE CODESET_CODE = 'hpjx.hpjx.poorType'
) B ON A.POOR_TYPE =B.ITEM_CODE
WHERE COMPANY_CODE= #companyCode# AND DELETE_FLAG =0
GROUP BY POOR_TYPE GROUP BY POOR_TYPE
</select> </select>
...@@ -65,11 +73,21 @@ ...@@ -65,11 +73,21 @@
INVENT_NAME as "inventName", <!-- 部件名称 --> INVENT_NAME as "inventName", <!-- 部件名称 -->
SUB_INVENT_CODE as "subInventCode", <!-- 零件编码 --> SUB_INVENT_CODE as "subInventCode", <!-- 零件编码 -->
SUB_INVENT_NAME as "subInventName", <!-- 零件名称 --> SUB_INVENT_NAME as "subInventName", <!-- 零件名称 -->
FACTORY_CODE as "factoryCode", <!-- 厂区编码 -->
FACTORY_NAME as "factoryName", <!-- 厂区名称 -->
ORG_NO as "orgNo", <!-- 生产组编码 --> ORG_NO as "orgNo", <!-- 生产组编码 -->
ORG_NAME as "orgName", <!-- 生产组名称 --> ORG_NAME as "orgName", <!-- 生产组名称 -->
POOR_TYPE as "poorType", <!-- 不良品类 --> POOR_TYPE as "poorType", <!-- 不良品类 -->
STATUS as "status" <!-- 单据状态 0未处理 1已处理 --> STATUS as "status", <!-- 单据状态 0未处理 1已处理 -->
FROM hpjx.t_hpzl001 WHERE COMPANY_CODE= #companyCode# AND STATUS=#status# AND DELETE_FLAG =0 B.ITEM_CNAME AS "itemCname"
FROM hpjx.t_hpzl001 A LEFT JOIN (
SELECT
ITEM_CODE,
ITEM_CNAME
FROM iplat.TEDCM01
WHERE CODESET_CODE = 'hpjx.hpjx.poorType'
) B ON A.POOR_TYPE =B.ITEM_CODE
WHERE COMPANY_CODE= #companyCode# AND STATUS=#status# AND DELETE_FLAG =0
</select> </select>
<select id="pmQualityDetail" resultClass="java.util.HashMap"> <select id="pmQualityDetail" resultClass="java.util.HashMap">
...@@ -84,15 +102,25 @@ ...@@ -84,15 +102,25 @@
INVENT_NAME as "inventName", <!-- 部件名称 --> INVENT_NAME as "inventName", <!-- 部件名称 -->
SUB_INVENT_CODE as "subInventCode", <!-- 零件编码 --> SUB_INVENT_CODE as "subInventCode", <!-- 零件编码 -->
SUB_INVENT_NAME as "subInventName", <!-- 零件名称 --> SUB_INVENT_NAME as "subInventName", <!-- 零件名称 -->
FACTORY_CODE as "factoryCode", <!-- 厂区编码 -->
FACTORY_NAME as "factoryName", <!-- 厂区名称 -->
ORG_NO as "orgNo", <!-- 生产组编码 --> ORG_NO as "orgNo", <!-- 生产组编码 -->
ORG_NAME as "orgName", <!-- 生产组名称 --> ORG_NAME as "orgName", <!-- 生产组名称 -->
POOR_TYPE as "poorType", <!-- 不良品类 --> POOR_TYPE as "poorType", <!-- 不良品类 -->
PROBLEM_DESC as "problemDesc", <!-- 质量问题描述 --> PROBLEM_DESC as "problemDesc", <!-- 质量问题描述 -->
CHECK_USER as "checkUser", <!-- 检查人 --> CHECK_USER as "checkUser", <!-- 检查人 -->
CHECK_USER_NAME as "checkUserName", <!-- 检查人名称 --> CHECK_USER_NAME as "checkUserName", <!-- 检查人名称 -->
STATUS as "status" <!-- 单据状态 0未处理 1已处理 --> STATUS as "status", <!-- 单据状态 0未处理 1已处理 -->
FROM hpjx.t_hpzl001 WHERE COMPANY_CODE= #companyCode# AND STATUS=#status# B.ITEM_CNAME AS "itemCname"
AND DELETE_FLAG = 0 AND CHECK_NO = #checkNo# FROM hpjx.t_hpzl001 A LEFT JOIN (
SELECT
ITEM_CODE,
ITEM_CNAME
FROM iplat.TEDCM01
WHERE CODESET_CODE = 'hpjx.hpjx.poorType'
) B ON A.POOR_TYPE =B.ITEM_CODE
WHERE COMPANY_CODE= #companyCode#
AND DELETE_FLAG = 0 AND ID = #id#
</select> </select>
<insert id="insert"> <insert id="insert">
...@@ -109,6 +137,8 @@ ...@@ -109,6 +137,8 @@
INVENT_NAME, <!-- 部件名称 --> INVENT_NAME, <!-- 部件名称 -->
SUB_INVENT_CODE, <!-- 零件编码 --> SUB_INVENT_CODE, <!-- 零件编码 -->
SUB_INVENT_NAME, <!-- 零件名称 --> SUB_INVENT_NAME, <!-- 零件名称 -->
FACTORY_CODE as "factoryCode", <!-- 厂区编码 -->
FACTORY_NAME as "factoryName", <!-- 厂区名称 -->
ORG_NO, <!-- 生产组编码 --> ORG_NO, <!-- 生产组编码 -->
ORG_NAME, <!-- 生产组名称 --> ORG_NAME, <!-- 生产组名称 -->
POOR_TYPE, <!-- 不良品类 --> POOR_TYPE, <!-- 不良品类 -->
...@@ -127,4 +157,9 @@ ...@@ -127,4 +157,9 @@
#createdBy#, #createdName#, #createdTime#, #deleteFlag#) #createdBy#, #createdName#, #createdTime#, #deleteFlag#)
</insert> </insert>
<select id="queryFile" resultClass="java.util.HashMap">
SELECT CHG_NAME FROM iplat.TEUDM02 where DOC_ID=#docId#
</select>
</sqlMap> </sqlMap>
package com.baosight.hpjx.hp.mt.untils;
import org.springframework.web.multipart.MultipartFile;
import java.io.*;
public class BASE64DecodedMultipartFile implements MultipartFile {
private final byte[] imgContent;
private final String header;
public BASE64DecodedMultipartFile(byte[] imgContent, String header) {
this.imgContent = imgContent;
this.header = header.split(";")[0];
}
@Override
public String getName() {
return System.currentTimeMillis() + Math.random() + "." + header.split("/")[1];
}
@Override
public String getOriginalFilename() {
return System.currentTimeMillis() + (int) Math.random() * 10000 + "." + header.split("/")[1];
}
@Override
public String getContentType() {
return header.split(":")[1];
}
@Override
public boolean isEmpty() {
return imgContent == null || imgContent.length == 0;
}
@Override
public long getSize() {
return imgContent.length;
}
@Override
public byte[] getBytes() throws IOException {
return imgContent;
}
@Override
public InputStream getInputStream() throws IOException {
return new ByteArrayInputStream(imgContent);
}
@Override
public void transferTo(File dest) throws IOException, IllegalStateException {
new FileOutputStream(dest).write(imgContent);
}
}
package com.baosight.hpjx.hp.mt.untils;
import org.apache.commons.fileupload.disk.DiskFileItem;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.xerces.impl.dv.util.Base64;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.commons.CommonsMultipartFile;
import sun.misc.BASE64Decoder;
import java.io.*;
public class Base64ToMultipartFile implements MultipartFile {
private static Logger logger = LoggerFactory.getLogger(Base64ToMultipartFile.class);
private final byte[] imgContent;
private final String header;
public Base64ToMultipartFile(byte[] imgContent, String header) {
this.imgContent = imgContent;
this.header = header.split(";")[0];
}
@Override
public String getName() {
return System.currentTimeMillis() + Math.random() + "." + header.split("/")[1];
}
@Override
public String getOriginalFilename() {
return System.currentTimeMillis() + (int) Math.random() * 10000 + "." + header.split("/")[1];
}
@Override
public String getContentType() {
return header.split(":")[1];
}
@Override
public boolean isEmpty() {
return imgContent == null || imgContent.length == 0;
}
@Override
public long getSize() {
return imgContent.length;
}
@Override
public byte[] getBytes() throws IOException {
return imgContent;
}
@Override
public InputStream getInputStream() throws IOException {
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(imgContent);
// 关闭流,不然文件会一直占用资源,无法对其操作
byteArrayInputStream.close();
return byteArrayInputStream;
}
@Override
public void transferTo(File dest) throws IOException, IllegalStateException {
FileOutputStream fileOutputStream = new FileOutputStream(dest);
fileOutputStream.write(imgContent);
// 关闭流,不然文件会一直占用资源,无法对其操作
fileOutputStream.close();
}
/**
* base64转multipartFile
*
* @param
* @return
*/
public static MultipartFile base64Convert(String base64) {
String[] baseStrs = base64.split(",");
BASE64Decoder decoder = new BASE64Decoder();
byte[] b = new byte[0];
try {
b = decoder.decodeBuffer(baseStrs[1]);
} catch (IOException e) {
e.printStackTrace();
}
for (int i = 0; i < b.length; ++i) {
if (b[i] < 0) {
b[i] += 256;
}
}
return new Base64ToMultipartFile(b, baseStrs[0]);
}
public static CommonsMultipartFile base64toMultipartFile(String base64filestr){
final File file = base64ToFile(base64filestr);
if(file.exists()){
logger.info("存在");
logger.info("长度"+file.length());
}
DiskFileItem item = (DiskFileItem)new DiskFileItemFactory().createItem(file.getName(), "image/jpeg", false, file.getName());
InputStream input = null;
try {
input = new FileInputStream(file);
} catch (FileNotFoundException e) {
e.printStackTrace();
}
OutputStream os = null;
try {
os = item.getOutputStream();
int ret = input.read();
while ( ret != -1 )
{
os.write(ret);
ret = input.read();
}
os.flush();
} catch (IOException e) {
e.printStackTrace();
}
return new CommonsMultipartFile(item);
}
public static File base64ToFile(String base64) {
if(base64==null||"".equals(base64)) {
return null;
}
//getRealImgeStr 方法 截取bese64字符串 逗号后半部分有用的字符串
byte[] buff= Base64.decode(getRealImgeStr(base64));
File file=null;
FileOutputStream fout=null;
try {
file = File.createTempFile("tmp", ".jpg");
fout=new FileOutputStream(file);
fout.write(buff);
} catch (IOException e) {
e.printStackTrace();
}finally {
if(fout!=null) {
try {
fout.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
return file;
}
public static String getRealImgeStr(String imgStr){
String[] str = imgStr.split(",");
return str[1];
}
}
package com.baosight.hpjx.hp.mt.untils;
import org.springframework.web.multipart.MultipartFile;
import sun.misc.BASE64Decoder;
import java.io.IOException;
public class Base64Utils {
public static MultipartFile base64ToMultipartFile (String s) {
MultipartFile image = null;
StringBuilder base64 = new StringBuilder("");
if (s != null && !"".equals(s)) {
base64.append(s);
String[] baseStrs = base64.toString().split(",");
BASE64Decoder decoder = new BASE64Decoder();
byte[] b = new byte[0];
try {
b = decoder.decodeBuffer(baseStrs[1]);
} catch (IOException e) {
e.printStackTrace();
}
for (int j = 0; j < b.length; ++j) {
if (b[j] < 0) {
b[j] += 256;
}
}
image = new BASE64DecodedMultipartFile(b, baseStrs[0]);
}
return image;
}
}
package com.baosight.hpjx.hp.mt.untils; package com.baosight.hpjx.hp.mt.untils;
import com.baosight.iplat4j.core.data.ibatis.dao.Dao;
import com.baosight.iplat4j.core.data.id.UUIDHexIdGenerator; import com.baosight.iplat4j.core.data.id.UUIDHexIdGenerator;
import com.baosight.iplat4j.core.exception.PlatException; import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.ioc.spring.PlatApplicationContext; import com.baosight.iplat4j.core.ioc.spring.PlatApplicationContext;
import com.baosight.iplat4j.core.util.DateUtils; import com.baosight.iplat4j.core.util.DateUtils;
import com.baosight.iplat4j.core.util.StringUtils; import com.baosight.iplat4j.core.util.StringUtils;
import com.baosight.iplat4j.core.web.threadlocal.UserSession;
import com.baosight.iplat4j.eu.dm.domain.EUDM02;
import com.baosight.iplat4j.eu.dm.util.FileProcessUtils;
import com.baosight.iplat4j.eu.dm.util.IFileUploader; import com.baosight.iplat4j.eu.dm.util.IFileUploader;
import net.sf.json.JSONObject; import net.sf.json.JSONObject;
import org.apache.commons.codec.binary.Base64;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.commons.CommonsMultipartFile; import org.springframework.web.multipart.commons.CommonsMultipartFile;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.ByteArrayOutputStream;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
public class uploadUntil { import static com.baosight.iplat4j.eu.dm.util.FileUploadConstant.VIRTUAL_ROOT;
public class UploadUtils {
public static String ROOT_PATH="C:/workspace/java/hp-smart/file";
private static String DEFAULT_INVALID_SUFFIX;
private static String MODULE_NAME="EP";
private static String PROJECT_NAME="HPJX";
private static String VIRTUAL_ROOT="HPJX_EP_$";
public static IFileUploader fileUploader; public static IFileUploader fileUploader;
public static String upload(CommonsMultipartFile multipartFile ) throws IOException { private static Dao dao = (Dao)PlatApplicationContext.getApplicationContext().getBean("dao");
public static JSONObject upload(CommonsMultipartFile multipartFile ) throws IOException {
JSONObject documentJSON = new JSONObject(); JSONObject documentJSON = new JSONObject();
String filePath; String filePath;
String msg; String msg;
...@@ -25,9 +43,9 @@ public class uploadUntil { ...@@ -25,9 +43,9 @@ public class uploadUntil {
String docPath; String docPath;
filePath = multipartFile.getOriginalFilename(); filePath = multipartFile.getOriginalFilename();
Long docSize = multipartFile.getSize(); Long docSize = multipartFile.getSize();
String chgName = fileUploader.transformFileName(filePath); String chgName = transformFileName(filePath);
String attachmentName; String attachmentName;
Map<String, String> pathMap = fileUploader.getRealPath("A"); Map<String, String> pathMap = getRealPath("A");
msg = (String)pathMap.get("dirId"); msg = (String)pathMap.get("dirId");
category = (String)pathMap.get("path"); category = (String)pathMap.get("path");
checkInvalidPath(category); checkInvalidPath(category);
...@@ -46,7 +64,7 @@ public class uploadUntil { ...@@ -46,7 +64,7 @@ public class uploadUntil {
map.put("docSize", docSize); map.put("docSize", docSize);
map.put("recCreator", ""); map.put("recCreator", "");
map.put("recCreateTime", DateUtils.curDateTimeStr14()); map.put("recCreateTime", DateUtils.curDateTimeStr14());
fileUploader.uploadDoc(map); uploadDoc(map);
attachmentName = category + "/" + chgName; attachmentName = category + "/" + chgName;
multipartFile.transferTo(new File(attachmentName)); multipartFile.transferTo(new File(attachmentName));
documentJSON.put("docId", docPath); documentJSON.put("docId", docPath);
...@@ -57,9 +75,56 @@ public class uploadUntil { ...@@ -57,9 +75,56 @@ public class uploadUntil {
documentJSON.put("docUrl", attachmentName); documentJSON.put("docUrl", attachmentName);
documentJSON.put("docSize", docSize); documentJSON.put("docSize", docSize);
documentJSON.put("docName", filePath); documentJSON.put("docName", filePath);
return documentJSON;
}
private static String transformFileName(String originalFileName) {
String dateMselStr14 = DateUtils.curDateTimeStr14();
String uuid8 = FileProcessUtils.getShortUuid();
String chgFileName = dateMselStr14 + "_" + uuid8;
String dot = ".";
int index = originalFileName.lastIndexOf(dot);
String fileName;
if (index > 0) {
String suffix = originalFileName.substring(index + 1);
String invalidSuffixConfig = PlatApplicationContext.getProperty("iplat.upload.invalidSuffix");
if (!StringUtils.isNotEmpty(invalidSuffixConfig)) {
invalidSuffixConfig = DEFAULT_INVALID_SUFFIX;
}
String[] invalidSuffixs = invalidSuffixConfig.split(",");
String[] var11 = invalidSuffixs;
int var12 = invalidSuffixs.length;
for(int var13 = 0; var13 < var12; ++var13) {
String invalidSuffix = var11[var13];
if (suffix.equalsIgnoreCase(invalidSuffix)) {
throw new PlatException("文件扩展名不合法!");
}
}
fileName = chgFileName + dot + suffix;
} else {
fileName = chgFileName.toString();
}
return fileName;
}
public static Map<String, String> getRealPath(String path) {
String postPath = preparePath(path);
String dirId = initPath(postPath);
postPath = ROOT_PATH + "/" + postPath;
Map<String, String> map = new HashMap();
map.put("path", postPath);
map.put("dirId", dirId);
return map;
}
return ""; public static String preparePath(String path) {
return path;
} }
public static void checkInvalidPath(String realPath) { public static void checkInvalidPath(String realPath) {
...@@ -83,4 +148,91 @@ public class uploadUntil { ...@@ -83,4 +148,91 @@ public class uploadUntil {
} }
} }
public static String initPath(String path) {
String[] dirs = path.split("/");
String parentId = VIRTUAL_ROOT;
String dirPath = VIRTUAL_ROOT;
String dirId = null;
String realPath = "";
try {
for(int i = 0; i < dirs.length; ++i) {
HashMap<String, String> pathMap = new HashMap();
pathMap.put("parentId", parentId);
pathMap.put("dirEname", dirs[i]);
pathMap.put("moduleEname", MODULE_NAME);
pathMap.put("projectEname", PROJECT_NAME);
List pathList = dao.query("EUDM01.queryPath", pathMap);
realPath = realPath + dirs[i] + "/";
if (pathList.size() == 0) {
Map<String, String> dirRow = new HashMap();
String userId = String.valueOf(UserSession.getUserId());
String dateTime = DateUtils.curDateTimeStr14();
dirId = UUIDHexIdGenerator.generate().toString();
dirPath = dirPath + "." + dirId;
dirRow.put("dirId", dirId);
dirRow.put("dirEname", dirs[i]);
dirRow.put("dirCname", dirs[i]);
dirRow.put("parentId", parentId);
dirRow.put("isLeaf", i == dirs.length - 1 ? "1" : "0");
dirRow.put("dirPath", dirPath);
dirRow.put("projectEname", PROJECT_NAME);
dirRow.put("moduleEname", MODULE_NAME);
dirRow.put("recCreator", userId);
dirRow.put("recCreateTime", dateTime);
dirRow.put("recRevisor", " ");
dirRow.put("recReviseTime", " ");
dirRow.put("archiveFlag", " ");
dirRow.put("archiveFlag", " ");
dirRow.put("realPath", realPath);
dao.insert("EUDM01.insert", dirRow);
Map<String, String> dirMap = new HashMap();
dirMap.put("dirId", parentId);
List list = dao.query("EUDM01.query", dirMap);
if (null != list && list.size() > 0) {
Map<String, String> item = (Map)list.get(0);
if ("1".equals(item.get("isLeaf"))) {
item.put("isLeaf", "0");
dao.update("EUDM01.update", list.get(0));
}
}
parentId = dirId;
} else {
Map<String, String> item = (Map)pathList.get(0);
parentId = (String)item.get("dirId");
dirId = (String)item.get("dirId");
dirPath = (String)item.get("dirPath");
}
}
return dirId;
} catch (Exception var16) {
throw new PlatException("上传附件,创建目录: " + path + " 失败!", var16);
}
}
public static boolean uploadDoc(Map docMap) {
EUDM02 document = new EUDM02();
document.fromMap(docMap);
try {
dao.insert("EUDM02.insert", document);
boolean success = true;
return success;
} catch (Exception var5) {
throw new PlatException("保存附件 " + docMap.get("docName") + " 失败!", var5);
}
}
public static String imageToBase64(BufferedImage bufferedImage) {
Base64 encoder = new Base64();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
try {
ImageIO.write(bufferedImage, "jpg", baos);
} catch (IOException e) {
}
return new String(encoder.encode((baos.toByteArray())));
}
} }
...@@ -333,6 +333,40 @@ ...@@ -333,6 +333,40 @@
ORDER BY PROJ_CODE ORDER BY PROJ_CODE
</select> </select>
<!-- 项目下拉框 -->
<select id="queryProjComboBox2" parameterClass="java.util.HashMap" resultClass="java.util.HashMap">
SELECT DISTINCT
A.PROJ_CODE as "projCode",
A.PROJ_NAME as "projName",
A.PROD_ORDER_NO AS "prodOrderNo",
B.PROD_TASK_NO AS "prodTaskNo"
FROM ${hpjxSchema}.T_HPSC005 A LEFT JOIN ${hpjxSchema}.T_HPSC005A B ON A.COMPANY_CODE=B.COMPANY_CODE
AND A.PROD_ORDER_NO=B.PROD_ORDER_NO
WHERE 1=1
<isNotEmpty prepend=" AND " property="companyCode">
A.COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="projCode">
A.PROJ_CODE = #projCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="status">
A.STATUS = #status#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="factoryCode">
B.FACTORY_CODE = #factoryCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="orgNo">
B.ORG_NO = #orgNo#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="parentPrdtCode">
A.PRDT_CODE = #parentPrdtCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="subInventCode">
A.PART_CODE = #subInventCode#
</isNotEmpty>
ORDER BY A.PROJ_CODE
</select>
<!-- 生产组下拉框 --> <!-- 生产组下拉框 -->
<select id="queryOrgComboBox" parameterClass="java.util.HashMap" resultClass="java.util.HashMap"> <select id="queryOrgComboBox" parameterClass="java.util.HashMap" resultClass="java.util.HashMap">
SELECT SELECT
......
...@@ -165,7 +165,10 @@ ...@@ -165,7 +165,10 @@
ORG_CNAME ORG_CNAME
FROM iplat.TXSOG01 WHERE COMPANY_CODE=#companyCode# FROM iplat.TXSOG01 WHERE COMPANY_CODE=#companyCode#
) B ON A.PARENT_ORG_ID=B.ORG_ENAME ) B ON A.PARENT_ORG_ID=B.ORG_ENAME
WHERE A.ORG_TYPE = 'cutGroup' AND A.COMPANY_CODE=#companyCode# WHERE A.ORG_TYPE = 'prodGroup' AND A.COMPANY_CODE=#companyCode#
<isNotEmpty prepend=" AND " property="factoryCode">
A.PARENT_ORG_ID=#factoryCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="factoryName"> <isNotEmpty prepend=" AND " property="factoryName">
B.ORG_CNAME LIKE CONCAT('%', #factoryName#, '%') B.ORG_CNAME LIKE CONCAT('%', #factoryName#, '%')
</isNotEmpty> </isNotEmpty>
...@@ -174,4 +177,15 @@ ...@@ -174,4 +177,15 @@
</isNotEmpty> </isNotEmpty>
</select> </select>
<!-- 查询组织信息 -->
<select id="queryTedcm01" resultClass="com.baosight.iplat4j.common.ed.domain.TEDCM01">
SELECT
ITEM_CODE AS "itemCode",
ITEM_CNAME AS "itemCname"
FROM iplat.TEDCM01
WHERE CODESET_CODE = 'hpjx.hpjx.poorType'
</select>
</sqlMap> </sqlMap>
...@@ -48,7 +48,9 @@ public class HPZL001 extends DaoEPBase { ...@@ -48,7 +48,9 @@ public class HPZL001 extends DaoEPBase {
public static final String FIELD_UPDATED_NAME = "updatedName"; /* 更新人名称*/ public static final String FIELD_UPDATED_NAME = "updatedName"; /* 更新人名称*/
public static final String FIELD_UPDATED_TIME = "updatedTime"; /* 更新时间*/ public static final String FIELD_UPDATED_TIME = "updatedTime"; /* 更新时间*/
public static final String FIELD_DELETE_FLAG = "deleteFlag"; /* 是否删除*/ public static final String FIELD_DELETE_FLAG = "deleteFlag"; /* 是否删除*/
public static final String FIELD_FACTORY_CODE = "factoryCode"; /* 厂区编码*/
public static final String FIELD_FACTORY_NAME = "factoryName"; /* 厂区名称*/
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"; /* 部门编码*/
...@@ -76,6 +78,8 @@ public class HPZL001 extends DaoEPBase { ...@@ -76,6 +78,8 @@ public class HPZL001 extends DaoEPBase {
public static final String COL_UPDATED_NAME = "UPDATED_NAME"; /* 更新人名称*/ public static final String COL_UPDATED_NAME = "UPDATED_NAME"; /* 更新人名称*/
public static final String COL_UPDATED_TIME = "UPDATED_TIME"; /* 更新时间*/ public static final String COL_UPDATED_TIME = "UPDATED_TIME"; /* 更新时间*/
public static final String COL_DELETE_FLAG = "DELETE_FLAG"; /* 是否删除*/ public static final String COL_DELETE_FLAG = "DELETE_FLAG"; /* 是否删除*/
public static final String COL_FACTORY_CODE = "FACTORY_CODE"; /* 厂区编码*/
public static final String COL_FACTORY_NAME = "FACTORY_NAME"; /* 厂区名称*/
public static final String QUERY = "HPZL001.query"; public static final String QUERY = "HPZL001.query";
public static final String COUNT = "HPZL001.count"; public static final String COUNT = "HPZL001.count";
...@@ -110,6 +114,8 @@ public class HPZL001 extends DaoEPBase { ...@@ -110,6 +114,8 @@ public class HPZL001 extends DaoEPBase {
private String updatedName = " "; /* 更新人名称*/ private String updatedName = " "; /* 更新人名称*/
private String updatedTime = " "; /* 更新时间*/ private String updatedTime = " "; /* 更新时间*/
private Integer deleteFlag; /* 是否删除*/ private Integer deleteFlag; /* 是否删除*/
private String factoryCode = " "; /* 厂区编码*/
private String factoryName = " "; /* 厂区名称*/
/** /**
* initialize the metadata. * initialize the metadata.
...@@ -225,6 +231,14 @@ public class HPZL001 extends DaoEPBase { ...@@ -225,6 +231,14 @@ public class HPZL001 extends DaoEPBase {
eiColumn = new EiColumn(FIELD_DELETE_FLAG); eiColumn = new EiColumn(FIELD_DELETE_FLAG);
eiColumn.setDescName("是否删除"); eiColumn.setDescName("是否删除");
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_FACTORY_CODE);
eiColumn.setDescName("厂区编码");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_FACTORY_NAME);
eiColumn.setDescName("厂区名称");
eiMetadata.addMeta(eiColumn);
} }
...@@ -669,6 +683,38 @@ public class HPZL001 extends DaoEPBase { ...@@ -669,6 +683,38 @@ public class HPZL001 extends DaoEPBase {
this.deleteFlag = deleteFlag; this.deleteFlag = deleteFlag;
} }
/** /**
* get the factoryCode - 厂区编码.
* @return the factoryCode
*/
public String getFactoryCode() {
return this.factoryCode;
}
/**
* set the factoryCode - 厂区编码.
*
* @param factoryCode - 厂区编码
*/
public void setFactoryCode(String factoryCode) {
this.factoryCode = factoryCode;
}
/**
* get the factoryName - 厂区名称.
* @return the factoryName
*/
public String getFactoryName() {
return this.factoryName;
}
/**
* set the factoryName - 厂区名称.
*
* @param factoryName - 厂区名称
*/
public void setFactoryName(String factoryName) {
this.factoryName = factoryName;
}
/**
* get the value from Map. * get the value from Map.
* *
* @param map - source data map * @param map - source data map
...@@ -703,6 +749,8 @@ public class HPZL001 extends DaoEPBase { ...@@ -703,6 +749,8 @@ public class HPZL001 extends DaoEPBase {
setUpdatedName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_UPDATED_NAME)), updatedName)); setUpdatedName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_UPDATED_NAME)), updatedName));
setUpdatedTime(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_UPDATED_TIME)), updatedTime)); setUpdatedTime(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_UPDATED_TIME)), updatedTime));
setDeleteFlag(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_DELETE_FLAG)), deleteFlag)); setDeleteFlag(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_DELETE_FLAG)), deleteFlag));
setFactoryCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_FACTORY_CODE)), factoryCode));
setFactoryName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_FACTORY_NAME)), factoryName));
} }
/** /**
...@@ -739,7 +787,8 @@ public class HPZL001 extends DaoEPBase { ...@@ -739,7 +787,8 @@ public class HPZL001 extends DaoEPBase {
map.put(FIELD_UPDATED_NAME, StringUtils.toString(updatedName, eiMetadata.getMeta(FIELD_UPDATED_NAME))); map.put(FIELD_UPDATED_NAME, StringUtils.toString(updatedName, eiMetadata.getMeta(FIELD_UPDATED_NAME)));
map.put(FIELD_UPDATED_TIME, StringUtils.toString(updatedTime, eiMetadata.getMeta(FIELD_UPDATED_TIME))); map.put(FIELD_UPDATED_TIME, StringUtils.toString(updatedTime, eiMetadata.getMeta(FIELD_UPDATED_TIME)));
map.put(FIELD_DELETE_FLAG, StringUtils.toString(deleteFlag, eiMetadata.getMeta(FIELD_DELETE_FLAG))); map.put(FIELD_DELETE_FLAG, StringUtils.toString(deleteFlag, eiMetadata.getMeta(FIELD_DELETE_FLAG)));
map.put(FIELD_FACTORY_CODE, StringUtils.toString(factoryCode, eiMetadata.getMeta(FIELD_FACTORY_CODE)));
map.put(FIELD_FACTORY_NAME, StringUtils.toString(factoryName, eiMetadata.getMeta(FIELD_FACTORY_NAME)));
return map; return map;
} }
} }
...@@ -35,6 +35,7 @@ public class HPZL001A extends DaoEPBase { ...@@ -35,6 +35,7 @@ public class HPZL001A extends DaoEPBase {
public static final String FIELD_UPDATED_BY = "updatedBy"; /* 修改人*/ public static final String FIELD_UPDATED_BY = "updatedBy"; /* 修改人*/
public static final String FIELD_UPDATED_NAME = "updatedName"; /* 修改人名称*/ public static final String FIELD_UPDATED_NAME = "updatedName"; /* 修改人名称*/
public static final String FIELD_UPDATED_TIME = "updatedTime"; /* 修改时间*/ public static final String FIELD_UPDATED_TIME = "updatedTime"; /* 修改时间*/
public static final String FIELD_BIZ_TYPE = "bizType"; /* 业务类型*/
public static final String COL_ID = "ID"; /* 主键ID*/ public static final String COL_ID = "ID"; /* 主键ID*/
public static final String COL_COMPANY_CODE = "COMPANY_CODE"; /* 企业编码 预留*/ public static final String COL_COMPANY_CODE = "COMPANY_CODE"; /* 企业编码 预留*/
...@@ -49,6 +50,7 @@ public class HPZL001A extends DaoEPBase { ...@@ -49,6 +50,7 @@ public class HPZL001A extends DaoEPBase {
public static final String COL_UPDATED_BY = "UPDATED_BY"; /* 修改人*/ public static final String COL_UPDATED_BY = "UPDATED_BY"; /* 修改人*/
public static final String COL_UPDATED_NAME = "UPDATED_NAME"; /* 修改人名称*/ public static final String COL_UPDATED_NAME = "UPDATED_NAME"; /* 修改人名称*/
public static final String COL_UPDATED_TIME = "UPDATED_TIME"; /* 修改时间*/ public static final String COL_UPDATED_TIME = "UPDATED_TIME"; /* 修改时间*/
public static final String COL_BIZ_TYPE = "BIZ_TYPE"; /* 业务类型*/
public static final String QUERY = "HPZL001A.query"; public static final String QUERY = "HPZL001A.query";
public static final String COUNT = "HPZL001A.count"; public static final String COUNT = "HPZL001A.count";
...@@ -69,6 +71,7 @@ public class HPZL001A extends DaoEPBase { ...@@ -69,6 +71,7 @@ public class HPZL001A extends DaoEPBase {
private String updatedBy = " "; /* 修改人*/ private String updatedBy = " "; /* 修改人*/
private String updatedName = " "; /* 修改人名称*/ private String updatedName = " "; /* 修改人名称*/
private String updatedTime = " "; /* 修改时间*/ private String updatedTime = " "; /* 修改时间*/
private String bizType = " "; /* 业务类型*/
/** /**
* initialize the metadata. * initialize the metadata.
...@@ -129,6 +132,10 @@ public class HPZL001A extends DaoEPBase { ...@@ -129,6 +132,10 @@ public class HPZL001A extends DaoEPBase {
eiColumn.setDescName("修改时间"); eiColumn.setDescName("修改时间");
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_BIZ_TYPE);
eiColumn.setDescName("业务类型");
eiMetadata.addMeta(eiColumn);
} }
...@@ -348,6 +355,22 @@ public class HPZL001A extends DaoEPBase { ...@@ -348,6 +355,22 @@ public class HPZL001A extends DaoEPBase {
this.updatedTime = updatedTime; this.updatedTime = updatedTime;
} }
/** /**
* get the bizType - 业务类型.
* @return the bizType
*/
public String getBizType() {
return this.bizType;
}
/**
* set the bizType - 业务类型.
*
* @param bizType - 业务类型
*/
public void setBizType(String bizType) {
this.bizType = bizType;
}
/**
* get the value from Map. * get the value from Map.
* *
* @param map - source data map * @param map - source data map
...@@ -368,6 +391,7 @@ public class HPZL001A extends DaoEPBase { ...@@ -368,6 +391,7 @@ public class HPZL001A extends DaoEPBase {
setUpdatedBy(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_UPDATED_BY)), updatedBy)); setUpdatedBy(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_UPDATED_BY)), updatedBy));
setUpdatedName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_UPDATED_NAME)), updatedName)); setUpdatedName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_UPDATED_NAME)), updatedName));
setUpdatedTime(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_UPDATED_TIME)), updatedTime)); setUpdatedTime(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_UPDATED_TIME)), updatedTime));
setBizType(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_BIZ_TYPE)), bizType));
} }
/** /**
...@@ -390,6 +414,7 @@ public class HPZL001A extends DaoEPBase { ...@@ -390,6 +414,7 @@ public class HPZL001A extends DaoEPBase {
map.put(FIELD_UPDATED_BY, StringUtils.toString(updatedBy, eiMetadata.getMeta(FIELD_UPDATED_BY))); map.put(FIELD_UPDATED_BY, StringUtils.toString(updatedBy, eiMetadata.getMeta(FIELD_UPDATED_BY)));
map.put(FIELD_UPDATED_NAME, StringUtils.toString(updatedName, eiMetadata.getMeta(FIELD_UPDATED_NAME))); map.put(FIELD_UPDATED_NAME, StringUtils.toString(updatedName, eiMetadata.getMeta(FIELD_UPDATED_NAME)));
map.put(FIELD_UPDATED_TIME, StringUtils.toString(updatedTime, eiMetadata.getMeta(FIELD_UPDATED_TIME))); map.put(FIELD_UPDATED_TIME, StringUtils.toString(updatedTime, eiMetadata.getMeta(FIELD_UPDATED_TIME)));
map.put(FIELD_BIZ_TYPE, StringUtils.toString(bizType, eiMetadata.getMeta(FIELD_BIZ_TYPE)));
return map; return map;
} }
......
...@@ -128,6 +128,8 @@ public class ServiceHPZL001B extends ServiceEPBase { ...@@ -128,6 +128,8 @@ public class ServiceHPZL001B extends ServiceEPBase {
newZl001.setDeleteFlag(CommonConstant.YesNo.NO_0); newZl001.setDeleteFlag(CommonConstant.YesNo.NO_0);
newZl001.setCheckUser(UserSession.getLoginName()); newZl001.setCheckUser(UserSession.getLoginName());
newZl001.setCheckUserName(UserSession.getLoginCName()); newZl001.setCheckUserName(UserSession.getLoginCName());
newZl001.setFactoryCode(dbSc005b.getFactoryCode());
newZl001.setFactoryName(dbSc005b.getFactoryName());
DaoUtils.insert(HPZL001.INSERT, newZl001); DaoUtils.insert(HPZL001.INSERT, newZl001);
} }
} catch (Exception e) { } catch (Exception e) {
......
...@@ -12,6 +12,8 @@ ...@@ -12,6 +12,8 @@
PROD_TASK_NO as "prodTaskNo", <!-- 生产任务号 --> PROD_TASK_NO as "prodTaskNo", <!-- 生产任务号 -->
PROJ_CODE as "projCode", <!-- 项目号 --> PROJ_CODE as "projCode", <!-- 项目号 -->
PROJ_NAME as "projName", <!-- 项目名称 --> PROJ_NAME as "projName", <!-- 项目名称 -->
FACTORY_CODE as "factoryCode", <!-- 厂区编码 -->
FACTORY_NAME as "factoryName", <!-- 厂区名称 -->
INVENT_CODE as "inventCode", <!-- 部件编码 --> INVENT_CODE as "inventCode", <!-- 部件编码 -->
INVENT_NAME as "inventName", <!-- 部件名称 --> INVENT_NAME as "inventName", <!-- 部件名称 -->
SUB_INVENT_CODE as "subInventCode", <!-- 零件编码 --> SUB_INVENT_CODE as "subInventCode", <!-- 零件编码 -->
...@@ -138,6 +140,8 @@ ...@@ -138,6 +140,8 @@
INVENT_NAME, <!-- 部件名称 --> INVENT_NAME, <!-- 部件名称 -->
SUB_INVENT_CODE, <!-- 零件编码 --> SUB_INVENT_CODE, <!-- 零件编码 -->
SUB_INVENT_NAME, <!-- 零件名称 --> SUB_INVENT_NAME, <!-- 零件名称 -->
FACTORY_CODE, <!-- 厂区编码 -->
FACTORY_NAME, <!-- 厂区名称 -->
ORG_NO, <!-- 生产组编码 --> ORG_NO, <!-- 生产组编码 -->
ORG_NAME, <!-- 生产组名称 --> ORG_NAME, <!-- 生产组名称 -->
POOR_TYPE, <!-- 不良品类 --> POOR_TYPE, <!-- 不良品类 -->
...@@ -151,7 +155,7 @@ ...@@ -151,7 +155,7 @@
DELETE_FLAG <!-- 是否删除 --> DELETE_FLAG <!-- 是否删除 -->
) VALUES ( ) VALUES (
#companyCode#, #depCode#, #receiptDate#, #checkNo#, #prodOrderNo#, #prodTaskNo#, #companyCode#, #depCode#, #receiptDate#, #checkNo#, #prodOrderNo#, #prodTaskNo#,
#projCode#, #projName#, #inventCode#, #inventName#, #subInventCode#, #subInventName#, #projCode#, #projName#, #inventCode#, #inventName#, #subInventCode#, #subInventName#,#factoryCode#,#factoryName#,
#orgNo#, #orgName#, #poorType#, #problemDesc#,#checkUser#,#checkUserName#, #status#, #orgNo#, #orgName#, #poorType#, #problemDesc#,#checkUser#,#checkUserName#, #status#,
#createdBy#, #createdName#, #createdTime#, #deleteFlag#) #createdBy#, #createdName#, #createdTime#, #deleteFlag#)
</insert> </insert>
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
A.CREATED_TIME as "createdTime", <!-- 创建时间 --> A.CREATED_TIME as "createdTime", <!-- 创建时间 -->
A.UPDATED_BY as "updatedBy", <!-- 修改人 --> A.UPDATED_BY as "updatedBy", <!-- 修改人 -->
A.UPDATED_NAME as "updatedName", <!-- 修改人名称 --> A.UPDATED_NAME as "updatedName", <!-- 修改人名称 -->
A.UPDATED_TIME as "updatedTime" <!-- 修改时间 --> A.UPDATED_TIME as "updatedTime"<!-- 修改时间 -->
</sql> </sql>
<sql id="condition"> <sql id="condition">
......
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