Commit 23a9f843 by 宋祥

1.收发存汇总前端页面

parent 1295a92c
...@@ -7,6 +7,20 @@ package com.baosight.hpjx.hp.constant; ...@@ -7,6 +7,20 @@ package com.baosight.hpjx.hp.constant;
public class HPSqlConstant { public class HPSqlConstant {
/** /**
* HPKC009 SQL 定义
*
* @author:songx
* @date:2024/1/20,16:45
*/
public class HPKC009 {
// 按日期删除
public static final String DELETE_BY_TIME = "HPKC009.deleteByTime";
// 查询
public static final String QUERY = "HPKC009.query";
}
/**
* HPPZ010 SQL 定义 * HPPZ010 SQL 定义
* *
* @author:songx * @author:songx
......
package com.baosight.hpjx.hp.kc.service; package com.baosight.hpjx.hp.kc.service;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.core.constant.CommonConstant; import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils; import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.constant.HPConstant; import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.constant.HPSqlConstant;
import com.baosight.hpjx.hp.kc.domain.HPKC001; import com.baosight.hpjx.hp.kc.domain.HPKC001;
import com.baosight.hpjx.hp.kc.domain.HPKC002; import com.baosight.hpjx.hp.kc.domain.HPKC002;
import com.baosight.hpjx.hp.kc.domain.HPKC003; import com.baosight.hpjx.hp.kc.domain.HPKC003;
...@@ -10,14 +12,19 @@ import com.baosight.hpjx.hp.kc.domain.HPKC004; ...@@ -10,14 +12,19 @@ import com.baosight.hpjx.hp.kc.domain.HPKC004;
import com.baosight.hpjx.hp.kc.domain.HPKC006; import com.baosight.hpjx.hp.kc.domain.HPKC006;
import com.baosight.hpjx.hp.kc.domain.HPKC007; import com.baosight.hpjx.hp.kc.domain.HPKC007;
import com.baosight.hpjx.hp.kc.domain.HPKC009; import com.baosight.hpjx.hp.kc.domain.HPKC009;
import com.baosight.hpjx.hp.pz.domain.HPPZ007;
import com.baosight.hpjx.hp.pz.domain.HPPZ009; import com.baosight.hpjx.hp.pz.domain.HPPZ009;
import com.baosight.hpjx.hp.pz.domain.THppz004;
import com.baosight.hpjx.hp.pz.tools.HPPZTools;
import com.baosight.hpjx.hp.xs.tools.HPXSUserTools; import com.baosight.hpjx.hp.xs.tools.HPXSUserTools;
import com.baosight.hpjx.util.AssertUtils; import com.baosight.hpjx.util.AssertUtils;
import com.baosight.hpjx.util.BeanUtils; import com.baosight.hpjx.util.BeanUtils;
import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.DateUtils; import com.baosight.hpjx.util.DateUtils;
import com.baosight.hpjx.util.EiInfoUtils; import com.baosight.hpjx.util.EiInfoUtils;
import com.baosight.hpjx.util.LogUtils; import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.RsaUtils; import com.baosight.hpjx.util.RsaUtils;
import com.baosight.hpjx.util.StringUtil;
import com.baosight.iplat4j.core.ei.EiConstant; import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo; import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException; import com.baosight.iplat4j.core.exception.PlatException;
...@@ -26,9 +33,12 @@ import com.baosight.iplat4j.core.service.soa.XLocalManager; ...@@ -26,9 +33,12 @@ import com.baosight.iplat4j.core.service.soa.XLocalManager;
import com.baosight.iplat4j.ed.util.SequenceGenerator; import com.baosight.iplat4j.ed.util.SequenceGenerator;
import com.baosight.xservices.xs.constants.LoginConstants; import com.baosight.xservices.xs.constants.LoginConstants;
import org.apache.commons.collections.MapUtils;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.time.LocalDate; import java.time.LocalDate;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -50,6 +60,8 @@ public class ServiceHPKC009 extends ServiceBase { ...@@ -50,6 +60,8 @@ public class ServiceHPKC009 extends ServiceBase {
*/ */
public EiInfo initLoad(EiInfo inInfo) { public EiInfo initLoad(EiInfo inInfo) {
try { try {
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.WH_RECORD_BLOCK_ID), null);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.INVENT_NAME_BLOCK_ID), null);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPKC009().eiMetadata); inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPKC009().eiMetadata);
} catch (PlatException e) { } catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败"); LogUtils.setDetailMsg(inInfo, e, "初始化失败");
...@@ -66,9 +78,13 @@ public class ServiceHPKC009 extends ServiceBase { ...@@ -66,9 +78,13 @@ public class ServiceHPKC009 extends ServiceBase {
@Override @Override
public EiInfo query(EiInfo inInfo) { public EiInfo query(EiInfo inInfo) {
try { try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo); Map queryRow = EiInfoUtils.getFirstRow(inInfo);
queryMap.put("dateType", "MONTH"); String receiptDate = MapUtils.getString(queryRow, "dateProc");
queryRow.put("dateProc", StringUtil.removeSpecifiedCharacter(receiptDate,
StringUtil.DEFAULT_CHARACTER_TO_BE_REMOVED));
inInfo = super.query(inInfo, "HPKC009.query", new HPPZ009()); inInfo = super.query(inInfo, "HPKC009.query", new HPPZ009());
List sum = dao.query("HPKC009.querySum", queryRow);
inInfo.getBlock(EiConstant.resultBlock).set(EiConstant.COLUMN_TOTAL_SUM, sum.get(0));
} catch (Exception e) { } catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败"); LogUtils.setDetailMsg(inInfo, e, "查询失败");
} }
...@@ -89,13 +105,18 @@ public class ServiceHPKC009 extends ServiceBase { ...@@ -89,13 +105,18 @@ public class ServiceHPKC009 extends ServiceBase {
LocalDate nowData = LocalDate.now(); LocalDate nowData = LocalDate.now();
queryMap.put("yesterday", nowData.minusDays(1).format(DateUtils.SHORT_DATE)); queryMap.put("yesterday", nowData.minusDays(1).format(DateUtils.SHORT_DATE));
queryMap.put("beforeDay", nowData.minusDays(2).format(DateUtils.SHORT_DATE)); queryMap.put("beforeDay", nowData.minusDays(2).format(DateUtils.SHORT_DATE));
// 0.清除数据
queryMap.put("dateProc", queryMap.get("yesterday"));
dao.delete(HPSqlConstant.HPKC009.DELETE_BY_TIME, queryMap);
// 1、统计采购库存 // 1、统计采购库存
results.addAll(this.statDayCg(queryMap)); results.addAll(this.statDayCg(queryMap));
// 2、统计生产库存 // 2、统计生产库存
results.addAll(this.statDaySc(queryMap)); results.addAll(this.statDaySc(queryMap));
// 3、统计其他库存 // 3、统计其他库存
results.addAll(this.statDayQt(queryMap)); results.addAll(this.statDayQt(queryMap));
// 4、写入数据库 // 4、设置基础信息
this.setBaseInfo(results);
// 5、写入数据库
DaoUtils.insert("HPKC009.insert", results); DaoUtils.insert("HPKC009.insert", results);
inInfo.setStatus(EiConstant.STATUS_DEFAULT); inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("按天统计成功"); inInfo.setMsg("按天统计成功");
...@@ -113,7 +134,7 @@ public class ServiceHPKC009 extends ServiceBase { ...@@ -113,7 +134,7 @@ public class ServiceHPKC009 extends ServiceBase {
private List<HPKC009> statDayCg(Map queryMap) { private List<HPKC009> statDayCg(Map queryMap) {
Map<String, HPKC009> kc009Map = new HashMap(); Map<String, HPKC009> kc009Map = new HashMap();
// 1.1、期末库存 // 1.1、期末库存
List<HPKC001> aKc001s = dao.query("HPKC001.statDay", new HashMap<>()); List<HPKC001> aItems = dao.query("HPKC001.statDay", new HashMap<>());
// 1.2、收入 // 1.2、收入
queryMap.put("createdTimeFrom", queryMap.get("yesterday") + "000000"); queryMap.put("createdTimeFrom", queryMap.get("yesterday") + "000000");
queryMap.put("createdTimeTo", queryMap.get("yesterday") + "235959"); queryMap.put("createdTimeTo", queryMap.get("yesterday") + "235959");
...@@ -129,9 +150,7 @@ public class ServiceHPKC009 extends ServiceBase { ...@@ -129,9 +150,7 @@ public class ServiceHPKC009 extends ServiceBase {
+ item.getMaterialType() + "#" + item.getMaterialCode() + "#" + item.getMaterialType() + "#" + item.getMaterialCode() + "#"
+ item.getSpec(), item -> item)); + item.getSpec(), item -> item));
// 1.4、期初库存 // 1.4、期初库存
// 取天天的日期 queryMap.put("dateProc", queryMap.get("beforeDay"));
queryMap.put("createdTimeFrom", queryMap.get("beforeDay") + "000000");
queryMap.put("createdTimeTo", queryMap.get("beforeDay") + "235959");
queryMap.put("kcType", HPConstant.KcType.CG); queryMap.put("kcType", HPConstant.KcType.CG);
List<HPKC009> dKc009s = dao.query("HPKC009.query", new HashMap<>()); List<HPKC009> dKc009s = dao.query("HPKC009.query", new HashMap<>());
Map<String, HPKC009> dKc009Map = dKc009s.stream().collect(Collectors.toMap(item -> Map<String, HPKC009> dKc009Map = dKc009s.stream().collect(Collectors.toMap(item ->
...@@ -139,17 +158,19 @@ public class ServiceHPKC009 extends ServiceBase { ...@@ -139,17 +158,19 @@ public class ServiceHPKC009 extends ServiceBase {
+ item.getInventType() + "#" + item.getInventCode() + "#" + item.getInventType() + "#" + item.getInventCode() + "#"
+ item.getSpec(), item -> item)); + item.getSpec(), item -> item));
// 根据期末库存生成收发存对象 // 根据期末库存生成收发存对象
for (HPKC001 aKc001 : aKc001s) { for (HPKC001 aItem : aItems) {
String key = aKc001.getCompanyCode() + "#" + aKc001.getDepCode() + "#" String key = aItem.getCompanyCode() + "#" + aItem.getDepCode() + "#"
+ aKc001.getWhCode() + "#" + aKc001.getMaterialType() + "#" + aItem.getWhCode() + "#" + aItem.getMaterialType() + "#"
+ aKc001.getMaterialCode() + "#" + aKc001.getSpec(); + aItem.getMaterialCode() + "#" + aItem.getSpec();
HPKC009 kc009 = BeanUtils.copy(aKc001, HPKC009.class); HPKC009 kc009 = BeanUtils.copy(aItem, HPKC009.class);
kc009.setInventType(aItem.getMaterialType());
kc009.setInventCode(aItem.getMaterialCode());
kc009.setKcType(HPConstant.KcType.CG); kc009.setKcType(HPConstant.KcType.CG);
kc009.setDateType(CommonConstant.DateType.DAY); kc009.setDateType(CommonConstant.DateType.DAY);
kc009.setDateProc(queryMap.get("yesterday").toString()); kc009.setDateProc(queryMap.get("yesterday").toString());
// 期末 // 期末
kc009.setEndAmount(BigDecimal.valueOf(aKc001.getQuantity())); kc009.setEndAmount(BigDecimal.valueOf(aItem.getQuantity()));
kc009.setEndWeight(aKc001.getWeight()); kc009.setEndWeight(aItem.getWeight());
// 收入 // 收入
HPKC001 bKc001 = bKc001Map.get(key); HPKC001 bKc001 = bKc001Map.get(key);
kc009.setStockinAmount(bKc001 == null ? BigDecimal.ZERO : BigDecimal.valueOf(bKc001.getQuantity())); kc009.setStockinAmount(bKc001 == null ? BigDecimal.ZERO : BigDecimal.valueOf(bKc001.getQuantity()));
...@@ -197,8 +218,7 @@ public class ServiceHPKC009 extends ServiceBase { ...@@ -197,8 +218,7 @@ public class ServiceHPKC009 extends ServiceBase {
item.getCompanyCode() + "#" + item.getDepCode() + "#" + item.getWhCode() + "#" item.getCompanyCode() + "#" + item.getDepCode() + "#" + item.getWhCode() + "#"
+ item.getMatType() + "#" + item.getMatCode(), item -> item)); + item.getMatType() + "#" + item.getMatCode(), item -> item));
// 1.4、期初库存 // 1.4、期初库存
queryMap.put("createdTimeFrom", queryMap.get("beforeDay") + "000000"); queryMap.put("dateProc", queryMap.get("beforeDay"));
queryMap.put("createdTimeTo", queryMap.get("beforeDay") + "235959");
queryMap.put("kcType", HPConstant.KcType.SC); queryMap.put("kcType", HPConstant.KcType.SC);
List<HPKC009> dItems = dao.query("HPKC009.query", new HashMap<>()); List<HPKC009> dItems = dao.query("HPKC009.query", new HashMap<>());
Map<String, HPKC009> dItemMap = dItems.stream().collect(Collectors.toMap(item -> Map<String, HPKC009> dItemMap = dItems.stream().collect(Collectors.toMap(item ->
...@@ -210,6 +230,9 @@ public class ServiceHPKC009 extends ServiceBase { ...@@ -210,6 +230,9 @@ public class ServiceHPKC009 extends ServiceBase {
+ aItem.getWarehouseCode() + "#" + aItem.getMaterialType() + "#" + aItem.getWarehouseCode() + "#" + aItem.getMaterialType() + "#"
+ aItem.getMaterialCode(); + aItem.getMaterialCode();
HPKC009 kc009 = BeanUtils.copy(aItem, HPKC009.class); HPKC009 kc009 = BeanUtils.copy(aItem, HPKC009.class);
kc009.setWhCode(aItem.getWarehouseCode());
kc009.setInventType(aItem.getMaterialType() + "");
kc009.setInventCode(aItem.getMaterialCode());
kc009.setKcType(HPConstant.KcType.SC); kc009.setKcType(HPConstant.KcType.SC);
kc009.setDateType(CommonConstant.DateType.DAY); kc009.setDateType(CommonConstant.DateType.DAY);
kc009.setDateProc(queryMap.get("yesterday").toString()); kc009.setDateProc(queryMap.get("yesterday").toString());
...@@ -263,8 +286,7 @@ public class ServiceHPKC009 extends ServiceBase { ...@@ -263,8 +286,7 @@ public class ServiceHPKC009 extends ServiceBase {
item.getCompanyCode() + "#" + item.getDepCode() + "#" + item.getWhCode() + "#" item.getCompanyCode() + "#" + item.getDepCode() + "#" + item.getWhCode() + "#"
+ item.getMatType() + "#" + item.getMatCode(), item -> item)); + item.getMatType() + "#" + item.getMatCode(), item -> item));
// 1.4、期初库存 // 1.4、期初库存
queryMap.put("createdTimeFrom", queryMap.get("beforeDay") + "000000"); queryMap.put("dateProc", queryMap.get("beforeDay"));
queryMap.put("createdTimeTo", queryMap.get("beforeDay") + "235959");
queryMap.put("kcType", HPConstant.KcType.QT); queryMap.put("kcType", HPConstant.KcType.QT);
List<HPKC009> dItems = dao.query("HPKC009.query", new HashMap<>()); List<HPKC009> dItems = dao.query("HPKC009.query", new HashMap<>());
Map<String, HPKC009> dItemMap = dItems.stream().collect(Collectors.toMap(item -> Map<String, HPKC009> dItemMap = dItems.stream().collect(Collectors.toMap(item ->
...@@ -275,6 +297,8 @@ public class ServiceHPKC009 extends ServiceBase { ...@@ -275,6 +297,8 @@ public class ServiceHPKC009 extends ServiceBase {
String key = aItem.getCompanyCode() + "#" + aItem.getDepCode() + "#" String key = aItem.getCompanyCode() + "#" + aItem.getDepCode() + "#"
+ aItem.getWhCode() + "#" + aItem.getMatType() + "#" + aItem.getMatCode(); + aItem.getWhCode() + "#" + aItem.getMatType() + "#" + aItem.getMatCode();
HPKC009 kc009 = BeanUtils.copy(aItem, HPKC009.class); HPKC009 kc009 = BeanUtils.copy(aItem, HPKC009.class);
kc009.setInventType(aItem.getMatType());
kc009.setInventCode(aItem.getMatCode());
kc009.setKcType(HPConstant.KcType.QT); kc009.setKcType(HPConstant.KcType.QT);
kc009.setDateType(CommonConstant.DateType.DAY); kc009.setDateType(CommonConstant.DateType.DAY);
kc009.setDateProc(queryMap.get("yesterday").toString()); kc009.setDateProc(queryMap.get("yesterday").toString());
...@@ -304,4 +328,28 @@ public class ServiceHPKC009 extends ServiceBase { ...@@ -304,4 +328,28 @@ public class ServiceHPKC009 extends ServiceBase {
} }
return kc009Map.values().stream().collect(Collectors.toList()); return kc009Map.values().stream().collect(Collectors.toList());
} }
/**
* 设置基础信息
*
* @param kc009s
*/
private void setBaseInfo(List<HPKC009> kc009s) {
// 仓库名称
List<String> whCodes = kc009s.stream().map(HPKC009::getWhCode).collect(Collectors.toList());
Map<String, HPPZ007> mapPz007 = HPPZTools.mapPz007(whCodes);
// 存货名称
List<String> inventCodes = kc009s.stream().map(HPKC009::getInventCode).collect(Collectors.toList());
Map<String, THppz004> mapPz004 = HPPZTools.mapPz004(inventCodes);
for (HPKC009 kc009 : kc009s) {
String whCode = kc009.getWhCode();
// 仓库名称
HPPZ007 pz007 = mapPz007 == null ? null : mapPz007.get(whCode);
kc009.setWhName(pz007 == null ? "" : pz007.getWhName());
// 存货名称
THppz004 pz004 = mapPz004 == null ? null : mapPz004.get(whCode);
kc009.setInventName(pz004 == null ? "" : pz004.getInventName());
}
}
} }
...@@ -178,7 +178,7 @@ ...@@ -178,7 +178,7 @@
<isNotEmpty prepend=" AND " property="createdTimeFrom"> <isNotEmpty prepend=" AND " property="createdTimeFrom">
CREATED_TIME BETWEEN #createdTimeFrom# AND #createdTimeTo# CREATED_TIME BETWEEN #createdTimeFrom# AND #createdTimeTo#
</isNotEmpty> </isNotEmpty>
GROUP BY COMPANY_CODE, DEP_CODE, WH_CODE, MATERIAL_TYPE, MATERIAL_CODE GROUP BY COMPANY_CODE, DEP_CODE, WH_CODE, MAT_TYPE, MAT_CODE
</select> </select>
</sqlMap> </sqlMap>
...@@ -41,11 +41,14 @@ ...@@ -41,11 +41,14 @@
<isNotEmpty prepend=" AND " property="depCode"> <isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode# DEP_CODE = #depCode#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="kcType">
KC_TYPE = #kcType#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="dateType"> <isNotEmpty prepend=" AND " property="dateType">
DATE_TYPE = #dateType# DATE_TYPE = #dateType#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="datemonth"> <isNotEmpty prepend=" AND " property="dateProc">
DATEMONTH = #datemonth# DATE_PROC = #dateProc#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="whCode"> <isNotEmpty prepend=" AND " property="whCode">
WH_CODE = #whCode# WH_CODE = #whCode#
...@@ -67,12 +70,6 @@ ...@@ -67,12 +70,6 @@
</isNotEmpty> </isNotEmpty>
</sql> </sql>
<sql id="customCondition">
<isNotEmpty prepend=" AND " property="createdTimeFrom">
CREATED_TIME BETWEEN #createdTimeFrom# AND #createdTimeTo#
</isNotEmpty>
</sql>
<!-- 查询 --> <!-- 查询 -->
<select id="query" resultClass="com.baosight.hpjx.hp.kc.domain.HPKC009"> <select id="query" resultClass="com.baosight.hpjx.hp.kc.domain.HPKC009">
SELECT SELECT
...@@ -80,7 +77,6 @@ ...@@ -80,7 +77,6 @@
FROM ${hpjxSchema}.T_HPKC009 FROM ${hpjxSchema}.T_HPKC009
WHERE 1=1 WHERE 1=1
<include refid="condition"/> <include refid="condition"/>
<include refid="customCondition"/>
<dynamic prepend="ORDER BY"> <dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy"> <isNotEmpty property="orderBy">
$orderBy$ $orderBy$
...@@ -94,7 +90,22 @@ ...@@ -94,7 +90,22 @@
<select id="count" resultClass="int"> <select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hpjxSchema}.T_HPKC009 WHERE 1=1 SELECT COUNT(*) FROM ${hpjxSchema}.T_HPKC009 WHERE 1=1
<include refid="condition"/> <include refid="condition"/>
<include refid="customCondition"/> </select>
<!-- 查询统计 -->
<select id="querySum" resultClass="com.baosight.hpjx.hp.kc.domain.HPKC009">
SELECT
COALESCE(SUM(INIT_AMOUNT), 0) AS "initAmount", <!-- 期初数量 -->
COALESCE(SUM(INIT_WEIGHT), 0) AS "initWeight", <!-- 期初重量 -->
COALESCE(SUM(STOCKIN_AMOUNT), 0) AS "stockinAmount", <!-- 入库数量 -->
COALESCE(SUM(STOCKIN_WEIGHT), 0) AS "stockinWeight", <!-- 入库重量 -->
COALESCE(SUM(STOCKOUT_AMOUNT), 0) AS "stockoutAmount", <!-- 差异数量 -->
COALESCE(SUM(STOCKOUT_WEIGHT), 0) AS "stockoutWeight", <!-- 差异重量 -->
COALESCE(SUM(END_AMOUNT), 0) AS "endAmount", <!-- 期末数量 -->
COALESCE(SUM(END_WEIGHT), 0) AS "endWeight" <!-- 期末重量 -->
FROM ${hpjxSchema}.T_HPKC009
WHERE 1=1
<include refid="condition"/>
</select> </select>
<insert id="insert"> <insert id="insert">
...@@ -115,4 +126,9 @@ ...@@ -115,4 +126,9 @@
DELETE FROM ${hpjxSchema}.T_HPKC009 WHERE ID = #id# DELETE FROM ${hpjxSchema}.T_HPKC009 WHERE ID = #id#
</delete> </delete>
<!-- 按时间删除数据 -->
<delete id="deleteByTime">
DELETE FROM ${hpjxSchema}.T_HPKC009 WHERE DATE_PROC = #dateProc#
</delete>
</sqlMap> </sqlMap>
...@@ -36,6 +36,9 @@ ...@@ -36,6 +36,9 @@
<isNotEmpty prepend=" AND " property="id"> <isNotEmpty prepend=" AND " property="id">
ID = #id# ID = #id#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="inventCodes">
INVENT_CODE IN <iterate close=")" open="(" conjunction="," property="inventCodes">#inventCodes[]#</iterate>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventName"> <isNotEmpty prepend=" AND " property="inventName">
INVENT_NAME = #inventName# INVENT_NAME = #inventName#
</isNotEmpty> </isNotEmpty>
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd"> <!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd">
<!-- table information
Generate time : 2024-01-10 15:43:22
Version : 1.0
tableName :hpjx.t_hppz006
ID BIGINT NOT NULL primarykey,
COMPANY_CODE VARCHAR NOT NULL,
INVENT_NAME VARCHAR NOT NULL,
INVENT_CODE VARCHAR NOT NULL,
INVENT_TYPE TINYINT NOT NULL,
STATUS TINYINT NOT NULL,
SPEC VARCHAR NOT NULL,
LENGTH VARCHAR NOT NULL,
WIDE VARCHAR NOT NULL,
THICK VARCHAR NOT NULL,
MATERIAL VARCHAR NOT NULL,
COEFFICIENT VARCHAR NOT NULL,
UNIT VARCHAR NOT NULL,
CREATED_BY VARCHAR,
CREATED_TIME VARCHAR,
UPDATED_BY VARCHAR,
UPDATED_TIME VARCHAR,
DEP_CODE VARCHAR
-->
<sqlMap namespace="HPPZ006"> <sqlMap namespace="HPPZ006">
<select id="query" parameterClass="java.util.HashMap" <select id="query" parameterClass="java.util.HashMap"
...@@ -77,63 +54,6 @@ ...@@ -77,63 +54,6 @@
</isNotEmpty> </isNotEmpty>
</select> </select>
<!--
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventName">
INVENT_NAME = #inventName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventCode">
INVENT_CODE = #inventCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventType">
INVENT_TYPE = #inventType#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="status">
STATUS = #status#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="spec">
SPEC = #spec#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="length">
LENGTH = #length#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="wide">
WIDE = #wide#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="thick">
THICK = #thick#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="material">
MATERIAL = #material#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="coefficient">
COEFFICIENT = #coefficient#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="unit">
UNIT = #unit#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdBy">
CREATED_BY = #createdBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdTime">
CREATED_TIME = #createdTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedBy">
UPDATED_BY = #updatedBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedTime">
UPDATED_TIME = #updatedTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
-->
<insert id="insert"> <insert id="insert">
INSERT INTO hpjx.t_hppz006 ( INSERT INTO hpjx.t_hppz006 (
COMPANY_CODE, <!-- 企业编码 预留 --> COMPANY_CODE, <!-- 企业编码 预留 -->
......
...@@ -37,6 +37,9 @@ ...@@ -37,6 +37,9 @@
<isNotEmpty prepend=" AND " property="whCode"> <isNotEmpty prepend=" AND " property="whCode">
WH_CODE = #whCode# WH_CODE = #whCode#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="whCodes">
WH_CODE IN <iterate close=")" open="(" conjunction="," property="whCodes">#whCodes[]#</iterate>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="whName"> <isNotEmpty prepend=" AND " property="whName">
WH_NAME LIKE CONCAT('%',CONCAT(#whName#),'%') WH_NAME LIKE CONCAT('%',CONCAT(#whName#),'%')
</isNotEmpty> </isNotEmpty>
......
...@@ -2,13 +2,17 @@ package com.baosight.hpjx.hp.pz.tools; ...@@ -2,13 +2,17 @@ package com.baosight.hpjx.hp.pz.tools;
import com.baosight.hpjx.core.constant.CommonConstant; import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoBase; import com.baosight.hpjx.core.dao.DaoBase;
import com.baosight.hpjx.hp.pz.domain.HPPZ007;
import com.baosight.hpjx.hp.pz.domain.HPPZ009; import com.baosight.hpjx.hp.pz.domain.HPPZ009;
import com.baosight.hpjx.hp.pz.domain.THppz004;
import com.baosight.hpjx.hp.pz.domain.THppz006;
import com.baosight.hpjx.util.AssertUtils; import com.baosight.hpjx.util.AssertUtils;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors;
/** /**
* @author:songx * @author:songx
...@@ -17,6 +21,64 @@ import java.util.Map; ...@@ -17,6 +21,64 @@ import java.util.Map;
public class HPPZTools { public class HPPZTools {
/** /**
* 查询存货信息
*
* @param inventCodes
* @return
*/
public static List<THppz004> listPz004(List<String> inventCodes) {
if (CollectionUtils.isEmpty(inventCodes)) {
return null;
}
Map queryMap = new HashMap();
queryMap.put("inventCodes", inventCodes);
return DaoBase.getInstance().query("HPPZ004.query", queryMap);
}
/**
* 查询存货信息
*
* @param inventCodes
* @return
*/
public static Map<String, THppz004> mapPz004(List<String> inventCodes) {
List<THppz004> pz004s = listPz004(inventCodes);
if (CollectionUtils.isEmpty(pz004s)) {
return null;
}
return pz004s.stream().collect(Collectors.toMap(THppz004::getInventCode, item -> item));
}
/**
* 查询仓库信息
*
* @param whCodes
* @return
*/
public static List<HPPZ007> listPz007(List<String> whCodes) {
if (CollectionUtils.isEmpty(whCodes)) {
return null;
}
Map queryMap = new HashMap();
queryMap.put("whCodes", whCodes);
return DaoBase.getInstance().query("HPPZ007.query", queryMap);
}
/**
* 查询仓库信息
*
* @param whCodes
* @return
*/
public static Map<String, HPPZ007> mapPz007(List<String> whCodes) {
List<HPPZ007> pz007s = listPz007(whCodes);
if (CollectionUtils.isEmpty(pz007s)) {
return null;
}
return pz007s.stream().collect(Collectors.toMap(HPPZ007::getWhCode, item -> item));
}
/**
* 查询企业信息 * 查询企业信息
* *
* @param companyCode * @param companyCode
......
$(function () {
IPLATUI.EFGrid.result = {
pageable: {
pageSize: 20,
pageSizes: [10, 20, 50, 70, 100],
},
}
// 查询
$("#QUERY").on("click", query);
});
/**
* 页面加载时执行
*/
$(window).load(function () {
// 查询
query();
});
/**
* 查询
*/
let query = function () {
resultGrid.dataSource.page(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:EFDatePicker ename="inqu_status-0-dateProc" cname="日期:"
role="date" format="yyyy-MM-dd" readonly="true"/>
<EF:EFSelect ename="inqu_status-0-inventType" cname="存货类型:" filter="contains" defaultValue="">
<EF:EFOption label="请选择" value=""/>
<EF:EFCodeOption codeName="hpjx.hpkc.inventType"/>
</EF:EFSelect>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="记录集">
<EF:EFGrid blockId="result" autoDraw="override">
<EF:EFColumn ename="id" cname="主键" hidden="true"/>
<EF:EFComboColumn cname="库存类型" ename="kcType" enable="false" width="80" align="center">
<EF:EFCodeOption codeName="hpjx.hpkc.kcType"/>
</EF:EFComboColumn>
<EF:EFComboColumn cname="日期类型" ename="dateType" enable="false" width="80" align="center">
<EF:EFCodeOption codeName="hpjx.hpkc.dateType"/>
</EF:EFComboColumn>
<EF:EFColumn cname="日期" ename="dateProc" enable="false" width="90" align="center"/>
<EF:EFComboColumn cname="仓库名称" ename="whCode" enable="false" columnTemplate="#=textField#"
itemTemplate="#=textField#" blockName="wh_record_block_id"
textField="textField" valueField="valueField"
align="center" filter="contains" width="100">
</EF:EFComboColumn>
<EF:EFComboColumn cname="存货类型" ename="inventType" enable="false" width="90" align="center">
<EF:EFCodeOption codeName="hpjx.hpkc.inventType"/>
</EF:EFComboColumn>
<EF:EFComboColumn cname="存货名称" ename="inventCode" enable="false" columnTemplate="#=textField#"
itemTemplate="#=textField#" blockName="invent_name_block_id"
textField="textField" valueField="valueField"
align="center" filter="contains" width="100">
</EF:EFComboColumn>
<EF:EFColumn cname="规格" ename="spec" enable="false" width="120"/>
<EF:EFColumn cname="期初数量" ename="initAmount" enable="false" width="90" align="right" format="{0:N3}"
sumType="all"/>
<EF:EFColumn cname="期初重量" ename="initWeight" enable="false" width="90" align="right" format="{0:N3}"
sumType="all"/>
<EF:EFColumn cname="入库数量" ename="stockinAmount" enable="false" width="90" align="right" format="{0:N3}"
sumType="all"/>
<EF:EFColumn cname="入库重量" ename="stockinWeight" enable="false" width="90" align="right" format="{0:N3}"
sumType="all"/>
<EF:EFColumn cname="出库数量" ename="stockoutAmount" enable="false" width="90" align="right" format="{0:N3}"
sumType="all"/>
<EF:EFColumn cname="出库重量" ename="stockoutWeight" enable="false" width="90" align="right" format="{0:N3}"
sumType="all"/>
<EF:EFColumn cname="期末数量" ename="endAmount" enable="false" width="90" align="right" format="{0:N3}"
sumType="all"/>
<EF:EFColumn cname="期末重量" ename="endWeight" enable="false" width="90" align="right" format="{0:N3}"
sumType="all"/>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
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