mirror of
https://github.com/weizhiqiang1995/erp-pro.git
synced 2025-01-30 19:17:54 +08:00
销售出库导出功能完成
This commit is contained in:
parent
8a61cb6f63
commit
f45daf8319
8 changed files with 111 additions and 1 deletions
|
@ -68,4 +68,16 @@ public class SalesOutLetController {
|
|||
salesOutLetService.editSalesOutLetMationById(inputObject, outputObject);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出Excel
|
||||
* @param inputObject
|
||||
* @param outputObject
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping("/post/SalesOutLetController/queryMationToExcel")
|
||||
@ResponseBody
|
||||
public void queryMationToExcel(InputObject inputObject, OutputObject outputObject) throws Exception{
|
||||
salesOutLetService.queryMationToExcel(inputObject, outputObject);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -25,4 +25,6 @@ public interface SalesOutLetDao {
|
|||
|
||||
public List<Map<String, Object>> querySalesManUserInfoById(Map<String, Object> bean) throws Exception;
|
||||
|
||||
public List<Map<String, Object>> queryMationToExcel(Map<String, Object> params) throws Exception;
|
||||
|
||||
}
|
||||
|
|
|
@ -13,4 +13,6 @@ public interface SalesOutLetService {
|
|||
|
||||
public void editSalesOutLetMationById(InputObject inputObject, OutputObject outputObject) throws Exception;
|
||||
|
||||
public void queryMationToExcel(InputObject inputObject, OutputObject outputObject) throws Exception;
|
||||
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
|
|||
import com.github.miemiedev.mybatis.paginator.domain.PageList;
|
||||
import com.skyeye.common.object.InputObject;
|
||||
import com.skyeye.common.object.OutputObject;
|
||||
import com.skyeye.common.util.ExcelUtil;
|
||||
import com.skyeye.common.util.ToolUtil;
|
||||
import com.skyeye.dao.SalesOutLetDao;
|
||||
import com.skyeye.erp.util.ErpConstants;
|
||||
|
@ -263,5 +264,39 @@ public class SalesOutLetServiceImpl implements SalesOutLetService{
|
|||
outputObject.setreturnMessage("数据格式错误");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出Excel
|
||||
* @param inputObject
|
||||
* @param outputObject
|
||||
* @throws Exception
|
||||
*/
|
||||
@SuppressWarnings("static-access")
|
||||
@Override
|
||||
public void queryMationToExcel(InputObject inputObject, OutputObject outputObject) throws Exception {
|
||||
Map<String, Object> params = inputObject.getParams();
|
||||
params.put("userId", inputObject.getLogParams().get("id"));
|
||||
List<Map<String, Object>> beans = salesOutLetDao.queryMationToExcel(params);
|
||||
String defaultNumber, linkNumber, status;
|
||||
for(Map<String, Object> bean : beans){
|
||||
defaultNumber = bean.get("defaultNumber").toString();
|
||||
linkNumber = bean.get("linkNumber").toString();
|
||||
status = bean.get("status").toString();
|
||||
if(!ToolUtil.isBlank(linkNumber)){
|
||||
defaultNumber += "[转]";
|
||||
if("2".equals(status)){
|
||||
defaultNumber += "[正常]";
|
||||
}else{
|
||||
defaultNumber += "[预警]";
|
||||
}
|
||||
}
|
||||
bean.put("defaultNumber", defaultNumber);
|
||||
}
|
||||
String[] key = new String[]{"defaultNumber", "supplierName", "materialNames", "totalPrice", "taxMoney", "discountLastMoney", "changeAmount", "operPersonName", "operTime"};
|
||||
String[] column = new String[]{"单据编号", "客户", "关联产品", "合计金额", "含税合计", "优惠后金额", "收款", "操作人", "单据日期"};
|
||||
String[] dataType = new String[]{"", "data", "data", "data", "data", "data", "data", "data", "data"};
|
||||
//采购销售出库信息导出
|
||||
ExcelUtil.createWorkBook("销售出库单", "销售出库单详细", beans, key, column, dataType, inputObject.getResponse());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -191,4 +191,39 @@
|
|||
INSTR(CONCAT(',', #{salesMan}, ','), CONCAT(',', a.user_id, ','))
|
||||
</select>
|
||||
|
||||
<select id="queryMationToExcel" parameterType="java.util.Map" resultType="java.util.Map">
|
||||
SELECT
|
||||
a.id,
|
||||
a.default_number defaultNumber,
|
||||
CONVERT (a.oper_time, char) operTime,
|
||||
a.oper_person_name operPersonName,
|
||||
b.supplier supplierName,
|
||||
FORMAT(a.total_price, 2) totalPrice,
|
||||
a.status,
|
||||
GROUP_CONCAT(DISTINCT CONCAT(c.material_name, c.material_model) SEPARATOR ',') materialNames,
|
||||
FORMAT(a.discount_last_money, 2) discountLastMoney,
|
||||
FORMAT(IFNULL(a.discount_last_money, 0) + IFNULL(a.discount_money, 0), 2) taxMoney,
|
||||
IFNULL(a.link_number, '') linkNumber,
|
||||
FORMAT(a.change_amount, 2) changeAmount
|
||||
FROM
|
||||
erp_depothead a
|
||||
LEFT JOIN erp_supplier b ON a.organ_id = b.id
|
||||
LEFT JOIN erp_depotitem c ON c.header_id = a.id
|
||||
WHERE
|
||||
a.sub_type = '5'
|
||||
AND a.tenant_id = #{userId}
|
||||
AND a.delete_flag = '0'
|
||||
<if test="material != '' and material != null">
|
||||
AND c.material_name LIKE '%${material}%'
|
||||
</if>
|
||||
<if test="defaultNumber != '' and defaultNumber != null">
|
||||
AND a.default_number LIKE '%${defaultNumber}%'
|
||||
</if>
|
||||
<if test="startTime != '' and startTime != null and endTime != '' and endTime != null">
|
||||
AND a.oper_time >= #{startTime} AND #{endTime} >= a.oper_time
|
||||
</if>
|
||||
GROUP BY a.id
|
||||
ORDER BY a.create_time DESC
|
||||
</select>
|
||||
|
||||
</mapper>
|
|
@ -484,6 +484,12 @@
|
|||
<property id="rowId" name="id" ref="required" var="销售出库id" />
|
||||
<property id="salesMan" name="salesMan" ref="" var="销售人员" />
|
||||
</url>
|
||||
<url id="salesoutlet005" path="/post/SalesOutLetController/queryMationToExcel" val="导出Excel" allUse="1">
|
||||
<property id="defaultNumber" name="defaultNumber" ref="" var="票据单号" />
|
||||
<property id="material" name="material" ref="" var="产品信息:名称或者型号" />
|
||||
<property id="startTime" name="startTime" ref="" var="单据开始时间"/>
|
||||
<property id="endTime" name="endTime" ref="" var="单据结束时间"/>
|
||||
</url>
|
||||
|
||||
|
||||
<url id="salesreturns001" path="/post/SalesReturnsController/querySalesReturnsToList" val="获取销售退货列表信息" allUse="1">
|
||||
|
|
|
@ -15,7 +15,8 @@ layui.config({
|
|||
form = layui.form,
|
||||
laydate = layui.laydate,
|
||||
table = layui.table;
|
||||
authBtn('1571813632546');
|
||||
authBtn('1571813632546');//添加
|
||||
authBtn('1572231503534');//导出
|
||||
|
||||
laydate.render({
|
||||
elem: '#operTime', //指定元素
|
||||
|
@ -173,6 +174,22 @@ layui.config({
|
|||
}
|
||||
table.reload("messageTable", {page: {curr: 1}, where:{defaultNumber: $("#defaultNumber").val(), material: $("#material").val(), startTime: startTime, endTime: endTime}})
|
||||
}
|
||||
|
||||
//导出excel
|
||||
$("body").on("click", "#downloadExcel", function () {
|
||||
if(isNull($("#operTime").val())){//一定要记得,当createTime为空时
|
||||
startTime = "";
|
||||
endTime = "";
|
||||
}else {
|
||||
startTime = $("#operTime").val().split('~')[0].trim() + ' 00:00:00';
|
||||
endTime = $("#operTime").val().split('~')[1].trim() + ' 23:59:59';
|
||||
}
|
||||
postDownLoadFile({
|
||||
url : reqBasePath + 'salesoutlet005?userToken=' + getCookie('userToken') + '&loginPCIp=' + returnCitySN["cip"],
|
||||
params: {defaultNumber: $("#defaultNumber").val(), material: $("#material").val(), startTime: startTime, endTime: endTime},
|
||||
method : 'post'
|
||||
});
|
||||
});
|
||||
|
||||
exports('salesoutletlist', {});
|
||||
});
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
<div class="winui-tool">
|
||||
<button id="reloadTable" class="winui-toolbtn"><i class="fa fa-refresh" aria-hidden="true"></i>刷新数据</button>
|
||||
<button id="addBean" class="winui-toolbtn" auth="1571813632546"><i class="fa fa-plus" aria-hidden="true"></i>新增</button>
|
||||
<button id="downloadExcel" class="winui-toolbtn" auth="1572231503534"><i class="fa fa-download" aria-hidden="true"></i>导出Excel</button>
|
||||
</div>
|
||||
</div>
|
||||
<div style="margin:auto 10px;">
|
||||
|
|
Loading…
Reference in a new issue