Commit d9bc18d5 by yukang

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

# Conflicts:
#	src/main/java/com/baosight/hpjx/hp/sc/sql/HPSC004.xml
parents d68c76f5 e16ecbcc
......@@ -56,8 +56,16 @@ public enum DdynamicEnum {
* 编写:wwl
*/
INVENT_ALL_BLOCK_ID("invent_all_block_id", "id", "spec", "material", "unit", "HPPZ006.queryComboBoxAll"),
/**
/**
* 模块:存货档案产品名称
* 用途:存货档案产品名称下拉框
* 编写:wwl
*/
INVENT_PRDT_NAME_BLOCK_ID("invent_prdt_name_block_id","id","inventCode","inventName","HPPZ006.queryPrdtComboBoxAll"),
/**
* 模块:存货档案(规格)
* 用途:存货档案下拉框
* 编写:wwl
......
......@@ -24,6 +24,7 @@ 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.ObjectUtils;
import com.baosight.hpjx.util.StringUtil;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
......@@ -32,6 +33,7 @@ import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.iplat4j.core.web.threadlocal.UserSession;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang.StringUtils;
import java.math.BigDecimal;
import java.time.LocalDate;
......@@ -122,7 +124,7 @@ public class ServiceHPKC009 extends ServiceBase {
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsg("按天统计成功");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "按天统计失败");
LogUtils.setMsg(inInfo, e, "按天统计失败");
}
return inInfo;
}
......@@ -158,7 +160,7 @@ public class ServiceHPKC009 extends ServiceBase {
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsg("按月统计成功");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "按月统计失败");
LogUtils.setMsg(inInfo, e, "按月统计失败");
}
return inInfo;
}
......@@ -172,61 +174,54 @@ public class ServiceHPKC009 extends ServiceBase {
List<HPKC009> newKc009s = new ArrayList<>();
// 1.1、期末库存
queryMap.put("dateProc", queryMap.get("yesterTo"));
List<HPKC010> endKcs = dao.query(HPKC010A.QUERY, queryMap);
List<HPKC010A> endKcs = dao.query(HPKC010A.QUERY, queryMap);
// 1.2、采购入库
queryMap.put("createdTimeFrom", queryMap.get("yesterFrom") + "000000");
queryMap.put("createdTimeTo", queryMap.get("yesterTo") + "235959");
List<HPKC001> cgRks = dao.query(HPSqlConstant.HPKC001.STAT_DATE, queryMap);
Map<String, HPKC001> cgRkMap = cgRks.stream().collect(Collectors.toMap(item ->
item.getCompanyCode() + "#" + item.getDepCode() + "#" + item.getWhCode() + "#"
+ item.getInventType() + "#" + item.getInventCode() + "#"
+ item.getInventRecordId(), item -> item));
buildKey(item.getCompanyCode(), item.getDepCode(), item.getInventType(), item.getInventCode(),
item.getWhCode(), item.getInventRecordId()), item -> item));
// 1.3、生产入库
List<HPKC003> scRks = dao.query(HPSqlConstant.HPKC003.STAT_DATE, queryMap);
Map<String, HPKC003> scRkMap = scRks.stream().collect(Collectors.toMap(item ->
item.getCompanyCode() + "#" + item.getDepCode() + "#" + item.getWhCode() + "#"
+ item.getInventType() + "#" + item.getInventCode(), item -> item));
buildKey(item.getCompanyCode(), item.getDepCode(), item.getInventType(), item.getInventCode(),
item.getWhCode(), item.getInventRecordId()), item -> item));
// 1.4、其他入库
List<HPKC006> qtRks = dao.query(HPSqlConstant.HPKC006.STAT_DATE, queryMap);
Map<String, HPKC006> qtRkMap = qtRks.stream().collect(Collectors.toMap(item ->
item.getCompanyCode() + "#" + item.getDepCode() + "#" + item.getWhCode() + "#"
+ item.getInventType() + "#" + item.getInventCode() + "#"
+ item.getInventRecordId(), item -> item));
buildKey(item.getCompanyCode(), item.getDepCode(), item.getInventType(), item.getInventCode(),
item.getWhCode(), item.getInventRecordId()), item -> item));
// 1.5、生产领料
List<HPKC002> scCks = dao.query(HPSqlConstant.HPKC002.STAT_DATE, queryMap);
Map<String, HPKC002> scCkMap = scCks.stream().collect(Collectors.toMap(item ->
item.getCompanyCode() + "#" + item.getDepCode() + "#" + item.getWhCode() + "#"
+ item.getInventType() + "#" + item.getInventCode() + "#"
+ item.getInventRecordId(), item -> item));
buildKey(item.getCompanyCode(), item.getDepCode(), item.getInventType(), item.getInventCode(),
item.getWhCode(), item.getInventRecordId()), item -> item));
// 1.6、销售出库
List<HPKC004> xsCks = dao.query(HPSqlConstant.HPKC004.STAT_DATE, queryMap);
Map<String, HPKC004> xsCkMap = xsCks.stream().collect(Collectors.toMap(item ->
item.getCompanyCode() + "#" + item.getDepCode() + "#" + item.getWhCode() + "#"
+ item.getInventType() + "#" + item.getInventCode(), item -> item));
buildKey(item.getCompanyCode(), item.getDepCode(), item.getInventType(), item.getInventCode(),
item.getWhCode(), item.getInventRecordId()), item -> item));
// 1.7、其它出库
List<HPKC007> qtCks = dao.query(HPSqlConstant.HPKC007.STAT_DATE, queryMap);
Map<String, HPKC007> qtCkMap = qtCks.stream().collect(Collectors.toMap(item ->
item.getCompanyCode() + "#" + item.getDepCode() + "#" + item.getWhCode() + "#"
+ item.getInventType() + "#" + item.getInventCode() + "#"
+ item.getInventRecordId(), item -> item));
buildKey(item.getCompanyCode(), item.getDepCode(), item.getInventType(), item.getInventCode(),
item.getWhCode(), item.getInventRecordId()), item -> item));
// 1.8、盘点差异数量
List<HPKC005> pdDiffs = dao.query(HPSqlConstant.HPKC005.STAT_DATE, queryMap);
Map<String, HPKC005> pdDiffMap = pdDiffs.stream().collect(Collectors.toMap(item ->
item.getCompanyCode() + "#" + item.getDepCode() + "#" + item.getWhCode() + "#"
+ item.getInventType() + "#" + item.getInventCode() + "#"
+ item.getInventRecordId(), item -> item));
buildKey(item.getCompanyCode(), item.getDepCode(), item.getInventType(), item.getInventCode(),
item.getWhCode(), item.getInventRecordId()), item -> item));
// 1.9、期初库存
queryMap.put("dateProc", queryMap.get("beforeDate"));
List<HPKC009> initKcs = dao.query(HPKC009.QUERY, new HashMap<>());
Map<String, HPKC009> initKcMap = initKcs.stream().collect(Collectors.toMap(item ->
item.getCompanyCode() + "#" + item.getDepCode() + "#" + item.getWhCode() + "#"
+ item.getInventType() + "#" + item.getInventCode() + "#"
+ item.getInventRecordId(), item -> item));
buildKey(item.getCompanyCode(), item.getDepCode(), item.getInventType(), item.getInventCode(),
item.getWhCode(), item.getInventRecordId()), item -> item));
// 根据期末库存生成收发存对象
for (HPKC010 endKc : endKcs) {
String key = endKc.getCompanyCode() + "#" + endKc.getDepCode() + "#"
+ endKc.getWhCode() + "#" + endKc.getInventType() + "#"
+ endKc.getInventCode() + "#" + endKc.getInventRecordId();
for (HPKC010A endKc : endKcs) {
String key = buildKey(endKc.getCompanyCode(), endKc.getDepCode(), endKc.getInventType(),
endKc.getInventCode(), endKc.getWhCode(), endKc.getInventRecordId());
HPKC009 kc009 = BeanUtils.copy(endKc, HPKC009.class);
kc009.setDateType(queryMap.get("dateType").toString());
kc009.setDateProc(queryMap.get("yesterDate").toString());
......@@ -519,4 +514,24 @@ public class ServiceHPKC009 extends ServiceBase {
}
}
/**
* 构建KEY
*
* @param companyCode
* @param depCode
* @param inventType
* @param inventCode
* @param whCode
* @param inventRecordId
* @return
*/
private String buildKey(Object companyCode, Object depCode, Object inventType, Object inventCode,
Object whCode, Object inventRecordId) {
return ObjectUtils.trimToEmpty(companyCode) + "#"
+ ObjectUtils.trimToEmpty(depCode) + "#"
+ ObjectUtils.trimToEmpty(inventType) + "#"
+ ObjectUtils.trimToEmpty(inventCode) + "#"
+ ObjectUtils.trimToEmpty(whCode) + "#"
+ ObjectUtils.trimToEmpty(inventRecordId);
}
}
......@@ -191,7 +191,7 @@
WH_CODE AS "whCode",
INVENT_TYPE AS "inventType",
INVENT_CODE AS "inventCode",
INVENT_RECORD_ID AS "inventRecordId";
INVENT_RECORD_ID AS "inventRecordId",
COALESCE(SUM(AMOUNT), 0) AS "amount",
COALESCE(SUM(WEIGHT), 0) AS "weight"
FROM ${hpjxSchema}.T_HPKC004
......
......@@ -223,5 +223,21 @@ public class ServiceHPPZ006 extends ServiceBase {
}
return inInfo;
}
/**
* 下拉框
*
* @param inInfo
* @return
*/
public EiInfo queryPrdtComboBox(EiInfo inInfo) {
try {
List<DdynamicEnum> list = new ArrayList<>();
list.add(DdynamicEnum.INVENT_PRDT_NAME_BLOCK_ID);
CommonMethod.initBlock(inInfo, list, EiInfoUtils.getFirstRow(inInfo), false);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询规格失败");
}
return inInfo;
}
}
......@@ -209,4 +209,18 @@
ORDER BY ID
</select>
<!-- 存货档案产品下拉框 -->
<select id="queryPrdtComboBoxAll" parameterClass="java.util.HashMap" resultClass="java.util.HashMap">
SELECT DISTINCT
ID AS "id",
INVENT_CODE as "inventCode",
INVENT_NAME as "inventName"
FROM hpjx.t_hppz006
WHERE DELETE_FLAG = 0
AND STATUS = 1
AND IFNULL(SPEC,'') = ''
<include refid="condition"/>
<include refid="customCondition"/>
ORDER BY ID
</select>
</sqlMap>
......@@ -27,7 +27,7 @@ public class HPSC002 extends DaoEPBase {
private String deptCode = " "; /* 部门编码 预留*/
private String projCode = " "; /* 项目编码*/
private String projName = " "; /* 项目名称*/
private String parentPrdtCode = " "; /* 父节点-产品编码*/
private String parentId = ""; /* 父节点-产品编码*/
private String parentPrdtName = " "; /* 父节点-产品名称*/
private String type = " "; /* 类别*/
private String leaf = "1"; /* 是否有叶子节点*/
......@@ -36,6 +36,7 @@ public class HPSC002 extends DaoEPBase {
private Integer prdtType = 0; /*产品类型*/
private String prdtCode = " "; /* 产品编码*/
private String prdtName = " "; /* 产品名称*/
private Long inventRecordId = new Long(0); /* 存货档案ID*/
private BigDecimal num = new BigDecimal(0.000); /* 数量*/
private BigDecimal unitWt = new BigDecimal(0.000); /* 单重*/
private BigDecimal totalWt = new BigDecimal(0.000); /* 总重*/
......@@ -79,7 +80,7 @@ public class HPSC002 extends DaoEPBase {
eiColumn.setDescName("项目名称");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("parentPrdtCode");
eiColumn = new EiColumn("parentId");
eiColumn.setDescName("父节点-产品编码");
eiMetadata.addMeta(eiColumn);
......@@ -115,6 +116,10 @@ public class HPSC002 extends DaoEPBase {
eiColumn.setDescName("产品名称");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("inventRecordId");
eiColumn.setDescName("存货档案ID");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("num");
eiColumn.setDescName("数量");
eiMetadata.addMeta(eiColumn);
......@@ -267,18 +272,18 @@ public class HPSC002 extends DaoEPBase {
}
/**
* get the parentPrdtCode - 父节点-产品编码
* @return the parentPrdtCode
* get the parentId - 父节点-产品编码
* @return the parentId
*/
public String getParentPrdtCode() {
return this.parentPrdtCode;
public String getParentId() {
return this.parentId;
}
/**
* set the parentPrdtCode - 父节点-产品编码
* set the parentId - 父节点-产品编码
*/
public void setParentPrdtCode(String parentPrdtCode) {
this.parentPrdtCode = parentPrdtCode;
public void setParentId(String parentId) {
this.parentId = parentId;
}
/**
......@@ -400,8 +405,23 @@ public class HPSC002 extends DaoEPBase {
public void setPrdtName(String prdtName) {
this.prdtName = prdtName;
}
/**
* get the inventRecordId - 存货档案ID.
* @return the inventRecordId
*/
public Long getInventRecordId() {
return this.inventRecordId;
}
/**
* set the inventRecordId - 存货档案ID.
*
* @param inventRecordId - 存货档案ID
*/
public void setInventRecordId(Long inventRecordId) {
this.inventRecordId = inventRecordId;
}
/**
* get the num - 数量
* @return the num
*/
......@@ -636,7 +656,7 @@ public class HPSC002 extends DaoEPBase {
setDeptCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get("deptCode")), deptCode));
setProjCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get("projCode")), projCode));
setProjName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get("projName")), projName));
setParentPrdtCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get("parentPrdtCode")), parentPrdtCode));
setParentId(StringUtils.defaultIfEmpty(StringUtils.toString(map.get("parentId")), parentId));
setParentPrdtName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get("parentPrdtName")), parentPrdtName));
setType(StringUtils.defaultIfEmpty(StringUtils.toString(map.get("type")), type));
setLeaf(StringUtils.defaultIfEmpty(StringUtils.toString(map.get("leaf")), leaf));
......@@ -645,6 +665,7 @@ public class HPSC002 extends DaoEPBase {
setPrdtType(NumberUtils.toInteger(StringUtils.toString(map.get("prdtType")), prdtType));
setPrdtCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get("prdtCode")), prdtCode));
setPrdtName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get("prdtName")), prdtName));
setInventRecordId(NumberUtils.toLong(StringUtils.toString(map.get("inventRecordId")), inventRecordId));
setNum(NumberUtils.toBigDecimal(StringUtils.toString(map.get("num")), num));
setUnitWt(NumberUtils.toBigDecimal(StringUtils.toString(map.get("unitWt")), unitWt));
setTotalWt(NumberUtils.toBigDecimal(StringUtils.toString(map.get("totalWt")), totalWt));
......@@ -673,7 +694,7 @@ public class HPSC002 extends DaoEPBase {
map.put("deptCode", StringUtils.toString(deptCode, eiMetadata.getMeta("deptCode")));
map.put("projCode", StringUtils.toString(projCode, eiMetadata.getMeta("projCode")));
map.put("projName", StringUtils.toString(projName, eiMetadata.getMeta("projName")));
map.put("parentPrdtCode", StringUtils.toString(parentPrdtCode, eiMetadata.getMeta("parentPrdtCode")));
map.put("parentId", StringUtils.toString(parentId, eiMetadata.getMeta("parentId")));
map.put("parentPrdtName", StringUtils.toString(parentPrdtName, eiMetadata.getMeta("parentPrdtName")));
map.put("type", StringUtils.toString(type, eiMetadata.getMeta("type")));
map.put("leaf", StringUtils.toString(leaf, eiMetadata.getMeta("leaf")));
......@@ -682,6 +703,7 @@ public class HPSC002 extends DaoEPBase {
map.put("prdtType", StringUtils.toString(prdtType, eiMetadata.getMeta("prdtType")));
map.put("prdtCode", StringUtils.toString(prdtCode, eiMetadata.getMeta("prdtCode")));
map.put("prdtName", StringUtils.toString(prdtName, eiMetadata.getMeta("prdtName")));
map.put("inventRecordId", StringUtils.toString(inventRecordId, eiMetadata.getMeta("inventRecordId")));
map.put("num", StringUtils.toString(num, eiMetadata.getMeta("num")));
map.put("unitWt", StringUtils.toString(unitWt, eiMetadata.getMeta("unitWt")));
map.put("totalWt", StringUtils.toString(totalWt, eiMetadata.getMeta("totalWt")));
......
......@@ -28,7 +28,7 @@ public class HPSC004 extends DaoEPBase {
public static final String FIELD_DEPT_CODE = "deptCode"; /* 部门编码 预留*/
public static final String FIELD_PROJ_CODE = "projCode"; /* 项目编码*/
public static final String FIELD_PROJ_NAME = "projName"; /* 项目名称*/
public static final String FIELD_PARENT_PRDT_CODE = "parentPrdtCode"; /* 父节点-产品编码*/
public static final String FIELD_PARENT_ID = "parentId"; /* 父节点-产品编码*/
public static final String FIELD_PARENT_PRDT_NAME = "parentPrdtName"; /* 父节点-产品名称*/
public static final String FIELD_TYPE = "type"; /* 类别*/
public static final String FIELD_LEAF = "leaf"; /* 是否有叶子节点*/
......@@ -66,7 +66,7 @@ public class HPSC004 extends DaoEPBase {
public static final String COL_PROJ_TYPE = "PROJ_TYPE"; /* 项目编码*/
public static final String COL_PROJ_CODE = "PROJ_CODE"; /* 项目编码*/
public static final String COL_PROJ_NAME = "PROJ_NAME"; /* 项目名称*/
public static final String COL_PARENT_PRDT_CODE = "PARENT_PRDT_CODE"; /* 父节点-产品编码*/
public static final String COL_PARENT_ID = "PARENT_ID"; /* 父节点-产品编码*/
public static final String COL_PARENT_PRDT_NAME = "PARENT_PRDT_NAME"; /* 父节点-产品名称*/
public static final String COL_TYPE = "TYPE"; /* 类别*/
public static final String COL_LEAF = "LEAF"; /* 是否有叶子节点*/
......@@ -109,7 +109,7 @@ public class HPSC004 extends DaoEPBase {
private String deptCode = " "; /* 部门编码 预留*/
private String projCode = " "; /* 项目编码*/
private String projName = " "; /* 项目名称*/
private String parentPrdtCode = " "; /* 父节点-产品编码*/
private String parentId = " "; /* 父节点-产品编码*/
private String parentPrdtName = " "; /* 父节点-产品名称*/
private String type = " "; /* 类别*/
private String leaf = "1"; /* 是否有叶子节点*/
......@@ -168,7 +168,7 @@ public class HPSC004 extends DaoEPBase {
eiColumn.setDescName("项目名称");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_PARENT_PRDT_CODE);
eiColumn = new EiColumn(FIELD_PARENT_ID);
eiColumn.setDescName("父节点-产品编码");
eiMetadata.addMeta(eiColumn);
......@@ -391,20 +391,20 @@ public class HPSC004 extends DaoEPBase {
this.projName = projName;
}
/**
* get the parentPrdtCode - 父节点-产品编码.
* @return the parentPrdtCode
* get the parentId - 父节点-产品编码.
* @return the parentId
*/
public String getParentPrdtCode() {
return this.parentPrdtCode;
public String getParentId() {
return this.parentId;
}
/**
* set the parentPrdtCode - 父节点-产品编码.
* set the parentId - 父节点-产品编码.
*
* @param parentPrdtCode - 父节点-产品编码
* @param parentId - 父节点-产品编码
*/
public void setParentPrdtCode(String parentPrdtCode) {
this.parentPrdtCode = parentPrdtCode;
public void setParentId(String parentId) {
this.parentId = parentId;
}
/**
* get the parentPrdtName - 父节点-产品名称.
......@@ -900,7 +900,7 @@ public class HPSC004 extends DaoEPBase {
setDeptCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_DEPT_CODE)), deptCode));
setProjCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PROJ_CODE)), projCode));
setProjName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PROJ_NAME)), projName));
setParentPrdtCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PARENT_PRDT_CODE)), parentPrdtCode));
setParentId(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PARENT_ID)), parentId));
setParentPrdtName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PARENT_PRDT_NAME)), parentPrdtName));
setType(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_TYPE)), type));
setLeaf(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_LEAF)), leaf));
......@@ -945,7 +945,7 @@ public class HPSC004 extends DaoEPBase {
map.put(FIELD_DEPT_CODE, StringUtils.toString(deptCode, eiMetadata.getMeta(FIELD_DEPT_CODE)));
map.put(FIELD_PROJ_CODE, StringUtils.toString(projCode, eiMetadata.getMeta(FIELD_PROJ_CODE)));
map.put(FIELD_PROJ_NAME, StringUtils.toString(projName, eiMetadata.getMeta(FIELD_PROJ_NAME)));
map.put(FIELD_PARENT_PRDT_CODE, StringUtils.toString(parentPrdtCode, eiMetadata.getMeta(FIELD_PARENT_PRDT_CODE)));
map.put(FIELD_PARENT_ID, StringUtils.toString(parentId, eiMetadata.getMeta(FIELD_PARENT_ID)));
map.put(FIELD_PARENT_PRDT_NAME, StringUtils.toString(parentPrdtName, eiMetadata.getMeta(FIELD_PARENT_PRDT_NAME)));
map.put(FIELD_TYPE, StringUtils.toString(type, eiMetadata.getMeta(FIELD_TYPE)));
map.put(FIELD_LEAF, StringUtils.toString(leaf, eiMetadata.getMeta(FIELD_LEAF)));
......
......@@ -177,7 +177,7 @@ public class ServiceHPSC001 extends ServiceBase {
hpsc002.put("deptCode", hpsc001.getDepCode());
hpsc002.put("projCode", hpsc001.getProjCode());
hpsc002.put("projName", hpsc001.getProjName());
hpsc002.put("parentPrdtCode", "root"); //固定写死
hpsc002.put("parentId", -1); //固定写死
hpsc002.put("parentPrdtName", hpsc001.getProjName());
hpsc002.put("type", "");
hpsc002.put("leaf", "0");
......
......@@ -2,6 +2,7 @@ package com.baosight.hpjx.hp.sc.service;
import cn.hutool.core.bean.BeanUtil;
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.HPKC003;
......@@ -19,9 +20,9 @@ import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.iplat4j.core.util.DateUtil;
import com.baosight.iplat4j.core.util.NumberUtils;
import com.baosight.iplat4j.core.util.StringUtils;
import com.baosight.iplat4j.core.web.threadlocal.UserSession;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import org.apache.commons.lang.StringUtils;
import java.math.BigDecimal;
import java.text.DecimalFormat;
......@@ -82,14 +83,14 @@ public class ServiceHPSC002 extends ServiceBase {
BigDecimal unitWt = hppz002.getUnitWt();
DecimalFormat decimalFormat = new DecimalFormat("#.000");
BigDecimal totalWt = new BigDecimal(decimalFormat.format(Math.round(num.multiply(unitWt).floatValue())));
hppz002.setDelStatus(1);
hppz002.setDelStatus(CommonConstant.YesNo.NO_0.intValue());
hppz002.setTotalWt(totalWt);
if (StringUtils.isNotEmpty(hppz002.getPrdtCode()) && !hppz002.getParentPrdtCode().equals("root")) {
if (StringUtils.isNotEmpty(hppz002.getPrdtCode()) && !hppz002.getParentId().equals("root")) {
hppz002.setPrdtName(HPPZTools.getPz004ByCode(hppz002.getPrdtCode()).getInventName());
}
DaoUtils.insert("HPSC002.insert", hppz002.toMap());
if (!hppz002.getParentPrdtCode().equals("root")) {
this.checkTreeNodeLeaf(new Long(hppz002.getParentPrdtCode()));
if (!hppz002.getParentId().equals("root")) {
this.checkTreeNodeLeaf(new Long(hppz002.getParentId()));
}
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
......@@ -141,7 +142,7 @@ public class ServiceHPSC002 extends ServiceBase {
Map<?, ?> map = eiBlock.getRow(i);
hppz002.fromMap(map);
this.dao.delete("HPSC002.delete", hppz002.toMap());
this.checkTreeNodeLeaf(new Long(hppz002.getParentPrdtCode()));
this.checkTreeNodeLeaf(new Long(hppz002.getParentId()));
//TODO 删除时 修改树结构
this.checkTreeNodeLeaf(new Long(hppz002.getId()));
}
......@@ -180,6 +181,9 @@ public class ServiceHPSC002 extends ServiceBase {
public EiInfo queryTreeNode(EiInfo inInfo) {
//1 获取参数
String pEname = inInfo.getCellStr(EiConstant.queryBlock, 0, "node");
if(StringUtils.equals("$",pEname)){
pEname = "root";
}
Long projId = NumberUtils.toLong(inInfo.get("projId"));
Map queryMap = new HashMap();
queryMap.put("pEname", pEname);
......@@ -249,19 +253,19 @@ public class ServiceHPSC002 extends ServiceBase {
hppz002.fromMap(map);
HPSC002 THPSC002 = (HPSC002) dao.get("HPSC002.query","id",hppz002.getId());
Map map1 = new HashMap();
map1.put("parentPrdtCode",THPSC002.getParentPrdtCode());
map1.put("parentId",THPSC002.getParentId());
List list = dao.query("HPSC002.checkExamineNum", map1);
int num = NumberUtils.toint(list.get(0));
Map map2 = new HashMap();
if (num == 0) {
map2.put("status",1);
map2.put("id",THPSC002.getParentPrdtCode());
map2.put("id",THPSC002.getParentId());
// 自动生成生产计划
this.autoPlanInfo(THPSC002.getParentPrdtCode());
this.autoPlanInfo(THPSC002.getParentId());
} else {
map2.put("status",0);
map2.put("id",THPSC002.getParentPrdtCode());
map2.put("id",THPSC002.getParentId());
}
DaoUtils.update("HPSC002.check",map2);
......@@ -368,7 +372,7 @@ public class ServiceHPSC002 extends ServiceBase {
HPSC004.setDeptCode("");
HPSC004.setProjCode(HPSC002.getProjCode());
HPSC004.setProjName(HPSC002.getProjName());
HPSC004.setParentPrdtCode(SCJHD);
HPSC004.setParentId(SCJHD);
HPSC004.setParentPrdtName(HPSC002.getParentPrdtName());
HPSC004.setPrdtType(HPSC002.getPrdtType());
HPSC004.setPrdtCode(HPSC002.getPrdtCode());
......
......@@ -184,7 +184,7 @@ public class ServiceHPSC003 extends ServiceBase {
DaoUtils.update("HPSC003.update", HPSC003.toMap());
//生成生产订单
HashMap params = new HashMap();
params.put("parentPrdtCode",HPSC003.getPlanInfoNo());
params.put("parentId",HPSC003.getId());
List list = dao.query("HPSC004.queryDetail",params,0,-999999);
for (int i = 0; i < list.size(); i ++) {
HPSC004 HPSC004 = (HPSC004) list.get(i);
......
......@@ -123,7 +123,7 @@ public class ServiceHPSC004 extends ServiceBase {
//添加返回到前台的块,块名和前台的对应
EiBlock eiBlock = outInfo.addBlock("result");
HashMap params = new HashMap();
params.put("parentPrdtCode",inInfo.get("parentPrdtCode"));
params.put("parentId",inInfo.get("parentId"));
List list = dao.query("HPSC004.queryDetail",params,0,-999999);
outInfo.addBlock("detail").addBlockMeta(HPSC004.eiMetadata);
outInfo.addBlock("detail").addRows(list);
......
......@@ -9,7 +9,7 @@
DEPT_CODE VARCHAR NOT NULL,
PROJ_CODE VARCHAR,
PROJ_NAME VARCHAR,
PARENT_PRDT_CODE VARCHAR,
PARENT_ID VARCHAR,
PARENT_PRDT_NAME VARCHAR,
TYPE VARCHAR NOT NULL,
LEAF VARCHAR NOT NULL,
......@@ -56,8 +56,8 @@
<isNotEmpty prepend=" AND " property="projName">
PROJ_NAME = #projName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="parentPrdtCode">
PARENT_PRDT_CODE = #parentPrdtCode#
<isNotEmpty prepend=" AND " property="parentId">
PARENT_ID = #parentId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="parentPrdtName">
PARENT_PRDT_NAME = #parentPrdtName#
......@@ -156,7 +156,7 @@
DEPT_CODE as "deptCode", <!-- 部门编码 预留 -->
PROJ_CODE as "projCode", <!-- 项目编码 -->
PROJ_NAME as "projName", <!-- 项目名称 -->
PARENT_PRDT_CODE as "parentPrdtCode", <!-- 父节点-产品编码 -->
PARENT_ID as "parentId", <!-- 父节点-产品编码 -->
PARENT_PRDT_NAME as "parentPrdtName", <!-- 父节点-产品名称 -->
TYPE as "type", <!-- 类别 -->
LEAF as "leaf", <!-- 是否有叶子节点 -->
......@@ -220,8 +220,8 @@
<isNotEmpty prepend=" AND " property="projName">
PROJ_NAME = #projName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="parentPrdtCode">
PARENT_PRDT_CODE = #parentPrdtCode#
<isNotEmpty prepend=" AND " property="parentId">
PARENT_ID = #parentId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="parentPrdtName">
PARENT_PRDT_NAME = #parentPrdtName#
......@@ -312,7 +312,7 @@
DEPT_CODE, <!-- 部门编码 预留 -->
PROJ_CODE, <!-- 项目编码 -->
PROJ_NAME, <!-- 项目名称 -->
PARENT_PRDT_CODE, <!-- 父节点-产品编码 -->
PARENT_ID, <!-- 父节点-产品编码 -->
PARENT_PRDT_NAME, <!-- 父节点-产品名称 -->
TYPE, <!-- 类别 -->
LEAF, <!-- 是否有叶子节点 -->
......@@ -343,6 +343,7 @@
UPDATED_TIME, <!-- 更新时间 -->
REMARK <!-- 备注 -->
)
VALUES (#id#, #companyCode#, #deptCode#, #projCode#, #projName#, #parentId#, #parentPrdtName#, #type#, #leaf#, #sort#, #icon#, #prdtType#, #prdtCode#, #prdtName#, #num#, #unitWt#, #totalWt#, #filePath1#, #filePath2#, #filePath3#, #filePath4#, #filePath5#, #planCommentDate#, #planCompletionDate#, #actualCompletionDate#, #actualCompletionNum#, #actualCompletionUnitWt#, #status#, #delStatus#, #createdBy#, #createdTime#, #updatedBy#, #updatedTime#, #remark#)
VALUES (#id#, #companyCode#, #deptCode#, #projCode#, #projName#, #parentPrdtCode#, #parentPrdtName#, #type#, #leaf#, #sort#, #icon#,#inventRecordId#, #prdtType#, #prdtCode#, #prdtName#, #num#, #unitWt#, #totalWt#, #filePath1#, #filePath2#, #filePath3#, #filePath4#, #filePath5#, #planCommentDate#, #planCompletionDate#, #actualCompletionDate#, #actualCompletionNum#, #actualCompletionUnitWt#, #status#, #delStatus#, #createdBy#, #createdTime#, #updatedBy#, #updatedTime#, #remark#)
</insert>
......@@ -358,7 +359,7 @@
DEPT_CODE = #deptCode#, <!-- 部门编码 预留 -->
PROJ_CODE = #projCode#, <!-- 项目编码 -->
PROJ_NAME = #projName#, <!-- 项目名称 -->
PARENT_PRDT_CODE = #parentPrdtCode#, <!-- 父节点-产品编码 -->
PARENT_ID = #parentId#, <!-- 父节点-产品编码 -->
PARENT_PRDT_NAME = #parentPrdtName#, <!-- 父节点-产品名称 -->
TYPE = #type#, <!-- 类别 -->
LEAF = #leaf#, <!-- 是否有叶子节点 -->
......@@ -411,7 +412,7 @@
DEPT_CODE as "deptCode", <!-- 部门编码 预留 -->
PROJ_CODE as "projCode", <!-- 项目编码 -->
PROJ_NAME as "projName", <!-- 项目名称 -->
PARENT_PRDT_CODE as "parentPrdtCode", <!-- 父节点-产品编码 -->
PARENT_ID as "parentId", <!-- 父节点-产品编码 -->
PARENT_PRDT_NAME as "parentPrdtName", <!-- 父节点-产品名称 -->
TYPE as "type", <!-- 类别 -->
LEAF as "leaf", <!-- 是否有叶子节点 -->
......@@ -448,7 +449,7 @@
<select id="inspectDetail" resultClass="int">
SELECT COUNT(*) FROM hpjx.T_HPSC004 WHERE 1=1
AND PARENT_PRDT_CODE = #id# AND (PLAN_COMMENT_DATE = '' OR PLAN_COMMENT_DATE IS NULL
AND PARENT_ID = #id# AND (PLAN_COMMENT_DATE = '' OR PLAN_COMMENT_DATE IS NULL
OR PLAN_COMPLETION_DATE = '' OR PLAN_COMPLETION_DATE IS NULL )
</select>
......
......@@ -33,20 +33,18 @@ public class LogUtils {
if (inInfo == null) {
return;
}
inInfo.setStatus(EiConstant.STATUS_FAILURE);
inInfo.setMsg(title);
if (e == null) {
inInfo.setStatus(EiConstant.STATUS_FAILURE);
inInfo.setDetailMsg("未知");
inInfo.setDetailMsg("");
return;
}
// 由于平台调用链不支持查看detailMsg的消息内容,因此这里修改成往Msg中写错误信息
inInfo.setDetailMsg(e.getMessage());
if (e instanceof PlatException) {
inInfo.setMsg(inInfo.getMsg().concat(",原因:").concat(e.getMessage()));
inInfo.setStatus(EiConstant.STATUS_FAILURE);
} else {
inInfo.setMsg(inInfo.getMsg().concat(",原因参见详细错误描述!"));
inInfo.setStatus(EiConstant.STATUS_FAILURE);
}
}
......@@ -66,18 +64,13 @@ public class LogUtils {
if (inInfo == null) {
return;
}
inInfo.setStatus(EiConstant.STATUS_FAILURE);
String msg = title.concat(",原因:");
if (e == null) {
inInfo.setStatus(EiConstant.STATUS_FAILURE);
inInfo.setMsg(msg.concat("未知"));
return;
}
inInfo.setMsg(msg.concat(e.getMessage()));
if (e instanceof PlatException) {
inInfo.setStatus(EiConstant.STATUS_FAILURE);
} else {
inInfo.setStatus(EiConstant.STATUS_FAILURE);
}
}
/**
......
......@@ -46,8 +46,8 @@ public class ObjectUtils extends org.apache.commons.lang.ObjectUtils {
/**
* Gets the toString of an Object returning an null if null input.
* ObjectUtils.toString(null) = " "
* ObjectUtils.toString("") = " "
* ObjectUtils.toString(null) = ""
* ObjectUtils.toString("") = ""
* ObjectUtils.toString("bat") = "bat"
* ObjectUtils.toString(Boolean.TRUE) = "true"
*
......@@ -55,13 +55,17 @@ public class ObjectUtils extends org.apache.commons.lang.ObjectUtils {
* @return
*/
public static String toEmptyString(Object obj) {
if (obj == null || "".equals(obj)) {
return " ";
} else {
return obj.toString();
}
//return obj == null ? " " : obj.toString();
return obj == null ? "" : obj.toString();
}
/**
*
* @param obj
* @return
*/
public static String trimToEmpty(Object obj) {
return obj == null ? "" : obj.toString().trim();
}
/**
* 检查object是empty或null
......
let inventNameGlobalData = [];
var inventNameGlobalData = [];
// 传递参数 将附件ID与当前记录ID进行绑定
let rowId = '';
let parentPrdtCode = '';
// let rowId = '';
let parentId = '';
let projCode = '';
var strs;
var url = location.search; //获取url中"?"符后的字串
if (url.indexOf("?") != -1) { //判断是否有参数
var str = url.substr(1); //从第一个字符开始 因为第0个是?号 获取所有除问号的所有符串
strs = str.split("="); //用等号进行分隔 (因为知道只有一个参数 所以直接用等号进分隔 如果有多个参数 要用&号分隔 再用等号进行分隔)
console.log('strs=' + strs) //直接弹出第一个参数 (如果有多个参数 还要进行循环的)
// console.log('strs=' + strs) //直接弹出第一个参数 (如果有多个参数 还要进行循环的)
}
$(function () {
IPLATUI.EFTree = {
"materialTree": {
ROOT: "root:项目列表",
ROOT: "root:项目列表",
/**
* 树加载完成后的回调函数
* @param options: 树的配置项
......@@ -45,7 +46,7 @@ $(function () {
IPLATUI.EFTree.materialTree.selectTreeNode.prdtName = nodeData.prdtName;
IPLATUI.EFTree.materialTree.selectTreeNode.projName = nodeData.projName;
// 重新查询EFGrid
parentPrdtCode = nodeData.nodeId;
parentId = nodeData.nodeId;
query();
},
selectTreeNode: {}
......@@ -83,7 +84,8 @@ $(function () {
ei.set("inqu_status-0-prdtType",$("#inqu_status-0-prdtType").val());
ei.set("inqu_status-0-prdtCode",$("#inqu_status-0-prdtCode").val());
ei.set("inqu_status-0-status",$("#inqu_status-0-status").val());
ei.set("inqu_status-0-parentPrdtCode",parentPrdtCode? parentPrdtCode : strs[1]);
ei.set("inqu_status-0-projCode",projCode? projCode : strs[1]);
// ei.set("inqu_status-0-parentId",-1);
return ei;
},
......@@ -134,7 +136,7 @@ $(function () {
$.each(e.items, function (index, item) {
item['projCode'] = selectTreeNode.projCode;
item['projName'] = selectTreeNode.projName;
item['parentPrdtCode'] = selectTreeNode.nodeId;
item['parentId'] = selectTreeNode.nodeId;
item['parentPrdtName'] = selectTreeNode.prdtName;
});
},
......@@ -200,11 +202,11 @@ $(function () {
return template;
}
},{
field: "prdtCode",
field: "inventRecordId",
template: function (dataItem) {
for (let i = 0; i < inventNameGlobalData.length; i++) {
if (inventNameGlobalData[i]['valueField'] === dataItem['prdtCode']) {
return inventNameGlobalData[i]['textField'];
if (inventNameGlobalData[i]['valueField'] === dataItem['inventRecordId']) {
return inventNameGlobalData[i]['textField']+'-'+inventNameGlobalData[i]['param1Field'];
}
}
return "";
......@@ -217,11 +219,12 @@ $(function () {
input.attr("id", options.field);
input.appendTo(container);
let eiInfo = new EiInfo();
eiInfo.set("inqu_status-0-inventTypes", [3, 4]);
eiInfo.set("inventType", options.model["prdtType"]);
var dataSource;
EiCommunicator.send("HPPZ004", "queryComboBox", eiInfo, {
EiCommunicator.send("HPPZ006", "queryComboBox", eiInfo, {
onSuccess: function (ei) {
dataSource = ei.getBlock("invent_name_block_id").getMappedRows();
dataSource = ei.getBlock("invent_prdt_name_block_id").getMappedRows();
inventNameGlobalData = dataSource;
},
onFail: function (ei) {
......@@ -230,9 +233,10 @@ $(function () {
input.kendoDropDownList({
valuePrimitive: true,
dataTextField: "textField",
dataParam1Field: "param1Field",
dataValueField: "valueField",
dataSource: dataSource,
template: "#=textField#"
template: "#=textField#-#=param1Field#"
});
}
}
......@@ -251,7 +255,7 @@ $(function () {
return;
}
let inEiInfo = new EiInfo();
inEiInfo.set("result-0-id", rowId);
// inEiInfo.set("result-0-id", rowId);
inEiInfo.set("result-0-filePath1", uploadFile);
EiCommunicator.send('HPSC002', 'bindDocIdById', inEiInfo, {
onSuccess(response) {
......@@ -294,9 +298,10 @@ $(function () {
$(window).load(function () {
// 存货名称
let inInfo = new EiInfo();
EiCommunicator.send("HPPZ004", "queryComboBox", inInfo, {
inInfo.set("inqu_status-0-inventTypes", [3, 4]);
EiCommunicator.send("HPPZ006", "queryPrdtComboBox", inInfo, {
onSuccess: function (ei) {
inventNameGlobalData = ei.getBlock("invent_name_block_id").getMappedRows();
inventNameGlobalData = ei.getBlock("invent_prdt_name_block_id").getMappedRows();
},
onFail: function (ei) {
}
......@@ -313,7 +318,7 @@ let query = function () {
}
function openUploadFile(id) {
uploadFileWindow.open().center();
rowId = id;
// rowId = id;
}
/**
......
......@@ -49,9 +49,9 @@
<EF:EFComboColumn cname="产品类型" ename="prdtType" width="90" align="center" required="true">
<EF:EFCodeOption codeName="hpjx.hpkc.inventType" condition="ITEM_CODE IN ('3','4')"/>
</EF:EFComboColumn>
<EF:EFColumn ename="prdtCode" required="true" cname="产品名称"/>
<EF:EFColumn ename="inventRecordId" required="true" cname="产品名称"/>
<%-- <EF:EFColumn ename="prdtName" required="true" cname="产品名称"/>--%>
<EF:EFColumn enable="false" ename="parentPrdtCode" hidden="true" cname="上级产品名称"/>
<EF:EFColumn enable="false" ename="parentId" hidden="true" cname="上级产品名称"/>
<EF:EFColumn enable="false" ename="parentPrdtName" cname="上级产品名称"/>
<EF:EFColumn ename="num" required="true" cname="数量"/>
<EF:EFColumn ename="unitWt" required="true" format="{0:N3}" cname="单重"/>
......
......@@ -49,8 +49,8 @@ $(function () {
detailGrid.setEiBlock(block);
}
var info = new EiInfo()
var planInfoNo = e.model['planInfoNo'];
info.set("parentPrdtCode",planInfoNo);
var parentId = e.model['id'];
info.set("parentId",parentId);
EiCommunicator.send("HPSC004","queryDetail",info,{
onSuccess:function(ei){//返回结果集
detailGrid.setEiInfo(ei);
......
......@@ -25,6 +25,6 @@ $(function () {
});
function jump(id) {
var herf= ctx + "\\web\\"+ "HPSC002?inqu_status-0-parentPrdtCode=" + id;
var herf= ctx + "\\web\\"+ "HPSC002?inqu_status-0-projId=" + id;
window.open(herf);
}
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