优化库存逻辑
This commit is contained in:
@@ -28,6 +28,9 @@
|
|||||||
#bill .allocation_out{
|
#bill .allocation_out{
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
#bill .stock_check_replay{
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
#bill .gift_recharge{
|
#bill .gift_recharge{
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -140,6 +140,21 @@
|
|||||||
$("#bill .allocation_out").show();
|
$("#bill .allocation_out").show();
|
||||||
tableString = $(".allocation_out").html();
|
tableString = $(".allocation_out").html();
|
||||||
}
|
}
|
||||||
|
else if(listSubType == "组装单") {
|
||||||
|
billType = "material";
|
||||||
|
$("#bill .allocation_out").show();
|
||||||
|
tableString = $(".allocation_out").html();
|
||||||
|
}
|
||||||
|
else if(listSubType == "拆卸单") {
|
||||||
|
billType = "material";
|
||||||
|
$("#bill .allocation_out").show();
|
||||||
|
tableString = $(".allocation_out").html();
|
||||||
|
}
|
||||||
|
else if(listSubType == "盘点复盘") {
|
||||||
|
billType = "material";
|
||||||
|
$("#bill .stock_check_replay").show();
|
||||||
|
tableString = $(".stock_check_replay").html();
|
||||||
|
}
|
||||||
else if(listSubType == "收入") {
|
else if(listSubType == "收入") {
|
||||||
billType = "account";
|
billType = "account";
|
||||||
payTypeTitle = "收入项目";
|
payTypeTitle = "收入项目";
|
||||||
@@ -373,6 +388,9 @@
|
|||||||
else if(listSubType == "调拨出库") {
|
else if(listSubType == "调拨出库") {
|
||||||
tableString = $(".allocation_out").html();
|
tableString = $(".allocation_out").html();
|
||||||
}
|
}
|
||||||
|
else if(listSubType == "盘点复盘") {
|
||||||
|
tableString = $(".stock_check_replay").html();
|
||||||
|
}
|
||||||
else if(listSubType == "收入") {
|
else if(listSubType == "收入") {
|
||||||
tableString = $(".item_in").html();
|
tableString = $(".item_in").html();
|
||||||
}
|
}
|
||||||
@@ -408,7 +426,8 @@
|
|||||||
depotHeadName = "仓库名称";
|
depotHeadName = "仓库名称";
|
||||||
}
|
}
|
||||||
var isShowTaxColumn = false; //是否显示税率相关的列,true为隐藏,false为显示
|
var isShowTaxColumn = false; //是否显示税率相关的列,true为隐藏,false为显示
|
||||||
if(listSubType == "调拨出库" || listSubType == "其它出库" || listSubType == "其它入库" || listSubType == "零售出库" || listSubType == "零售退货入库"){
|
if(listSubType == "调拨出库" || listSubType == "其它出库" || listSubType == "其它入库" ||
|
||||||
|
listSubType == "零售出库" || listSubType == "零售退货入库" || listSubType == "盘点复盘"){
|
||||||
isShowTaxColumn = true; //隐藏
|
isShowTaxColumn = true; //隐藏
|
||||||
}
|
}
|
||||||
var isShowMaterialTypeColumn = true; //是否显示商品类型相关的列,true为隐藏,false为显示
|
var isShowMaterialTypeColumn = true; //是否显示商品类型相关的列,true为隐藏,false为显示
|
||||||
|
|||||||
@@ -559,6 +559,41 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
<!--盘点复盘-->
|
||||||
|
<div class="stock_check_replay" style="width:1100px;padding:10px 20px;top:70px"
|
||||||
|
closed="true" modal="true" cache="false" collapsible="false" closable="true">
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<td style="width:70px;">单据日期:</td>
|
||||||
|
<td style="padding:5px;width:130px;">
|
||||||
|
<span class="OperTimeShow"></span>
|
||||||
|
</td>
|
||||||
|
<td style="width:80px;">单据编号:</td>
|
||||||
|
<td style="padding:5px;width:140px;">
|
||||||
|
<span class="NumberShow"></span>
|
||||||
|
</td>
|
||||||
|
<td style="width:70px;">关联订单:</td>
|
||||||
|
<td style="padding:5px;width:130px;">
|
||||||
|
<span class="LinkNumberShow"></span>
|
||||||
|
</td>
|
||||||
|
<td style="width:60px;"></td>
|
||||||
|
<td style="padding:5px;width:130px;"></td>
|
||||||
|
<td style="width:100px;"></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="9" style="width: 1130px;">
|
||||||
|
<!-- 商品列表table -->
|
||||||
|
<table class="materialDataShow" style="top:100px;border-bottom-color:#FFFFFF"></table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td style="width:60px;">单据备注:</td>
|
||||||
|
<td colspan="8" style="height:35px;">
|
||||||
|
<span class="RemarkShow" style="width: 1070px; height:35px;"></span>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
<!--收入单-->
|
<!--收入单-->
|
||||||
<div class="item_in" style="width:1300px;padding:10px 20px;top:20px"
|
<div class="item_in" style="width:1300px;padding:10px 20px;top:20px"
|
||||||
closed="true" modal="true" cache="false" collapsible="false" closable="true">
|
closed="true" modal="true" cache="false" collapsible="false" closable="true">
|
||||||
|
|||||||
@@ -73,7 +73,13 @@ public class DepotItemController {
|
|||||||
for (DepotItemVo4DetailByTypeAndMId d: list) {
|
for (DepotItemVo4DetailByTypeAndMId d: list) {
|
||||||
JSONObject item = new JSONObject();
|
JSONObject item = new JSONObject();
|
||||||
item.put("Number", d.getNumber()); //商品编号
|
item.put("Number", d.getNumber()); //商品编号
|
||||||
item.put("Type", d.getNewtype()); //进出类型
|
String type = d.getType();
|
||||||
|
String subType = d.getSubType();
|
||||||
|
if(("其它").equals(type)) {
|
||||||
|
item.put("Type", subType); //进出类型
|
||||||
|
} else {
|
||||||
|
item.put("Type", subType + type); //进出类型
|
||||||
|
}
|
||||||
item.put("BasicNumber", d.getBnum()); //数量
|
item.put("BasicNumber", d.getBnum()); //数量
|
||||||
item.put("OperTime", d.getOtime().getTime()); //时间
|
item.put("OperTime", d.getOtime().getTime()); //时间
|
||||||
dataArray.add(item);
|
dataArray.add(item);
|
||||||
|
|||||||
@@ -7,7 +7,9 @@ public class DepotItemVo4DetailByTypeAndMId {
|
|||||||
|
|
||||||
private String number;
|
private String number;
|
||||||
|
|
||||||
private String newtype;
|
private String type;
|
||||||
|
|
||||||
|
private String subType;
|
||||||
|
|
||||||
private BigDecimal bnum;
|
private BigDecimal bnum;
|
||||||
|
|
||||||
@@ -21,12 +23,20 @@ public class DepotItemVo4DetailByTypeAndMId {
|
|||||||
this.number = number;
|
this.number = number;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getNewtype() {
|
public String getType() {
|
||||||
return newtype;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setNewtype(String newtype) {
|
public void setType(String type) {
|
||||||
this.newtype = newtype;
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSubType() {
|
||||||
|
return subType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSubType(String subType) {
|
||||||
|
this.subType = subType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getBnum() {
|
public BigDecimal getBnum() {
|
||||||
|
|||||||
@@ -70,6 +70,12 @@ public interface DepotItemMapperEx {
|
|||||||
@Param("subType") String subType,
|
@Param("subType") String subType,
|
||||||
@Param("MonthTime") String MonthTime);
|
@Param("MonthTime") String MonthTime);
|
||||||
|
|
||||||
|
BigDecimal getStockCheckSum(
|
||||||
|
@Param("depotId") Long depotId,
|
||||||
|
@Param("mId") Long mId,
|
||||||
|
@Param("beginTime") String beginTime,
|
||||||
|
@Param("endTime") String endTime);
|
||||||
|
|
||||||
DepotItemVo4Stock getStockByParam(
|
DepotItemVo4Stock getStockByParam(
|
||||||
@Param("depotId") Long depotId,
|
@Param("depotId") Long depotId,
|
||||||
@Param("mId") Long mId,
|
@Param("mId") Long mId,
|
||||||
|
|||||||
@@ -647,10 +647,12 @@ public class DepotItemService {
|
|||||||
public BigDecimal getStockByParam(Long depotId, Long mId, String beginTime, String endTime, Long tenantId){
|
public BigDecimal getStockByParam(Long depotId, Long mId, String beginTime, String endTime, Long tenantId){
|
||||||
//初始库存
|
//初始库存
|
||||||
BigDecimal initStock = materialService.getInitStockByMid(depotId, mId);
|
BigDecimal initStock = materialService.getInitStockByMid(depotId, mId);
|
||||||
|
//盘点复盘后数量的变动
|
||||||
|
BigDecimal stockCheckSum = depotItemMapperEx.getStockCheckSum(depotId, mId, beginTime, endTime);
|
||||||
DepotItemVo4Stock stockObj = depotItemMapperEx.getStockByParam(depotId, mId, beginTime, endTime, tenantId);
|
DepotItemVo4Stock stockObj = depotItemMapperEx.getStockByParam(depotId, mId, beginTime, endTime, tenantId);
|
||||||
BigDecimal intNum = stockObj.getInNum();
|
BigDecimal intNum = stockObj.getInNum();
|
||||||
BigDecimal outNum = stockObj.getOutNum();
|
BigDecimal outNum = stockObj.getOutNum();
|
||||||
return initStock.add(intNum).subtract(outNum);
|
return initStock.add(intNum).subtract(outNum).add(stockCheckSum);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -4,8 +4,9 @@
|
|||||||
|
|
||||||
<resultMap id="DetailByTypeAndMIdResultMap" type="com.jsh.erp.datasource.entities.DepotItemVo4DetailByTypeAndMId">
|
<resultMap id="DetailByTypeAndMIdResultMap" type="com.jsh.erp.datasource.entities.DepotItemVo4DetailByTypeAndMId">
|
||||||
<result column="Number" jdbcType="VARCHAR" property="number" />
|
<result column="Number" jdbcType="VARCHAR" property="number" />
|
||||||
<result column="newType" jdbcType="VARCHAR" property="newtype" />
|
<result column="Type" jdbcType="VARCHAR" property="type" />
|
||||||
<result column="b_num" jdbcType="DECIMAL" property="bnum" />
|
<result column="SubType" jdbcType="VARCHAR" property="subType" />
|
||||||
|
<result column="b_num" jdbcType="BIGINT" property="bnum" />
|
||||||
<result column="oTime" jdbcType="TIMESTAMP" property="otime" />
|
<result column="oTime" jdbcType="TIMESTAMP" property="otime" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
@@ -96,7 +97,7 @@
|
|||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="findDetailByTypeAndMaterialIdList" parameterType="com.jsh.erp.datasource.entities.DepotItemExample" resultMap="DetailByTypeAndMIdResultMap">
|
<select id="findDetailByTypeAndMaterialIdList" parameterType="com.jsh.erp.datasource.entities.DepotItemExample" resultMap="DetailByTypeAndMIdResultMap">
|
||||||
select dh.Number,concat(dh.SubType,dh.Type) as newType,
|
select dh.Number,dh.Type,dh.SubType,
|
||||||
case
|
case
|
||||||
when type='入库' then ifnull(di.BasicNumber,0)
|
when type='入库' then ifnull(di.BasicNumber,0)
|
||||||
when type='出库' then 0-di.BasicNumber
|
when type='出库' then 0-di.BasicNumber
|
||||||
@@ -104,6 +105,7 @@
|
|||||||
when dh.SubType='组装单' and di.MType='普通子件' then 0-di.BasicNumber
|
when dh.SubType='组装单' and di.MType='普通子件' then 0-di.BasicNumber
|
||||||
when dh.SubType='拆卸单' and di.MType='普通子件' then ifnull(di.BasicNumber,0)
|
when dh.SubType='拆卸单' and di.MType='普通子件' then ifnull(di.BasicNumber,0)
|
||||||
when dh.SubType='拆卸单' and di.MType='组合件' then 0-di.BasicNumber
|
when dh.SubType='拆卸单' and di.MType='组合件' then 0-di.BasicNumber
|
||||||
|
when dh.SubType='盘点复盘' then ifnull(di.BasicNumber,0)
|
||||||
else 0
|
else 0
|
||||||
end
|
end
|
||||||
as b_num,
|
as b_num,
|
||||||
@@ -112,7 +114,8 @@
|
|||||||
INNER JOIN jsh_depotitem di on dh.id=di.HeaderId and ifnull(di.delete_Flag,'0') !='1'
|
INNER JOIN jsh_depotitem di on dh.id=di.HeaderId and ifnull(di.delete_Flag,'0') !='1'
|
||||||
where ((dh.type!='其它' and dh.SubType!='调拨')
|
where ((dh.type!='其它' and dh.SubType!='调拨')
|
||||||
or (dh.type='其它' and dh.SubType='组装单')
|
or (dh.type='其它' and dh.SubType='组装单')
|
||||||
or (dh.type='其它' and dh.SubType='拆卸单'))
|
or (dh.type='其它' and dh.SubType='拆卸单')
|
||||||
|
or (dh.type='其它' and dh.SubType='盘点复盘' and dh.Status=1))
|
||||||
and di.MaterialId =${mId}
|
and di.MaterialId =${mId}
|
||||||
and ifnull(dh.delete_Flag,'0') !='1'
|
and ifnull(dh.delete_Flag,'0') !='1'
|
||||||
ORDER BY oTime desc
|
ORDER BY oTime desc
|
||||||
@@ -125,8 +128,10 @@
|
|||||||
select count(1)
|
select count(1)
|
||||||
from jsh_depothead dh
|
from jsh_depothead dh
|
||||||
INNER JOIN jsh_depotitem di on dh.id=di.HeaderId and ifnull(di.delete_Flag,'0') !='1'
|
INNER JOIN jsh_depotitem di on dh.id=di.HeaderId and ifnull(di.delete_Flag,'0') !='1'
|
||||||
where dh.type!='其它'
|
where ((dh.type!='其它' and dh.SubType!='调拨')
|
||||||
and dh.SubType!='调拨'
|
or (dh.type='其它' and dh.SubType='组装单')
|
||||||
|
or (dh.type='其它' and dh.SubType='拆卸单')
|
||||||
|
or (dh.type='其它' and dh.SubType='盘点复盘' and dh.Status=1))
|
||||||
and di.MaterialId =${mId}
|
and di.MaterialId =${mId}
|
||||||
and ifnull(dh.delete_Flag,'0') !='1'
|
and ifnull(dh.delete_Flag,'0') !='1'
|
||||||
</select>
|
</select>
|
||||||
@@ -223,6 +228,27 @@
|
|||||||
and ifnull(dh.delete_Flag,'0') !='1'
|
and ifnull(dh.delete_Flag,'0') !='1'
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getStockCheckSum" resultType="java.math.BigDecimal">
|
||||||
|
select ifnull(sum(di.BasicNumber),0) stockCheckSum from jsh_depothead dh
|
||||||
|
INNER JOIN jsh_depotitem di on dh.id=di.HeaderId
|
||||||
|
where 1=1
|
||||||
|
<if test="mId != null">
|
||||||
|
and di.MaterialId=#{mId}
|
||||||
|
</if>
|
||||||
|
and dh.SubType='盘点复盘' and dh.`Status`='1'
|
||||||
|
<if test="depotId != null">
|
||||||
|
and di.DepotId=#{depotId}
|
||||||
|
</if>
|
||||||
|
<if test="beginTime != null">
|
||||||
|
and dh.OperTime >= '${beginTime}'
|
||||||
|
</if>
|
||||||
|
<if test="endTime != null">
|
||||||
|
and dh.OperTime <= '${endTime}'
|
||||||
|
</if>
|
||||||
|
and ifnull(dh.delete_Flag,'0') !='1'
|
||||||
|
and ifnull(di.delete_Flag,'0') !='1'
|
||||||
|
</select>
|
||||||
|
|
||||||
<select id="getStockByParam" resultMap="StockMap">
|
<select id="getStockByParam" resultMap="StockMap">
|
||||||
select ifnull((curep.inTotal+curep.transfInTotal+curep.assemInTotal+curep.disAssemInTotal),0) as in_stock,
|
select ifnull((curep.inTotal+curep.transfInTotal+curep.assemInTotal+curep.disAssemInTotal),0) as in_stock,
|
||||||
ifnull((curep.transfOutTotal+curep.outTotal+curep.assemOutTotal+curep.disAssemOutTotal),0) out_stock
|
ifnull((curep.transfOutTotal+curep.outTotal+curep.assemOutTotal+curep.disAssemOutTotal),0) out_stock
|
||||||
|
|||||||
Reference in New Issue
Block a user