给系统参数表增加库存审核启用标记

This commit is contained in:
季圣华
2023-03-16 22:41:07 +08:00
parent 3cfadbc031
commit eefb72e16b
10 changed files with 163 additions and 15 deletions

View File

@@ -31,6 +31,8 @@ public class SystemConfig {
private String amountApprovalFlag;
private String stockApprovalFlag;
private Long tenantId;
private String deleteFlag;
@@ -155,6 +157,14 @@ public class SystemConfig {
this.amountApprovalFlag = amountApprovalFlag == null ? null : amountApprovalFlag.trim();
}
public String getStockApprovalFlag() {
return stockApprovalFlag;
}
public void setStockApprovalFlag(String stockApprovalFlag) {
this.stockApprovalFlag = stockApprovalFlag == null ? null : stockApprovalFlag.trim();
}
public Long getTenantId() {
return tenantId;
}

View File

@@ -1144,6 +1144,76 @@ public class SystemConfigExample {
return (Criteria) this;
}
public Criteria andStockApprovalFlagIsNull() {
addCriterion("stock_approval_flag is null");
return (Criteria) this;
}
public Criteria andStockApprovalFlagIsNotNull() {
addCriterion("stock_approval_flag is not null");
return (Criteria) this;
}
public Criteria andStockApprovalFlagEqualTo(String value) {
addCriterion("stock_approval_flag =", value, "stockApprovalFlag");
return (Criteria) this;
}
public Criteria andStockApprovalFlagNotEqualTo(String value) {
addCriterion("stock_approval_flag <>", value, "stockApprovalFlag");
return (Criteria) this;
}
public Criteria andStockApprovalFlagGreaterThan(String value) {
addCriterion("stock_approval_flag >", value, "stockApprovalFlag");
return (Criteria) this;
}
public Criteria andStockApprovalFlagGreaterThanOrEqualTo(String value) {
addCriterion("stock_approval_flag >=", value, "stockApprovalFlag");
return (Criteria) this;
}
public Criteria andStockApprovalFlagLessThan(String value) {
addCriterion("stock_approval_flag <", value, "stockApprovalFlag");
return (Criteria) this;
}
public Criteria andStockApprovalFlagLessThanOrEqualTo(String value) {
addCriterion("stock_approval_flag <=", value, "stockApprovalFlag");
return (Criteria) this;
}
public Criteria andStockApprovalFlagLike(String value) {
addCriterion("stock_approval_flag like", value, "stockApprovalFlag");
return (Criteria) this;
}
public Criteria andStockApprovalFlagNotLike(String value) {
addCriterion("stock_approval_flag not like", value, "stockApprovalFlag");
return (Criteria) this;
}
public Criteria andStockApprovalFlagIn(List<String> values) {
addCriterion("stock_approval_flag in", values, "stockApprovalFlag");
return (Criteria) this;
}
public Criteria andStockApprovalFlagNotIn(List<String> values) {
addCriterion("stock_approval_flag not in", values, "stockApprovalFlag");
return (Criteria) this;
}
public Criteria andStockApprovalFlagBetween(String value1, String value2) {
addCriterion("stock_approval_flag between", value1, value2, "stockApprovalFlag");
return (Criteria) this;
}
public Criteria andStockApprovalFlagNotBetween(String value1, String value2) {
addCriterion("stock_approval_flag not between", value1, value2, "stockApprovalFlag");
return (Criteria) this;
}
public Criteria andTenantIdIsNull() {
addCriterion("tenant_id is null");
return (Criteria) this;

View File

@@ -125,18 +125,21 @@ public interface DepotItemMapperEx {
BigDecimal getStockCheckSumByDepotList(
@Param("depotList") List<Long> depotList,
@Param("mId") Long mId,
@Param("stockApprovalFlag") Boolean stockApprovalFlag,
@Param("beginTime") String beginTime,
@Param("endTime") String endTime);
DepotItemVo4Stock getSkuStockByParamWithDepotList(
@Param("depotList") List<Long> depotList,
@Param("meId") Long meId,
@Param("stockApprovalFlag") Boolean stockApprovalFlag,
@Param("beginTime") String beginTime,
@Param("endTime") String endTime);
DepotItemVo4Stock getStockByParamWithDepotList(
@Param("depotList") List<Long> depotList,
@Param("mId") Long mId,
@Param("stockApprovalFlag") Boolean stockApprovalFlag,
@Param("beginTime") String beginTime,
@Param("endTime") String endTime);

View File

@@ -563,6 +563,15 @@ public class DepotHeadService {
DepotHeadExample example = new DepotHeadExample();
example.createCriteria().andIdIn(dhIds);
result = depotHeadMapper.updateByExampleSelective(depotHead, example);
//更新当前库存(此时开启了库存审核)
if(systemConfigService.getStockApprovalFlag()) {
for(Long dhId: dhIds) {
List<DepotItem> list = depotItemService.getListByHeaderId(dhId);
for (DepotItem depotItem : list) {
depotItemService.updateCurrentStock(depotItem);
}
}
}
}
return result;
}

View File

@@ -873,8 +873,10 @@ public class DepotItemService {
* @return
*/
public BigDecimal getSkuStockByParam(Long depotId, Long meId, String beginTime, String endTime) throws Exception {
//获取库存审核开关
Boolean stockApprovalFlag = systemConfigService.getStockApprovalFlag();
List<Long> depotList = depotService.parseDepotList(depotId);
DepotItemVo4Stock stockObj = depotItemMapperEx.getSkuStockByParamWithDepotList(depotList, meId, beginTime, endTime);
DepotItemVo4Stock stockObj = depotItemMapperEx.getSkuStockByParamWithDepotList(depotList, meId, stockApprovalFlag, beginTime, endTime);
BigDecimal stockSum = BigDecimal.ZERO;
if(stockObj!=null) {
BigDecimal inTotal = stockObj.getInTotal();
@@ -912,12 +914,14 @@ public class DepotItemService {
* @param endTime
* @return
*/
public BigDecimal getStockByParamWithDepotList(List<Long> depotList, Long mId, String beginTime, String endTime){
public BigDecimal getStockByParamWithDepotList(List<Long> depotList, Long mId, String beginTime, String endTime) throws Exception {
//获取库存审核开关
Boolean stockApprovalFlag = systemConfigService.getStockApprovalFlag();
//初始库存
BigDecimal initStock = materialService.getInitStockByMidAndDepotList(depotList, mId);
//盘点复盘后数量的变动
BigDecimal stockCheckSum = depotItemMapperEx.getStockCheckSumByDepotList(depotList, mId, beginTime, endTime);
DepotItemVo4Stock stockObj = depotItemMapperEx.getStockByParamWithDepotList(depotList, mId, beginTime, endTime);
BigDecimal stockCheckSum = depotItemMapperEx.getStockCheckSumByDepotList(depotList, mId, stockApprovalFlag, beginTime, endTime);
DepotItemVo4Stock stockObj = depotItemMapperEx.getStockByParamWithDepotList(depotList, mId, stockApprovalFlag, beginTime, endTime);
BigDecimal stockSum = BigDecimal.ZERO;
if(stockObj!=null) {
BigDecimal inTotal = stockObj.getInTotal();
@@ -942,13 +946,15 @@ public class DepotItemService {
* @param endTime
* @return
*/
public Map<String, BigDecimal> getIntervalMapByParamWithDepotList(List<Long> depotList, Long mId, String beginTime, String endTime){
public Map<String, BigDecimal> getIntervalMapByParamWithDepotList(List<Long> depotList, Long mId, String beginTime, String endTime) throws Exception {
//获取库存审核开关
Boolean stockApprovalFlag = systemConfigService.getStockApprovalFlag();
Map<String,BigDecimal> intervalMap = new HashMap<>();
BigDecimal inSum = BigDecimal.ZERO;
BigDecimal outSum = BigDecimal.ZERO;
//盘点复盘后数量的变动
BigDecimal stockCheckSum = depotItemMapperEx.getStockCheckSumByDepotList(depotList, mId, beginTime, endTime);
DepotItemVo4Stock stockObj = depotItemMapperEx.getStockByParamWithDepotList(depotList, mId, beginTime, endTime);
BigDecimal stockCheckSum = depotItemMapperEx.getStockCheckSumByDepotList(depotList, mId, stockApprovalFlag, beginTime, endTime);
DepotItemVo4Stock stockObj = depotItemMapperEx.getStockByParamWithDepotList(depotList, mId, stockApprovalFlag, beginTime, endTime);
if(stockObj!=null) {
BigDecimal inTotal = stockObj.getInTotal();
BigDecimal transfInTotal = stockObj.getTransfInTotal();

View File

@@ -217,6 +217,23 @@ public class SystemConfigService {
return amountApprovalFlag;
}
/**
* 获取库存审核开关
* @return
* @throws Exception
*/
public boolean getStockApprovalFlag() throws Exception {
boolean amountApprovalFlag = false;
List<SystemConfig> list = getSystemConfig();
if(list.size()>0) {
String flag = list.get(0).getStockApprovalFlag();
if(("1").equals(flag)) {
amountApprovalFlag = true;
}
}
return amountApprovalFlag;
}
/**
* 获取多级审核开关
* @return

View File

@@ -574,6 +574,9 @@
#{item}
</foreach>
</if>
<if test="stockApprovalFlag">
and dh.status = '1'
</if>
<if test="beginTime != null">
and dh.oper_time &gt;= #{beginTime}
</if>
@@ -601,6 +604,9 @@
and ifnull(dh.delete_flag,'0') !='1'
and di.material_extend_id=#{meId}
and ifnull(di.sku,'') !=''
<if test="stockApprovalFlag">
and dh.status = '1'
</if>
<if test="beginTime != null">
and dh.oper_time &gt;= #{beginTime}
</if>
@@ -625,6 +631,9 @@
where 1=1
and ifnull(dh.delete_flag,'0') !='1'
and di.material_id=#{mId}
<if test="stockApprovalFlag">
and dh.status = '1'
</if>
<if test="beginTime != null">
and dh.oper_time &gt;= #{beginTime}
</if>

View File

@@ -17,6 +17,7 @@
<result column="multi_level_approval_flag" jdbcType="VARCHAR" property="multiLevelApprovalFlag" />
<result column="multi_bill_type" jdbcType="VARCHAR" property="multiBillType" />
<result column="amount_approval_flag" jdbcType="VARCHAR" property="amountApprovalFlag" />
<result column="stock_approval_flag" jdbcType="VARCHAR" property="stockApprovalFlag" />
<result column="tenant_id" jdbcType="BIGINT" property="tenantId" />
<result column="delete_flag" jdbcType="VARCHAR" property="deleteFlag" />
</resultMap>
@@ -81,7 +82,8 @@
<sql id="Base_Column_List">
id, company_name, company_contacts, company_address, company_tel, company_fax, company_post_code,
sale_agreement, depot_flag, customer_flag, minus_stock_flag, purchase_by_sale_flag,
multi_level_approval_flag, multi_bill_type, amount_approval_flag, tenant_id, delete_flag
multi_level_approval_flag, multi_bill_type, amount_approval_flag, stock_approval_flag,
tenant_id, delete_flag
</sql>
<select id="selectByExample" parameterType="com.jsh.erp.datasource.entities.SystemConfigExample" resultMap="BaseResultMap">
select
@@ -119,15 +121,15 @@
company_post_code, sale_agreement, depot_flag,
customer_flag, minus_stock_flag, purchase_by_sale_flag,
multi_level_approval_flag, multi_bill_type,
amount_approval_flag, tenant_id, delete_flag
)
amount_approval_flag, stock_approval_flag,
tenant_id, delete_flag)
values (#{id,jdbcType=BIGINT}, #{companyName,jdbcType=VARCHAR}, #{companyContacts,jdbcType=VARCHAR},
#{companyAddress,jdbcType=VARCHAR}, #{companyTel,jdbcType=VARCHAR}, #{companyFax,jdbcType=VARCHAR},
#{companyPostCode,jdbcType=VARCHAR}, #{saleAgreement,jdbcType=VARCHAR}, #{depotFlag,jdbcType=VARCHAR},
#{customerFlag,jdbcType=VARCHAR}, #{minusStockFlag,jdbcType=VARCHAR}, #{purchaseBySaleFlag,jdbcType=VARCHAR},
#{multiLevelApprovalFlag,jdbcType=VARCHAR}, #{multiBillType,jdbcType=VARCHAR},
#{amountApprovalFlag,jdbcType=VARCHAR}, #{tenantId,jdbcType=BIGINT}, #{deleteFlag,jdbcType=VARCHAR}
)
#{amountApprovalFlag,jdbcType=VARCHAR}, #{stockApprovalFlag,jdbcType=VARCHAR},
#{tenantId,jdbcType=BIGINT}, #{deleteFlag,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.jsh.erp.datasource.entities.SystemConfig">
insert into jsh_system_config
@@ -177,6 +179,9 @@
<if test="amountApprovalFlag != null">
amount_approval_flag,
</if>
<if test="stockApprovalFlag != null">
stock_approval_flag,
</if>
<if test="tenantId != null">
tenant_id,
</if>
@@ -230,6 +235,9 @@
<if test="amountApprovalFlag != null">
#{amountApprovalFlag,jdbcType=VARCHAR},
</if>
<if test="stockApprovalFlag != null">
#{stockApprovalFlag,jdbcType=VARCHAR},
</if>
<if test="tenantId != null">
#{tenantId,jdbcType=BIGINT},
</if>
@@ -292,6 +300,9 @@
<if test="record.amountApprovalFlag != null">
amount_approval_flag = #{record.amountApprovalFlag,jdbcType=VARCHAR},
</if>
<if test="record.stockApprovalFlag != null">
stock_approval_flag = #{record.stockApprovalFlag,jdbcType=VARCHAR},
</if>
<if test="record.tenantId != null">
tenant_id = #{record.tenantId,jdbcType=BIGINT},
</if>
@@ -320,6 +331,7 @@
multi_level_approval_flag = #{record.multiLevelApprovalFlag,jdbcType=VARCHAR},
multi_bill_type = #{record.multiBillType,jdbcType=VARCHAR},
amount_approval_flag = #{record.amountApprovalFlag,jdbcType=VARCHAR},
stock_approval_flag = #{record.stockApprovalFlag,jdbcType=VARCHAR},
tenant_id = #{record.tenantId,jdbcType=BIGINT},
delete_flag = #{record.deleteFlag,jdbcType=VARCHAR}
<if test="_parameter != null">
@@ -371,6 +383,9 @@
<if test="amountApprovalFlag != null">
amount_approval_flag = #{amountApprovalFlag,jdbcType=VARCHAR},
</if>
<if test="stockApprovalFlag != null">
stock_approval_flag = #{stockApprovalFlag,jdbcType=VARCHAR},
</if>
<if test="tenantId != null">
tenant_id = #{tenantId,jdbcType=BIGINT},
</if>
@@ -396,6 +411,7 @@
multi_level_approval_flag = #{multiLevelApprovalFlag,jdbcType=VARCHAR},
multi_bill_type = #{multiBillType,jdbcType=VARCHAR},
amount_approval_flag = #{amountApprovalFlag,jdbcType=VARCHAR},
stock_approval_flag = #{stockApprovalFlag,jdbcType=VARCHAR},
tenant_id = #{tenantId,jdbcType=BIGINT},
delete_flag = #{deleteFlag,jdbcType=VARCHAR}
where id = #{id,jdbcType=BIGINT}