出库汇总统计完成

This commit is contained in:
weizhiqiang 2019-10-23 10:26:55 +08:00
parent f6752ae182
commit 6cf7988304
9 changed files with 246 additions and 4 deletions

View file

@ -98,5 +98,17 @@ public class StatisticsController {
public void queryInComimgAllDetails(InputObject inputObject, OutputObject outputObject) throws Exception{
statisticsService.queryInComimgAllDetails(inputObject, outputObject);
}
/**
* 出库汇总
* @param inputObject
* @param outputObject
* @throws Exception
*/
@RequestMapping("/post/StatisticsController/querySalesAllDetails")
@ResponseBody
public void querySalesAllDetails(InputObject inputObject, OutputObject outputObject) throws Exception{
statisticsService.querySalesAllDetails(inputObject, outputObject);
}
}

View file

@ -21,4 +21,6 @@ public interface StatisticsDao {
public List<Map<String, Object>> queryInComimgAllDetails(Map<String, Object> params, PageBounds pageBounds) throws Exception;
public List<Map<String, Object>> querySalesAllDetails(Map<String, Object> params, PageBounds pageBounds) throws Exception;
}

View file

@ -19,4 +19,6 @@ public interface StatisticsService {
public void queryInComimgAllDetails(InputObject inputObject, OutputObject outputObject) throws Exception;
public void querySalesAllDetails(InputObject inputObject, OutputObject outputObject) throws Exception;
}

View file

@ -144,5 +144,23 @@ public class StatisticsServiceImpl implements StatisticsService{
outputObject.setBeans(beans);
outputObject.settotal(total);
}
/**
* 出库汇总
* @param inputObject
* @param outputObject
* @throws Exception
*/
@Override
public void querySalesAllDetails(InputObject inputObject, OutputObject outputObject) throws Exception {
Map<String, Object> params = inputObject.getParams();
params.put("userId", inputObject.getLogParams().get("id"));
List<Map<String, Object>> beans = statisticsDao.querySalesAllDetails(params,
new PageBounds(Integer.parseInt(params.get("page").toString()), Integer.parseInt(params.get("limit").toString())));
PageList<Map<String, Object>> beansPageList = (PageList<Map<String, Object>>)beans;
int total = beansPageList.getPaginator().getTotalCount();
outputObject.setBeans(beans);
outputObject.settotal(total);
}
}

View file

@ -254,13 +254,11 @@
k.`name` firstTypeName,
l.`name` secondTypeName,
IFNULL(SUM(m.oper_number * (CASE m.sub_type
WHEN 11 THEN 0
WHEN 12 THEN (CASE m.m_type WHEN 1 THEN 0 ELSE 1 END)
WHEN 13 THEN (CASE m.m_type WHEN 1 THEN 1 ELSE 0 END)
ELSE CASE m.type WHEN 2 THEN 1 ELSE 0 END
END)), 0) currentTock,
FORMAT(IFNULL(SUM(m.total_price * (CASE m.sub_type
WHEN 11 THEN 0
WHEN 12 THEN (CASE m.m_type WHEN 1 THEN 0 ELSE 1 END)
WHEN 13 THEN (CASE m.m_type WHEN 1 THEN 1 ELSE 0 END)
ELSE CASE m.type WHEN 2 THEN 1 ELSE 0 END
@ -301,5 +299,60 @@
GROUP BY a.id
ORDER BY b.`name`
</select>
<select id="querySalesAllDetails" parameterType="java.util.Map" resultType="java.util.Map">
SELECT
b.id,
b.`name` materialName,
b.model,
IFNULL(c.`name`, b.unit_name) unitName,
k.`name` firstTypeName,
l.`name` secondTypeName,
IFNULL(SUM(m.oper_number * (CASE m.sub_type
WHEN 12 THEN (CASE m.m_type WHEN 1 THEN 1 ELSE 0 END)
WHEN 13 THEN (CASE m.m_type WHEN 1 THEN 0 ELSE 1 END)
ELSE CASE m.type WHEN 2 THEN 1 ELSE 0 END
END)), 0) currentTock,
FORMAT(IFNULL(SUM(m.total_price * (CASE m.sub_type
WHEN 12 THEN (CASE m.m_type WHEN 1 THEN 1 ELSE 0 END)
WHEN 13 THEN (CASE m.m_type WHEN 1 THEN 0 ELSE 1 END)
ELSE CASE m.type WHEN 2 THEN 1 ELSE 0 END
END)), 0), 2) currentTockMoney
FROM
erp_material_norms a
LEFT JOIN erp_unit c ON a.unit_id = c.id
LEFT JOIN (
SELECT
q.m_unit_id,
p.total_price,
q.oper_number,
p.sub_type,
p.type,
q.m_type
FROM
erp_depothead p,
erp_depotitem q
WHERE
q.header_id = p.id
AND q.delete_flag = '0'
AND p.delete_flag = '0'
AND (p.type = '1' OR (p.type = '3' AND p.sub_type IN(12, 13)))
AND p.tenant_id = #{userId}
AND p.sub_type != '11'
AND DATE_FORMAT(p.oper_time, '%Y-%m') = #{operTime}
) m ON m.m_unit_id = a.id,
erp_material b
LEFT JOIN erp_material_category k ON b.category_id = k.id
LEFT JOIN erp_material_category l ON b.category_id_sec = l.id
WHERE a.meterial_id = b.id
<if test="materialName != '' and materialName != null">
AND b.material_name LIKE '%${materialName}%'
</if>
AND a.delete_flag = '0'
AND b.delete_flag = '0'
AND b.tenant_id = #{userId}
GROUP BY a.id
ORDER BY b.`name`
</select>
</mapper>

View file

@ -685,6 +685,12 @@
<property id="limit" name="limit" ref="required,num" var="分页参数,每页多少条数据" />
<property id="page" name="page" ref="required,num" var="分页参数,第几页"/>
</url>
<url id="statistics008" path="/post/StatisticsController/querySalesAllDetails" val="出库汇总" allUse="2">
<property id="materialName" name="materialName" ref="" var="产品名称" />
<property id="operTime" name="operTime" ref="required" var="单据时间"/>
<property id="limit" name="limit" ref="required,num" var="分页参数,每页多少条数据" />
<property id="page" name="page" ref="required,num" var="分页参数,第几页"/>
</url>
<!-- 统计结束 -->
</controller>

View file

@ -55,8 +55,8 @@ layui.config({
{ field: 'firstTypeName', title: '一级类型', align: 'left', width: 100},
{ field: 'secondTypeName', title: '二级类型', align: 'left', width: 100},
{ field: 'unitName', title: '单位', align: 'left', width: 80},
{ field: 'currentTock', title: '进货数量', align: 'left', width: 100},
{ field: 'currentTockMoney', title: '进货金额', align: 'left', width: 120}
{ field: 'currentTock', title: '入库数量', align: 'left', width: 100},
{ field: 'currentTockMoney', title: '入库金额', align: 'left', width: 120}
]]
});
form.render();

View file

@ -0,0 +1,103 @@
var rowId = "";
//单据的时间
var operTime = "";
layui.config({
base: basePath,
version: skyeyeVersion
}).extend({ //指定js别名
window: 'js/winui.window'
}).define(['window', 'table', 'jquery', 'winui', 'form', 'laydate'], function (exports) {
winui.renderColor();
var $ = layui.$,
form = layui.form,
laydate = layui.laydate,
table = layui.table;
//初始化统计时间
operTime = getOneYMFormatDate();
//获取本月日期
function getOneYMFormatDate(){
var date = new Date;
var year = date.getFullYear();
var month = date.getMonth() + 1;
month = (month < 10 ? "0" + month : month);
return year.toString() + "-" + month.toString();
}
laydate.render({
elem: '#operTime', //指定元素
type: 'month',
value: operTime
});
initTable();
function initTable(){
//表格渲染
table.render({
id: 'messageTable',
elem: '#messageTable',
method: 'post',
url: reqBasePath + 'statistics008',
where: {materialName: $("#materialName").val(), operTime: operTime},
even: true, //隔行变色
page: true,
limits: [8, 16, 24, 32, 40, 48, 56],
limit: 8,
cols: [[
{ title: '序号', type: 'numbers'},
{ field: 'materialName', title: '产品名称', align: 'left', width: 250},
{ field: 'model', title: '型号', align: 'left', width: 100},
{ field: 'firstTypeName', title: '一级类型', align: 'left', width: 100},
{ field: 'secondTypeName', title: '二级类型', align: 'left', width: 100},
{ field: 'unitName', title: '单位', align: 'left', width: 80},
{ field: 'currentTock', title: '出库数量', align: 'left', width: 100},
{ field: 'currentTockMoney', title: '出库金额', align: 'left', width: 120}
]]
});
form.render();
}
//搜索表单
form.on('submit(formSearch)', function (data) {
//表单验证
if (winui.verifyForm(data.elem)) {
loadTable();
}
return false;
});
$("body").on("click", "#reloadTable", function() {
loadTable();
});
$("body").on("click", "#formSearch", function () {
refreshTable();
})
//刷新
function loadTable(){
if(isNull($("#operTime").val())){//一定要记得当createTime为空时
winui.window.msg("请选择日期.", {icon: 2,time: 2000});
}else {
operTime = $("#operTime").val();
table.reload("messageTable", {where:{materialName: $("#materialName").val(), operTime: operTime}});
}
}
//搜索
function refreshTable(){
if(isNull($("#operTime").val())){//一定要记得当createTime为空时
winui.window.msg("请选择日期.", {icon: 2,time: 2000});
}else {
operTime = $("#operTime").val();
table.reload("messageTable", {page: {curr: 1}, where:{materialName: $("#materialName").val(), operTime: operTime}})
}
}
exports('incomingstatistics', {});
});

View file

@ -0,0 +1,46 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
<link href="../../assets/lib/layui/css/layui.css" rel="stylesheet" />
<link href="../../assets/lib/font-awesome-4.7.0/css/font-awesome.css" rel="stylesheet" />
<link href="../../assets/lib/winui/css/winui.css" rel="stylesheet" />
</head>
<body>
<div class="txtcenter" style="margin:0 auto;padding-top:10px;">
<form class="layui-form layui-form-pane" action="" autocomplete="off">
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">商品名称</label>
<div class="layui-input-inline">
<input type="text" id="materialName" name="materialName" placeholder="请输入名称" class="layui-input" />
</div>
<label class="layui-form-label">单据日期</label>
<div class="layui-input-inline">
<input type="text" id="operTime" name="operTime" placeholder="请选择单据日期" class="layui-input" />
</div>
<button type="reset" class="layui-btn layui-btn-primary list-form-search">重置</button>
<button class="layui-btn list-form-search" lay-submit lay-filter="formSearch">搜索</button>
</div>
</div>
</form>
</div>
<div class="winui-toolbar">
<div class="winui-tool">
<button id="reloadTable" class="winui-toolbtn"><i class="fa fa-refresh" aria-hidden="true"></i>刷新数据</button>
<div style="width: calc(100% - 120px); float: right; padding: 8px 10px;">
<div class="layui-form-mid layui-word-aux" style="color: red !important;">注:此处包含零售+销售+其他出库+拆分+组装。</div>
</div>
</div>
</div>
<div style="margin:auto 10px;">
<table id="messageTable" lay-filter="messageTable"></table>
</div>
<script src="../../assets/lib/layui/layui.js"></script>
<script src="../../assets/lib/layui/custom.js"></script>
<script type="text/javascript">
layui.config({base: '../../js/erpstatistics/'}).use('salesallstatistics');
</script>
</body>
</html>