优化库存预警报表
This commit is contained in:
parent
c4db070541
commit
8d85df5dbd
@ -202,16 +202,14 @@
|
||||
pageSize: 10,
|
||||
pageList: [10, 50, 100],
|
||||
columns: [[
|
||||
{title: '名称', field: 'materialName', width: 160},
|
||||
{title: '规格', field: 'materialStandard', width: 80},
|
||||
{title: '型号', field: 'materialModel', width: 80},
|
||||
{title: '名称', field: 'mname', width: 160},
|
||||
{title: '规格', field: 'mstandard', width: 80},
|
||||
{title: '型号', field: 'mmodel', width: 80},
|
||||
{title: '扩展信息', field: 'materialOther', width: 150},
|
||||
{title: '单位', field: 'materialUnit', width: 80},
|
||||
{title: '入库数量', field: 'basicInNumber', width: 80},
|
||||
{title: '出库数量', field: 'basicOutNumber', width: 80},
|
||||
{title: '库存数量', field: 'basicNumber', width: 80},
|
||||
{title: '安全库存量', field: 'safetystock', width: 80},
|
||||
{title: '临界库存量', field: 'basicLinjieNumber', width: 80}
|
||||
{title: '安全存量', field: 'safetystock', width: 80},
|
||||
{title: '当前库存', field: 'currentNumber', width: 80},
|
||||
{title: '建议入库量', field: 'linjieNumber', width: 80}
|
||||
]],
|
||||
onLoadError: function () {
|
||||
$.messager.alert('页面加载提示', '页面加载异常,请稍后再试!', 'error');
|
||||
|
||||
@ -591,6 +591,7 @@ public class DepotItemController {
|
||||
diEx.setMOtherField2(disw.getMOtherField2());
|
||||
diEx.setMOtherField3(disw.getMOtherField3());
|
||||
disw.setMaterialOther(getOtherInfo(mpArr, diEx));
|
||||
disw.setMaterialUnit(getUName(disw.getMaterialUnit(), disw.getUnitName()));
|
||||
}
|
||||
}
|
||||
int total = depotItemService.findStockWarningCountTotal(pid);
|
||||
@ -628,7 +629,7 @@ public class DepotItemController {
|
||||
List<DepotItemStockWarningCount> dataList = depotItemService.findStockWarningCount((currentPage - 1) * pageSize, pageSize, projectId);
|
||||
//存放数据json数组
|
||||
Integer pid = projectId;
|
||||
String[] names = {"名称", "规格", "型号", "扩展信息", "单位", "入库数量", "出库数量", "库存数量", "安全库存量", "临界库存量"};
|
||||
String[] names = {"名称", "规格", "型号", "扩展信息", "单位", "安全存量", "当前库存", "建议入库量"};
|
||||
String title = "库存预警报表";
|
||||
List<String[]> objects = new ArrayList<String[]>();
|
||||
if (null != dataList) {
|
||||
@ -639,17 +640,16 @@ public class DepotItemController {
|
||||
diVI.setMOtherField2(diEx.getMOtherField2());
|
||||
diVI.setMOtherField3(diEx.getMOtherField3());
|
||||
String materialOther = getOtherInfo(mpArr, diVI);
|
||||
String[] objs = new String[10];
|
||||
objs[0] = diEx.getMaterialName();
|
||||
objs[1] = diEx.getMaterialStandard();
|
||||
objs[2] = diEx.getMaterialModel();
|
||||
String unitName = getUName(diEx.getMaterialUnit(), diEx.getUnitName());
|
||||
String[] objs = new String[8];
|
||||
objs[0] = diEx.getMName();
|
||||
objs[1] = diEx.getMStandard();
|
||||
objs[2] = diEx.getMModel();
|
||||
objs[3] = materialOther;
|
||||
objs[4] = diEx.getMaterialUnit();
|
||||
objs[5] = diEx.getBasicInNumber().toString();
|
||||
objs[6] = diEx.getBasicOutNumber() == null ? "0" : diEx.getBasicOutNumber().toString();
|
||||
objs[7] = diEx.getBasicNumber() == null ? "0" : diEx.getBasicNumber().toString();
|
||||
objs[8] = diEx.getSafetystock() == null ? "0" : diEx.getSafetystock().toString();
|
||||
objs[9] = diEx.getBasicLinjieNumber() == null ? "0" : diEx.getBasicLinjieNumber().toString();
|
||||
objs[4] = unitName;
|
||||
objs[5] = diEx.getSafetystock() == null ? "0" : diEx.getSafetystock().toString();
|
||||
objs[6] = diEx.getCurrentNumber() == null ? "0" : diEx.getCurrentNumber().toString();
|
||||
objs[7] = diEx.getLinjieNumber() == null ? "0" : diEx.getLinjieNumber().toString();
|
||||
objects.add(objs);
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,15 +5,21 @@ import java.math.BigDecimal;
|
||||
|
||||
public class DepotItemStockWarningCount {
|
||||
|
||||
private String MaterialName;
|
||||
private Long MId;
|
||||
|
||||
private String MaterialModel;
|
||||
private String MName;
|
||||
|
||||
private String MaterialStandard;
|
||||
private String MModel;
|
||||
|
||||
private String MaterialUnit;
|
||||
|
||||
private String MColor;
|
||||
|
||||
private String MStandard;
|
||||
|
||||
private String MMfrs;
|
||||
|
||||
private String categoryName;
|
||||
private String unitName;
|
||||
|
||||
private String MaterialOther;
|
||||
|
||||
@ -23,41 +29,58 @@ public class DepotItemStockWarningCount {
|
||||
|
||||
private String MOtherField3;
|
||||
|
||||
private String MaterialUnit;
|
||||
|
||||
private BigDecimal safetystock;//安全库存量
|
||||
|
||||
private BigDecimal BasicInNumber;//入库量
|
||||
private BigDecimal currentNumber;//库存
|
||||
|
||||
private BigDecimal BasicOutNumber;//出库量
|
||||
private BigDecimal linjieNumber;//临界库存
|
||||
|
||||
|
||||
private BigDecimal BasicNumber;//库存
|
||||
|
||||
private BigDecimal BasicLinjieNumber;//临界库存
|
||||
|
||||
public String getMaterialName() {
|
||||
return MaterialName;
|
||||
public Long getMId() {
|
||||
return MId;
|
||||
}
|
||||
|
||||
public void setMaterialName(String materialName) {
|
||||
MaterialName = materialName;
|
||||
public void setMId(Long MId) {
|
||||
this.MId = MId;
|
||||
}
|
||||
|
||||
public String getMaterialModel() {
|
||||
return MaterialModel;
|
||||
public String getMName() {
|
||||
return MName;
|
||||
}
|
||||
|
||||
public void setMaterialModel(String materialModel) {
|
||||
MaterialModel = materialModel;
|
||||
public void setMName(String MName) {
|
||||
this.MName = MName;
|
||||
}
|
||||
|
||||
public String getMaterialStandard() {
|
||||
return MaterialStandard;
|
||||
public String getMModel() {
|
||||
return MModel;
|
||||
}
|
||||
|
||||
public void setMaterialStandard(String materialStandard) {
|
||||
MaterialStandard = materialStandard;
|
||||
public void setMModel(String MModel) {
|
||||
this.MModel = MModel;
|
||||
}
|
||||
|
||||
public String getMaterialUnit() {
|
||||
return MaterialUnit;
|
||||
}
|
||||
|
||||
public void setMaterialUnit(String materialUnit) {
|
||||
MaterialUnit = materialUnit;
|
||||
}
|
||||
|
||||
public String getMColor() {
|
||||
return MColor;
|
||||
}
|
||||
|
||||
public void setMColor(String MColor) {
|
||||
this.MColor = MColor;
|
||||
}
|
||||
|
||||
public String getMStandard() {
|
||||
return MStandard;
|
||||
}
|
||||
|
||||
public void setMStandard(String MStandard) {
|
||||
this.MStandard = MStandard;
|
||||
}
|
||||
|
||||
public String getMMfrs() {
|
||||
@ -68,12 +91,12 @@ public class DepotItemStockWarningCount {
|
||||
this.MMfrs = MMfrs;
|
||||
}
|
||||
|
||||
public String getCategoryName() {
|
||||
return categoryName;
|
||||
public String getUnitName() {
|
||||
return unitName;
|
||||
}
|
||||
|
||||
public void setCategoryName(String categoryName) {
|
||||
this.categoryName = categoryName;
|
||||
public void setUnitName(String unitName) {
|
||||
this.unitName = unitName;
|
||||
}
|
||||
|
||||
public String getMaterialOther() {
|
||||
@ -108,14 +131,6 @@ public class DepotItemStockWarningCount {
|
||||
this.MOtherField3 = MOtherField3;
|
||||
}
|
||||
|
||||
public String getMaterialUnit() {
|
||||
return MaterialUnit;
|
||||
}
|
||||
|
||||
public void setMaterialUnit(String materialUnit) {
|
||||
MaterialUnit = materialUnit;
|
||||
}
|
||||
|
||||
public BigDecimal getSafetystock() {
|
||||
return safetystock;
|
||||
}
|
||||
@ -124,35 +139,19 @@ public class DepotItemStockWarningCount {
|
||||
this.safetystock = safetystock;
|
||||
}
|
||||
|
||||
public BigDecimal getBasicInNumber() {
|
||||
return BasicInNumber;
|
||||
public BigDecimal getCurrentNumber() {
|
||||
return currentNumber;
|
||||
}
|
||||
|
||||
public void setBasicInNumber(BigDecimal basicInNumber) {
|
||||
BasicInNumber = basicInNumber;
|
||||
public void setCurrentNumber(BigDecimal currentNumber) {
|
||||
this.currentNumber = currentNumber;
|
||||
}
|
||||
|
||||
public BigDecimal getBasicOutNumber() {
|
||||
return BasicOutNumber;
|
||||
public BigDecimal getLinjieNumber() {
|
||||
return linjieNumber;
|
||||
}
|
||||
|
||||
public void setBasicOutNumber(BigDecimal basicOutNumber) {
|
||||
BasicOutNumber = basicOutNumber;
|
||||
}
|
||||
|
||||
public BigDecimal getBasicNumber() {
|
||||
return BasicNumber;
|
||||
}
|
||||
|
||||
public void setBasicNumber(BigDecimal basicNumber) {
|
||||
BasicNumber = basicNumber;
|
||||
}
|
||||
|
||||
public BigDecimal getBasicLinjieNumber() {
|
||||
return BasicLinjieNumber;
|
||||
}
|
||||
|
||||
public void setBasicLinjieNumber(BigDecimal basicLinjieNumber) {
|
||||
BasicLinjieNumber = basicLinjieNumber;
|
||||
public void setLinjieNumber(BigDecimal linjieNumber) {
|
||||
this.linjieNumber = linjieNumber;
|
||||
}
|
||||
}
|
||||
|
||||
@ -50,20 +50,19 @@
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="ResultStockWarningCount" type="com.jsh.erp.datasource.vo.DepotItemStockWarningCount">
|
||||
<result column="MaterialName" jdbcType="VARCHAR" property="MaterialName" />
|
||||
<result column="MaterialModel" jdbcType="VARCHAR" property="MaterialModel" />
|
||||
<result column="MaterialStandard" jdbcType="VARCHAR" property="MaterialStandard" />
|
||||
<result column="MId" jdbcType="VARCHAR" property="MId" />
|
||||
<result column="MName" jdbcType="VARCHAR" property="MName" />
|
||||
<result column="MMfrs" jdbcType="VARCHAR" property="MMfrs" />
|
||||
<result column="categoryName" jdbcType="VARCHAR" property="categoryName" />
|
||||
<result column="MModel" jdbcType="VARCHAR" property="MModel" />
|
||||
<result column="MStandard" jdbcType="VARCHAR" property="MStandard" />
|
||||
<result column="MaterialUnit" jdbcType="VARCHAR" property="MaterialUnit" />
|
||||
<result column="MOtherField1" jdbcType="VARCHAR" property="MOtherField1" />
|
||||
<result column="MOtherField2" jdbcType="VARCHAR" property="MOtherField2" />
|
||||
<result column="MOtherField3" jdbcType="VARCHAR" property="MOtherField3" />
|
||||
<result column="unit_name" jdbcType="VARCHAR" property="unitName" />
|
||||
<result column="safetystock" jdbcType="DECIMAL" property="safetystock" />
|
||||
<result column="BasicInNumber" jdbcType="DECIMAL" property="BasicInNumber" />
|
||||
<result column="BasicOutNumber" jdbcType="DECIMAL" property="BasicOutNumber" />
|
||||
<result column="BasicNumber" jdbcType="DECIMAL" property="BasicNumber" />
|
||||
<result column="BasicLinjieNumber" jdbcType="DECIMAL" property="BasicLinjieNumber" />
|
||||
<result column="current_number" jdbcType="DECIMAL" property="currentNumber" />
|
||||
<result column="linjieNumber" jdbcType="DECIMAL" property="linjieNumber" />
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="StockMap" type="com.jsh.erp.datasource.vo.DepotItemVo4Stock">
|
||||
@ -372,61 +371,23 @@
|
||||
</select>
|
||||
|
||||
<select id="findStockWarningCount" parameterType="com.jsh.erp.datasource.entities.DepotItemExample" resultMap="ResultStockWarningCount">
|
||||
SELECT
|
||||
m.name MaterialName,
|
||||
m.model MaterialModel,
|
||||
m.standard MaterialStandard,
|
||||
m.mfrs MMfrs,
|
||||
select m.id MId, m.name MName, m.mfrs MMfrs, m.model MModel, m.standard MStandard,m.color MColor,
|
||||
m.other_field1 MOtherField1,m.other_field2 MOtherField2,m.other_field3 MOtherField3,
|
||||
mc.`Name` categoryName,
|
||||
m.unit MaterialUnit,
|
||||
ifnull(m.safety_stock,0) safetystock,
|
||||
IFNULL(intype.BasicInNumber ,0) BasicInNumber,
|
||||
IFNULL(outtype.BasicOutNumber ,0) BasicOutNumber,
|
||||
(
|
||||
IFNULL(intype.BasicInNumber ,0) - IFNULL(outtype.BasicOutNumber ,0)
|
||||
) BasicNumber,
|
||||
(IFNULL(intype.BasicInNumber ,0) - IFNULL(outtype.BasicOutNumber ,0) - ifnull(m.safety_stock,0)) BasicLinjieNumber
|
||||
FROM
|
||||
jsh_material m
|
||||
LEFT JOIN jsh_material_category mc ON mc.id = m.category_id
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
di.material_id,
|
||||
ifnull(sum(basic_number), 0) AS BasicInNumber
|
||||
FROM
|
||||
jsh_depot_head dh
|
||||
INNER JOIN jsh_depot_item di ON dh.id = di.header_id
|
||||
AND ifnull(di.delete_flag, '0') != '1'
|
||||
WHERE
|
||||
dh.type = '入库'
|
||||
m.unit MaterialUnit, u.name unit_name,mcs.current_number,ifnull(m.safety_stock,0) safetystock,
|
||||
(ifnull(m.safety_stock,0)-mcs.current_number) linjieNumber
|
||||
from jsh_material m
|
||||
left join jsh_material_current_stock mcs on mcs.material_id=m.id and ifnull(mcs.delete_Flag,'0') !='1'
|
||||
left join jsh_depot_item di on di.material_id=m.id and ifnull(di.delete_Flag,'0') !='1'
|
||||
left join jsh_depot_head dh on di.header_id=dh.id and ifnull(dh.delete_flag,'0') !='1'
|
||||
left join jsh_unit u on m.unit_id=u.id and ifnull(u.delete_Flag,'0') !='1'
|
||||
where 1=1
|
||||
and ifnull(m.delete_flag,'0') !='1'
|
||||
and ifnull(m.safety_stock,0) > mcs.current_number
|
||||
<if test="pid != null">
|
||||
and di.depot_id= ${pid}
|
||||
and mcs.depot_id= ${pid}
|
||||
</if>
|
||||
AND ifnull(dh.delete_flag, '0') != '1' group by di.material_id
|
||||
) intype ON intype.material_id = m.id
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
di.material_id,
|
||||
ifnull(sum(basic_number), 0) AS BasicOutNumber
|
||||
FROM
|
||||
jsh_depot_head dh
|
||||
INNER JOIN jsh_depot_item di ON dh.id = di.header_id
|
||||
AND ifnull(di.delete_flag, '0') != '1'
|
||||
WHERE
|
||||
dh.type = '出库'
|
||||
AND dh.sub_type != '调拨'
|
||||
<if test="pid != null">
|
||||
and di.depot_id= ${pid}
|
||||
</if>
|
||||
AND ifnull(dh.delete_flag, '0') != '1' group by di.material_id
|
||||
) outtype ON outtype.material_id = m.id
|
||||
WHERE
|
||||
1 = 1
|
||||
AND ifnull(m.delete_flag, '0') != '1'
|
||||
AND intype.BasicInNumber > 0
|
||||
ORDER BY
|
||||
(IFNULL(intype.BasicInNumber ,0) - IFNULL(outtype.BasicOutNumber ,0) - ifnull(m.safety_stock,0))
|
||||
group by m.id,m.name, m.model, m.unit, m.color, u.name
|
||||
order by linjieNumber desc
|
||||
<if test="offset != null and rows != null">
|
||||
limit #{offset},#{rows}
|
||||
</if>
|
||||
@ -434,26 +395,18 @@
|
||||
|
||||
<select id="findStockWarningCountTotal" resultType="java.lang.Integer">
|
||||
select count(1) from
|
||||
jsh_material m
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
di.material_id,
|
||||
ifnull(sum(basic_number), 0) AS BasicInNumber
|
||||
FROM
|
||||
jsh_depot_head dh
|
||||
INNER JOIN jsh_depot_item di ON dh.id = di.header_id
|
||||
AND ifnull(di.delete_flag, '0') != '1'
|
||||
WHERE
|
||||
dh.type = '入库'
|
||||
(select m.id
|
||||
from jsh_material m
|
||||
left join jsh_material_current_stock mcs on mcs.material_id=m.id and ifnull(mcs.delete_Flag,'0') !='1'
|
||||
left join jsh_depot_item di on di.material_id=m.id and ifnull(di.delete_Flag,'0') !='1'
|
||||
left join jsh_depot_head dh on di.header_id=dh.id and ifnull(dh.delete_flag,'0') !='1'
|
||||
left join jsh_unit u on m.unit_id=u.id and ifnull(u.delete_Flag,'0') !='1'
|
||||
where 1=1
|
||||
and ifnull(m.delete_flag,'0') !='1'
|
||||
and ifnull(m.safety_stock,0) > mcs.current_number
|
||||
<if test="pid != null">
|
||||
and di.depot_id= ${pid}
|
||||
and mcs.depot_id= ${pid}
|
||||
</if>
|
||||
AND ifnull(dh.delete_flag, '0') != '1' group by di.material_id
|
||||
) intype ON intype.material_id = m.id
|
||||
|
||||
WHERE
|
||||
1 = 1
|
||||
AND ifnull(m.delete_Flag, '0') != '1'
|
||||
AND intype.BasicInNumber > 0
|
||||
group by m.id,m.name, m.model, m.unit, m.color, u.name) tb
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user