优化库存逻辑

This commit is contained in:
季圣华
2020-07-09 23:45:23 +08:00
parent ad5b6e9daa
commit cbba347579
8 changed files with 121 additions and 14 deletions

View File

@@ -73,7 +73,13 @@ public class DepotItemController {
for (DepotItemVo4DetailByTypeAndMId d: list) {
JSONObject item = new JSONObject();
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("OperTime", d.getOtime().getTime()); //时间
dataArray.add(item);

View File

@@ -7,7 +7,9 @@ public class DepotItemVo4DetailByTypeAndMId {
private String number;
private String newtype;
private String type;
private String subType;
private BigDecimal bnum;
@@ -21,12 +23,20 @@ public class DepotItemVo4DetailByTypeAndMId {
this.number = number;
}
public String getNewtype() {
return newtype;
public String getType() {
return type;
}
public void setNewtype(String newtype) {
this.newtype = newtype;
public void setType(String type) {
this.type = type;
}
public String getSubType() {
return subType;
}
public void setSubType(String subType) {
this.subType = subType;
}
public BigDecimal getBnum() {

View File

@@ -70,6 +70,12 @@ public interface DepotItemMapperEx {
@Param("subType") String subType,
@Param("MonthTime") String MonthTime);
BigDecimal getStockCheckSum(
@Param("depotId") Long depotId,
@Param("mId") Long mId,
@Param("beginTime") String beginTime,
@Param("endTime") String endTime);
DepotItemVo4Stock getStockByParam(
@Param("depotId") Long depotId,
@Param("mId") Long mId,

View File

@@ -647,10 +647,12 @@ public class DepotItemService {
public BigDecimal getStockByParam(Long depotId, Long mId, String beginTime, String endTime, Long tenantId){
//初始库存
BigDecimal initStock = materialService.getInitStockByMid(depotId, mId);
//盘点复盘后数量的变动
BigDecimal stockCheckSum = depotItemMapperEx.getStockCheckSum(depotId, mId, beginTime, endTime);
DepotItemVo4Stock stockObj = depotItemMapperEx.getStockByParam(depotId, mId, beginTime, endTime, tenantId);
BigDecimal intNum = stockObj.getInNum();
BigDecimal outNum = stockObj.getOutNum();
return initStock.add(intNum).subtract(outNum);
return initStock.add(intNum).subtract(outNum).add(stockCheckSum);
}
/**