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;
......@@ -13,20 +11,50 @@ import com.baosight.hggp.hg.sj.domain.HGSJ003;
* @date:2022/9/23,14:51
*/
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);
}
......
......@@ -47,162 +47,141 @@
-->
<sqlMap namespace="HGSC007">
<sql id="authCondition">
<!-- 无权限时使用 -->
<isNotEmpty prepend=" AND " property="authDepCode">
A.DEP_CODE = #authDepCode#
</isNotEmpty>
<!-- 仅本人和部门组合 -->
<isEqual prepend=" AND " property="authCombination" compareValue="1">
(A.CREATED_BY = #authOnlyPeople# OR A.DEP_CODE IN <iterate close=")" open="(" conjunction=","
property="authDepCodes">#authDepCodes[]#</iterate>)
</isEqual>
<!-- 仅本人或部门 -->
<isNotEqual prepend=" AND " property="authCombination" compareValue="1">
<isNotEmpty property="authOnlyPeople">
A.CREATED_BY = #authOnlyPeople#
</isNotEmpty>
<isNotEmpty property="authDepCodes">
A.DEP_CODE IN
<iterate close=")" open="(" conjunction="," property="authDepCodes">#authDepCodes[]#</iterate>
</isNotEmpty>
</isNotEqual>
</sql>
<sql id="condition">
<include refid="authCondition"/>
<include refid="HGXSDataAuth.authCondition"/>
<isNotEmpty prepend=" AND " property="id">
A.id = #id#
id = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="matId">
A.mat_id = #matId#
mat_id = #matId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="orderId">
A.order_id = #orderId#
order_id = #orderId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="orderDetailId">
A.order_detail_id = #orderDetailId#
order_detail_id = #orderDetailId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="techFlowId">
A.tech_flow_id = #techFlowId#
tech_flow_id = #techFlowId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="techFlowName">
A.tech_flow_name = #techFlowName#
tech_flow_name = #techFlowName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventProcessId">
A.invent_process_id = #inventProcessId#
invent_process_id = #inventProcessId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="processCode">
A.process_code = #processCode#
process_code = #processCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="processName">
A.process_name = #processName#
process_name = #processName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="processOrder">
A.process_order = #processOrder#
process_order = #processOrder#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
A.company_code = #companyCode#
company_code = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyName">
A.company_name = #companyName#
company_name = #companyName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
A.dep_code = #depCode#
dep_code = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depName">
A.dep_name = #depName#
dep_name = #depName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="projCode">
A.proj_code = #projCode#
proj_code = #projCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="projName">
A.proj_name = #projName#
proj_name = #projName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="taskCode">
A.task_code = #taskCode#
task_code = #taskCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="productType">
A.product_type = #productType#
product_type = #productType#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="productCode">
A.product_code LIKE CONCAT('%', #productCode#, '%')
product_code LIKE CONCAT('%', #productCode#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="productName">
A.product_name LIKE CONCAT('%', #productName#, '%')
product_name LIKE CONCAT('%', #productName#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="planStartDate">
A.plan_start_date = #planStartDate#
plan_start_date = #planStartDate#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="planEndDate">
A.plan_end_date = #planEndDate#
plan_end_date = #planEndDate#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="factoryCode">
A.factory_code = #factoryCode#
factory_code = #factoryCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="factoryName">
A.factory_name = #factoryName#
factory_name = #factoryName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="groupCode">
A.group_code = #groupCode#
group_code = #groupCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="groupName">
A.group_name LIKE CONCAT('%', #groupName# ,'%')
group_name LIKE CONCAT('%', #groupName# ,'%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="completeDate">
A.complete_date = #completeDate#
complete_date = #completeDate#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="quantity">
A.quantity = #quantity#
quantity = #quantity#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="finishQuantity">
A.finish_quantity = #finishQuantity#
finish_quantity = #finishQuantity#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="unfinishQuantity">
A.unfinish_quantity = #unfinishQuantity#
unfinish_quantity = #unfinishQuantity#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="singleWeight">
A.single_weight = #singleWeight#
single_weight = #singleWeight#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="totalWeight">
A.total_weight = #totalWeight#
total_weight = #totalWeight#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="finishWeight">
A.finish_weight = #finishWeight#
finish_weight = #finishWeight#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="unfinishWeight">
A.unfinish_weight = #unfinishWeight#
unfinish_weight = #unfinishWeight#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="accountCode">
A.account_code = #accountCode#
account_code = #accountCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdBy">
A.created_by = #createdBy#
created_by = #createdBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdName">
A.created_name = #createdName#
created_name = #createdName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdTime">
A.created_time LIKE CONCAT('%', #createdTime# ,'%')
created_time LIKE CONCAT('%', #createdTime# ,'%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedBy">
A.updated_by = #updatedBy#
updated_by = #updatedBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedName">
A.updated_name = #updatedName#
updated_name = #updatedName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedTime">
A.updated_time = #updatedTime#
updated_time = #updatedTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="ids">
A.id IN <iterate close=")" open="(" conjunction="," property="ids">#ids[]#</iterate>
id IN <iterate close=")" open="(" conjunction="," property="ids">#ids[]#</iterate>
</isNotEmpty>
<!-- 移动端请求参数 -->
<isEqual prepend=" AND " property="completeStatus" compareValue="0">
ifnull(A.complete_date,'') = ''
ifnull(complete_date,'') = ''
</isEqual>
<isEqual prepend=" AND " property="completeStatus" compareValue="1">
ifnull(A.complete_date,'') != ''
ifnull(complete_date,'') != ''
</isEqual>
</sql>
<sql id="appCondition">
......@@ -245,50 +224,50 @@
<select id="query" parameterClass="java.util.HashMap"
resultClass="com.baosight.hggp.hg.sc.domain.HGSC007">
SELECT
A.id as "id",
A.mat_id as "matId", <!-- 物料清单ID -->
A.order_id as "orderId", <!-- 生产计划ID -->
A.order_detail_id as "orderDetailId", <!-- 生产计划明细ID -->
A.tech_flow_id as "techFlowId", <!-- 工艺流程ID -->
A.tech_flow_name as "techFlowName", <!-- 工艺流程名称 -->
A.invent_process_id as "inventProcessId", <!-- 存货工序ID,对应HGPZ005A.id -->
A.process_code as "processCode", <!-- 工序编码 -->
A.process_name as "processName", <!-- 工序名称 -->
A.process_order as "processOrder", <!-- 加工顺序 -->
A.company_code as "companyCode", <!-- 公司编码 -->
A.company_name as "companyName", <!-- 公司名称 -->
A.dep_code as "depCode", <!-- 部门编码 -->
A.dep_name as "depName", <!-- 部门名称 -->
A.proj_code as "projCode", <!-- 项目编码 -->
A.proj_name as "projName", <!-- 项目名称 -->
A.task_code as "taskCode", <!-- 任务编码 -->
A.product_type as "productType", <!-- 产品类型 -->
A.product_code as "productCode", <!-- 产品编号 -->
A.product_name as "productName", <!-- 产品名称 -->
A.plan_start_date as "planStartDate", <!-- 计划开始日期 -->
A.plan_end_date as "planEndDate", <!-- 计划结束日期 -->
A.factory_code as "factoryCode", <!-- 工厂编号 -->
A.factory_name as "factoryName", <!-- 工厂名称 -->
A.group_code as "groupCode", <!-- 工作组编号 -->
A.group_name as "groupName", <!-- 工作组名称 -->
A.complete_date as "completeDate", <!-- 完工日期 -->
A.quantity as "quantity", <!-- 数量 -->
A.finish_quantity as "finishQuantity", <!-- 完工数量 -->
A.unfinish_quantity as "unfinishQuantity", <!-- 未完工数量 -->
A.single_weight as "singleWeight", <!-- 单重 -->
A.total_weight as "totalWeight", <!-- 总重 -->
A.finish_weight as "finishWeight", <!-- 完工重量 -->
A.unfinish_weight as "unfinishWeight", <!-- 未完工重量 -->
A.account_code as "accountCode", <!-- 帐套 -->
A.created_by as "createdBy", <!-- 创建人 -->
A.created_name as "createdName", <!-- 创建人名称 -->
A.created_time as "createdTime", <!-- 创建时间 -->
A.updated_by as "updatedBy", <!-- 更新人 -->
A.updated_name as "updatedName", <!-- 修改人名称 -->
A.updated_time as "updatedTime", <!-- 更新时间 -->
B.LENGTH as "length", <!-- 长 -->
B.SPEC as "spec" <!-- 规格 -->
FROM ${hggpSchema}.HGSC007 A LEFT JOIN ${hggpSchema}.HGPZ005 B ON A.product_code = B.INVENT_CODE
id as "id",
mat_id as "matId", <!-- 物料清单ID -->
order_id as "orderId", <!-- 生产计划ID -->
order_detail_id as "orderDetailId", <!-- 生产计划明细ID -->
tech_flow_id as "techFlowId", <!-- 工艺流程ID -->
tech_flow_name as "techFlowName", <!-- 工艺流程名称 -->
invent_process_id as "inventProcessId", <!-- 存货工序ID,对应HGPZ005A.id -->
process_code as "processCode", <!-- 工序编码 -->
process_name as "processName", <!-- 工序名称 -->
process_order as "processOrder", <!-- 加工顺序 -->
company_code as "companyCode", <!-- 公司编码 -->
company_name as "companyName", <!-- 公司名称 -->
dep_code as "depCode", <!-- 部门编码 -->
dep_name as "depName", <!-- 部门名称 -->
proj_code as "projCode", <!-- 项目编码 -->
proj_name as "projName", <!-- 项目名称 -->
task_code as "taskCode", <!-- 任务编码 -->
product_type as "productType", <!-- 产品类型 -->
product_code as "productCode", <!-- 产品编号 -->
product_name as "productName", <!-- 产品名称 -->
plan_start_date as "planStartDate", <!-- 计划开始日期 -->
plan_end_date as "planEndDate", <!-- 计划结束日期 -->
factory_code as "factoryCode", <!-- 工厂编号 -->
factory_name as "factoryName", <!-- 工厂名称 -->
group_code as "groupCode", <!-- 工作组编号 -->
group_name as "groupName", <!-- 工作组名称 -->
complete_date as "completeDate", <!-- 完工日期 -->
quantity as "quantity", <!-- 数量 -->
finish_quantity as "finishQuantity", <!-- 完工数量 -->
unfinish_quantity as "unfinishQuantity", <!-- 未完工数量 -->
single_weight as "singleWeight", <!-- 单重 -->
total_weight as "totalWeight", <!-- 总重 -->
finish_weight as "finishWeight", <!-- 完工重量 -->
unfinish_weight as "unfinishWeight", <!-- 未完工重量 -->
account_code as "accountCode", <!-- 帐套 -->
created_by as "createdBy", <!-- 创建人 -->
created_name as "createdName", <!-- 创建人名称 -->
created_time as "createdTime", <!-- 创建时间 -->
updated_by as "updatedBy", <!-- 更新人 -->
updated_name as "updatedName", <!-- 修改人名称 -->
updated_time as "updatedTime", <!-- 更新时间 -->
LENGTH as "length", <!-- 长 -->
SPEC as "spec" <!-- 规格 -->
FROM ${hggpSchema}.HGSC007
WHERE 1=1
<include refid="condition" />
......@@ -297,14 +276,14 @@
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
A.id desc, A.product_type asc, A.product_name, A.process_order desc
id desc, product_type asc, product_name, process_order desc
</isEmpty>
</dynamic>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hggpSchema}.HGSC007 A LEFT JOIN ${hggpSchema}.HGPZ005 B ON A.product_code = B.INVENT_CODE WHERE 1=1
SELECT COUNT(*) FROM ${hggpSchema}.HGSC007 WHERE 1=1
<include refid="condition" />
</select>
......@@ -475,10 +454,16 @@
created_time, <!-- 创建时间 -->
updated_by, <!-- 更新人 -->
updated_name, <!-- 修改人名称 -->
updated_time <!-- 更新时间 -->
updated_time, <!-- 更新时间 -->
spec,
length
)
VALUES (#id#, #matId#, #orderId#, #orderDetailId#, #techFlowId#, #techFlowName#, #inventProcessId#, #processCode#, #processName#, #processOrder#, #companyCode#, #companyName#, #depCode#, #depName#, #projCode#, #projName#, #taskCode#, #productType#, #productCode#, #productName#, #planStartDate#, #planEndDate#, #factoryCode#, #factoryName#, #groupCode#, #groupName#, #completeDate#, #quantity#, #finishQuantity#, #unfinishQuantity#, #singleWeight#, #totalWeight#, #finishWeight#, #unfinishWeight#, #accountCode#, #createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedName#, #updatedTime#)
VALUES (#id#, #matId#, #orderId#, #orderDetailId#, #techFlowId#, #techFlowName#, #inventProcessId#,
#processCode#, #processName#, #processOrder#, #companyCode#, #companyName#, #depCode#, #depName#, #projCode#,
#projName#, #taskCode#, #productType#, #productCode#, #productName#, #planStartDate#, #planEndDate#,
#factoryCode#, #factoryName#, #groupCode#, #groupName#, #completeDate#, #quantity#, #finishQuantity#,
#unfinishQuantity#, #singleWeight#, #totalWeight#, #finishWeight#, #unfinishWeight#, #accountCode#, #createdBy#,
#createdName#, #createdTime#, #updatedBy#, #updatedName#, #updatedTime#, #spec#, #length#)
</insert>
<delete id="delete">
......@@ -528,7 +513,9 @@
created_time = #createdTime#, <!-- 创建时间 -->
updated_by = #updatedBy#, <!-- 更新人 -->
updated_name = #updatedName#, <!-- 修改人名称 -->
updated_time = #updatedTime# <!-- 更新时间 -->
updated_time = #updatedTime#, <!-- 更新时间 -->
spec = #spec#,
length = #length#
WHERE
id = #id#
</update>
......
......@@ -43,182 +43,161 @@
-->
<sqlMap namespace="HGSC008">
<sql id="authCondition">
<!-- 无权限时使用 -->
<isNotEmpty prepend=" AND " property="authDepCode">
A.DEP_CODE = #authDepCode#
</isNotEmpty>
<!-- 仅本人和部门组合 -->
<isEqual prepend=" AND " property="authCombination" compareValue="1">
(A.CREATED_BY = #authOnlyPeople# OR A.DEP_CODE IN <iterate close=")" open="(" conjunction=","
property="authDepCodes">#authDepCodes[]#</iterate>)
</isEqual>
<!-- 仅本人或部门 -->
<isNotEqual prepend=" AND " property="authCombination" compareValue="1">
<isNotEmpty property="authOnlyPeople">
A.CREATED_BY = #authOnlyPeople#
</isNotEmpty>
<isNotEmpty property="authDepCodes">
A.DEP_CODE IN
<iterate close=")" open="(" conjunction="," property="authDepCodes">#authDepCodes[]#</iterate>
</isNotEmpty>
</isNotEqual>
</sql>
<sql id="condition">
<include refid="authCondition"/>
<include refid="HGXSDataAuth.authCondition"/>
<isNotEmpty prepend=" AND " property="id">
A.id = #id#
id = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="matId">
A.mat_id = #matId#
mat_id = #matId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="taskId">
A.task_id = #taskId#
task_id = #taskId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="techFlowId">
A.tech_flow_id = #techFlowId#
tech_flow_id = #techFlowId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="techFlowName">
A.tech_flow_name = #techFlowName#
tech_flow_name = #techFlowName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventProcessId">
A.invent_process_id = #inventProcessId#
invent_process_id = #inventProcessId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="processCode">
A.process_code = #processCode#
process_code = #processCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="processName">
A.process_name = #processName#
process_name = #processName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="processOrder">
A.process_order = #processOrder#
process_order = #processOrder#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
A.company_code = #companyCode#
company_code = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyName">
A.company_name like ('%$companyName$%')
company_name like ('%$companyName$%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
A.dep_code = #depCode#
dep_code = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depName">
A.dep_name = #depName#
dep_name = #depName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="projCode">
A.proj_code = #projCode#
proj_code = #projCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="projName">
A.proj_name = #projName#
proj_name = #projName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="workCode">
A.work_code like ('%$workCode$%')
work_code like ('%$workCode$%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="productType">
A.product_type = #productType#
product_type = #productType#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="productCode">
A.product_code = #productCode#
product_code = #productCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="productName">
A.product_name = #productName#
product_name = #productName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="planStartDate">
A.plan_start_date = #planStartDate#
plan_start_date = #planStartDate#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="planEndDate">
A.plan_end_date = #planEndDate#
plan_end_date = #planEndDate#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="factoryCode">
A.factory_code = #factoryCode#
factory_code = #factoryCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="factoryName">
A.factory_name = #factoryName#
factory_name = #factoryName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="groupCode">
A.group_code = #groupCode#
group_code = #groupCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="groupName">
A.group_name like ('%$groupName$%')
group_name like ('%$groupName$%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="registerDate">
A.register_date = #registerDate#
register_date = #registerDate#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="quantity">
A.quantity = #quantity#
quantity = #quantity#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="singleWeight">
A.single_weight = #singleWeight#
single_weight = #singleWeight#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="totalWeight">
A.total_weight = #totalWeight#
total_weight = #totalWeight#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="accountCode">
A.account_code = #accountCode#
account_code = #accountCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdBy">
A.created_by = #createdBy#
created_by = #createdBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdName">
A.created_name = #createdName#
created_name = #createdName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdTime">
A.created_time = #createdTime#
created_time = #createdTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedBy">
A.updated_by = #updatedBy#
updated_by = #updatedBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedName">
A.updated_name = #updatedName#
updated_name = #updatedName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedTime">
A.updated_time = #updatedTime#
updated_time = #updatedTime#
</isNotEmpty>
</sql>
<select id="query" parameterClass="java.util.HashMap"
resultClass="com.baosight.hggp.hg.sc.domain.HGSC008">
SELECT
A.id as "id",
A.mat_id as "matId", <!-- 物料清单ID -->
A.task_id as "taskId", <!-- 生产任务ID -->
A.tech_flow_id as "techFlowId", <!-- 工艺流程ID -->
A.tech_flow_name as "techFlowName", <!-- 工艺流程名称 -->
A.invent_process_id as "inventProcessId", <!-- 存货工序ID,对应HGPZ005A.id -->
A.process_code as "processCode", <!-- 工序编码 -->
A.process_name as "processName", <!-- 工序名称 -->
A.process_order as "processOrder", <!-- 加工顺序 -->
A.company_code as "companyCode", <!-- 公司编码 -->
A.company_name as "companyName", <!-- 公司名称 -->
A.dep_code as "depCode", <!-- 部门编码 -->
A.dep_name as "depName", <!-- 部门名称 -->
A.proj_code as "projCode", <!-- 项目编码 -->
A.proj_name as "projName", <!-- 项目名称 -->
A.work_code as "workCode", <!-- 报工编码 -->
A.product_type as "productType", <!-- 产品类型 -->
A.product_code as "productCode", <!-- 产品编号 -->
A.product_name as "productName", <!-- 产品名称 -->
A.plan_start_date as "planStartDate", <!-- 计划开始日期 -->
A.plan_end_date as "planEndDate", <!-- 计划结束日期 -->
A.factory_code as "factoryCode", <!-- 工厂编号 -->
A.factory_name as "factoryName", <!-- 工厂名称 -->
A.group_code as "groupCode", <!-- 工作组编号 -->
A.group_name as "groupName", <!-- 工作组名称 -->
A.register_date as "registerDate", <!-- 报工日期 -->
A.quantity as "quantity", <!-- 数量 -->
A.single_weight as "singleWeight", <!-- 单重 -->
A.total_weight as "totalWeight", <!-- 总重 -->
A.account_code as "accountCode", <!-- 帐套 -->
A.created_by as "createdBy", <!-- 创建人 -->
A.created_name as "createdName", <!-- 创建人名称 -->
A.created_time as "createdTime", <!-- 创建时间 -->
A.updated_by as "updatedBy", <!-- 更新人 -->
A.updated_name as "updatedName", <!-- 修改人名称 -->
A.updated_time as "updatedTime", <!-- 更新时间 -->
B.LENGTH as "length", <!-- 长 -->
B.SPEC as "spec" <!-- 规格 -->
FROM ${hggpSchema}.HGSC008 A LEFT JOIN ${hggpSchema}.HGPZ005 B ON A.product_code = B.INVENT_CODE
id as "id",
mat_id as "matId", <!-- 物料清单ID -->
task_id as "taskId", <!-- 生产任务ID -->
tech_flow_id as "techFlowId", <!-- 工艺流程ID -->
tech_flow_name as "techFlowName", <!-- 工艺流程名称 -->
invent_process_id as "inventProcessId", <!-- 存货工序ID,对应HGPZ005A.id -->
process_code as "processCode", <!-- 工序编码 -->
process_name as "processName", <!-- 工序名称 -->
process_order as "processOrder", <!-- 加工顺序 -->
company_code as "companyCode", <!-- 公司编码 -->
company_name as "companyName", <!-- 公司名称 -->
dep_code as "depCode", <!-- 部门编码 -->
dep_name as "depName", <!-- 部门名称 -->
proj_code as "projCode", <!-- 项目编码 -->
proj_name as "projName", <!-- 项目名称 -->
work_code as "workCode", <!-- 报工编码 -->
product_type as "productType", <!-- 产品类型 -->
product_code as "productCode", <!-- 产品编号 -->
product_name as "productName", <!-- 产品名称 -->
plan_start_date as "planStartDate", <!-- 计划开始日期 -->
plan_end_date as "planEndDate", <!-- 计划结束日期 -->
factory_code as "factoryCode", <!-- 工厂编号 -->
factory_name as "factoryName", <!-- 工厂名称 -->
group_code as "groupCode", <!-- 工作组编号 -->
group_name as "groupName", <!-- 工作组名称 -->
register_date as "registerDate", <!-- 报工日期 -->
quantity as "quantity", <!-- 数量 -->
single_weight as "singleWeight", <!-- 单重 -->
total_weight as "totalWeight", <!-- 总重 -->
account_code as "accountCode", <!-- 帐套 -->
created_by as "createdBy", <!-- 创建人 -->
created_name as "createdName", <!-- 创建人名称 -->
created_time as "createdTime", <!-- 创建时间 -->
updated_by as "updatedBy", <!-- 更新人 -->
updated_name as "updatedName", <!-- 修改人名称 -->
updated_time as "updatedTime", <!-- 更新时间 -->
length as "length", <!-- 长 -->
spec as "spec" <!-- 规格 -->
FROM ${hggpSchema}.HGSC008
WHERE 1=1
<include refid="condition" />
<dynamic prepend="ORDER BY">
......@@ -226,14 +205,14 @@
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
A.register_date desc ,A.id desc
register_date desc, id desc
</isEmpty>
</dynamic>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hggpSchema}.HGSC008 A LEFT JOIN ${hggpSchema}.HGPZ005 B ON A.product_code = B.INVENT_CODE WHERE 1=1
SELECT COUNT(*) FROM ${hggpSchema}.HGSC008 WHERE 1=1
<include refid="condition" />
</select>
......@@ -350,43 +329,49 @@
<insert id="insert">
INSERT INTO ${hggpSchema}.HGSC008 (id,
mat_id, <!-- 物料清单ID -->
task_id, <!-- 生产任务ID -->
tech_flow_id, <!-- 工艺流程ID -->
tech_flow_name, <!-- 工艺流程名称 -->
invent_process_id, <!-- 存货工序ID,对应HGPZ005A.id -->
process_code, <!-- 工序编码 -->
process_name, <!-- 工序名称 -->
process_order, <!-- 加工顺序 -->
company_code, <!-- 公司编码 -->
company_name, <!-- 公司名称 -->
dep_code, <!-- 部门编码 -->
dep_name, <!-- 部门名称 -->
proj_code, <!-- 项目编码 -->
proj_name, <!-- 项目名称 -->
work_code, <!-- 报工编码 -->
product_type, <!-- 产品类型 -->
product_code, <!-- 产品编号 -->
product_name, <!-- 产品名称 -->
plan_start_date, <!-- 计划开始日期 -->
plan_end_date, <!-- 计划结束日期 -->
factory_code, <!-- 工厂编号 -->
factory_name, <!-- 工厂名称 -->
group_code, <!-- 工作组编号 -->
group_name, <!-- 工作组名称 -->
register_date, <!-- 报工日期 -->
quantity, <!-- 数量 -->
single_weight, <!-- 单重 -->
total_weight, <!-- 总重 -->
account_code, <!-- 帐套 -->
created_by, <!-- 创建人 -->
created_name, <!-- 创建人名称 -->
created_time, <!-- 创建时间 -->
updated_by, <!-- 更新人 -->
updated_name, <!-- 修改人名称 -->
updated_time <!-- 更新时间 -->
)
VALUES (#id#, #matId#, #taskId#, #techFlowId#, #techFlowName#, #inventProcessId#, #processCode#, #processName#, #processOrder#, #companyCode#, #companyName#, #depCode#, #depName#, #projCode#, #projName#, #workCode#, #productType#, #productCode#, #productName#, #planStartDate#, #planEndDate#, #factoryCode#, #factoryName#, #groupCode#, #groupName#, #registerDate#, #quantity#, #singleWeight#, #totalWeight#, #accountCode#, #createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedName#, #updatedTime#)
mat_id, <!-- 物料清单ID -->
task_id, <!-- 生产任务ID -->
tech_flow_id, <!-- 工艺流程ID -->
tech_flow_name, <!-- 工艺流程名称 -->
invent_process_id, <!-- 存货工序ID,对应HGPZ005A.id -->
process_code, <!-- 工序编码 -->
process_name, <!-- 工序名称 -->
process_order, <!-- 加工顺序 -->
company_code, <!-- 公司编码 -->
company_name, <!-- 公司名称 -->
dep_code, <!-- 部门编码 -->
dep_name, <!-- 部门名称 -->
proj_code, <!-- 项目编码 -->
proj_name, <!-- 项目名称 -->
work_code, <!-- 报工编码 -->
product_type, <!-- 产品类型 -->
product_code, <!-- 产品编号 -->
product_name, <!-- 产品名称 -->
plan_start_date, <!-- 计划开始日期 -->
plan_end_date, <!-- 计划结束日期 -->
factory_code, <!-- 工厂编号 -->
factory_name, <!-- 工厂名称 -->
group_code, <!-- 工作组编号 -->
group_name, <!-- 工作组名称 -->
register_date, <!-- 报工日期 -->
quantity, <!-- 数量 -->
single_weight, <!-- 单重 -->
total_weight, <!-- 总重 -->
account_code, <!-- 帐套 -->
created_by, <!-- 创建人 -->
created_name, <!-- 创建人名称 -->
created_time, <!-- 创建时间 -->
updated_by, <!-- 更新人 -->
updated_name, <!-- 修改人名称 -->
updated_time, <!-- 更新时间 -->
spec,
length
)
VALUES (#id#, #matId#, #taskId#, #techFlowId#, #techFlowName#, #inventProcessId#, #processCode#, #processName#,
#processOrder#, #companyCode#, #companyName#, #depCode#, #depName#, #projCode#, #projName#, #workCode#,
#productType#, #productCode#, #productName#, #planStartDate#, #planEndDate#, #factoryCode#, #factoryName#,
#groupCode#, #groupName#, #registerDate#, #quantity#, #singleWeight#, #totalWeight#, #accountCode#, #createdBy#,
#createdName#, #createdTime#, #updatedBy#, #updatedName#, #updatedTime#,#spec#,#length#)
<selectKey resultClass="long" keyProperty="id">
SELECT MAX(ID) AS "id" FROM ${hggpSchema}.HGSC008
</selectKey>
......@@ -434,7 +419,9 @@
created_time = #createdTime#, <!-- 创建时间 -->
updated_by = #updatedBy#, <!-- 更新人 -->
updated_name = #updatedName#, <!-- 修改人名称 -->
updated_time = #updatedTime# <!-- 更新时间 -->
updated_time = #updatedTime#, <!-- 更新时间 -->
spec = #spec#,
length = #length#
WHERE
id = #id#
</update>
......
......@@ -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