Commit a8318a65 by liuyang

Merge branch 'dev' of https://gitlab.baocloud.cn/bggf/smart/hp-smart into dev

parents efe0e78a 00281a1d
......@@ -127,6 +127,19 @@ public enum DdynamicEnum {
*/
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 {
* 编写:wwl
*/
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"),
//------------------------------------用户管理-----------------------------------
/**
......@@ -223,7 +249,15 @@ public enum DdynamicEnum {
* 用途:厂区查询
* 编写:ly
*/
FACTORY_CODE_BLOCK_ID("factory_code_block_id","factoryCode","factoryName","HPXS001.queryFactoryCode");
FACTORY_CODE_BLOCK_ID("factory_code_block_id","factoryCode","factoryName","HPXS001.queryFactoryCode"),
/**
* 模块:工人管理
* 用途:工人管理下拉框
* 编写:wwl
*/
WORKER_BLOCK_ID("worker_block_id","userId","userName","HPPZ013.queryComboBox");
/** 将结果集放入的块名 */
private final String blockId;
......
package com.baosight.hpjx.config;
import com.baosight.hpjx.xss.XssFilter;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* @Author wwl
* @Date 2024/3/11 14:20
*/
@Configuration
public class FilterConfig {
@Bean
public FilterRegistrationBean<XssFilter> xssFilterRegistration() {
FilterRegistrationBean<XssFilter> registration = new FilterRegistrationBean<>();
registration.setFilter(new XssFilter());
registration.addUrlPatterns("/*");
registration.setOrder(1);
return registration;
}
}
\ No newline at end of file
package com.baosight.hpjx.core.constant;
import com.baosight.hpjx.util.StringUtils;
/**
* @author:songx
* @date:2024/3/1,17:36
......
......@@ -48,8 +48,16 @@
COUNT(POOR_TYPE) AS POOR_TYPE_NUM,<!-- 单种不良品类数量 -->
CONCAT( FORMAT(COUNT(POOR_TYPE)/ (
SELECT COUNT(*) FROM hpjx.t_hpzl001 WHERE
COMPANY_CODE=#companyCode# )* 100,2),'%') AS NUM
FROM hpjx.t_hpzl001 WHERE COMPANY_CODE= #companyCode# AND DELETE_FLAG =0
COMPANY_CODE=#companyCode# )* 100,2),'%') AS NUM,
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
</select>
......@@ -65,11 +73,21 @@
INVENT_NAME as "inventName", <!-- 部件名称 -->
SUB_INVENT_CODE as "subInventCode", <!-- 零件编码 -->
SUB_INVENT_NAME as "subInventName", <!-- 零件名称 -->
FACTORY_CODE as "factoryCode", <!-- 厂区编码 -->
FACTORY_NAME as "factoryName", <!-- 厂区名称 -->
ORG_NO as "orgNo", <!-- 生产组编码 -->
ORG_NAME as "orgName", <!-- 生产组名称 -->
POOR_TYPE as "poorType", <!-- 不良品类 -->
STATUS as "status" <!-- 单据状态 0未处理 1已处理 -->
FROM hpjx.t_hpzl001 WHERE COMPANY_CODE= #companyCode# AND STATUS=#status# AND DELETE_FLAG =0
STATUS as "status", <!-- 单据状态 0未处理 1已处理 -->
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 id="pmQualityDetail" resultClass="java.util.HashMap">
......@@ -84,15 +102,25 @@
INVENT_NAME as "inventName", <!-- 部件名称 -->
SUB_INVENT_CODE as "subInventCode", <!-- 零件编码 -->
SUB_INVENT_NAME as "subInventName", <!-- 零件名称 -->
FACTORY_CODE as "factoryCode", <!-- 厂区编码 -->
FACTORY_NAME as "factoryName", <!-- 厂区名称 -->
ORG_NO as "orgNo", <!-- 生产组编码 -->
ORG_NAME as "orgName", <!-- 生产组名称 -->
POOR_TYPE as "poorType", <!-- 不良品类 -->
PROBLEM_DESC as "problemDesc", <!-- 质量问题描述 -->
CHECK_USER as "checkUser", <!-- 检查人 -->
CHECK_USER_NAME as "checkUserName", <!-- 检查人名称 -->
STATUS as "status" <!-- 单据状态 0未处理 1已处理 -->
FROM hpjx.t_hpzl001 WHERE COMPANY_CODE= #companyCode# AND STATUS=#status#
AND DELETE_FLAG = 0 AND CHECK_NO = #checkNo#
STATUS as "status", <!-- 单据状态 0未处理 1已处理 -->
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 DELETE_FLAG = 0 AND ID = #id#
</select>
<insert id="insert">
......@@ -109,6 +137,8 @@
INVENT_NAME, <!-- 部件名称 -->
SUB_INVENT_CODE, <!-- 零件编码 -->
SUB_INVENT_NAME, <!-- 零件名称 -->
FACTORY_CODE as "factoryCode", <!-- 厂区编码 -->
FACTORY_NAME as "factoryName", <!-- 厂区名称 -->
ORG_NO, <!-- 生产组编码 -->
ORG_NAME, <!-- 生产组名称 -->
POOR_TYPE, <!-- 不良品类 -->
......@@ -127,4 +157,9 @@
#createdBy#, #createdName#, #createdTime#, #deleteFlag#)
</insert>
<select id="queryFile" resultClass="java.util.HashMap">
SELECT CHG_NAME FROM iplat.TEUDM02 where DOC_ID=#docId#
</select>
</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;
import com.baosight.iplat4j.core.data.ibatis.dao.Dao;
import com.baosight.iplat4j.core.data.id.UUIDHexIdGenerator;
import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.ioc.spring.PlatApplicationContext;
import com.baosight.iplat4j.core.util.DateUtils;
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 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 javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
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 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();
String filePath;
String msg;
......@@ -25,9 +43,9 @@ public class uploadUntil {
String docPath;
filePath = multipartFile.getOriginalFilename();
Long docSize = multipartFile.getSize();
String chgName = fileUploader.transformFileName(filePath);
String chgName = transformFileName(filePath);
String attachmentName;
Map<String, String> pathMap = fileUploader.getRealPath("A");
Map<String, String> pathMap = getRealPath("A");
msg = (String)pathMap.get("dirId");
category = (String)pathMap.get("path");
checkInvalidPath(category);
......@@ -46,7 +64,7 @@ public class uploadUntil {
map.put("docSize", docSize);
map.put("recCreator", "");
map.put("recCreateTime", DateUtils.curDateTimeStr14());
fileUploader.uploadDoc(map);
uploadDoc(map);
attachmentName = category + "/" + chgName;
multipartFile.transferTo(new File(attachmentName));
documentJSON.put("docId", docPath);
......@@ -57,9 +75,56 @@ public class uploadUntil {
documentJSON.put("docUrl", attachmentName);
documentJSON.put("docSize", docSize);
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) {
......@@ -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())));
}
}
......@@ -19,9 +19,12 @@ 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.service.soa.XLocalManager;
import com.baosight.iplat4j.core.service.soa.XServiceManager;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -162,6 +165,28 @@ public class ServiceHPPZ013 extends ServiceBase {
fPz01301.setUserId(userId);
fPz01301.setDeleteFlag(CommonConstant.YesNo.NO_0);
DaoUtils.insert(HPPZ013.INSERT, fPz01301);
// 添加到组织机构
this.insertOrgMember(fPz01301);
}
/**
* 用户关联组织
*
* @param fPz01301
*/
private void insertOrgMember(HPPZ01301 fPz01301) {
Map inInfoRowMap = new HashMap();
inInfoRowMap.put("loginName", fPz01301.getUserId());
inInfoRowMap.put("userId", fPz01301.getUserId());
inInfoRowMap.put("orgId", fPz01301.getGroupCode());
EiInfo inInfo = new EiInfo();
inInfo.addBlock(EiConstant.resultBlock).addRow(inInfoRowMap);
inInfo.set(EiConstant.serviceName, "XSOG0801");
inInfo.set(EiConstant.methodName, "insertUserByOrgId");
EiInfo outInfo = XLocalManager.call(inInfo);
if (outInfo.getStatus() < 0) {
throw new PlatException(outInfo.getMsg());
}
}
/**
......@@ -188,6 +213,8 @@ public class ServiceHPPZ013 extends ServiceBase {
fPz013.fromMap(resultRow);
fPz013.setDeleteFlag(CommonConstant.YesNo.YES_1);
DaoUtils.update(HPPZ013.DELETE, fPz013);
// 从组织机构删除
this.deleteOrgMember(fPz013);
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
......@@ -198,4 +225,24 @@ public class ServiceHPPZ013 extends ServiceBase {
return inInfo;
}
/**
* 用户删除组织
*
* @param fPz013
*/
private void deleteOrgMember(HPPZ013 fPz013) {
EiInfo inInfo = new EiInfo();
inInfo.set("inqu_status-0-parentOrgId", fPz013.getGroupCode());
inInfo.set("result-0-userId", fPz013.getUserId());
inInfo.set("result-0-loginName", fPz013.getUserId());
inInfo.set("result-0-orgId", fPz013.getGroupCode());
inInfo.set("result-0-orgEname", fPz013.getGroupCode());
// serviceName:XSOrgManage,methodName:deleteRelationBetweenUserAndOrg
inInfo.set(EiConstant.serviceName, "XSOG0801");
inInfo.set(EiConstant.methodName, "deleteUserByOrgId");
EiInfo outInfo = XLocalManager.call(inInfo);
if (outInfo.getStatus() < 0) {
throw new PlatException(outInfo.getMsg());
}
}
}
......@@ -26,12 +26,10 @@
<sql id="condition">
AND DELETE_FLAG = '0'
AND COMPANY_CODE = #companyCode#
<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>
......@@ -170,4 +168,21 @@
WHERE ID = #id#
</update>
<select id="queryComboBox" parameterClass="java.util.HashMap"
resultClass="java.util.HashMap">
SELECT DISTINCT
USER_ID as "userId",
USER_NAME as "userName"
FROM ${hpjxSchema}.T_HPPZ013 WHERE STATUS = 1 AND DELETE_FLAG = '0'
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="factoryCode">
FACTORY_CODE = #factoryCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="groupCode">
GROUP_CODE = #groupCode#
</isNotEmpty>
ORDER BY USER_ID
</select>
</sqlMap>
......@@ -25,12 +25,10 @@
<sql id="condition">
AND DELETE_FLAG = '0'
AND COMPANY_CODE = #companyCode#
<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>
......
......@@ -6,11 +6,7 @@ import com.baosight.hpjx.core.dao.DaoBase;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.constant.HPSqlConstant;
import com.baosight.hpjx.hp.pz.domain.HPPZ004;
import com.baosight.hpjx.hp.pz.domain.HPPZ006;
import com.baosight.hpjx.hp.pz.domain.HPPZ007;
import com.baosight.hpjx.hp.pz.domain.HPPZ009;
import com.baosight.hpjx.hp.pz.domain.HPPZ011;
import com.baosight.hpjx.hp.pz.domain.*;
import com.baosight.hpjx.util.AssertUtils;
import com.baosight.hpjx.util.MapUtils;
import com.baosight.hpjx.util.ObjectUtils;
......@@ -534,6 +530,18 @@ public class HPPZTools {
}
}
public static class HpPz013 {
public static HPPZ013 get(String userId) {
AssertUtils.isNull(userId, "工人ID不能为空");
Map queryMap = new HashMap();
queryMap.put("userId", userId);
List<HPPZ013> results = DaoBase.getInstance().query(HPPZ013.QUERY, queryMap);
AssertUtils.isEmpty(results, String.format("工人ID[%s]不存在", userId));
return results.get(0);
}
}
/**
* 判断存货档案是否存在,如果存在返回存货档案,否则新增并返回存货档案
*
......
......@@ -2,17 +2,22 @@ package com.baosight.hpjx.hp.sc.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.common.ProdOrderStatusEnum;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoBase;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.sc.domain.*;
import com.baosight.hpjx.hp.sc.tools.HPSCTools;
import com.baosight.hpjx.hp.xs.domain.Org;
import com.baosight.hpjx.hp.xs.tools.HPXSTools;
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.service.impl.ServiceBase;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import org.apache.commons.collections.CollectionUtils;
import java.math.BigDecimal;
......@@ -86,7 +91,7 @@ public class ServiceHPSC003B extends ServiceBase {
Map parmMap = new HashMap();
parmMap.put("orgType","prodGroup");
parmMap.put("parentOrgId", factoryCode);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.GROUP_RECORD_BLOCK_ID), null, false);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.GROUP_RECORD_BLOCK_ID), parmMap, false);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
......@@ -101,4 +106,56 @@ public class ServiceHPSC003B extends ServiceBase {
public EiInfo query(EiInfo inInfo) {
return inInfo;
}
/**
* 创建任务
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "自动排产",operType = "查询")
public EiInfo autoGenerateTask(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 写入数据
for (int i = 0; i < resultRows.size(); i++) {
HPSC005 hpsc005 = new HPSC005();
hpsc005.fromMap(resultRows.get(i));
HPSC005 dbSc005 = HPSCTools.HpSc005.get(hpsc005.getProdOrderNo());
// 锁主单号
HPSCTools.HpSc005.lock(dbSc005.getProdOrderNo());
// 校验主订单是否已分派
AssertUtils.isTrue(ProdOrderStatusEnum.ALL_ASSIGN.getCode().equals(dbSc005.getStatus()),
String.format("生产订单[%s]已全部分派,不能在进行批量分派,请检查!", dbSc005.getProdOrderNo()));
// 更新订单主表数量
if (ProdOrderStatusEnum.NOT_ASSIGN.getCode().equals(dbSc005.getStatus())) {
HPSCTools.checkAssignedNum(dbSc005.getProdOrderNo(), dbSc005.getNum());
} else {
HPSCTools.checkAssignedNum2(dbSc005.getProdOrderNo(), dbSc005.getUnassignedNum());
}
// 写入子表数据
HPSC005A newSc005a = new HPSC005A();
newSc005a.setProdTaskNo(SequenceGenerator.getNextSequence(HPConstant.SequenceId.PROD_TASK_NO,
new String[]{dbSc005.getProdOrderNo()}));
newSc005a.setProdOrderNo(dbSc005.getProdOrderNo());
//区分未派单与部分派单
if (ProdOrderStatusEnum.NOT_ASSIGN.getCode().equals(dbSc005.getStatus())) {
newSc005a.setNum(dbSc005.getNum());
} else {
newSc005a.setNum(dbSc005.getUnassignedNum());
}
newSc005a.setTotalWt(newSc005a.getNum().multiply(dbSc005.getUnitWt()));
newSc005a.setOrgNo(hpsc005.getOrgNo());
newSc005a.setOrgName(hpsc005.getOrgName());
newSc005a.setFactoryCode(hpsc005.getFactoryCode());
newSc005a.setFactoryName(hpsc005.getFactoryName());
DaoUtils.insert(HPSC005A.INSERT, newSc005a);
}
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据进行智能分派!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "智能分派失败");
}
return inInfo;
}
}
......@@ -226,6 +226,9 @@ public class ServiceHPSC005A extends ServiceBase {
for (String orderId : orderIds) {
// 校验主订单是否已分派
HPSC005 dbSc005 = HPSCTools.HpSc005.getById(Long.parseLong(orderId));
// 锁主单号
HPSCTools.HpSc005.lock(dbSc005.getProdOrderNo());
AssertUtils.isTrue(ProdOrderStatusEnum.ALL_ASSIGN.getCode().equals(dbSc005.getStatus()),
String.format("生产订单[%s]已全部分派,不能在进行批量分派,请检查!", dbSc005.getProdOrderNo()));
// 更新订单主表数量
......
......@@ -6,6 +6,7 @@ import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.core.security.UserSessionUtils;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.pz.tools.HPPZTools;
import com.baosight.hpjx.hp.sc.domain.HPSC004;
import com.baosight.hpjx.hp.sc.domain.HPSC005;
import com.baosight.hpjx.hp.sc.domain.HPSC006;
......@@ -46,7 +47,10 @@ public class ServiceHPSC007 extends ServiceBase {
HPSC006.setPartName(HPSC005.getPartName());
inInfo.addBlock("detail").addRow(HPSC006);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPSC007().eiMetadata);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.USER_BLOCK_ID), null, false);
Map map = new HashMap();
map.put("factoryCode", HPSC006.getFactoryCode());
map.put("groupCode", HPSC006.getOrgNo());
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.WORKER_BLOCK_ID), map, false);
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "初始化失败");
}
......@@ -112,8 +116,7 @@ public class ServiceHPSC007 extends ServiceBase {
BigDecimal totalWt = new BigDecimal(decimalFormat.format(num.multiply(unitWt).floatValue()));
actualCompletionTotalWt = actualCompletionTotalWt.add(totalWt);
HPSC007.setactualCompletionTotalWt(totalWt);
Map<String,String> user = (Map<String, String>) this.dao.get("HPXSUser.queryComboBox", "userId", HPSC007.getUserId());
HPSC007.setUserName(user.get("userName"));
HPSC007.setUserName(HPPZTools.HpPz013.get(HPSC007.getUserId()).getUserName());
DaoUtils.insert("HPSC007.insert",HPSC007);
}
// 修改下料表中的字段
......@@ -178,6 +181,7 @@ public class ServiceHPSC007 extends ServiceBase {
BigDecimal totalWt = new BigDecimal(decimalFormat.format(Math.round(num.multiply(unitWt).floatValue())));
actualCompletionTotalWt = actualCompletionTotalWt.add(new BigDecimal(decimalFormat.format(Math.round(totalNum.multiply(unitWt).floatValue()))));
HPSC007.setactualCompletionTotalWt(totalWt);
HPSC007.setUserName(HPPZTools.HpPz013.get(HPSC007.getUserId()).getUserName());
DaoUtils.insert("HPSC007.update",HPSC007);
}
// 修改下料表中的字段
......
......@@ -333,6 +333,40 @@
ORDER BY PROJ_CODE
</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
......
......@@ -4,6 +4,7 @@
<sql id="condition">
AND IS_DELETED = '0'
AND COMPANY_CODE = #companyCode#
<isNotEmpty prepend=" AND " property="orgEname">
ORG_ENAME = #orgEname#
</isNotEmpty>
......@@ -19,9 +20,6 @@
<isNotEmpty prepend=" AND " property="parentOrgId">
PARENT_ORG_ID = #parentOrgId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
</sql>
<sql id="customCondition">
......@@ -165,7 +163,10 @@
ORG_CNAME
FROM iplat.TXSOG01 WHERE COMPANY_CODE=#companyCode#
) 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">
B.ORG_CNAME LIKE CONCAT('%', #factoryName#, '%')
</isNotEmpty>
......@@ -174,4 +175,15 @@
</isNotEmpty>
</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>
......@@ -48,7 +48,9 @@ public class HPZL001 extends DaoEPBase {
public static final String FIELD_UPDATED_NAME = "updatedName"; /* 更新人名称*/
public static final String FIELD_UPDATED_TIME = "updatedTime"; /* 更新时间*/
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_COMPANY_CODE = "COMPANY_CODE"; /* 企业编码 预留*/
public static final String COL_DEP_CODE = "DEP_CODE"; /* 部门编码*/
......@@ -76,6 +78,8 @@ public class HPZL001 extends DaoEPBase {
public static final String COL_UPDATED_NAME = "UPDATED_NAME"; /* 更新人名称*/
public static final String COL_UPDATED_TIME = "UPDATED_TIME"; /* 更新时间*/
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 COUNT = "HPZL001.count";
......@@ -110,6 +114,8 @@ public class HPZL001 extends DaoEPBase {
private String updatedName = " "; /* 更新人名称*/
private String updatedTime = " "; /* 更新时间*/
private Integer deleteFlag; /* 是否删除*/
private String factoryCode = " "; /* 厂区编码*/
private String factoryName = " "; /* 厂区名称*/
/**
* initialize the metadata.
......@@ -225,6 +231,14 @@ public class HPZL001 extends DaoEPBase {
eiColumn = new EiColumn(FIELD_DELETE_FLAG);
eiColumn.setDescName("是否删除");
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 {
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.
*
* @param map - source data map
......@@ -703,6 +749,8 @@ public class HPZL001 extends DaoEPBase {
setUpdatedName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_UPDATED_NAME)), updatedName));
setUpdatedTime(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_UPDATED_TIME)), updatedTime));
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 {
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_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;
}
}
......@@ -35,6 +35,7 @@ public class HPZL001A extends DaoEPBase {
public static final String FIELD_UPDATED_BY = "updatedBy"; /* 修改人*/
public static final String FIELD_UPDATED_NAME = "updatedName"; /* 修改人名称*/
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_COMPANY_CODE = "COMPANY_CODE"; /* 企业编码 预留*/
......@@ -49,6 +50,7 @@ public class HPZL001A extends DaoEPBase {
public static final String COL_UPDATED_BY = "UPDATED_BY"; /* 修改人*/
public static final String COL_UPDATED_NAME = "UPDATED_NAME"; /* 修改人名称*/
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 COUNT = "HPZL001A.count";
......@@ -69,6 +71,7 @@ public class HPZL001A extends DaoEPBase {
private String updatedBy = " "; /* 修改人*/
private String updatedName = " "; /* 修改人名称*/
private String updatedTime = " "; /* 修改时间*/
private String bizType = " "; /* 业务类型*/
/**
* initialize the metadata.
......@@ -129,6 +132,10 @@ public class HPZL001A extends DaoEPBase {
eiColumn.setDescName("修改时间");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_BIZ_TYPE);
eiColumn.setDescName("业务类型");
eiMetadata.addMeta(eiColumn);
}
......@@ -348,6 +355,22 @@ public class HPZL001A extends DaoEPBase {
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.
*
* @param map - source data map
......@@ -368,6 +391,7 @@ public class HPZL001A extends DaoEPBase {
setUpdatedBy(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_UPDATED_BY)), updatedBy));
setUpdatedName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_UPDATED_NAME)), updatedName));
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 {
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_TIME, StringUtils.toString(updatedTime, eiMetadata.getMeta(FIELD_UPDATED_TIME)));
map.put(FIELD_BIZ_TYPE, StringUtils.toString(bizType, eiMetadata.getMeta(FIELD_BIZ_TYPE)));
return map;
}
......
......@@ -128,6 +128,8 @@ public class ServiceHPZL001B extends ServiceEPBase {
newZl001.setDeleteFlag(CommonConstant.YesNo.NO_0);
newZl001.setCheckUser(UserSession.getLoginName());
newZl001.setCheckUserName(UserSession.getLoginCName());
newZl001.setFactoryCode(dbSc005b.getFactoryCode());
newZl001.setFactoryName(dbSc005b.getFactoryName());
DaoUtils.insert(HPZL001.INSERT, newZl001);
}
} catch (Exception e) {
......
......@@ -12,6 +12,8 @@
PROD_TASK_NO as "prodTaskNo", <!-- 生产任务号 -->
PROJ_CODE as "projCode", <!-- 项目号 -->
PROJ_NAME as "projName", <!-- 项目名称 -->
FACTORY_CODE as "factoryCode", <!-- 厂区编码 -->
FACTORY_NAME as "factoryName", <!-- 厂区名称 -->
INVENT_CODE as "inventCode", <!-- 部件编码 -->
INVENT_NAME as "inventName", <!-- 部件名称 -->
SUB_INVENT_CODE as "subInventCode", <!-- 零件编码 -->
......@@ -138,6 +140,8 @@
INVENT_NAME, <!-- 部件名称 -->
SUB_INVENT_CODE, <!-- 零件编码 -->
SUB_INVENT_NAME, <!-- 零件名称 -->
FACTORY_CODE, <!-- 厂区编码 -->
FACTORY_NAME, <!-- 厂区名称 -->
ORG_NO, <!-- 生产组编码 -->
ORG_NAME, <!-- 生产组名称 -->
POOR_TYPE, <!-- 不良品类 -->
......@@ -151,7 +155,7 @@
DELETE_FLAG <!-- 是否删除 -->
) VALUES (
#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#,
#createdBy#, #createdName#, #createdTime#, #deleteFlag#)
</insert>
......
......@@ -15,7 +15,7 @@
A.CREATED_TIME as "createdTime", <!-- 创建时间 -->
A.UPDATED_BY as "updatedBy", <!-- 修改人 -->
A.UPDATED_NAME as "updatedName", <!-- 修改人名称 -->
A.UPDATED_TIME as "updatedTime" <!-- 修改时间 -->
A.UPDATED_TIME as "updatedTime"<!-- 修改时间 -->
</sql>
<sql id="condition">
......
......@@ -2,9 +2,12 @@ package com.baosight.hpjx.util;
import com.alibaba.fastjson.JSONObject;
import com.baosight.iplat4j.core.exception.PlatException;
import org.springframework.util.AntPathMatcher;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.UUID;
......@@ -127,5 +130,65 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
paramsText = URLDecoder.decode(paramsText, "UTF-8");
return JSONObject.parseObject(paramsText).getInnerMap();
}
/**
* 查找指定字符串是否匹配指定字符串列表中的任意一个字符串
*
* @param str 指定字符串
* @param strs 需要检查的字符串数组
* @return 是否匹配
*/
public static boolean matches(String str, List<String> strs)
{
if (isEmpty(str) || isEmpty(strs))
{
return false;
}
for (String pattern : strs)
{
if (isMatch(pattern, str))
{
return true;
}
}
return false;
}
/**
* 判断url是否与规则配置:
* ? 表示单个字符;
* * 表示一层路径内的任意字符串,不可跨层级;
* ** 表示任意层路径;
*
* @param pattern 匹配规则
* @param url 需要匹配的url
* @return
*/
public static boolean isMatch(String pattern, String url)
{
AntPathMatcher matcher = new AntPathMatcher();
return matcher.match(pattern, url);
}
/**
* * 判断一个Collection是否为空, 包含List,Set,Queue
*
* @param coll 要判断的Collection
* @return true:为空 false:非空
*/
public static boolean isEmpty(Collection<?> coll)
{
return isNull(coll) || coll.isEmpty();
}
/**
* * 判断一个对象是否为空
*
* @param object Object
* @return true:为空 false:非空
*/
public static boolean isNull(Object object)
{
return object == null;
}
}
package com.baosight.hpjx.xss;
import com.baosight.hpjx.util.StringUtils;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
/**
* xss过滤
*/
public class XssFilter implements Filter {
//不拦截的地址
private List<String> excludedList = new ArrayList<String>();
@Override
public void init(FilterConfig config) throws ServletException {
/*
* 这里只处理了需要拦截的url地址,如果想不拦截某个字段,比如富文本字段,
* 需要自己在XssHttpServletRequestWrapper类中去添加逻辑
*/
excludedList.add("/service/HP*/*");
}
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
throws IOException, ServletException {
XssHttpServletRequestWrapper xssRequest = new XssHttpServletRequestWrapper(
(HttpServletRequest) request);
String url = xssRequest.getServletPath();
if(isExcluded(url)){
chain.doFilter(request, response);
}else{
//使用XSS过滤
chain.doFilter(xssRequest, response);
}
}
@Override
public void destroy() {
}
/**
* 是否不拦截
* @param url 请求地址
* @return true不拦截,false拦截
*/
private boolean isExcluded(String url){
// if(StringUtils.isBlank(url)){
// return false;
// }
if(!StringUtils.matches(url, excludedList)){
return true;
}
// for (String excluded : excludedList) {
// if(!url.contains(excluded)){
// return true;
// }
// }
return false;
}
}
package com.baosight.hpjx.xss;
import org.apache.commons.lang3.StringEscapeUtils;
import org.apache.commons.lang3.StringUtils;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequestWrapper;
import java.util.LinkedHashMap;
import java.util.Map;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import javax.servlet.ReadListener;
import javax.servlet.ServletInputStream;
import org.apache.commons.io.IOUtils;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
public class XssHttpServletRequestWrapper extends HttpServletRequestWrapper {
// 没被包装过的HttpServletRequest(特殊场景,需求自己过滤)
HttpServletRequest orgRequest;
// html过滤
private final static HTMLFilter htmlFilter = new HTMLFilter();
public XssHttpServletRequestWrapper(HttpServletRequest request) {
super(request);
orgRequest = request;
}
/**
* 过滤json参数
*/
@Override
public ServletInputStream getInputStream() throws IOException {
String contentType = super.getHeader(HttpHeaders.CONTENT_TYPE);
//非json类型,直接返回
if(!(MediaType.APPLICATION_JSON_VALUE.
equalsIgnoreCase(contentType) ||
MediaType.APPLICATION_JSON_UTF8_VALUE.
equalsIgnoreCase(contentType))){
return super.getInputStream();
}
//为空,直接返回
String json = IOUtils.toString(super.getInputStream(), "utf-8");
if (StringUtils.isBlank(json)) {
return super.getInputStream();
}
//xss过滤
json =xssEncode(json);
json = StringEscapeUtils.unescapeHtml4(json);
final ByteArrayInputStream bis =
new ByteArrayInputStream(json.getBytes("utf-8"));
return new ServletInputStream() {
@Override
public boolean isFinished() {
return true;
}
@Override
public boolean isReady() {
return true;
}
@Override
public void setReadListener(ReadListener readListener) {
}
@Override
public int read() throws IOException {
return bis.read();
}
};
}
@Override
public String getParameter(String name) {
String value = super.getParameter(xssEncode(name));
if (StringUtils.isNotBlank(value)) {
value =xssEncode(value);
}
return StringEscapeUtils.unescapeHtml4(value);
}
@Override
public String[] getParameterValues(String name) {
String[] parameters = super.getParameterValues(name);
if (parameters == null || parameters.length == 0) {
return null;
}
for (int i = 0; i < parameters.length; i++) {
parameters[i] = xssEncode(parameters[i]);
parameters[i] = StringEscapeUtils.unescapeHtml4(parameters[i]);
}
return parameters;
}
@Override
public Map<String, String[]> getParameterMap() {
Map<String, String[]> map = new LinkedHashMap<>();
Map<String, String[]> parameters = super.getParameterMap();
for (String key : parameters.keySet()) {
String[] values = parameters.get(key);
for (int i = 0; i < values.length; i++) {
values[i] = xssEncode(values[i]);
values[i] = StringEscapeUtils.unescapeHtml4(values[i]);
}
map.put(key, values);
}
return map;
}
@Override
public String getHeader(String name) {
String value = super.getHeader(xssEncode(name));
if (StringUtils.isNotBlank(value)) {
value = xssEncode(value);
}
return StringEscapeUtils.unescapeHtml4(value);
}
private String xssEncode(String input) {
return htmlFilter.filter(input);
}
/**
* 获取最原始的request
*/
public HttpServletRequest getOrgRequest() {
return orgRequest;
}
/**
* 获取最原始的request
*/
public static HttpServletRequest getOrgRequest(HttpServletRequest request) {
if (request instanceof XssHttpServletRequestWrapper) {
return ((XssHttpServletRequestWrapper) request).getOrgRequest();
}
return request;
}
}
......@@ -11,11 +11,11 @@
<%--<EF:EFInput cname="项目编号" blockId="inqu_status" ename="projCode" row="0" colWidth="3"/>--%>
<EF:EFInput cname="项目名称" blockId="inqu_status" ename="projName" row="0" colWidth="3"/>
<EF:EFInput cname="部件名称" blockId="inqu_status" ename="prdtName" row="0" colWidth="3"/>
<EF:EFInput cname="生产计划单号" blockId="inqu_status" ename="planInfoNo" row="0" colWidth="3"/>
<%-- <EF:EFInput cname="生产计划单号" blockId="inqu_status" ename="planInfoNo" row="0" colWidth="3"/>--%>
<EF:EFDatePicker cname="计划完成日期" blockId="inqu_status" ename="planCompletionDate" row="0" colWidth="3"
format="yyyy-MM-dd" readonly="true"/>
</div>
<div class="row">
<%-- </div>--%>
<%-- <div class="row">--%>
<EF:EFSelect cname="状态" blockId="inqu_status" ename="status" row="0" colWidth="3" optionLabel="全部">
<EF:EFOption label="未提交" value="0"/>
<EF:EFOption label="已提交" value="1"/>
......@@ -28,7 +28,7 @@
<EF:EFColumn ename="id" cname="主键" hidden="true"/>
<EF:EFColumn ename="operator" cname="操作" locked="true" enable="false" width="100" align="center"/>
<EF:EFColumn enable="false" ename="projCode" cname="项目号" readonly="true" hidden="true"/>
<EF:EFColumn enable="false" ename="planInfoNo" cname="生产计划单号" readonly="true" width="100"/>
<EF:EFColumn enable="false" ename="planInfoNo" cname="生产计划单号" readonly="true" hidden="true" width="100"/>
<EF:EFColumn enable="false" ename="projName" cname="项目名称" width="120" readonly="true"/>
<EF:EFComboColumn ename="prdtType" cname="部件类型" hidden = 'true' width="90" align="center" enable="false">
<EF:EFCodeOption codeName="hpjx.hpkc.inventType" />
......
$(function () {
IPLATUI.EFGrid = {
"result" : {
"result": {
toolbarConfig: {
hidden: true, // true时,不显示功能按钮,但保留setting导出按钮
},
......@@ -18,6 +18,53 @@ $(function () {
}
}
/**
* 取消
*/
$('#cancel').on('click', function () {
// 关闭弹窗
parent.JSColorbox.close();
})
/**
* 确认
*/
$('#confirm').on('click', function () {
let allRows = new Array();
allRows = resultGrid.getDataItems();
console.log(allRows);
if (allRows.length > 0) {
const inEiInfo = new EiInfo();
$.each(allRows, function(index, item) {
inEiInfo.set("result-"+index+"-id",item["id"])
inEiInfo.set("result-"+index+"-prodOrderNo",item["prodOrderNo"])
inEiInfo.set("result-"+index+"-factoryName",item["factoryName"])
inEiInfo.set("result-"+index+"-factoryCode",item["factoryCode"])
inEiInfo.set("result-"+index+"-orgName",item["orgName"])
inEiInfo.set("result-"+index+"-orgNo",item["orgNo"])
})
EiCommunicator.send('HPSC003B', 'autoGenerateTask', inEiInfo, {
onSuccess(response) {
NotificationUtil(response.msg);
// 关闭弹窗
parent.JSColorbox.close();
query();
},
onFail(errorMessage, status, e) {
NotificationUtil("执行失败!", "error");
}
},
{
async: false
}
);
} else {
message("没有可以生成的计划!");
return;
}
})
});
......@@ -25,14 +72,15 @@ $(function () {
* 查询
*/
function query() {
resultGrid.dataSource.page(1);
resultGrid.dataSource.page(1);
}
function deleteRow(rowNo) {
resultGrid.removeRows([rowNo]);// 刷新行号
refreshRowNo();
}
let refreshRowNo =function() {
let refreshRowNo = function () {
let allRows = resultGrid.getDataItems();
for (let i = 0; i < allRows.length; i++) {
resultGrid.setCellValue(i, "rowNo", i);
......@@ -43,17 +91,4 @@ $(window).load(function () {
refreshRowNo();
});
/**
* 取消
*/
$('#cancel').on('click',function () {
// 关闭弹窗
parent.JSColorbox.close();
})
/**
* 确认
*/
$('#confirm').on('click',function () {
})
......@@ -10,8 +10,9 @@
<EF:EFRegion id="result" title="记录集">
<EF:EFGrid blockId="result" autoDraw="override">
<EF:EFColumn ename="operator" cname="操作" locked="true" enable="false" width="80" align="center"/>
<EF:EFColumn ename="id" cname="主键" hidden="true"/>
<EF:EFColumn ename="rowNo" cname="行号" hidden="true"/>
<EF:EFColumn ename="id" cname="主键" hidden="true"/>
<EF:EFColumn ename="prodOrderNo" cname="生产订单号" hidden="true"/>
<EF:EFColumn ename="projName" cname="项目名称" enable="false" width="140" align="center"/>
<EF:EFColumn ename="prdtName" cname="部件名称" enable="false" width="100" align="center"/>
<EF:EFColumn ename="partName" cname="零件名称" enable="false" width="100" align="center"/>
......
......@@ -47,7 +47,7 @@
<EF:EFColumn ename="hpsc006Id" cname="生产下料ID" hidden="true"/>
<EF:EFComboColumn ename="userId" cname="完成人" width="100" align="center"
filter="contains" readonly="true">
<EF:EFOptions blockId="user_block_id" valueField="valueField" textField="textField"/>
<EF:EFOptions blockId="worker_block_id" valueField="valueField" textField="textField"/>
</EF:EFComboColumn>
<EF:EFColumn ename="userName" cname="完成名称" hidden="true"/>
<EF:EFColumn ename="actualCompletionNum" cname="完成数量" format="{0:N3}" maxLength="12" displayType="0.000"
......
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