Commit fb809a10 by 江和松

Merge remote-tracking branch 'origin/dev' into dev

parents 9689b245 762c272d
package com.baosight.hggp.aspect.annotation;
import com.baosight.hggp.aspect.domain.TCPReceive;
import com.baosight.hggp.controller.DocController;
import com.baosight.iplat4j.core.web.controller.WebDispatchController;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......
package com.baosight.hggp.aspect.annotation;
package com.baosight.hggp.controller;
import com.alibaba.fastjson.JSONObject;
import com.baosight.hggp.core.enums.DocRouteEnum;
import com.baosight.hggp.util.DocExcelUtils;
import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.util.MapUtils;
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.soa.XLocalManager;
import com.baosight.iplat4j.core.web.controller.WebDispatchController;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.math.NumberUtils;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.CrossOrigin;
......@@ -20,10 +21,11 @@ import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import java.net.URLDecoder;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.baosight.hggp.common.DocRouteEnum;
/**
* DOC 接口类
*
......@@ -35,7 +37,7 @@ import com.baosight.hggp.common.DocRouteEnum;
@RequestMapping("/doc")
public class DocController extends WebDispatchController {
private final static Logger logger = LoggerFactory.getLogger(DocController.class);
private final static Logger log = LoggerFactory.getLogger(DocController.class);
/**
* 批量导入
......@@ -53,29 +55,28 @@ public class DocController extends WebDispatchController {
outInfo.setMsg("导入文件不能为空");
return outInfo;
}
Map<String, String> params = this.convertParam(paramMaps);
Map<String, Object> params = this.convertParam(paramMaps);
String id = request.getParameter("id");
DocRouteEnum docRouteEnum = DocRouteEnum.getById(id);
if (params.get("fileName").contains("HGSC004A")){
if (MapUtils.getString(params, "fileName").contains("HGSC004A")) {
docRouteEnum = DocRouteEnum.getById("route_001");
}else if (params.get("fileName").contains("HGSC009A")){
} else if (params.get("fileName").toString().contains("HGSC009A")) {
docRouteEnum = DocRouteEnum.getById("route_002");
}else if (params.get("fileName").contains("HGPZ005")){
} else if (params.get("fileName").toString().contains("HGPZ005")) {
docRouteEnum = DocRouteEnum.getById("route_003");
}
if (docRouteEnum == null) {
outInfo.setMsg("导入标识ID不存在");
return outInfo;
}
String startRow = request.getParameter("startRow");
List dataList = DocExcelUtils.readExcel(file, NumberUtils.createInteger(startRow), docRouteEnum.getClazz());
List dataList = DocExcelUtils.readExcel(file, docRouteEnum.getStartRow(), docRouteEnum.getClazz());
if (CollectionUtils.isEmpty(dataList)) {
outInfo.setMsg("未读取到数据");
return outInfo;
}
outInfo.set(EiConstant.serviceName, docRouteEnum.getServiceNme());
outInfo.set(EiConstant.methodName, docRouteEnum.getMethodName());
outInfo.set("params", this.convertParam(paramMaps));
outInfo.set("params", params);
outInfo.set("dataList", dataList);
outInfo = XLocalManager.call(outInfo);
} catch (Exception e) {
......@@ -90,15 +91,42 @@ public class DocController extends WebDispatchController {
* @param paramMaps
* @return
*/
private Map<String, String> convertParam(Map<String, String[]> paramMaps) {
private Map<String, Object> convertParam(Map<String, String[]> paramMaps) {
if (MapUtils.isEmpty(paramMaps)) {
return new HashMap<>();
}
Map<String, String> paramMap = new HashMap<>();
Map<String, Object> paramMap = new HashMap<>();
for (Map.Entry<String, String[]> entry : paramMaps.entrySet()) {
paramMap.put(entry.getKey(), entry.getValue()[0]);
String key = entry.getKey();
String value = entry.getValue()[0];
if ("parameter".equals(key)) {
paramMap.put(key, encodeParam(value));
} else {
paramMap.put(key, value);
}
}
return paramMap;
}
/**
* 解码参数
*
* @param parameter
* @return
*/
private Map<String, Object> encodeParam(String parameter) {
try {
if (StringUtils.isBlank(parameter)) {
return null;
}
// 帆软传递进来的参数进行了两次编码,因此需要进行两次解码
String paramsText = URLDecoder.decode(parameter, "UTF-8");
paramsText = URLDecoder.decode(paramsText, "UTF-8");
return JSONObject.parseObject(paramsText).getInnerMap();
} catch (Exception e) {
log.error("字符串解码:{}", e.getMessage(), e);
throw new PlatException("参数格式错误,解码失败");
}
}
}
package com.baosight.hggp.controller;
import com.baosight.hggp.core.utils.Iplat4jUtils;
import com.baosight.hggp.util.LogUtils;
import com.baosight.iplat4j.core.ei.EiConstant;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
/**
* @author:songx
* @date:2024/3/14,14:26
*/
@CrossOrigin
@RestController
@RequestMapping({"/file"})
public class FileController {
/**
* 删除文件
*
* @param docId
* @throws IOException
*/
@RequestMapping(value = "/delete/{docId}", method = RequestMethod.GET)
public Map delete(@PathVariable String docId) throws IOException {
Map resultMap = new HashMap();
try {
Iplat4jUtils.deleteFileByDocId(docId);
resultMap.put("id", docId);
resultMap.put("status", EiConstant.STATUS_SUCCESS);
resultMap.put("message", "SUCCESS");
} catch (Exception e) {
resultMap.put("status", 500);
resultMap.put("message", LogUtils.getMsg(e));
}
return resultMap;
}
}
package com.baosight.hggp.core.constant;
import com.baosight.iplat4j.core.ioc.spring.PlatApplicationContext;
import lombok.Data;
/**
* @author:songx
* @date:2023/8/28,10:05
*/
@Data
public class S3Constant {
/**
* s3、local
*/
public static String FILE_LOCATION = PlatApplicationContext.getProperty("iplat4j.admin.upload.fileLocation");
/**
* endpoint
*/
public static String ENDPOINT = PlatApplicationContext.getProperty("iplat4j.admin.objectStorage.s3.endpoint");
/**
* bucket名称
*/
public static String BUCKET_NAME = PlatApplicationContext.getProperty("iplat4j.admin.objectStorage.s3.bucket");
/**
* AK
*/
public static String ACCESS_KEY = PlatApplicationContext.getProperty("iplat4j.admin.objectStorage.s3.accessKey");
/**
* SK
*/
public static String SECRET_KEY = PlatApplicationContext.getProperty("iplat4j.admin.objectStorage.s3.secretKey");
}
package com.baosight.hggp.common;
package com.baosight.hggp.core.enums;
import com.baosight.hggp.hg.cw.domain.HGCW003;
import com.baosight.hggp.hg.pz.domain.HGPZ005;
import com.baosight.hggp.hg.sc.domain.HGSC004A;
import com.baosight.hggp.hg.sc.domain.HGSC009;
import com.baosight.hggp.hg.sc.domain.HGSC009A;
import com.baosight.hggp.hg.sj.domain.HGSJ003;
......@@ -14,19 +12,49 @@ import com.baosight.hggp.hg.sj.domain.HGSJ003;
*/
public enum DocRouteEnum {
HGSC004A("route_001", "HGSC004A", "importData", HGSC004A.class),
HGSC009A("route_002", "HGSC009", "importData", HGSC009A.class),
HGPZ005("route_003", "HGPZ005", "importData", HGPZ005.class),
HGCW003("route_004", "HGCW003", "importData", HGCW003.class),
HGSJ003("route_005", "HGSJ003", "importData", HGSJ003.class),
HGSC004A("route_001", "", 1, "HGSC004A", "importData", HGSC004A.class),
HGSC009A("route_002", "", 1, "HGSC009", "importData", HGSC009A.class),
HGPZ005("route_003", "", 1, "HGPZ005", "importData", HGPZ005.class),
HGCW003("route_004", "", 1, "HGCW003", "importData", HGCW003.class),
HGSJ003("route_005", "", 1, "HGSJ003", "importData", HGSJ003.class),
;
/**
* 唯一标识
*/
private String id;
/**
* 模版文件的地址,模版文件路径必须在META-INF.resources下面
*/
private String templateUrl;
/**
* 数据从excel的第几行开始,起始0
*/
private int startRow;
/**
* 业务处理类
*/
private String serviceNme;
/**
* 业务处理方法
*/
private String methodName;
/**
* 数据转换后的实体类
*/
private Class clazz;
<T> DocRouteEnum(String id, String serviceNme, String methodName, Class<T> clazz) {
<T> DocRouteEnum(String id, String templateUrl, int startRow, String serviceNme, String methodName,
Class<T> clazz) {
this.id = id;
this.templateUrl = templateUrl;
this.startRow = startRow;
this.serviceNme = serviceNme;
this.methodName = methodName;
this.clazz = clazz;
......@@ -51,6 +79,14 @@ public enum DocRouteEnum {
return id;
}
public String getTemplateUrl() {
return templateUrl;
}
public int getStartRow() {
return startRow;
}
public String getServiceNme() {
return serviceNme;
}
......
......@@ -3,6 +3,7 @@ package com.baosight.hggp.core.tools;
import com.baosight.hggp.core.dao.DaoBase;
import com.baosight.hggp.util.AssertUtils;
import com.baosight.iplat4j.common.ed.domain.TEDFA00;
import com.baosight.iplat4j.common.eu.domain.Teudm05;
import com.baosight.iplat4j.core.exception.PlatException;
import org.apache.commons.collections.CollectionUtils;
......@@ -16,7 +17,7 @@ import java.util.Map;
* @author:songx
* @date:2022/8/10,13:55
*/
public class EDTools {
public class Iplat4jTools {
/**
* 页面工具类
......@@ -33,7 +34,7 @@ public class EDTools {
* @return
*/
public static TEDFA00 query(String ename) {
AssertUtils.isNull(ename, "页面英文名称不能为空!");
AssertUtils.isEmpty(ename, "页面英文名称不能为空!");
Map<String, String> paramMap = new HashMap();
paramMap.put("form_ename", ename);
List<TEDFA00> results = DaoBase.getInstance().query("tedfa00.query", paramMap);
......@@ -56,7 +57,7 @@ public class EDTools {
* @return
*/
public static List<Map<String, Object>> list(String codeSetCode) {
AssertUtils.isNull(codeSetCode, "代码分类编码不能为空!");
AssertUtils.isEmpty(codeSetCode, "代码分类编码不能为空!");
Map<String, String> paramMap = new HashMap();
paramMap.put("codesetCode", codeSetCode);
List<Map<String, Object>> results = DaoBase.getInstance().query("EDCM01.queryDetail", paramMap);
......@@ -68,4 +69,26 @@ public class EDTools {
}
/**
* 上传的文件
*
* @author:songx
* @date:2024/8/8,16:47
*/
public static class EuDm05 {
/**
* 查询页面信息
*
* @param docId
* @return
*/
public static Teudm05 getDocByDocId(String docId) {
AssertUtils.isEmpty(docId, "文件ID不能为空!");
Map<String, String> paramMap = new HashMap();
paramMap.put("resId", docId);
List<Teudm05> results = DaoBase.getInstance().query("EUDM05.getDocByDocId", paramMap);
return CollectionUtils.isEmpty(results) ? null : results.get(0);
}
}
}
package com.baosight.hggp.core.utils;
import com.baosight.hggp.core.constant.S3Constant;
import com.baosight.hggp.core.tools.Iplat4jTools;
import com.baosight.hggp.util.FileUtils;
import com.baosight.hggp.util.StringUtils;
import com.baosight.iplat4j.common.eu.domain.Teudm05;
import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.ioc.spring.PlatApplicationContext;
import com.baosight.iplat4j.eu.dm.util.PlatFileUploader;
import java.util.Map;
/**
* @author:songx
* @date:2024/8/8,17:00
*/
public class Iplat4jUtils {
static PlatFileUploader platFileUploader = PlatApplicationContext.getApplicationContext()
.getBean("platFileUploader", PlatFileUploader.class);
/**
* 删除文件
*
* @param docId
* @return
*/
public static boolean deleteFileByDocId(String docId) {
// 判断文件上传的地址
String fileLocation = S3Constant.FILE_LOCATION;
if ("s3".equalsIgnoreCase(fileLocation)) {
Teudm05 dbDm05 = Iplat4jTools.EuDm05.getDocByDocId(docId);
if (dbDm05 == null) {
throw new PlatException("文件在服务器中不存在");
}
String url = dbDm05.getUrl();
if (StringUtils.isBlank(url)) {
return false;
}
// 删除本地记录
// platFileUploader.deleteDocById(docId);
// 删除S3文件,从文件路径中截取key,不包含域名
String key = url.replace(S3Constant.ENDPOINT + "/", "");
return S3Utils.deleteFile(key);
} else {
Map document = platFileUploader.getDocument(docId);
String chgName = document.get("chgName").toString();
String docPath = document.get("realPath").toString();
String filePath = docPath + chgName;
// if (platFileUploader.deleteDocById(docId) > 0) {
return FileUtils.deleteFile(filePath);
// }
// return false;
}
}
}
package com.baosight.hggp.core.utils;
import com.amazonaws.ClientConfiguration;
import com.amazonaws.auth.AWSStaticCredentialsProvider;
import com.amazonaws.auth.BasicAWSCredentials;
import com.amazonaws.client.builder.AwsClientBuilder;
import com.amazonaws.services.s3.AmazonS3;
import com.amazonaws.services.s3.AmazonS3ClientBuilder;
import com.baosight.hggp.core.constant.S3Constant;
import lombok.extern.slf4j.Slf4j;
/**
* OSS凭证
*
* @author:songx
* @date:2023/8/28,11:26
*/
@Slf4j
public class S3ClientUtils {
private S3ClientUtils() {
}
/**
* 初始化配置信息(纯粹就打印日志而已,因为会加载该类的全局变量)
*/
public static void init() {
AmazonS3 s3Client = Instance.s3Client;
log.info("初始化OSS客户端完成:isReady -> {}", s3Client != null);
}
/**
* 获取S3客户端
*
* @return
*/
public static AmazonS3 getS3Client() {
return Instance.s3Client;
}
/**
* 刷新客户端
*/
public static void refresh() {
Instance.refresh();
}
/**
* 初始化Instance
*
* @author:songx
* @date:2022/4/2,9:58
*/
private static class Instance {
/**
* 客户端实例
*/
private static AmazonS3 s3Client = buildAmazonS3();
/**
* 刷新S3客户端
*/
private static void refresh() {
s3Client = buildAmazonS3();
log.info("刷新OSS客户端完成:isReady->{}", s3Client != null);
}
/**
* 获取AmazonS3Client实例
*
* @return
*/
private static synchronized AmazonS3 buildAmazonS3() {
if (!"s3".equalsIgnoreCase(S3Constant.FILE_LOCATION)) {
return null;
}
// 判断上传类型是否S3
AmazonS3ClientBuilder client = AmazonS3ClientBuilder.standard();
ClientConfiguration config = new ClientConfiguration();
config.setProtocol(com.amazonaws.Protocol.HTTPS);
config.setConnectionTimeout(10001);
config.setSignerOverride("S3SignerType");
client.setClientConfiguration(config);
client.setCredentials(new AWSStaticCredentialsProvider(
new BasicAWSCredentials(S3Constant.ACCESS_KEY, S3Constant.SECRET_KEY)));
// 去掉地址中的bucket前缀
String endpoint = S3Constant.ENDPOINT.replace(S3Constant.BUCKET_NAME + ".", "");
client.setEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration(endpoint, null));
return client.build();
}
}
}
package com.baosight.hggp.core.utils;
import com.amazonaws.services.s3.AmazonS3;
import com.baosight.hggp.core.constant.S3Constant;
import com.baosight.hggp.util.AssertUtils;
import java.io.File;
/**
* OSS工具类
*
* @author:songx
* @date:2023/8/28,11:25
*/
public class S3Utils {
/**
* 上传文件
*
* @param key 默认不指定key的情况下,以文件内容的hash值作为文件名
* @param file
*/
public static boolean uploadFile(String key, File file) {
AmazonS3 client = S3ClientUtils.getS3Client();
AssertUtils.isNull(client, "上传失败,OSS客户端未初始化,请检查");
client.putObject(S3Constant.BUCKET_NAME, key, file);
return true;
}
/**
* 删除文件
*
* @param key
*/
public static boolean deleteFile(String key) {
AmazonS3 client = S3ClientUtils.getS3Client();
AssertUtils.isNull(client, "删除失败,OSS客户端未初始化,请检查");
client.deleteObject(S3Constant.BUCKET_NAME, key);
return true;
}
}
package com.baosight.hggp.hg.dm.service;
import com.baosight.hggp.core.enums.DocRouteEnum;
import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.LogUtils;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang.StringUtils;
import java.util.Map;
/**
* 文件导入
*
* @author:songx
* @date:2024/4/7,17:02
*/
public class ServiceHGDM91 extends ServiceEPBase {
/**
* 初始化
*
* @param inInfo
* @return
*/
@Override
public EiInfo initLoad(EiInfo inInfo) {
try {
Map queryRow = EiInfoUtils.getFirstRow(inInfo);
setTemplateUrl(queryRow);
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
/**
* 根据路由获取模版地址
*
* @param queryRow
* @return
*/
private void setTemplateUrl(Map queryRow) {
String templateUrl = "";
String id = MapUtils.getString(queryRow, "id");
if (StringUtils.isNotBlank(id)) {
DocRouteEnum docRouteEnum = DocRouteEnum.getById(id);
templateUrl = docRouteEnum == null ? "" : docRouteEnum.getTemplateUrl();
}
queryRow.put("templateUrl", templateUrl);
}
}
......@@ -642,7 +642,7 @@ public class HGPZTools {
pz005.setInventCode(hgsc009a.getInventCode());
pz005.setInventName(hgsc009a.getInventName());
pz005.setSpec(hgsc009a.getSpec());
pz005.setInventTypeDetail((Integer) objectMap.get(inventType));
pz005.setInventTypeDetail(Integer.parseInt(objectMap.get(inventType).toString()));
pz005.setLength(hgsc009a.getLength());
pz005.setWidth(hgsc009a.getWidth());
pz005.setThick(hgsc009a.getThick());
......
......@@ -3,12 +3,11 @@ package com.baosight.hggp.hg.sc.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.common.AssignStatusEnum;
import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.core.dao.DaoBase;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.sc.domain.HGSC005A;
import com.baosight.hggp.hg.sc.domain.HGSC006;
import com.baosight.hggp.hg.sc.domain.HGSC006A;
import com.baosight.hggp.hg.sc.domain.HGSC007;
import com.baosight.hggp.hg.pz.domain.HGPZ005;
import com.baosight.hggp.hg.sc.domain.*;
import com.baosight.hggp.hg.sc.tools.HGSCTools;
import com.baosight.hggp.util.AssertUtils;
import com.baosight.hggp.util.BeanUtils;
......@@ -23,6 +22,8 @@ import com.baosight.iplat4j.ed.util.SequenceGenerator;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.stream.Collectors;
/**
......@@ -67,6 +68,7 @@ public class ServiceHGSC006A extends ServiceBase {
String groupCode = inInfo.getString("groupCode");
String groupName = inInfo.getString("groupName");
HGSC006 hgsc006 = HGSCTools.THGSC006.getByOrderCode(orderCode);
List<HGPZ005> hgpz005List = DaoBase.getInstance().query(HGPZ005.QUERY,new HashMap<>());
for (String orderDetailId : orderDetailIds) {
// 校验主订单是否已分派
HGSC006A hgsc006A = HGSCTools.THGSC006A.getById(Long.parseLong(orderDetailId));
......@@ -89,10 +91,15 @@ public class ServiceHGSC006A extends ServiceBase {
default:
throw new PlatException(String.format("生产订单[%s]%s状态异常,请联系管理员!",hgsc006A.getProcessName(), hgsc006A.getProductName()));
}
HGPZ005 hgpz005 =hgpz005List.stream().filter(pz005 -> pz005.getInventCode().equals(hgsc006A.getProductCode())).findAny().get();
// 写入子表数据
HGSC007 hgsc007 = new HGSC007();
BeanUtils.copyProperties(hgsc006A,hgsc007);
cleanBaseInfo(hgsc007);
if (hgpz005 != null) {
hgsc007.setSpec(hgpz005.getSpec());
hgsc007.setLength(hgpz005.getLength());
}
hgsc007.setTaskCode(SequenceGenerator.getNextSequence(HGConstant.SequenceId.HGSC007_TASK_CODE));
hgsc007.setMatId(hgsc006.getMatId());
hgsc007.setOrderId(hgsc006.getId());
......
......@@ -3,9 +3,12 @@ package com.baosight.hggp.hg.sc.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.common.ProductTypeEnum;
import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.dao.DaoBase;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.enums.OrgTypeEnum;
import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.pz.domain.HGPZ005;
import com.baosight.hggp.hg.pz.tools.HGPZTools;
import com.baosight.hggp.hg.sc.domain.*;
import com.baosight.hggp.hg.sc.tools.HGSCTools;
import com.baosight.hggp.hg.xs.domain.Org;
......@@ -145,12 +148,13 @@ public class ServiceHGSC006B extends ServiceBase {
HGSC006A hgsc006A = HGSCTools.THGSC006A.getById(orderDetailId);
// 查询任务信息
List<HGSC007> hgsc007List = HGSCTools.THGSC007.list(taskIds);
HGPZ005 hgpz005 = HGPZTools.HgPz005.get(hgsc006A.getProductCode());
// 写入数据
for (Map resultRow : resultRows) {
HGSC007 hgsc007 = new HGSC007();
hgsc007.fromMap(resultRow);
if (hgsc007.getId() == null || hgsc007.getId() == 0) {
this.add(hgsc006, hgsc006A, hgsc007);
this.add(hgsc006, hgsc006A, hgsc007,hgpz005);
} else {
this.modify(hgsc006A, hgsc007, hgsc007List);
}
......@@ -173,7 +177,7 @@ public class ServiceHGSC006B extends ServiceBase {
* @param hgsc006A
* @param hgsc007
*/
private void add(HGSC006 hgsc006, HGSC006A hgsc006A, HGSC007 hgsc007) {
private void add(HGSC006 hgsc006, HGSC006A hgsc006A, HGSC007 hgsc007,HGPZ005 hgpz005) {
Long orderDetailId = hgsc006A.getId();
// 数据校验
AssertUtils.isEmpty(hgsc007.getFactoryCode(), "请选择厂区");
......@@ -196,6 +200,10 @@ public class ServiceHGSC006B extends ServiceBase {
add007.setGroupName(hgsc007.getGroupName());
add007.setFactoryCode(hgsc007.getFactoryCode());
add007.setFactoryName(hgsc007.getFactoryName());
if (hgpz005 != null) {
add007.setSpec(hgpz005.getSpec());
add007.setLength(hgpz005.getLength());
}
DaoUtils.insert(HGSC007.INSERT, add007);
}
......
......@@ -1438,8 +1438,13 @@ public class HGSCTools {
DaoUtils.insert(HGSC009.INSERT,hgsc009);
List<HGSC009A> hgsc009as = new ArrayList<>();
for (HGSC009A hgsc009a: hgsc009aList) {
HGPZ005 hgpz005 = HGPZTools.HgPz005.getByCode(hgsc009a.getInventCode());
if (Objects.isNull(hgpz005)){
List<HGPZ005> hgpz005List = DaoBase.getInstance().query(HGPZ005.QUERY,new HashMap<String,String>(){{
put("inventCode",hgsc009a.getInventCode());
}});
HGPZ005 hgpz005 = null;
if (hgpz005List.size()> 0){
hgpz005 = hgpz005List.get(0);
}else {
hgpz005 = HGPZTools.HgPz005.add(hgsc009a);
}
hgsc009a.setCompanyCode(hgsc009.getCompanyCode());
......
......@@ -2,6 +2,7 @@
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd">
<sqlMap namespace="XS0702">
<select id="query" resultClass="java.util.HashMap">
SELECT
tree_ename as "parent",
......@@ -23,7 +24,7 @@
<!-- 非管理员非root节点仅显示有权限的菜单 added by songx at 20240126 -->
<isNotEqual property="node" compareValue="root">
<isEqual prepend=" AND " property="isUserAdmin" compareValue="0">
exists (
(exists (
select
c. object_id, d.resource_ename
from ${platSchema}.xs_user a,
......@@ -36,7 +37,7 @@
and a.login_name = #loginName#
and d.type = 'PAGE'
and m.node_ename = d.resource_ename
)
) or node_type = '2')
</isEqual>
</isNotEqual>
</dynamic>
......
......@@ -56,8 +56,8 @@
<sqlMap resource="com/baosight/hggp/hg/sc/sql/HGSC005A.xml"/>
<sqlMap resource="com/baosight/hggp/hg/sc/sql/HGSC006.xml"/>
<sqlMap resource="com/baosight/hggp/hg/sc/sql/HGSC006A.xml"/>
<!--<sqlMap resource="com/baosight/hggp/hg/sc/sql/HGSC007.xml"/>
<sqlMap resource="com/baosight/hggp/hg/sc/sql/HGSC008.xml"/>-->
<sqlMap resource="com/baosight/hggp/hg/sc/sql/HGSC007.xml"/>
<sqlMap resource="com/baosight/hggp/hg/sc/sql/HGSC008.xml"/>
<sqlMap resource="com/baosight/hggp/hg/sc/sql/HGSC009.xml"/>
<!-- 財務 -->
......
$(function () {
// 提交
$("#SUBMIT").on("click", submit);
});
/**
* 页面加载时执行
*/
$(window).load(function () {
// 显示下载模版按钮
let templateUrl = $("#inqu_status-0-templateUrl").val();
if (!isBlank(templateUrl)) {
$("#templateUrl").attr('href', IPLATUI.CONTEXT_PATH + templateUrl);
$("#templateDiv").show();
}
});
/**
* 提交
*/
let submit = function () {
let file = $("#inqu_status-0-file")[0].files[0];
if (isBlank(file)) {
message("请选择文件");
return;
}
var suffix = file.name.substr(file.name.lastIndexOf("."));
if (".xls" != suffix && ".xlsx" != suffix) {
message("请选择Excel格式的文件导入");
return false;
}
let _IPLAT = IPLAT;
_IPLAT.progress($("body"), true);
let formData = new FormData();
formData.append("id", $("#inqu_status-0-id").val());
formData.append("parameter", $("#inqu_status-0-parameter").val());
formData.append("file", file);
$.ajax({
url: IPLATUI.CONTEXT_PATH + '/doc/import/api',
type: 'POST',
data: formData,
async: true,
cache: false,
contentType: false,
processData: false,
success: function (res) {
_IPLAT.progress($("body"), false);
message(res.msg);
if (res.status != -1) {
parent.JSColorbox.setValueCallback(res);
}
},
error: function (res) {
_IPLAT.progress($("body"), false);
message(res.msg);
}
});
}
/**
* 判断是否为null
*
* @param value
* @returns {boolean}
*/
function isBlank(data) {
return data == null || data === undefined || data === 'null' || $.trim(data) === '' ||
data === 'undefined' || data === 'unknown';
}
/**
* 消息提示
*
* @param msg
*/
function message(msg) {
WindowUtil({
title: "提示:",
content: "<div class='kendo-del-message'>" + msg + "</div>"
});
};
<!DOCTYPE html>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="EF" tagdir="/WEB-INF/tags/EF" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<EF:EFPage title="导入">
<EF:EFRegion id="inqu" title="文件区域">
<div class="row">
<EF:EFInput cname="参数" blockId="inqu_status" ename="parameter" row="0" colWidth="12" type="hidden"/>
<EF:EFInput cname="路由ID" blockId="inqu_status" ename="id" row="0" colWidth="12" type="hidden"/>
<EF:EFInput cname="模版地址" blockId="inqu_status" ename="templateUrl" row="0" colWidth="12" type="hidden"/>
<EF:EFInput cname="导入文件" blockId="inqu_status" ename="file" row="0" colWidth="12" ratio="2:10" type="file"/>
</div>
<div id="templateDiv" class="row" style="display: none;text-align: right;padding-right: 25px;">
<a id="templateUrl" href="">下载模版</a>
</div>
</EF:EFRegion>
<EF:EFRegion title="提示">
<span style='color: red;font-size: 12px;'>
1.请选择xls或xlsx格式的excel文件
</span>
</EF:EFRegion>
</EF:EFPage>
......@@ -14,22 +14,24 @@
<EF:EFInput ename="result-0-processName" cname="工序" colWidth="4" readonly="true"/>
</div>
<div class="row">
<EF:EFInput ename="result-0-spec" cname="规格" colWidth="4" readonly="true"/>
<EF:EFInput ename="result-0-length" cname="长度" colWidth="4" readonly="true"/>
<EF:EFInput ename="result-0-singleWeight" cname="单重(KG)" colWidth="4" format="{0:0.00}" editType="text" readonly="true"/>
</div>
<div class="row">
<EF:EFInput ename="result-0-taskQuantity" cname="任务数量" format="{0:0}" editType="text" colWidth="4" readonly="true"/>
<EF:EFInput ename="result-0-taskWeight" cname="任务重量" format="{0:0.00}" editType="text" colWidth="4" readonly="true"/>
<EF:EFInput ename="result-0-registeredQuantity" cname="已报工数量" format="{0:0}" editType="text" colWidth="4" readonly="true"/>
</div>
<div class="row">
<EF:EFInput ename="result-0-registeredQuantity" cname="已报工数量" format="{0:0}" editType="text" colWidth="4" readonly="true"/>
<EF:EFInput ename="result-0-registeredWeight" cname="已报工重量" format="{0:0.00}" editType="text" colWidth="4" readonly="true"/>
<EF:EFInput ename="result-0-unregisterQuantity" cname="剩余数量" format="{0:0}" editType="text" colWidth="4" readonly="true"/>
<EF:EFInput ename="result-0-unregisterWeight" cname="剩余重量" format="{0:0.00}" editType="text" colWidth="4" readonly="true"/>
</div>
<div class="row">
<EF:EFInput ename="result-0-unregisterWeight" cname="剩余重量" format="{0:0.00}" editType="text" colWidth="4" readonly="true"/>
<EF:EFInput ename="result-0-groupName" cname="班组" colWidth="4" required="true" readonly="true"/>
<EF:EFDatePicker cname="报工日期" ename="result-0-registerDate" colWidth="4"
format="yyyy-MM-dd" required="true" readonly="false"/>
</div>
<div class="row">
<EF:EFInput ename="result-0-quantity" cname="报工数量" format="{0:0}" editType="text" colWidth="4" required="true" />
<EF:EFInput ename="result-0-totalWeight" cname="报工重量" format="{0:0.00}" editType="text" colWidth="4" readonly="true"/>
</div>
......
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