Commit 72d41ddd by liuyang

Merge branch 'dev' of http://git.pseer.com:8800/platform/hp-smart into dev-ly

 Conflicts:
	src/main/java/com/baosight/hpjx/core/enums/DocRouteEnum.java
	src/main/java/com/baosight/hpjx/hp/sc/service/ServiceHPSC102.java
	src/main/java/com/baosight/hpjx/hp/sc/service/ServiceHPSC111.java
	src/main/webapp/HP/SC/HPSC102.js
	src/main/webapp/HP/SC/HPSC102.jsp
	src/main/webapp/HP/SC/HPSC111.js
	src/main/webapp/HP/SC/HPSC111.jsp
parents c036452d e85b0904
package com.baosight.hpjx.aspect.annotation;
import com.baosight.hpjx.aspect.domain.TCPReceive;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.web.controller.WebDispatchController;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -16,7 +15,7 @@ import org.springframework.web.bind.annotation.RestController;
@RequestMapping("/tcp")
public class TCPController extends WebDispatchController {
private final static Logger logger = LoggerFactory.getLogger(DocController.class);
private final static Logger logger = LoggerFactory.getLogger(TCPController.class);
@RequestMapping(value = "/receive/api", method = RequestMethod.POST)
......
package com.baosight.hpjx.aspect.annotation;
package com.baosight.hpjx.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baosight.hpjx.core.enums.DocRouteEnum;
import com.baosight.hpjx.util.DocExcelUtils;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.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.collections.MapUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.math.NumberUtils;
import org.apache.http.HttpEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.util.Args;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.Reader;
import java.net.URLDecoder;
import java.net.URLEncoder;
import java.nio.charset.Charset;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import com.baosight.hpjx.common.DocRouteEnum;
/**
* DOC 接口类
*
......@@ -63,7 +38,7 @@ import com.baosight.hpjx.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);
/**
* 批量导入
......@@ -110,15 +85,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.hpjx.controller;
import com.baosight.hpjx.core.utils.Iplat4jUtils;
import com.baosight.hpjx.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.hpjx.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");
}
......@@ -15,12 +15,37 @@ public enum DocRouteEnum {
HPSC006("route_002", "HPSC006", "importData", HPSC006 .class),
HPSC102("route_003", "HPSC102", "importData", HPSC102.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;
......@@ -45,6 +70,14 @@ public enum DocRouteEnum {
return id;
}
public String getTemplateUrl() {
return templateUrl;
}
public int getStartRow() {
return startRow;
}
public String getServiceNme() {
return serviceNme;
}
......
package com.baosight.hpjx.core.interceptor;
import com.baosight.hpjx.core.constant.EPCodeConstant;
import com.baosight.hpjx.core.security.UserSessionUtils;
import com.baosight.hpjx.core.tools.ServletTools;
import com.baosight.hpjx.util.ObjectUtils;
import com.baosight.hpjx.util.StringUtils;
......@@ -31,7 +32,7 @@ public class MyHandlerInterceptor implements HandlerInterceptor {
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object o) throws Exception {
try {
// 设置环境变量
request.setAttribute("projectEnv", ProjectInfo.getProjectEnv());
request.setAttribute("PROJECT_ENV", ProjectInfo.getProjectEnv());
// 校验接口权限
boolean isInterfaceAuth = this.checkUserInterfaceAuth(request, response);
if (!isInterfaceAuth) {
......@@ -46,6 +47,8 @@ public class MyHandlerInterceptor implements HandlerInterceptor {
@Override
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object o,
ModelAndView modelAndView) throws Exception {
// 设置登录用户的企业编码
request.setAttribute("COMPANY_CODE", UserSessionUtils.getCompanyCode());
}
@Override
......
......@@ -3,6 +3,7 @@ package com.baosight.hpjx.core.tools;
import com.baosight.hpjx.core.dao.DaoBase;
import com.baosight.hpjx.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.hpjx.core.utils;
import com.baosight.hpjx.core.constant.S3Constant;
import com.baosight.hpjx.core.tools.Iplat4jTools;
import com.baosight.hpjx.util.FileUtils;
import com.baosight.hpjx.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("文件在服务器中不存在");
}
// 从文件路径中截取key,不包含域名和bucket名称
String url = dbDm05.getUrl();
if (StringUtils.isBlank(url)) {
return false;
}
// 删除本地记录
// platFileUploader.deleteDocById(docId);
// 删除S3文件
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.hpjx.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.hpjx.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.hpjx.core.utils;
import com.amazonaws.services.s3.AmazonS3;
import com.baosight.hpjx.core.constant.S3Constant;
import com.baosight.hpjx.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 void uploadFile(String key, File file) {
AmazonS3 client = S3ClientUtils.getS3Client();
AssertUtils.isNull(client, "上传失败,OSS客户端未初始化,请检查");
client.putObject(S3Constant.BUCKET_NAME, key, file);
}
/**
* 删除文件
*
* @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.hpjx.hp.constant;
import com.jcraft.jsch.UserAuth;
/**
* @author:songx
* @date:2024/1/18,17:16
......
package com.baosight.hpjx.hp.dm.service;
import com.baosight.hpjx.core.enums.DocRouteEnum;
import com.baosight.hpjx.util.EiInfoUtils;
import com.baosight.hpjx.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 ServiceHPDM91 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);
}
}
......@@ -189,8 +189,8 @@ public class HPKC003 extends DaoEPBase {
eiColumn = new EiColumn(FIELD_WEIGHT);
eiColumn.setType("N");
eiColumn.setScaleLength(0);
eiColumn.setFieldLength(12);
eiColumn.setScaleLength(3);
eiColumn.setFieldLength(20);
eiColumn.setDescName("重量");
eiMetadata.addMeta(eiColumn);
......
......@@ -42,6 +42,8 @@ public class HPKC004 extends DaoEPBase {
public static final String FIELD_AMOUNT = "amount"; /* 数量*/
public static final String FIELD_UNIT_WEIGHT = "unitWeight"; /* 单重*/
public static final String FIELD_WEIGHT = "weight"; /* 重量*/
public static final String FIELD_INV_WEIGHT = "invWeight"; /* 库存重量*/
public static final String FIELD_DIFF_WEIGHT = "diffWeight"; /* 差异重量*/
public static final String FIELD_REMARK = "remark"; /* 备注*/
public static final String FIELD_KC_ID = "kcId"; /* 库存ID*/
public static final String FIELD_OLD_SALE_NO = "oldSaleNo"; /* 原销售单号*/
......@@ -58,7 +60,6 @@ public class HPKC004 extends DaoEPBase {
public static final String FIELD_FACTORY_CODE = "factoryCode"; /* 厂区编码*/
public static final String FIELD_FACTORY_NAME = "factoryName"; /* 工厂*/
public static final String COL_ID = "ID"; /* ID*/
public static final String COL_COMPANY_CODE = "COMPANY_CODE"; /* 企业编码 预留*/
public static final String COL_DEP_CODE = "DEP_CODE"; /* 部门编码 预留*/
......@@ -79,6 +80,8 @@ public class HPKC004 extends DaoEPBase {
public static final String COL_AMOUNT = "AMOUNT"; /* 数量*/
public static final String COL_UNIT_WEIGHT = "UNIT_WEIGHT"; /* 单重*/
public static final String COL_WEIGHT = "WEIGHT"; /* 重量*/
public static final String COL_INV_WEIGHT = "INV_WEIGHT"; /* 库存重量*/
public static final String COL_DIFF_WEIGHT = "DIFF_WEIGHT"; /* 差异重量*/
public static final String COL_REMARK = "REMARK"; /* 备注*/
public static final String COL_KC_ID = "KC_ID"; /* 库存ID*/
public static final String COL_OLD_SALE_NO = "OLD_SALE_NO"; /* 原销售单号*/
......@@ -121,6 +124,8 @@ public class HPKC004 extends DaoEPBase {
private BigDecimal amount = new BigDecimal(0.000); /* 数量*/
private BigDecimal unitWeight = new BigDecimal(0.000); /* 单重*/
private BigDecimal weight = new BigDecimal(0.000); /* 重量*/
private BigDecimal invWeight = new BigDecimal(0.000); /* 库存重量*/
private BigDecimal diffWeight = new BigDecimal(0.000); /* 差异重量*/
private String remark = " "; /* 备注*/
private Long kcId; /* 库存ID*/
private String oldSaleNo = " "; /* 原销售单号*/
......@@ -242,6 +247,20 @@ public class HPKC004 extends DaoEPBase {
eiColumn.setDescName("重量");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_INV_WEIGHT);
eiColumn.setType("N");
eiColumn.setScaleLength(3);
eiColumn.setFieldLength(15);
eiColumn.setDescName("库存重量");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_DIFF_WEIGHT);
eiColumn.setType("N");
eiColumn.setScaleLength(3);
eiColumn.setFieldLength(15);
eiColumn.setDescName("差异重量");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_REMARK);
eiColumn.setDescName("备注");
eiMetadata.addMeta(eiColumn);
......@@ -631,6 +650,38 @@ public class HPKC004 extends DaoEPBase {
this.weight = weight;
}
/**
* get the invWeight - 库存重量.
* @return the invWeight
*/
public BigDecimal getInvWeight() {
return this.invWeight;
}
/**
* set the invWeight - 库存重量.
*
* @param invWeight - 库存重量
*/
public void setInvWeight(BigDecimal invWeight) {
this.invWeight = invWeight;
}
/**
* get the diffWeight - 差异重量.
* @return the diffWeight
*/
public BigDecimal getDiffWeight() {
return this.diffWeight;
}
/**
* set the diffWeight - 差异重量.
*
* @param diffWeight - 差异重量
*/
public void setDiffWeight(BigDecimal diffWeight) {
this.diffWeight = diffWeight;
}
/**
* get the remark - 备注.
* @return the remark
*/
......@@ -891,6 +942,8 @@ public class HPKC004 extends DaoEPBase {
setAmount(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_AMOUNT)), amount));
setUnitWeight(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_UNIT_WEIGHT)), unitWeight));
setWeight(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_WEIGHT)), weight));
setInvWeight(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_INV_WEIGHT)), invWeight));
setDiffWeight(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_DIFF_WEIGHT)), diffWeight));
setRemark(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_REMARK)), remark));
setKcId(NumberUtils.toLong(StringUtils.toString(map.get(FIELD_KC_ID)), kcId));
setOldSaleNo(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_OLD_SALE_NO)), oldSaleNo));
......@@ -935,6 +988,8 @@ public class HPKC004 extends DaoEPBase {
map.put(FIELD_AMOUNT, StringUtils.toString(amount, eiMetadata.getMeta(FIELD_AMOUNT)));
map.put(FIELD_UNIT_WEIGHT, StringUtils.toString(unitWeight, eiMetadata.getMeta(FIELD_UNIT_WEIGHT)));
map.put(FIELD_WEIGHT, StringUtils.toString(weight, eiMetadata.getMeta(FIELD_WEIGHT)));
map.put(FIELD_INV_WEIGHT, StringUtils.toString(invWeight, eiMetadata.getMeta(FIELD_INV_WEIGHT)));
map.put(FIELD_DIFF_WEIGHT, StringUtils.toString(diffWeight, eiMetadata.getMeta(FIELD_DIFF_WEIGHT)));
map.put(FIELD_REMARK, StringUtils.toString(remark, eiMetadata.getMeta(FIELD_REMARK)));
map.put(FIELD_KC_ID, StringUtils.toString(kcId, eiMetadata.getMeta(FIELD_KC_ID)));
map.put(FIELD_OLD_SALE_NO, StringUtils.toString(oldSaleNo, eiMetadata.getMeta(FIELD_OLD_SALE_NO)));
......
......@@ -222,8 +222,8 @@ public class HPKC011 extends DaoEPBase {
eiColumn = new EiColumn(FIELD_WEIGHT);
eiColumn.setType("N");
eiColumn.setScaleLength(2);
eiColumn.setFieldLength(10);
eiColumn.setScaleLength(3);
eiColumn.setFieldLength(20);
eiColumn.setDescName("重量");
eiMetadata.addMeta(eiColumn);
......
......@@ -209,8 +209,8 @@ public class HPKC011A extends DaoEPBase {
eiColumn = new EiColumn(FIELD_WEIGHT);
eiColumn.setType("N");
eiColumn.setScaleLength(2);
eiColumn.setFieldLength(10);
eiColumn.setScaleLength(3);
eiColumn.setFieldLength(20);
eiColumn.setDescName("重量");
eiMetadata.addMeta(eiColumn);
......
......@@ -131,7 +131,6 @@ public class ServiceHPKC004 extends ServiceBase {
HPKCTools.updateProdStock(dbKc004.getWhCode(), dbKc004.getProdNo(),
dbKc004.getAmount(), dbKc004.getWeight(),hpkc011.getFactoryCode());
}
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
......
......@@ -21,6 +21,7 @@ import com.baosight.iplat4j.core.service.soa.XLocalManager;
import com.baosight.iplat4j.core.util.DateUtils;
import com.baosight.iplat4j.core.web.threadlocal.UserSession;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.BooleanUtils;
import org.apache.commons.lang.StringUtils;
import java.math.BigDecimal;
......@@ -104,31 +105,34 @@ public class ServiceHPKC011 extends ServiceBase {
String factoryCode = inInfo.getString("factoryCode");
BigDecimal amount = new BigDecimal(inInfo.getString("amount"));
BigDecimal weight = new BigDecimal(inInfo.getString("weight"));
boolean isOnlyWeight = BooleanUtils.toBoolean(inInfo.getString("isOnlyWeight"));
String companyCode = UserSessionUtils.getCompanyCode();
try {
checkUpdateStockParam(companyCode,whCode,prodNo,amount,weight);
HPKC011 newObj = generatorBaseInfo(companyCode,whCode,prodNo,amount,weight);
List<Map> list = dao.query("HPKC011.queryByCondition",new HashMap<String,Object>(){{
put("companyCode",companyCode);
put("whCode",whCode);
put("prodNo",prodNo);
checkUpdateStockParam(companyCode, whCode, prodNo, amount, weight);
HPKC011 newObj = generatorBaseInfo(companyCode, whCode, prodNo, amount, weight);
List<Map> list = dao.query("HPKC011.queryByCondition", new HashMap<String, Object>() {{
put("companyCode", companyCode);
put("whCode", whCode);
put("prodNo", prodNo);
}});
if(CollectionUtils.isEmpty(list)){
//新增
if(amount.compareTo(BigDecimal.ZERO)<0
||weight.compareTo(BigDecimal.ZERO)<0){
if (CollectionUtils.isEmpty(list)) {
// 新增
if (amount.compareTo(BigDecimal.ZERO) < 0
|| weight.compareTo(BigDecimal.ZERO) < 0) {
throw new PlatException("当前库存为空,库存变更数量与重量不能小于等于0!");
}
newObj.setFactoryCode(factoryCode);
generatorBaseInfo(newObj);
DaoUtils.insert("HPKC011.insert",newObj);
}else{
//修改
DaoUtils.insert("HPKC011.insert", newObj);
} else {
// 修改
HPKC011 oldObj = new HPKC011();
oldObj.fromMap(list.get(0));
BigDecimal afterAmout = oldObj.getAmount().add(amount);
BigDecimal afterWeight = oldObj.getWeight().add(weight);
if(afterAmout.compareTo(BigDecimal.ZERO)<0||afterWeight.compareTo(BigDecimal.ZERO)<0){
// 仅有重量的时候,不校验数据和重量
if (!isOnlyWeight && (afterAmout.compareTo(BigDecimal.ZERO) < 0
|| afterWeight.compareTo(BigDecimal.ZERO) < 0)) {
throw new PlatException("库存更新失败,出库数量与重量不能大于当前库存!");
}
oldObj.setAmount(afterAmout);
......@@ -136,8 +140,8 @@ public class ServiceHPKC011 extends ServiceBase {
oldObj.setUpdatedBy(newObj.getUpdatedBy());
oldObj.setUpdatedName(newObj.getUpdatedName());
oldObj.setUpdatedTime(newObj.getUpdatedTime());
int result = DaoUtils.update("HPKC011.updateStock",oldObj);
if(result!=1){
int result = DaoUtils.update("HPKC011.updateStock", oldObj);
if (result != 1) {
throw new PlatException("库存更新失败,库存已发生变更或系统异常,请重试!");
}
}
......@@ -158,7 +162,8 @@ public class ServiceHPKC011 extends ServiceBase {
* @param weight
* @reutrn HPKC011
*/
private HPKC011 generatorBaseInfo(String companyCode, String whCode, String prodNo, BigDecimal amout, BigDecimal weight) {
private HPKC011 generatorBaseInfo(String companyCode, String whCode, String prodNo, BigDecimal amout,
BigDecimal weight) {
HPKC011 hpkc011 = new HPKC011();
hpkc011.setCompanyCode(companyCode);
hpkc011.setWhCode(whCode);
......@@ -186,7 +191,7 @@ public class ServiceHPKC011 extends ServiceBase {
EiInfo outInfo = XLocalManager.call(inInfo);
List<HPPZ007> whNameList = (List) outInfo.get("list");
hpkc011.setWhName(whNameList.get(0).getWhName());
}catch (Exception e){
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "库存更新失败!");
throw new PlatException("仓库编码异常,找不到对应的仓库档案!");
}
......@@ -204,7 +209,7 @@ public class ServiceHPKC011 extends ServiceBase {
hpkc011.setPrdtSpec(hpsc005.getPrdtSpec());
hpkc011.setUnitWeight(hpsc005.getUnitWt());
hpkc011.setRemark(hpsc005.getRemark1());
}catch (Exception e){
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "库存更新失败!");
throw new PlatException("生产单号异常,找不到对应的生产订单!");
}
......@@ -214,30 +219,30 @@ public class ServiceHPKC011 extends ServiceBase {
/**
* 校验库存变更请求参数
*
* @param companyCode
* @param whCode
* @param prodNo
* @param amout
* @param weight
*/
private void checkUpdateStockParam(String companyCode, String whCode, String prodNo
, BigDecimal amout, BigDecimal weight){
if(StringUtils.isBlank(companyCode)){
private void checkUpdateStockParam(String companyCode, String whCode, String prodNo, BigDecimal amout,
BigDecimal weight) {
if (StringUtils.isBlank(companyCode)) {
throw new PlatException("企业编码不能为空!");
}
if(StringUtils.isBlank(whCode)){
if (StringUtils.isBlank(whCode)) {
throw new PlatException("仓库编码不能为空!");
}
if(StringUtils.isBlank(prodNo)){
if (StringUtils.isBlank(prodNo)) {
throw new PlatException("生产单号不能为空!");
}
if(Objects.isNull(amout)||
Objects.isNull(amout)){
if (Objects.isNull(amout) || Objects.isNull(weight)) {
throw new PlatException("库存变更数量或重量不能为空!");
}
if(amout.compareTo(BigDecimal.ZERO)==0
&&weight.compareTo(BigDecimal.ZERO)==0){
throw new PlatException("库存变更数量或重量不能为0)!");
// 宏建路桥没有数量的概念,因此这里不校验数量
if (weight.compareTo(BigDecimal.ZERO) == 0) {
throw new PlatException("库存变更数量或重量不能为0!");
}
}
......
package com.baosight.hpjx.hp.kc.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.kc.domain.HPKC003;
import com.baosight.hpjx.hp.kc.tools.HPKCTools;
import com.baosight.hpjx.hp.sc.tools.HPSCTools;
import com.baosight.hpjx.util.BeanUtils;
import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.EiInfoUtils;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.ObjectUtils;
import com.baosight.hpjx.util.StringUtil;
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.MapUtils;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author:songx
* @date:2024/1/22,10:48
*/
public class ServiceHPKC103 extends ServiceBase {
/**
* 画面初始化
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "生产入库单",operType = "查询",operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) {
try {
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.WH_RECORD_BLOCK_ID), new HashMap<String,Object>(){{put("inventTypes",new String[]{"3"});}}, false);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.INVENT_NAME_BLOCK_ID), null);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.FACTORY_RECORD_BLOCK_ID), null, false);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPKC003().eiMetadata);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
inInfo.setStatus(500);
}
return inInfo;
}
/**
* 查询操作
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "生产入库单",operType = "查询",operDesc = "查询")
@Override
public EiInfo query(EiInfo inInfo) {
try {
Map queryRow = EiInfoUtils.getFirstRow(inInfo);
String receiptDate = MapUtils.getString(queryRow, "documentDate");
queryRow.put("documentDate", StringUtil.removeSpecifiedCharacter(receiptDate,
StringUtil.DEFAULT_CHARACTER_TO_BE_REMOVED));
inInfo = super.query(inInfo, "HPKC003.query", new HPKC003());
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
inInfo.setStatus(500);
}
return inInfo;
}
/**
* 删除操作
*
* @param eiInfo
* @return
*/
@OperationLogAnnotation(operModul = "生产入库单",operType = "删除",operDesc = "删除")
public EiInfo delete(EiInfo eiInfo) {
try {
List<Map> resultRows = eiInfo.getBlock(EiConstant.resultBlock).getRows();
List<String> prodNos = ObjectUtils.listKey(resultRows, "prodNo");
List<String> prodOrderNos = ObjectUtils.listKey(resultRows, "prodOrderNo");
// 锁库存
HPKCTools.HpKc003.lock(prodNos);
// 锁生产计划明细
HPSCTools.HpSc004.lock(prodOrderNos);
// 查询数据
Map<String, HPKC003> dbKc003Map = HPKCTools.HpKc003.map(prodNos);
for (Map resultRow : resultRows) {
HPKC003 fKc003 = new HPKC003();
fKc003.fromMap(resultRow);
DaoUtils.update(HPKC003.DELETE, fKc003);
// 生产一条负数量和产量的红冲记录
HPKC003 dbKc003 = dbKc003Map.get(fKc003.getProdNo());
HPKC003 newKc003 = BeanUtils.copy(dbKc003, HPKC003.class);
newKc003.setAmount(dbKc003.getAmount().negate());
newKc003.setWeight(dbKc003.getWeight().negate());
newKc003.setDeleteFlag(1);
newKc003.setProdNoOld(fKc003.getProdNo());
newKc003.setProdNo(SequenceGenerator.getNextSequence(HPConstant.SequenceId.HPKC003_PROD_NO));
DaoUtils.insert(HPKC003.INSERT, newKc003);
// 同步生产计划
HPSCTools.syncPlan(newKc003.getProdOrderNo(), newKc003.getAmount());
// 更新生产任务已完成数量
HPSCTools.HpSc005a.updateCompleteNum(newKc003.getProdTaskNo(), newKc003.getAmount());
// 修改库存
HPKCTools.updateProdStock(newKc003.getWhCode(), newKc003.getProdOrderNo(),
BigDecimal.ZERO, newKc003.getWeight(), newKc003.getFactoryCode(), true);
}
eiInfo.setStatus(EiConstant.STATUS_SUCCESS);
eiInfo.setMsg("删除成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(eiInfo, e, "删除失败");
eiInfo.setStatus(500);
}
return eiInfo;
}
}
package com.baosight.hpjx.hp.kc.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.common.InventTypeEnum;
import com.baosight.hpjx.common.ProdOrderStatusEnum;
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.kc.domain.HPKC003;
import com.baosight.hpjx.hp.kc.tools.HPKCTools;
import com.baosight.hpjx.hp.pz.tools.HPPZTools;
import com.baosight.hpjx.hp.sc.domain.HPSC005B;
import com.baosight.hpjx.hp.sc.tools.HPSCTools;
import com.baosight.hpjx.util.AssertUtils;
import com.baosight.hpjx.util.BeanUtils;
import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.DateUtils;
import com.baosight.hpjx.util.EiInfoUtils;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.MapUtils;
import com.baosight.hpjx.util.ObjectUtils;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 选择生产任务
*
* @author:songx
* @date:2022/7/11,11:08
*/
public class ServiceHPKC103A extends ServiceEPBase {
private final Integer[] DEFAULT_INVENT_TYPE = {InventTypeEnum.SEMI_FINISHED_PRODUCT.getCode()};
/**
* 初始化
*
* @param inInfo
* @return
*/
@Override
@OperationLogAnnotation(operModul = "生产任务查询", operType = "查询", operDesc = "生产入库单-生产任务查询-初始化")
public EiInfo initLoad(EiInfo inInfo) {
try {
Map queryMap = new HashMap();
//"2",
queryMap.put("inventTypes", new String[]{"3"});
queryMap.put("userId", UserSessionUtils.getUserId());
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.USER_GROUP_BLOCK_ID), queryMap, false);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.WH_RECORD_BLOCK_ID), queryMap, false);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.FACTORY_RECORD_BLOCK_ID), null, false);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.GROUP_RECORD_BLOCK_ID), null, false);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPSC005B().eiMetadata);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
inInfo.setStatus(500);
}
return inInfo;
}
/**
* 查询数据列表
*
* @param inInfo
* @return
*/
@Override
@OperationLogAnnotation(operModul = "生产任务查询", operType = "查询", operDesc = "生产入库单-生产任务查询-查询")
public EiInfo query(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
queryMap.put("isComplete", CommonConstant.YesNo.NO_0);
inInfo = super.query(inInfo, HPSC005B.QUERY, new HPSC005B());
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
inInfo.setStatus(500);
}
return inInfo;
}
/**
* 生成入库单(小程序)
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "生产任务查询", operType = "插入", operDesc = "生产入库单-生产任务查询-生成入库单")
public EiInfo select(EiInfo inInfo) {
inInfo = selectDo(inInfo);
if (inInfo.getStatus() == EiConstant.STATUS_FAILURE) {
inInfo.setStatus(500);
}
return inInfo;
}
/**
* 生成入库单
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "生产任务查询", operType = "插入", operDesc = "生产入库单-生产任务查询-生成入库单")
public EiInfo selectDo(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 订单号
List<String> prodOrderNos = ObjectUtils.listKey(resultRows, "prodOrderNo");
// 任务号
List<String> prodTaskNos = ObjectUtils.listKey(resultRows, "prodTaskNo");
// 锁生产计划
HPSCTools.HpSc004.lock(prodOrderNos);
// 锁生产订单
HPSCTools.HpSc005.lock(prodOrderNos);
// 锁生产任务
HPSCTools.HpSc005a.lock(prodTaskNos);
// 查询生产任务信息
Map<String, HPSC005B> dbSc005bMap = HPSCTools.HpSc005b.map(prodTaskNos);
// 数据校验
this.selectCheck(resultRows, dbSc005bMap);
// 生成入库单
this.selectData(resultRows, dbSc005bMap);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "生成入库单失败");
}
return inInfo;
}
/**
* 数据校验
*
* @param resultRows
* @param dbSc005bMap
*/
public void selectCheck(List<Map> resultRows, Map<String, HPSC005B> dbSc005bMap) {
for (Map row : resultRows) {
String whCode = MapUtils.getString(row, "whCode");
BigDecimal applyNum = MapUtils.getBigDecimal(row, "applyNum");
HPSC005B fSc005b = new HPSC005B();
fSc005b.fromMap(row);
AssertUtils.isEmpty(whCode, String.format("任务号[%s]的仓库不存在为空", fSc005b.getProdTaskNo()));
HPSC005B dbSc005b = dbSc005bMap.get(fSc005b.getProdTaskNo());
AssertUtils.isTrue(ProdOrderStatusEnum.NOT_ASSIGN.getCode().equals(dbSc005b.getStatus()),
String.format("生产任务ID[%s]状态不是已分派,不允许操作", fSc005b.getId()));
// 完成数量是百分比
BigDecimal subNum = new BigDecimal("100").subtract(dbSc005b.getCompleteNum());
AssertUtils.isGt(applyNum, subNum, String.format("任务号[%s]申请数量[%s]%%不能大于未入库的数量[%s]%%",
fSc005b.getProdTaskNo(), applyNum, subNum));
// 校验是否存在巡检单
/* Map queryMap = new HashMap();
queryMap.put("prodTaskNo", fSc005b.getProdTaskNo());
queryMap.put("status", CommonConstant.YesNo.NO_0);
List<HPZL001> dbZl001s = dao.query(HPZL001.QUERY, queryMap);
AssertUtils.isNotEmpty(dbZl001s, String.format("任务号[%s]存在未处理的质量巡检单,请先处理质量巡检单",
fSc005b.getProdTaskNo()));*/
}
}
/**
* 生成入库单
*
* @param resultRows
* @param dbSc005bMap
*/
public void selectData(List<Map> resultRows, Map<String, HPSC005B> dbSc005bMap) {
for (Map row : resultRows) {
String whCode = MapUtils.getString(row, "whCode");
BigDecimal applyNum = MapUtils.getBigDecimal(row, "applyNum");
HPSC005B fSc005b = new HPSC005B();
fSc005b.fromMap(row);
HPSC005B dbSc005b = dbSc005bMap.get(fSc005b.getProdTaskNo());
HPKC003 newKc003 = BeanUtils.copy(dbSc005b, HPKC003.class);
newKc003.setProdNo(SequenceGenerator.getNextSequence(HPConstant.SequenceId.HPKC003_PROD_NO));
newKc003.setDocumentDate(DateUtils.shortDate());
newKc003.setWhCode(whCode);
newKc003.setWhName(HPPZTools.HpPz007.getByCode(whCode).getWhName());
newKc003.setRemark(MapUtils.getString(row, "remark1"));
newKc003.setAmount(applyNum);
// 百分比存的0~100,因此需要除以100
newKc003.setWeight(applyNum.multiply(dbSc005b.getTotalWt()).divide(new BigDecimal("100")));
newKc003.setDeleteFlag(CommonConstant.YesNo.NO_0);
DaoUtils.insert(HPKC003.INSERT, newKc003);
// 同步生产计划
HPSCTools.syncPlan(newKc003.getProdOrderNo(), newKc003.getAmount());
// 更新生产任务已完成数量
HPSCTools.HpSc005a.updateCompleteNum(fSc005b.getProdTaskNo(), applyNum);
// 修改库存
HPKCTools.updateProdStock(newKc003.getWhCode(), newKc003.getProdOrderNo(),
BigDecimal.ZERO, newKc003.getWeight(), fSc005b.getFactoryCode(), true);
}
}
}
package com.baosight.hpjx.hp.kc.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.common.InventTypeEnum;
import com.baosight.hpjx.common.ReturnStatusEnum;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.kc.domain.HPKC004;
import com.baosight.hpjx.hp.kc.domain.HPKC010;
import com.baosight.hpjx.hp.kc.domain.HPKC011;
import com.baosight.hpjx.hp.kc.domain.HPKC013;
import com.baosight.hpjx.hp.kc.tools.HPKCTools;
import com.baosight.hpjx.util.BeanUtils;
import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.EiInfoUtils;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.ObjectUtils;
import com.baosight.hpjx.util.StringUtil;
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.MapUtils;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author:songx
* @date:2024/1/25,22:22
*/
public class ServiceHPKC104 extends ServiceBase {
// 指定存货类型
private static final Integer[] DEFAULT_INVENT_CODE = {InventTypeEnum.RAW.getCode(),
InventTypeEnum.CONSUMABLE.getCode(), InventTypeEnum.SEMI_FINISHED_PRODUCT.getCode(),
InventTypeEnum.FINISHED_PRODUCT.getCode()};
/**
* 画面初始化
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "销售出库单",operType = "查询",operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) {
try {
Map queryMap = new HashMap();
queryMap.put("inventTypes", DEFAULT_INVENT_CODE);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.WH_RECORD_BLOCK_ID), queryMap);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.INVENT_NAME_BLOCK_ID), queryMap);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.INVENT_SPEC_BLOCK_ID), queryMap, false);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.SPEC_NAME_BLOCK_ID), queryMap, false);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.FACTORY_RECORD_BLOCK_ID), null, false);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPKC004().eiMetadata);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
/**
* 查询操作
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "销售出库单",operType = "查询",operDesc = "查询")
@Override
public EiInfo query(EiInfo inInfo) {
try {
Map queryRow = EiInfoUtils.getFirstRow(inInfo);
String receiptDate = MapUtils.getString(queryRow, "receiptDate");
queryRow.put("receiptDate", StringUtil.removeSpecifiedCharacter(receiptDate,
StringUtil.DEFAULT_CHARACTER_TO_BE_REMOVED));
queryRow.put("inventTypes", DEFAULT_INVENT_CODE);
inInfo = super.query(inInfo, HPKC004.QUERY, new HPKC004());
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
/**
* 删除操作
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "销售出库单",operType = "删除",operDesc = "删除")
public EiInfo delete(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 销售单号
List<String> saleNos = ObjectUtils.listKey(resultRows, "saleNo");
// 锁记录
HPKCTools.HpKc004.lock(saleNos);
// 查询数据库记录
Map<String, HPKC004> mapKc004 = HPKCTools.HpKc004.map(saleNos);
for (int i = 0; i < resultRows.size(); i++) {
HPKC011 hpkc011 = null;
HPKC010 hpkc010 = null;
HPKC004 fKc004 = new HPKC004();
fKc004.fromMap(resultRows.get(i));
if (!fKc004.getSubInventCode().equals(" "))
hpkc011 = HPKCTools.HpKc011.listById(fKc004.getKcId());
else
hpkc010 = HPKCTools.HpKc010.listById(fKc004.getKcId());
DaoUtils.update(HPKC004.DELETE, fKc004);
// 生成红冲记录
HPKC004 dbKc004 = mapKc004.get(fKc004.getSaleNo());
HPKC004 newKc004 = BeanUtils.copy(dbKc004, HPKC004.class);
newKc004.setSaleNo(SequenceGenerator.getNextSequence(HPConstant.SequenceId.HPKC004_SALE_NO));
newKc004.setAmount(dbKc004.getAmount().negate());
newKc004.setWeight(dbKc004.getWeight().negate());
newKc004.setOldSaleNo(dbKc004.getSaleNo());
newKc004.setProjCode(dbKc004.getProjCode());
newKc004.setProjName(dbKc004.getProjName());
newKc004.setIsPrint(CommonConstant.YesNo.NO_0);
newKc004.setDeleteFlag(CommonConstant.YesNo.YES_1);
DaoUtils.insert(HPKC004.INSERT, newKc004);
// 修改库存
if (hpkc010 != null) {
HPKCTools.updateStock(dbKc004.getWhCode(), hpkc010.getInventRecordId(),
dbKc004.getAmount(), dbKc004.getWeight(), hpkc010.getFactoryCode());
} else {
HPKCTools.updateProdStock(dbKc004.getWhCode(), dbKc004.getProdNo(),
BigDecimal.ZERO, dbKc004.getWeight(), hpkc011.getFactoryCode(), true);
}
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据删除成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "删除失败");
}
return inInfo;
}
/**
* 删除操作
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "销售出库单",operType = "修改",operDesc = "申请退货")
public EiInfo returnApply(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 销售单号
List<String> saleNos = ObjectUtils.listKey(resultRows, "saleNo");
// 锁记录
HPKCTools.HpKc004.lock(saleNos);
for (int i = 0; i < resultRows.size(); i++) {
HPKC004 fKc004 = new HPKC004();
fKc004.fromMap(resultRows.get(i));
DaoUtils.update("HPKC004.returnApply", fKc004);
HPKC013 hpkc013 = new HPKC013();
BeanUtils.copyProperties(fKc004,hpkc013);
hpkc013.setReturnNo(SequenceGenerator.getNextSequence(HPConstant.SequenceId.HPKC013_RETURN_NO));
hpkc013.setReturnStatus(ReturnStatusEnum.RETURNING.getCode());
DaoUtils.update(HPKC013.INSERT, hpkc013);
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据申请退货成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "删除失败");
}
return inInfo;
}
}
package com.baosight.hpjx.hp.kc.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.kc.domain.HPKC004;
import com.baosight.hpjx.hp.kc.domain.HPKC011;
import com.baosight.hpjx.hp.kc.tools.HPKCTools;
import com.baosight.hpjx.util.AssertUtils;
import com.baosight.hpjx.util.BeanUtils;
import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.DateUtils;
import com.baosight.hpjx.util.EiInfoUtils;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.MapUtils;
import com.baosight.hpjx.util.ObjectUtils;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* 销售出库单挑选库存
*
* @author:songx
* @date:2022/7/11,11:08
*/
public class ServiceHPKC104A extends ServiceEPBase {
/**
* 初始化
*
* @param inInfo
* @return
*/
@Override
@OperationLogAnnotation(operModul = "库存查询", operType = "查询", operDesc = "销售出库单-库存查询-初始化")
public EiInfo initLoad(EiInfo inInfo) {
try {
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.FACTORY_RECORD_BLOCK_ID), null, false);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPKC011().eiMetadata);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
/**
* 查询数据列表
*
* @param inInfo
* @return
*/
@Override
@OperationLogAnnotation(operModul = "库存查询", operType = "查询", operDesc = "销售出库单-库存查询-查询")
public EiInfo query(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
queryMap.put("isWeight", CommonConstant.YesNo.YES_1);
inInfo = super.query(inInfo, HPKC011.QUERYKC, new HPKC011());
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
/**
* 生成出库单
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "库存查询", operType = "插入", operDesc = "销售出库单-库存查询-生成出库单")
public EiInfo select(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 库存ID
List<Long> ids = ObjectUtils.listKey(resultRows, "id");
// 行锁
HPKCTools.HpKc011.lock(ids);
// 获取库存信息
Map<Long, HPKC011> dbKc011Map = HPKCTools.HpKc011.map(ids);
// 状态校验
this.selectCheck(resultRows, dbKc011Map);
// 生成销售库单
this.selectData(resultRows, dbKc011Map);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "生成出库单失败");
}
return inInfo;
}
/**
* 数据校验
*
* @param resultRows
* @param dbKc011Map
*/
private void selectCheck(List<Map> resultRows, Map<Long, HPKC011> dbKc011Map) {
for (Map row : resultRows) {
Long id = MapUtils.getLong(row, "id");
HPKC011 dbKc011 = dbKc011Map.get(id);
AssertUtils.isNull(dbKc011, "库存号[" + id + "]不存在!");
// 校验数量
// BigDecimal applyAmount = MapUtils.getBigDecimal(row, "applyAmount");
// AssertUtils.isGt(applyAmount, dbKc011.getAmount(), "库存号[" + id + "]可用数量不足!");
}
}
/**
* 写入数据
*
* @param resultRows
* @param dbKc011Map
*/
private void selectData(List<Map> resultRows, Map<Long, HPKC011> dbKc011Map) {
for (Map row : resultRows) {
BigDecimal applyWeight = MapUtils.getBigDecimal(row, "applyWeight");
String applyRemark = MapUtils.getString(row, "applyRemark");
Long kcId = MapUtils.getLong(row, "id");
HPKC011 dbKc011 = dbKc011Map.get(kcId);
HPKC004 newKc004 = BeanUtils.copy(dbKc011, HPKC004.class);
newKc004.setSaleNo(SequenceGenerator.getNextSequence(HPConstant.SequenceId.HPKC004_SALE_NO));
newKc004.setReceiptDate(DateUtils.shortDate());
newKc004.setAmount(BigDecimal.ZERO);
newKc004.setWeight(applyWeight);
newKc004.setInvWeight(dbKc011.getWeight());
newKc004.setDiffWeight(dbKc011.getWeight().subtract(applyWeight));
newKc004.setRemark(applyRemark);
newKc004.setKcId(kcId);
newKc004.setIsPrint(CommonConstant.YesNo.NO_0);
newKc004.setDeleteFlag(CommonConstant.YesNo.NO_0);
DaoUtils.insert(HPKC004.INSERT, newKc004);
// 修改库存数量
HPKCTools.updateProdStock(newKc004.getWhCode(), newKc004.getProdNo(),
BigDecimal.ZERO, newKc004.getWeight().negate(), dbKc011.getFactoryCode(), true);
}
}
}
package com.baosight.hpjx.hp.kc.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.common.InventTypeEnum;
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.kc.domain.HPKC011;
import com.baosight.hpjx.hp.pz.domain.HPPZ007;
import com.baosight.hpjx.hp.sc.domain.HPSC005;
import com.baosight.hpjx.hp.sc.tools.HPSCTools;
import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.EiInfoUtils;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.contants.ACConstants;
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.util.DateUtils;
import com.baosight.iplat4j.core.web.threadlocal.UserSession;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
/**
* @author:wwl
* @date:2024/1/23,10:51
*/
public class ServiceHPKC111 extends ServiceBase {
/**
* 画面初始化
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "产品库存管理", operType = "查润", operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) {
HPKC011 HPKC011 = new HPKC011();
EiInfo outInfo = super.initLoad(inInfo, HPKC011);
outInfo.getBlock(EiConstant.resultBlock).getRows().clear();
Map paramMap = new HashMap<String, Object>() {{
put("inventTypes", InventTypeEnum.getProdTypes());
}};
CommonMethod.initBlock(outInfo, Arrays.asList(DdynamicEnum.FACTORY_RECORD_BLOCK_ID), null, false);
CommonMethod.initBlock(outInfo, Arrays.asList(DdynamicEnum.WH_RECORD_BLOCK_ID), paramMap);
CommonMethod.initBlock(outInfo, Arrays.asList(DdynamicEnum.MATERIAL_RECORD_BLOCK_ID), paramMap);
return outInfo;
}
/**
* 查询操作.
*/
@Override
@OperationLogAnnotation(operModul = "产品库存管理", operType = "查润", operDesc = "查询")
public EiInfo query(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
queryMap.put("isWeight", CommonConstant.YesNo.YES_1);
inInfo = super.query(inInfo, HPKC011.QUERY, new HPKC011());
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
/**
* 新增操作.
*/
@Override
@OperationLogAnnotation(operModul = "产品库存管理", operType = "新增", operDesc = "新增")
public EiInfo insert(EiInfo inInfo) {
try {
CommonMethod.creatorInfo(inInfo, EiConstant.resultBlock);
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
for (int i = 0; i < resultRows.size(); i++) {
HPKC011 fKc010 = new HPKC011();
fKc010.fromMap(resultRows.get(i));
// 设置基础信息
DaoUtils.insert(HPKC011.INSERT, fKc010);
}
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据新增成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "新增失败");
}
return inInfo;
}
/**
* 更新库存
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "产品库存管理", operType = "修改", operDesc = "更新库存")
public EiInfo updateStock(EiInfo inInfo) {
String whCode = inInfo.getString("whCode");
String prodNo = inInfo.getString("prodNo");
String factoryCode = inInfo.getString("factoryCode");
BigDecimal amount = new BigDecimal(inInfo.getString("amount"));
BigDecimal weight = new BigDecimal(inInfo.getString("weight"));
String companyCode = UserSessionUtils.getCompanyCode();
try {
checkUpdateStockParam(companyCode, whCode, prodNo, amount, weight);
HPKC011 newObj = generatorBaseInfo(companyCode, whCode, prodNo, amount, weight);
List<Map> list = dao.query("HPKC011.queryByCondition", new HashMap<String, Object>() {{
put("companyCode", companyCode);
put("whCode", whCode);
put("prodNo", prodNo);
}});
if (CollectionUtils.isEmpty(list)) {
//新增
if (amount.compareTo(BigDecimal.ZERO) < 0
|| weight.compareTo(BigDecimal.ZERO) < 0) {
throw new PlatException("当前库存为空,库存变更数量与重量不能小于等于0!");
}
newObj.setFactoryCode(factoryCode);
generatorBaseInfo(newObj);
DaoUtils.insert("HPKC011.insert", newObj);
} else {
//修改
HPKC011 oldObj = new HPKC011();
oldObj.fromMap(list.get(0));
BigDecimal afterAmout = oldObj.getAmount().add(amount);
BigDecimal afterWeight = oldObj.getWeight().add(weight);
if (afterAmout.compareTo(BigDecimal.ZERO) < 0 || afterWeight.compareTo(BigDecimal.ZERO) < 0) {
throw new PlatException("库存更新失败,出库数量与重量不能大于当前库存!");
}
oldObj.setAmount(afterAmout);
oldObj.setWeight(afterWeight);
oldObj.setUpdatedBy(newObj.getUpdatedBy());
oldObj.setUpdatedName(newObj.getUpdatedName());
oldObj.setUpdatedTime(newObj.getUpdatedTime());
int result = DaoUtils.update("HPKC011.updateStock", oldObj);
if (result != 1) {
throw new PlatException("库存更新失败,库存已发生变更或系统异常,请重试!");
}
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsg("库存更新成功!");
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "库存更新失败!");
}
return inInfo;
}
/**
* 生成库存对象
*
* @param companyCode
* @param whCode
* @param prodNo
* @param amout
* @param weight
* @reutrn HPKC011
*/
private HPKC011 generatorBaseInfo(String companyCode, String whCode, String prodNo, BigDecimal amout,
BigDecimal weight) {
HPKC011 hpkc011 = new HPKC011();
hpkc011.setCompanyCode(companyCode);
hpkc011.setWhCode(whCode);
hpkc011.setProdNo(prodNo);
hpkc011.setAmount(amout);
hpkc011.setWeight(weight);
String userId = UserSession.getLoginName();
String userName = UserSession.getLoginCName();
String time = DateUtils.curDateTimeStr14();
hpkc011.setCreatedBy(userId);
hpkc011.setCreatedName(userName);
hpkc011.setCreatedTime(time);
hpkc011.setUpdatedBy(userId);
hpkc011.setUpdatedName(userName);
hpkc011.setUpdatedTime(time);
return hpkc011;
}
private void generatorBaseInfo(HPKC011 hpkc011) {
EiInfo inInfo = new EiInfo();
try {
inInfo.set("whCode", hpkc011.getWhCode());
inInfo.set(EiConstant.serviceName, "HPPZ007");
inInfo.set(EiConstant.methodName, "queryByWhCode");
EiInfo outInfo = XLocalManager.call(inInfo);
List<HPPZ007> whNameList = (List) outInfo.get("list");
hpkc011.setWhName(whNameList.get(0).getWhName());
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "库存更新失败!");
throw new PlatException("仓库编码异常,找不到对应的仓库档案!");
}
try {
HPSC005 hpsc005 = HPSCTools.HpSc005.get(hpkc011.getProdNo());
hpkc011.setProjCode(hpsc005.getProjCode());
hpkc011.setProjName(hpsc005.getProjName());
hpkc011.setInventCode(hpsc005.getPrdtCode());
hpkc011.setInventName(hpsc005.getPrdtName());
hpkc011.setSubInventCode(hpsc005.getPartCode());
hpkc011.setSubInventName(hpsc005.getPartName());
hpkc011.setLength(hpsc005.getPartLength());
hpkc011.setWidth(hpsc005.getPartWidth());
hpkc011.setThick(hpsc005.getPartThick());
hpkc011.setPrdtSpec(hpsc005.getPrdtSpec());
hpkc011.setUnitWeight(hpsc005.getUnitWt());
hpkc011.setRemark(hpsc005.getRemark1());
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "库存更新失败!");
throw new PlatException("生产单号异常,找不到对应的生产订单!");
}
hpkc011.setVersion(new Integer(1));
}
/**
* 校验库存变更请求参数
*
* @param companyCode
* @param whCode
* @param prodNo
* @param amout
* @param weight
*/
private void checkUpdateStockParam(String companyCode, String whCode, String prodNo
, BigDecimal amout, BigDecimal weight) {
if (StringUtils.isBlank(companyCode)) {
throw new PlatException("企业编码不能为空!");
}
if (StringUtils.isBlank(whCode)) {
throw new PlatException("仓库编码不能为空!");
}
if (StringUtils.isBlank(prodNo)) {
throw new PlatException("生产单号不能为空!");
}
if (Objects.isNull(amout) ||
Objects.isNull(amout)) {
throw new PlatException("库存变更数量或重量不能为空!");
}
if (amout.compareTo(BigDecimal.ZERO) == 0
&& weight.compareTo(BigDecimal.ZERO) == 0) {
throw new PlatException("库存变更数量或重量不能为0)!");
}
}
}
......@@ -23,6 +23,8 @@
AMOUNT as "amount", <!-- 数量 -->
UNIT_WEIGHT as "unitWeight", <!-- 单重 -->
WEIGHT as "weight", <!-- 重量 -->
INV_WEIGHT as "invWeight", <!-- 库存重量 -->
DIFF_WEIGHT as "diffWeight", <!-- 差异重量 -->
REMARK as "remark", <!-- 备注 -->
KC_ID as "kcId", <!-- 库存ID -->
OLD_SALE_NO as "oldSaleNo", <!-- 原销售单号 -->
......@@ -181,6 +183,8 @@
AMOUNT, <!-- 数量 -->
UNIT_WEIGHT, <!-- 单重 -->
WEIGHT, <!-- 重量 -->
INV_WEIGHT, <!-- 库存重量 -->
DIFF_WEIGHT, <!-- 差异重量 -->
REMARK, <!-- 备注 -->
KC_ID, <!-- 库存ID -->
OLD_SALE_NO, <!-- 原销售单号 -->
......@@ -195,11 +199,12 @@
) VALUES (
#companyCode#, #depCode#, #receiptDate#, #saleNo#, #whCode#, #whName#, #prodNo#,
#projCode#, #projName#, #inventCode#, #inventName#, #subInventCode#, #subInventName#,
#length#, #width#, #thick#, #amount#, #unitWeight#, #weight#, #remark#, #kcId#,
#oldSaleNo#, #isPrint#, #isReturn#, #createdBy#, #createdName#, #createdTime#, #deleteFlag#,#factoryCode#, #factoryName#
#length#, #width#, #thick#, #amount#, #unitWeight#, #weight#, #invWeight#, #diffWeight#,
#remark#, #kcId#, #oldSaleNo#, #isPrint#, #isReturn#, #createdBy#, #createdName#,
#createdTime#, #deleteFlag#,#factoryCode#, #factoryName#
)
</insert>
<!-- 逻辑删除 -->
<delete id="delete">
UPDATE ${hpjxSchema}.T_HPKC004 SET DELETE_FLAG = 1 WHERE ID = #id#
......
......@@ -103,6 +103,9 @@
<isNotEmpty prepend=" AND " property="isAmount">
a.AMOUNT != 0
</isNotEmpty>
<isNotEmpty prepend=" AND " property="isWeight">
a.WEIGHT > 0
</isNotEmpty>
</sql>
<sql id="customCondition">
......
package com.baosight.hpjx.hp.kc.tools;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.hp.kc.domain.HPKC004;
import com.baosight.hpjx.util.DateUtils;
import com.baosight.hpjx.util.ExcelUtils;
......@@ -47,12 +48,13 @@ public class CKExcelTools {
HttpServletResponse response = (HttpServletResponse) pageContext.getResponse();
Map parameter = StringUtils.encodeParam(request.getParameter("parameter"));
// 获取数据
String isWeight = (String) parameter.get("isWeight");
List<Long> saleIds = (List<Long>) parameter.get("saleIds");
List<HPKC004> dbKc004s = HPKCTools.HpKc004.listById(saleIds);
// 数据格式转换
Map dataMap = convertData(dbKc004s);
// 构建excel
HSSFWorkbook workbook = buildExcel(dataMap);
HSSFWorkbook workbook = buildExcel(dataMap, isWeight);
String fileName = "出库单-" + DateUtils.shortYmdhmss() + ".xls";
ExcelUtils.download(fileName, workbook, response);
// 更新状态
......@@ -91,8 +93,9 @@ public class CKExcelTools {
* 导出Excel
*
* @param dataMap 数据集
* @param isWeight
*/
public static HSSFWorkbook buildExcel(Map dataMap) {
public static HSSFWorkbook buildExcel(Map dataMap, String isWeight) {
HSSFWorkbook workbook = new HSSFWorkbook();
// 在Workbook中,创建一个sheet,对应Excel中的工作薄(sheet)
HSSFSheet sheet = workbook.createSheet("出库单");
......@@ -106,7 +109,7 @@ public class CKExcelTools {
// 第1行
startRow = buildRow1(workbook, sheet, startRow, dataMap);
// 第2行:标题栏
startRow = buildRow2(workbook, sheet, startRow);
startRow = buildRow2(workbook, sheet, startRow, isWeight);
// 第2行:标题栏
startRow = buildRow3(workbook, sheet, startRow);
// 遍历数据行,excel行从第3行开始
......@@ -117,7 +120,7 @@ public class CKExcelTools {
// 组名称
startRow = buildGroupRow(workbook, sheet, key, startRow);
// 明细数据,返回末尾行数
startRow = buildChildRow(workbook, sheet, values, startRow);
startRow = buildChildRow(workbook, sheet, values, startRow, isWeight);
}
// 页脚
buildFoot(workbook, sheet, startRow);
......@@ -170,8 +173,10 @@ public class CKExcelTools {
* @param sheet
* @param values
* @param startRow
* @param isWeight
*/
private static int buildChildRow(HSSFWorkbook workbook, HSSFSheet sheet, List<HPKC004> values, int startRow) {
private static int buildChildRow(HSSFWorkbook workbook, HSSFSheet sheet, List<HPKC004> values, int startRow,
String isWeight) {
for (int i = 0; i < values.size(); i++) {
HPKC004 valueMap = values.get(i);
HSSFRow row = sheet.createRow(startRow);
......@@ -200,10 +205,14 @@ public class CKExcelTools {
HSSFCell cell1_4 = row.createCell(4);
cell1_4.setCellValue(valueMap.getThick() == null ? "" : valueMap.getThick().toString());
cell1_4.setCellStyle(getCellStyle(workbook));
// 数量
// 数量/重量
HSSFCell cell1_5 = row.createCell(5);
cell1_5.setCellValue(valueMap.getAmount() + "");
cell1_5.setCellStyle(getCellStyle(workbook));
if (CommonConstant.YesNo.YES.equals(isWeight)) {
cell1_5.setCellValue(valueMap.getWeight() + "");
} else {
cell1_5.setCellValue(valueMap.getAmount() + "");
}
// 备注
HSSFCell cell1_6 = row.createCell(6);
cell1_6.setCellValue(valueMap.getRemark());
......@@ -279,8 +288,9 @@ public class CKExcelTools {
* @param workbook
* @param sheet
* @param startRow
* @param isWeight
*/
private static int buildRow2(HSSFWorkbook workbook, HSSFSheet sheet, int startRow) {
private static int buildRow2(HSSFWorkbook workbook, HSSFSheet sheet, int startRow, String isWeight) {
// 2.第2行标题行
HSSFRow row2 = sheet.createRow(startRow);
row2.setHeight((short) (20 * 20));
......@@ -304,9 +314,9 @@ public class CKExcelTools {
cell2_3.setCellStyle(getCellStyle(workbook, true));
HSSFCell cell2_4 = row2.createCell(4);
cell2_4.setCellStyle(getCellStyle(workbook, true));
// 2.5、数量
// 2.5、数量/重量
HSSFCell cell2_5 = row2.createCell(5);
cell2_5.setCellValue("数量");
cell2_5.setCellValue(CommonConstant.YesNo.YES.equals(isWeight) ? "重量(T)" : "数量");
cell2_5.setCellStyle(getCellStyle(workbook, HorizontalAlignment.CENTER, VerticalAlignment.CENTER, true,
true));
// 2.6、备注
......
......@@ -742,8 +742,25 @@ public class HPKCTools {
* @param amount
* @param weight
*/
public static void updateProdStock(String whCode, String prodNo, BigDecimal amount, BigDecimal weight,String factoryCode) {
if (amount.compareTo(BigDecimal.ZERO) == 0 && weight.compareTo(BigDecimal.ZERO) == 0) {
public static void updateProdStock(String whCode, String prodNo, BigDecimal amount, BigDecimal weight,
String factoryCode) {
updateProdStock(whCode, prodNo, amount, weight, factoryCode, false);
}
/**
* 更新产品库存
*
* @param whCode
* @param prodNo
* @param amount
* @param weight
* @param isOnlyWeight 只有重量
*/
public static void updateProdStock(String whCode, String prodNo, BigDecimal amount, BigDecimal weight,
String factoryCode, boolean isOnlyWeight) {
// 只有重量的时候,不校验数量
if ((!isOnlyWeight && amount.compareTo(BigDecimal.ZERO) == 0)
|| weight.compareTo(BigDecimal.ZERO) == 0) {
return;
}
EiInfo inInfo = new EiInfo();
......@@ -752,11 +769,12 @@ public class HPKCTools {
inInfo.set("amount", amount);
inInfo.set("weight", weight);
inInfo.set("factoryCode", factoryCode);
inInfo.set("isOnlyWeight", isOnlyWeight);
inInfo.set(EiConstant.serviceName, "HPKC011");
inInfo.set(EiConstant.methodName, "updateStock");
EiInfo outInfo = XLocalManager.call(inInfo);
if (outInfo.getStatus() < 0) {
throw new PlatException("新库存失败:" + outInfo.getMsg());
throw new PlatException("新库存失败:" + outInfo.getMsg());
}
}
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-2.dtd"> <!-- table information
Generate time : 2024-05-14 13:52:21
Version : 1.0
schema : hpjx
tableName : T_HPPZ009A
ID BIGINT NOT NULL primarykey,
COMPANY_CODE VARCHAR NOT NULL,
DEP_CODE VARCHAR NOT NULL,
PARENT_ID BIGINT,
DOC_ID VARCHAR,
CREATED_BY VARCHAR,
CREATED_NAME VARCHAR,
CREATED_TIME VARCHAR,
UPDATED_BY VARCHAR,
UPDATED_NAME VARCHAR,
UPDATED_TIME VARCHAR
-->
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd">
<sqlMap namespace="HPPZ009A">
<sql id="column">
......
......@@ -263,6 +263,22 @@ public class HPPZTools {
}
/**
* 查询企业信息
*
* @param companyCode
* @return
*/
public static HPPZ009 queryByCode(String companyCode) {
if (StringUtils.isBlank(companyCode)) {
return null;
}
Map queryMap = new HashMap();
queryMap.put("companyCode", companyCode);
List<HPPZ009> pz009s = DaoBase.getInstance().query("HPPZ009.query", queryMap);
return CollectionUtils.isEmpty(pz009s) ? null : pz009s.get(0);
}
/**
* 企业是否启用
*
* @param companyCode
......
package com.baosight.xservices.xs.service;
import com.baosight.hpjx.core.security.UserSessionUtils;
import com.baosight.hpjx.hp.pz.domain.HPPZ009;
import com.baosight.hpjx.hp.pz.tools.HPPZTools;
import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
......@@ -9,6 +11,7 @@ import com.baosight.iplat4j.core.log.LoggerFactory;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import com.baosight.iplat4j.core.service.soa.XServiceManager;
import com.baosight.iplat4j.core.util.DateUtils;
import com.baosight.iplat4j.core.util.StringUtils;
import com.baosight.xservices.xs.domain.XS01;
import com.baosight.xservices.xs.domain.XS02;
import com.baosight.xservices.xs.util.LoginUserDetails;
......@@ -27,6 +30,7 @@ public class ServiceXS3002 extends ServiceEPBase {
EiInfo eiInfo = new EiInfo();
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
String companyCode = UserSessionUtils.getCompanyCode();
HPPZ009 dbPz009 = HPPZTools.HpPz009.queryByCode(companyCode);
for(int i = 0; i < eiBlock.getRowCount(); ++i) {
Map<String, Object> inInfoRowMap = eiBlock.getRow(i);
inInfoRowMap.remove("groupId");
......@@ -34,12 +38,14 @@ public class ServiceXS3002 extends ServiceEPBase {
inInfoRowMap.put("recCreateTime", DateUtils.curDateTimeStr14());
// 设置所属企业 added by songx at 2024-01-16
inInfoRowMap.put("companyCode", companyCode);
// 角色英文名称前面增加企业信息 modify by songx at 2024-08-8
if (dbPz009 != null) {
inInfoRowMap.put("groupEname", "[" + dbPz009.getLoginPrefix() + "]" + inInfoRowMap.get("groupEname"));
}
}
eiInfo.addBlock(inInfo.getBlock(EiConstant.resultBlock));
eiInfo.set(EiConstant.serviceId, "S_XS_18");
EiInfo outInfo = XServiceManager.call(eiInfo);
return outInfo;
return XServiceManager.call(eiInfo);
}
public EiInfo query(EiInfo inInfo) {
......
......@@ -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",
......@@ -20,12 +21,10 @@
<isNotEmpty prepend=" AND " property="notNodeEnames">
node_ename not in <iterate close=")" open="(" conjunction="," property="notNodeEnames">#notNodeEnames[]#</iterate>
</isNotEmpty>
<!-- 非管理员非root节点仅显示有权限的菜单 added by songx at 20240126 -->
<isNotEqual property="node" compareValue="root">
<!-- 非管理员仅展示有权限的菜单 added by songx at 20240809 -->
<isEqual prepend=" AND " property="isUserAdmin" compareValue="0">
exists (
select
c. object_id, d.resource_ename
select c.object_id, d.resource_ename
from ${platSchema}.xs_user a,
${platSchema}.xs_user_group_member b,
${platSchema}.xs_authorization c,
......@@ -35,10 +34,9 @@
and c.object_id = d.id
and a.login_name = #loginName#
and d.type = 'PAGE'
and m.node_ename = d.resource_ename
and find_in_set(d.resource_ename, (select queryMenuPageInfo(m.node_ename)))
)
</isEqual>
</isNotEqual>
</dynamic>
UNION
SELECT
......
......@@ -19,7 +19,7 @@
}
</script>
<script type="text/javascript">
let projectEnv = "${projectEnv}";
let PROJECT_ENV = "${PROJECT_ENV}";
</script>
<script src="${ctx}/common/js/common.js"></script>
<script src="${ctx}/common/js/jsUtils.js"></script>
......
$(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>
$(function () {
// 查询
$("#QUERY").on("click", query);
// 选择生产任务
$("#GENERATE").on("click", generate);
IPLATUI.EFGrid.result = {
pageable: {
pageSize: 20,
pageSizes: [10, 20, 30, 50, 100, 200],
},
columns: [],
loadComplete: function (grid) {
},
onSuccess: function (e) {
if(e.eiInfo.extAttr.methodName == 'delete' ){
query();
}
}
}
});
/**
* 页面加载时执行
*/
$(window).load(function () {
query();
});
/**
* 查询
*/
let query = function () {
resultGrid.dataSource.page(1);
}
/**
* 选择生产任务
*/
let generate = function () {
JSColorbox.open({
href: "HPKC103A?methodName=initLoad",
title: "<div style='text-align: center;'>生产任务查询</div>",
width: "80%",
height: "80%",
callbackName: generateCallback
});
}
/**
* 挑选库存回调
*/
let generateCallback = function () {
// 刷新页面
query();
// 关闭弹窗
JSColorbox.close();
}
<!DOCTYPE html>
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="EF" tagdir="/WEB-INF/tags/EF" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<EF:EFPage title="生产入库单">
<EF:EFRegion id="inqu" title="查询条件">
<div class="row">
<EF:EFDatePicker cname="单据日期" ename="documentDate" blockId="inqu_status" row="0" colWidth="3"
format="yyyy-MM-dd" readonly="true"/>
<EF:EFSelect cname="厂区" blockId="inqu_status" ename="factoryCode" row="0" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="factory_record_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFInput cname="项目名称" ename="projName" blockId="inqu_status" row="0" colWidth="3"/>
<EF:EFSelect cname="仓库名称" ename="whCode" blockId="inqu_status" row="0" colWidth="3"
filter="contains" defultValue="">
<EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="wh_record_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
</div>
<div class="row">
<EF:EFInput cname="部件名称" ename="prdtName" blockId="inqu_status" row="0" colWidth="3"/>
<EF:EFInput cname="零件名称" ename="partName" blockId="inqu_status" row="0" colWidth="3"/>
<EF:EFDateSpan startCname="创建日期(从)" endCname="至" blockId="inqu_status"
startName="createdDateFrom" endName="createdDateTo" row="0" role="date"
format="yyyy-MM-dd" ratio="3:3" satrtRatio="4:8" endRatio="4:8" readonly="true">
</EF:EFDateSpan>
</div>
<div class="row">
<EF:EFSelect cname="是否删除" ename="deleteFlag" blockId="inqu_status" row="0" colWidth="3" defaultValue="0">
<EF:EFOption label="全部" value=""/>
<EF:EFCodeOption codeName="hpjx.hpjx.deleteFlag"/>
</EF:EFSelect>
<%-- <EF:EFInput cname="生产订单号" ename="prodOrderNo" blockId="inqu_status" row="0" colWidth="3"/>
<EF:EFInput cname="生产任务号" ename="prodTaskNo" blockId="inqu_status" row="0" colWidth="3"/>--%>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="明细信息">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true" checkMode="row">
<EF:EFColumn ename="id" cname="内码" hidden="true"/>
<EF:EFColumn ename="prodNo" cname="生产单号" enable="false" width="140" align="center"/>
<EF:EFColumn ename="documentDate" cname="单据日期" width="100" align="center" editType="date" readonly="true"
dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" required="true"/>
<%--<EF:EFColumn ename="projCode" cname="项目号" enable="false" width="140" align="center"/>--%>
<EF:EFComboColumn ename="factoryCode" cname="厂区" width="110" align="center" defaultValue="" required="true"
filter="contains">
<EF:EFOptions blockId="factory_record_block_id" valueField="valueField" textField="textField"/>
</EF:EFComboColumn>
<EF:EFColumn ename="projName" cname="项目名称" enable="false" width="140" align="center"/>
<EF:EFComboColumn ename="whCode" cname="仓库名称" enable="false" width="120" align="center"
blockName="wh_record_block_id" textField="textField" valueField="valueField"
columnTemplate="#=textField#" itemTemplate="#=textField#">
</EF:EFComboColumn>
<EF:EFColumn ename="prdtName" cname="部件名称" enable="false" width="120" align="center"/>
<EF:EFColumn ename="partName" cname="零件名称" enable="false" width="120" align="center"/>
<EF:EFColumn ename="partSpec" cname="零件规格" enable="false" width="150" align="center"/>
<%-- <EF:EFColumn ename="amount" cname="数量" enable="false" width="120" align="right" format="{0:N0}"/>--%>
<EF:EFColumn ename="weight" cname="总重(T)" enable="false" width="120" align="right" format="{0:N3}"/>
<EF:EFColumn ename="remark" cname="备注" enable="false" width="150"/>
<EF:EFColumn ename="prdtCode" cname="部件编码" enable="false" width="120" align="center" hidden="true"/>
<EF:EFColumn ename="partCode" cname="零件编码" enable="false" width="120" align="center" hidden="true"/>
<%-- <EF:EFColumn ename="prodTaskNo" cname="生产任务号" enable="false" width="150" align="center"/>
<EF:EFColumn ename="prodOrderNo" cname="生产订单号" enable="false" width="140" align="center"/>--%>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
let whNameGlobalData = [];
$(function () {
IPLATUI.EFGrid = {
"result": {
columns: [{
field: "whCode",
template: function (dataItem) {
for (let i = 0; i < whNameGlobalData.length; i++) {
if (whNameGlobalData[i]['valueField'] === dataItem['whCode']) {
return whNameGlobalData[i]['textField'];
}
}
return "";
},
editor: function (container, options) {
let inInfo = new EiInfo();
// 1.原料,2.耗材
inInfo.set("inqu_status-0-inventTypes", [3]);
inInfo.set("inqu_status-0-whType", options.model["inventType"]);
inInfo.set("inqu_status-0-factoryCode", options.model["factoryCode"]);
inInfo.set("inqu_status-0-isSplicingSymbol", false);
inInfo.set("serviceName", "HPPZ007");
inInfo.set("methodName", "queryComboBox");
inInfo.set("blockId", "wh_record_block_id");
inInfo.set("field", options.field);
refreshSelect(container, inInfo);
}
}, {
field: "applyNum",
template: function (model) {
return model.applyNum ? model.applyNum + "%" : "";
}
}, {
field: "completeNum",
template: function (model) {
return model.completeNum ? model.completeNum + "%" : "";
}
}],
dataBound: function () {
}
}
};
$("#ef_form_head").hide();
// 查询
$("#QUERY").on("click", query);
// 选择
$("#BTN_SELECT").on("click", select);
});
/**
* 页面加载时执行
*/
$(window).load(function () {
// 初始化查询
query();
// 仓库名称
initWh();
// 键盘按键
downKeyUp();
});
/**
* 初始化仓库
*/
let initWh = function () {
let inInfo = new EiInfo();
// 1.原料,2.耗材
inInfo.set("inqu_status-0-inventTypes", [3]);
inInfo.set("inqu_status-0-isSplicingSymbol", false);
EiCommunicator.send("HPPZ007", "queryComboBox", inInfo, {
onSuccess: function (ei) {
whNameGlobalData = ei.getBlock("wh_record_block_id").getMappedRows();
},
onFail: function (ei) {
}
}, {async: false});
}
/**
* 查询
*/
var query = function (e) {
resultGrid.dataSource.page(1);
};
/**
* 选择库存
*/
let select = function () {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据")
return;
}
for (let i = 0; i < rows.length; i++) {
let whCode = rows[i]['whCode'];
let applyNum = rows[i]['applyNum'];
let completeNum = rows[i]['completeNum'];
if (isBlank(whCode)) {
message("第" + (i + 1) + "行请选择仓库名称");
return;
}
if (!isPositiveInteger(applyNum) || parseFloat(applyNum) > 100) {
message("勾选的第" + (i + 1) + "行入库数量必须是大于0小于100的整数");
return;
}
if (parseFloat(applyNum) > 100 - parseFloat(completeNum)) {
message("第" + (i + 1) + "行入库数量不能大于未入库的数量");
return;
}
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据生成入库单吗? ", {
ok: function () {
JSUtils.submitGridsData("result", "HPKC103A", "selectDo",
true, function (e) {
var status = e.getStatus();
if (status !== -1) {
parent.JSColorbox.setValueCallback();
}
}
);
}
});
}
<!DOCTYPE html>
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="EF" tagdir="/WEB-INF/tags/EF" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<EF:EFPage title="生产任务查询">
<EF:EFRegion id="inqu" title="查询区域" type="query">
<div class="row">
<%-- <EF:EFInput cname="生产订单号" ename="prodOrderNo" blockId="inqu_status" row="0" colWidth="3"/>
<EF:EFInput cname="生产任务号" ename="prodTaskNo" blockId="inqu_status" row="0" colWidth="3"/>--%>
<EF:EFInput cname="项目名称" ename="projName" blockId="inqu_status" row="0" colWidth="4"/>
<EF:EFInput cname="部件名称" ename="prdtName" blockId="inqu_status" row="0" colWidth="4"/>
<EF:EFInput cname="零件名称" ename="partName" blockId="inqu_status" row="0" colWidth="4"/>
</div>
<div class="row">
<EF:EFSelect cname="工厂" blockId="inqu_status" ename="factoryCode" row="0" colWidth="4" filter="contains">
<EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="factory_record_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<%--<EF:EFInput cname="生产组名称" ename="orgName" blockId="inqu_status" row="0" colWidth="3"/>--%>
<EF:EFSelect cname="生产组" blockId="inqu_status" ename="groupCode" row="0" colWidth="4" filter="contains">
<EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="group_record_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="记录集">
<EF:EFGrid blockId="result" autoDraw="override" checkMode="row" isFloat="true">
<EF:EFColumn ename="id" cname="生产订单ID" enable="false" width="90" align="center" hidden="true"/>
<EF:EFColumn ename="childId" cname="生产任务ID" enable="false" width="90" align="center" hidden="true"/>
<EF:EFColumn ename="projName" cname="项目名称" enable="false" width="140" align="center"/>
<EF:EFColumn ename="prdtName" cname="部件名称" enable="false" width="120" align="center"/>
<EF:EFColumn ename="partName" cname="零件名称" enable="false" width="120" align="center"/>
<EF:EFColumn ename="partSpec" cname="零件规格" enable="false" width="150" align="center"/>
<%-- <EF:EFComboColumn ename="whCode" cname="仓库名称" width="120" align="center"
blockName="wh_record_block_id" textField="textField" valueField="valueField"
columnTemplate="#=textField#" itemTemplate="#=textField#" required="true">
</EF:EFComboColumn>--%>
<EF:EFColumn ename="whCode" cname="仓库名称" width="120" align="center" required="true"/>
<EF:EFColumn ename="applyNum" cname="入库数量(%)" width="120" align="right" format="{0:N0}" required="true"/>
<EF:EFColumn ename="remark1" cname="入库说明" width="150"/>
<EF:EFColumn ename="completeNum" cname="已入库数量(%)" enable="false" width="120" align="right" format="{0:N0}"/>
<EF:EFColumn ename="unCompleteNum" cname="待入库数量(%)" enable="false" width="120" align="right"
format="{0:N0}" hidden="true"/>
<EF:EFColumn ename="totalWt" cname="任务重量(T)" enable="false" width="120" align="right" format="{0:N3}"/>
<EF:EFColumn ename="factoryName" cname="工厂" enable="false" width="150" align="center"/>
<EF:EFColumn ename="orgName" cname="生产组名称" enable="false" width="150" align="center"/>
<%-- <EF:EFColumn ename="remark" cname="备注" enable="false" width="150"/>
<EF:EFColumn ename="projCode" cname="项目号" enable="false" width="140" align="center"/>
<EF:EFColumn ename="prodTaskNo" cname="生产任务号" enable="false" width="150" align="center"/>
<EF:EFColumn ename="prodOrderNo" cname="生产订单号" enable="false" width="140" align="center"/>--%>
<EF:EFColumn ename="prdtCode" cname="部件编码" enable="false" width="120" align="center" hidden="true"/>
<EF:EFColumn ename="partCode" cname="零件编码" enable="false" width="120" align="center" hidden="true"/>
<EF:EFColumn ename="factoryCode" cname="厂区编码" enable="false" width="150" hidden="true"/>
<EF:EFColumn ename="orgNo" cname="生产组编码" enable="false" width="150" hidden="true"/>
</EF:EFGrid>
<br/>
<span style='color: red;font-size: 13px;'>说明:入库数量请输入1~100的数字,按百分比计算重量</span>
</EF:EFRegion>
</EF:EFPage>
$(function () {
IPLATUI.EFGrid = {
"result": {
columns: [{
field: "createdName",
template: function (options) {
return showUserName(options.createdBy, options.createdName);
}
}],
loadComplete: function (grid) {
}
},
onSuccess: function (e) {
if(e.eiInfo.extAttr.methodName == 'delete' ){
query();
}
}
}
// 查询
$("#QUERY").on("click", query);
// 挑选库存
$("#SELECT_STOCK").on("click", selectStock);
// 挑选耗材
$("#SELECT_CONSUMABLES").on("click", selectConsumables);
// 导出打印
$("#PRINT").on("click", exportPrint);
// 退货
$("#RETURN_APPLY").on("click", returnApply);
});
/**
* 页面加载时执行
*/
$(window).load(function () {
// 查询
query();
});
/**
* 查询
*/
let query = function () {
resultGrid.dataSource.page(1);
}
/**
* 挑选耗材
*/
let selectStock = function () {
JSColorbox.open({
href: "HPKC104A?methodName=initLoad",
title: "<div style='text-align: center;'>库存查询</div>",
width: "90%",
height: "80%",
callbackName: selectStockCallback
});
}
/**
* 挑选库存
*/
let selectConsumables = function () {
JSColorbox.open({
href: "HPKC004B?methodName=initLoad",
title: "<div style='text-align: center;'>耗材查询</div>",
width: "90%",
height: "80%",
callbackName: selectStockCallback
});
}
/**
* 挑选库存回调
*/
let selectStockCallback = function () {
// 刷新页面
query();
// 关闭弹窗
JSColorbox.close();
}
/**
* 导出打印
*/
let exportPrint = function () {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择同一个项目的数据")
return;
}
let saleIds = [];
let projCodeTemp;
for (let i = 0; i < rows.length; i++) {
let projCode = rows[i]['projCode'];
if (projCodeTemp == null) {
projCodeTemp = projCode;
} else if (projCodeTemp != projCode) {
message("第" + (i + 1) + "行项目不一致,请选择同一个项目的数据");
return;
}
saleIds.push(rows[i]['id']);
}
let parameter = {
"saleIds": saleIds,
"isWeight": "Y" // 仅重量
};
window.location = IPLATUI.CONTEXT_PATH + "/HP/KC/HPKC90.jsp?route=1&parameter="
+ encodeURI(encodeURI(JSON.stringify(parameter)));
}
function returnApply(){
//重置全局变量
ids = [];
let rows = resultGrid.getCheckedRows()
if (rows.length < 1) {
message("请至少选择一条需要退货的数据");
return;
}
let factoryCodes = null;
let flag = true;
$.each(rows, function(index, item) {
let isReturn= item.get("isReturn");
if(isReturn == 1){
IPLAT.alert({
message : "选中的出库单已申请退货!",
okFn : function(e) {
},
title : '错误'
});
flag = false;
return false;
}
});
if(flag) {
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"申请退货\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HPKC004", "returnApply", true);
query();
}
});
}
}
<!DOCTYPE html>
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="EF" tagdir="/WEB-INF/tags/EF" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<EF:EFPage title="销售出库单">
<EF:EFRegion id="inqu" title="查询条件">
<div class="row">
<EF:EFDatePicker cname="单据日期" ename="receiptDate" blockId="inqu_status" row="0" colWidth="3"
format="yyyy-MM-dd" readonly="true"/>
<EF:EFInput cname="销售单号" ename="saleNo" blockId="inqu_status" row="0" colWidth="3"/>
<EF:EFInput cname="项目号" ename="projCode" blockId="inqu_status" row="0" colWidth="3"/>
<EF:EFInput cname="项目名称" ename="projName" blockId="inqu_status" row="0" colWidth="3"/>
</div>
<div class="row">
<EF:EFInput cname="部件名称" ename="inventName" blockId="inqu_status" row="0" colWidth="3"/>
<EF:EFInput cname="零件名称" ename="subInventName" blockId="inqu_status" row="0" colWidth="3"/>
<EF:EFSelect cname="是否打印" ename="isPrint" blockId="inqu_status" row="0" colWidth="3" defaultValue="">
<EF:EFOption label="全部" value=""/>
<EF:EFCodeOption codeName="hpjx.hpjx.isPrint"/>
</EF:EFSelect>
<EF:EFSelect cname="是否删除" ename="deleteFlag" blockId="inqu_status" row="0" colWidth="3" defaultValue="0">
<EF:EFOption label="全部" value=""/>
<EF:EFCodeOption codeName="hpjx.hpjx.deleteFlag"/>
</EF:EFSelect>
</div>
<div class="row">
<EF:EFDateSpan startCname="创建日期(从)" endCname="至" startName="createdDateFrom" endName="createdDateTo"
blockId="inqu_status" row="0" role="date" format="yyyy-MM-dd" ratio="3:3" satrtRatio="4:8"
endRatio="4:8" readonly="true">
</EF:EFDateSpan>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="明细信息">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true" checkMode="row">
<EF:EFColumn ename="id" cname="内码" hidden="true"/>
<EF:EFColumn ename="saleNo" cname="销售单号" enable="false" width="140" align="center"/>
<EF:EFColumn ename="receiptDate" cname="单据日期" enable="false" width="90" align="center"
editType="date" dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']"/>
<EF:EFColumn ename="projName" cname="项目名称" enable="false" width="140" align="center"/>
<EF:EFComboColumn ename="factoryCode" enable="false" cname="厂区" width="110" align="center" defaultValue=""
filter="contains" readonly="true">
<EF:EFOptions blockId="factory_record_block_id" valueField="valueField" textField="textField"/>
</EF:EFComboColumn>
<EF:EFComboColumn ename="whCode" cname="仓库名称" enable="false" width="120" align="center"
blockName="wh_record_block_id" textField="textField" valueField="valueField"
columnTemplate="#=textField#" itemTemplate="#=textField#">
</EF:EFComboColumn>
<EF:EFColumn ename="inventName" cname="部件名称/存货名称" enable="false" width="150" align="center"/>
<EF:EFColumn ename="subInventName" cname="零件名称" enable="false" width="120" align="center"/>
<EF:EFComboColumn ename="inventRecordId" cname="规格" enable="false" width="120" align="center" hidden="true"
blockName="invent_spec_block_id" textField="textField" valueField="valueField"
columnTemplate="#=textField#" itemTemplate="#=textField#">
</EF:EFComboColumn>
<EF:EFColumn ename="length" cname="长(MM)" enable="false" width="100" align="right" format="{0:N3}"
hidden="true"/>
<EF:EFColumn ename="width" cname="宽(MM)" enable="false" width="100" align="right" format="{0:N3}"
hidden="true"/>
<EF:EFColumn ename="thick" cname="厚(MM)" enable="false" width="100" align="right" format="{0:N3}"
hidden="true"/>
<EF:EFColumn ename="invWeight" cname="库存重量(T)" enable="false" width="120" align="right" format="{0:N3}"/>
<EF:EFColumn ename="weight" cname="出库重量(T)" enable="false" width="120" align="right" format="{0:N3}"/>
<EF:EFColumn ename="diffWeight" cname="差异重量(T)" enable="false" width="120" align="right" format="{0:N3}"/>
<EF:EFComboColumn ename="isPrint" cname="是否制单" width="80" align="center">
<EF:EFCodeOption codeName="hpjx.hpjx.isPrint"/>
</EF:EFComboColumn>
<EF:EFComboColumn ename="isReturn" cname="是否退货" width="80" align="center" hidden="true">
<EF:EFCodeOption codeName="hpjx.hpjx.isReturn"/>
</EF:EFComboColumn>
<EF:EFColumn ename="remark" cname="备注" enable="false" width="100" align="center" />
<EF:EFColumn ename="projCode" cname="项目号" enable="false" width="140" align="center" hidden="true"/>
<EF:EFColumn ename="prodNo" cname="生产订单号" enable="false" width="140" align="center" hidden="true"/>
<EF:EFColumn ename="oldSaleNo" cname="原销售单号" enable="false" width="140" align="center" hidden="true"/>
<EF:EFColumn ename="inventCode" cname="部件编码" enable="false" width="120" align="center" hidden="true"/>
<EF:EFColumn ename="subInventCode" cname="零件编码" enable="false" width="120" align="center" hidden="true"/>
<EF:EFColumn ename="createdName" cname="创建人" enable="false" width="120" align="center"/>
<EF:EFColumn ename="createdTime" cname="创建时间" enable="false" width="140" align="center"
editType="datetime" parseFormats="['yyyyMMddHHmmss','yyyy-MM-dd HH:mm:ss']"/>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
$(function () {
IPLATUI.EFGrid = {
"result": {
columns: [{
field: "applyWeight",
template: function (model) {
let applyWeight = model.applyWeight;
if (isBlank(applyWeight)) {
return "";
}
let weight = model.weight;
if (parseFloat(applyWeight) > parseFloat(weight)) {
return "<span style='color: red'>" + applyWeight + "</span>";
} else {
return applyWeight;
}
}
}],
dataBound: function (e) {
$.each(e.sender.getDataItems(), function (index, item) {
let currentDate = getCurrentDate();
if (currentDate > item.deliveryDate) {
$('tr[data-uid=' + item.uid + ']').css({'color': 'red'});
}
})
},
loadComplete: function (grid) {
// 表格发生变更
grid.dataSource.bind("change", function (model) {
applyWeightChange(model);
});
}
}
};
$("#ef_form_head").hide();
// 查询
$("#QUERY").on("click", query);
// 选择
$("#BTN_SELECT").on("click", select);
});
/**
* 页面加载时执行
*/
$(window).load(function () {
// 初始化查询
query();
// 回车退出编辑状态
downKeyUp();
});
/**
* 查询
*/
var query = function (e) {
resultGrid.dataSource.page(1);
};
/**
* 选择库存
*/
let select = function () {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据")
return;
}
for (let i = 0; i < rows.length; i++) {
let applyWeight = rows[i]['applyWeight'];
let weight = rows[i]['weight'];
if (!isPositiveNumber(applyWeight)) {
message("勾选的第" + (i + 1) + "行出库重量必须是大于0的数字");
return;
}
// if (parseFloat(applyAmount) > parseFloat(amount)) {
// message("第" + (i + 1) + "行申请数量不能大于库存数量");
// return;
// }
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据生成出库单吗? ", {
ok: function () {
JSUtils.submitGridsData("result", "HPKC104A", "select",
true, function (e) {
var status = e.getStatus();
if (status !== -1) {
parent.JSColorbox.setValueCallback();
}
}
);
}
});
}
/**
* 申请重量变更
*
* @param grid
*/
let applyWeightChange = function (model) {
if (model.field != "applyWeight") {
return;
}
// 获取此model元素信息
var item = model.items[0];
let applyWeight = item.applyWeight;
let weight = item.weight;
if (parseFloat(applyWeight) > parseFloat(weight)) {
message("出库重量【" + applyWeight + "】大于库存数量【" + weight + "】")
}
}
function getCurrentDate() {
const now = new Date();
const year = now.getFullYear();
const month = (now.getMonth() + 1).toString().padStart(2, '0');
const day = now.getDate().toString().padStart(2, '0');
return year.toString() + month + day;
}
<!DOCTYPE html>
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="EF" tagdir="/WEB-INF/tags/EF" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<EF:EFPage title="库存查询">
<EF:EFRegion id="inqu" title="查询区域" type="query">
<div class="row">
<div class="row">
<EF:EFSelect ename="inqu_status-0-factoryCode" cname="厂区" colWidth="3" filter="contains" defultValue="">
<EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="factory_record_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFInput cname="项目名称" ename="projName" blockId="inqu_status" row="0" colWidth="3"/>
<EF:EFInput cname="部件名称" ename="inventName" blockId="inqu_status" row="0" colWidth="3"/>
<EF:EFInput cname="零件名称" ename="subInventName" blockId="inqu_status" row="0" colWidth="3"/>
</div>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="记录集">
<EF:EFGrid blockId="result" autoDraw="override" checkMode="row" isFloat="true">
<EF:EFColumn ename="id" cname="库存ID" enable="false" width="60" align="center" hidden="true"/>
<EF:EFComboColumn ename="factoryCode" enable="false" cname="厂区" width="110" align="center" defaultValue=""
filter="contains" readonly="true">
<EF:EFOptions blockId="factory_record_block_id" valueField="valueField" textField="textField"/>
</EF:EFComboColumn>
<EF:EFColumn ename="whName" cname="仓库名称" enable="false" width="140" align="center"/>
<EF:EFColumn ename="projName" cname="项目名称" enable="false" width="140" align="center"/>
<EF:EFColumn ename="inventName" cname="部件名称" enable="false" width="120" align="center"/>
<EF:EFColumn ename="subInventName" cname="零件名称" enable="false" width="120" align="center"/>
<EF:EFColumn ename="applyWeight" cname="出库重量" width="120" align="right" format="{0:N0}" required="true"/>
<EF:EFColumn ename="applyRemark" cname="出库说明" width="150" editType="textarea" copy="true"/>
<EF:EFColumn ename="weight" cname="库存重量(T)" enable="false" width="120" align="right" format="{0:N3}"/>
<EF:EFColumn ename="remark" cname="备注" enable="false" width="150" hidden="true"/>
<EF:EFColumn ename="whCode" cname="仓库编码" enable="false" width="140" align="center" hidden="true"/>
<EF:EFColumn ename="projCode" cname="项目号" enable="false" width="140" align="center" hidden="true"/>
<EF:EFColumn ename="inventCode" cname="部件编码" enable="false" width="120" align="center" hidden="true"/>
<EF:EFColumn ename="subInventCode" cname="零件编码" enable="false" width="120" align="center" hidden="true"/>
<EF:EFColumn ename="prodNo" cname="生产订单号" enable="false" width="140" align="center" hidden="true"/>
<EF:EFColumn ename="deliveryDate" cname="交货日期" width="90" align="center" editType="date"
dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" readonly="true"/>
</EF:EFGrid>
</EF:EFRegion>
<EF:EFRegion title="提示">
<span style="color: red">说明:红色数据是未按销售交货日期出库的数据。</span>
</EF:EFRegion>
</EF:EFPage>
var inventNameGlobalData = [];
$(function() {
// 查询
$("#QUERY").on("click", query);
IPLATUI.EFGrid = {
"result": {
columns: [{
field: "inventCode",
template: function (dataItem) {
for (let i = 0; i < inventNameGlobalData.length; i++) {
if (inventNameGlobalData[i]['valueField'] === dataItem['inventCode']) {
return inventNameGlobalData[i]['textField'];
}
}
return "";
}
},{
field: "subInventCode",
template: function (dataItem) {
for (let i = 0; i < inventNameGlobalData.length; i++) {
if (inventNameGlobalData[i]['valueField'] === dataItem['subInventCode']) {
return inventNameGlobalData[i]['textField'];
}
}
return "";
}
}]
},
};
});
/**
* 页面加载时执行
*/
$(window).load(function () {
// 存货名称
let eiInfo = new EiInfo();
EiCommunicator.send("HPPZ004", "queryComboBox", eiInfo, {
onSuccess: function (ei) {
inventNameGlobalData = ei.getBlock("invent_name_block_id").getMappedRows();
},
onFail: function (ei) {
}
}, {async: false});
// 查询
query();
});
/**
* 查询
*/
let query = function () {
resultGrid.dataSource.page(1); // 点击查询按钮,从第1页开始查询
}
<!DOCTYPE html>
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="EF" tagdir="/WEB-INF/tags/EF" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<EF:EFPage title="产品库存管理">
<EF:EFRegion id="inqu" title="查询条件">
<div class="row">
<%--<EF:EFInput blockId="inqu_status" ename="projCode" colWidth="3" cname="项目编号:" />--%>
<EF:EFInput blockId="inqu_status" ename="projName" colWidth="3" cname="项目名称:" />
<%-- <EF:EFInput blockId="inqu_status" ename="prodNo" colWidth="3" cname="生产单号:" />--%>
<EF:EFSelect ename="inqu_status-0-factoryCode" cname="厂区" colWidth="3" filter="contains" defultValue="">
<EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="factory_record_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFSelect ename="inqu_status-0-whCode" cname="仓库名称" colWidth="3" filter="contains" defultValue="">
<EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="wh_record_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFSelect ename="inqu_status-0-inventCode" cname="部件名称" colWidth="3" filter="contains" defultValue="">
<EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="material_record_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFSelect ename="inqu_status-0-subInventCode" cname="零件名称" colWidth="3" filter="contains" defultValue="">
<EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="material_record_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
</div>
<div class="row">
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="明细信息">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true" checkMode="row">
<EF:EFColumn ename="id" cname="内码" hidden="true"/>
<%-- <EF:EFColumn ename="prodNo" cname="生产单号" width="120" align="center" required="true" enable="false"/>--%>
<EF:EFComboColumn ename="factoryCode" cname="厂区" width="110" align="center" defaultValue=""
filter="contains" readonly="true" enable="false" >
<EF:EFOptions blockId="factory_record_block_id" valueField="valueField" textField="textField"/>
</EF:EFComboColumn>
<EF:EFComboColumn ename="whCode" cname="仓库名称" width="120" columnTemplate="#=textField#"
itemTemplate="#=textField#" blockName="wh_record_block_id"
textField="textField" valueField="valueField"
align="center" filter="contains" required="true" enable="false">
</EF:EFComboColumn>
<%--<EF:EFColumn ename="projCode" cname="项目编号" width="120" align="center" required="true" enable="false"/>--%>
<EF:EFColumn ename="projName" cname="项目名称" width="120" align="center" required="true" enable="false"/>
<EF:EFColumn ename="inventCode" cname="部件名称" width="120" align="center" required="true" enable="false"/>
<EF:EFColumn ename="subInventCode" cname="零件名称" width="120" align="center" required="true" enable="false"/>
<%-- <EF:EFColumn ename="length" cname="长(MM)" format="{0:N3}" maxLength="20" width="90" align="right" enable="false"/>
<EF:EFColumn ename="width" cname="宽(MM)" format="{0:N3}" maxLength="20" width="90" align="right" enable="false"/>
<EF:EFColumn ename="thick" cname="厚(MM)" format="{0:N3}" maxLength="20" width="90" align="right" enable="false"/>--%>
<EF:EFColumn ename="prdtSpec" cname="规格" enable="false" width="150" align="center"/>
<%-- <EF:EFColumn ename="amount" cname="数量" format="{0:N0}" maxLength="20" width="90" align="right" required="true" enable="false"/>--%>
<%-- <EF:EFColumn ename="unitWeight" cname="单重(KG)" format="{0:N3}" maxLength="20" width="90" align="right" enable="false"/>--%>
<EF:EFColumn ename="weight" cname="总重(T)" format="{0:N3}" maxLength="20" width="90" align="right" enable="false"/>
<%--<EF:EFColumn ename="remark" cname="备注" width="120" align="center" enable="false"/>--%>
<EF:EFColumn ename="createdBy" cname="创建人" enable="false" width="100" align="center"/>
<EF:EFColumn ename="createdTime" cname="创建时刻" enable="false" width="140" align="center"
editType="datetime" parseFormats="['yyyyMMddHHmmss']"/>
<EF:EFColumn ename="updatedBy" cname="更新人" enable="false" width="100" align="center"/>
<EF:EFColumn ename="updatedTime" cname="更新时刻" enable="false" width="140" align="center"
editType="datetime" parseFormats="['yyyyMMddHHmmss']"/>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
......@@ -15,7 +15,6 @@ $(function () {
field: "operator",
template: function (item) {
let template = '';
debugger;
// banner清单
if (item.id) {
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
......@@ -24,8 +23,7 @@ $(function () {
return template
}
},
{
}, {
field: "docIdPc",
title: "PC端log",
template: function (item) {
......
......@@ -4,27 +4,27 @@ $(function () {
resultGrid.dataSource.page(1);
});
IPLATUI.EFGrid.result = {
pageable: {
pageSize: 20,
pageSizes: [10, 20, 50, 70, 100],
},
columns: [
{
columns: [{
field: "operator",
template: function (item) {
let template = '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" ' +
'onclick="jump(' + item.id + ')" >物料清单</a>';
let template = '<a style="cursor: pointer;display: inline-flex;justify-content: center;'
+ 'margin:auto 5px" onclick="jump(' + item.id + ')" >物料清单</a>';
return template;
}
}
],
}],
}
});
/**
* 跳转页面
*
* @param id
*/
function jump(id) {
var herf = ctx + "\\web\\" + "HPSC002?inqu_status-0-projId=" + id + "&efParentFormEname=HPSC011";
window.open(herf);
......
<%@ page import="com.baosight.hpjx.core.security.UserSessionUtils" %>
<!DOCTYPE html>
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
......
......@@ -74,10 +74,10 @@ function message(msg) {
*/
function downloadHref(docId) {
// S3地址有外网
// return IPLATUI.CONTEXT_PATH + ("run" == projectEnv ? ('/docFileDownload/' + docId)
// return IPLATUI.CONTEXT_PATH + ("run" == PROJECT_ENV ? ('/docFileDownload/' + docId)
// : ('/EU/DM/EUDM06.jsp?docId=' + docId));
// S3地址无外网
return IPLATUI.CONTEXT_PATH + ("run" == projectEnv ? ('/file/download/' + docId)
return IPLATUI.CONTEXT_PATH + ("run" == PROJECT_ENV ? ('/file/download/' + docId)
: ('/EU/DM/EUDM06.jsp?docId=' + docId));
}
......
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