一、ERP
1、SaleReturnReportController
private static final Logger log = LoggerFactory.getLogger(SaleReturnReportController.class); @Autowired SaleReturnReportServiceAPI saleReturnReportServiceAPI;
@GetMapping
String index(){
return "saleReport/list";
}
/**
* 获取销售退货数据集合
* @param param
* @return
*/
@ResponseBody
@RequestMapping("/getSaleReturnList")
PageUtils<SaleReturnReport> getSaleReturnList(@RequestParam Map<String,Object> param){
ParamUtil.dealParam(param);
return saleReturnReportServiceAPI.getSaleReturnList(param);
}
2、SaleReturnReportServiceAPI
@FeignClient(name="warehouseServer",configuration = FeignAuthConfig.class)
public interface SaleReturnReportServiceAPI {
@RequestMapping("/saleReturnReport/getSaleReturnList")
PageUtils<SaleReturnReport> getSaleReturnList(@RequestParam Map<String,Object> param);
}
3、js
var prefix = "/saleReturnReport"
$('#exampleTable').bootstrapTable('destroy');
$('#exampleTable')
.bootstrapTable(
{
method : 'get', // 服务器数据的请求方式 get or post
url : prefix+'/getSaleReturnList', // 服务器数据的加载地址
striped : true, // 设置为true会有隔行变色效果
dataType : "json", // 服务器返回的数据类型
pagination : true, // 设置为true会在底部显示分页条
// queryParamsType : "limit",
// //设置为limit则会发送符合RESTFull格式的参数
singleSelect : false, // 设置为true将禁止多选
iconSize : 'outline',
toolbar : '#exampleToolbar',
contentType : "application/x-www-form-urlencoded",
// //发送到服务器的数据编码类型
pageSize : 10, // 如果设置了分页,每页数据条数
pageNumber : 1, // 如果设置了分布,首页页码
search : false, // 是否显示搜索框
showColumns : false, // 是否显示内容下拉框(选择显示的列)
showRefresh: false, //是否显示刷新按钮
sidePagination : "server", // 设置在哪里进行分页,可选值为"client" 或者
queryParams : function(params) {
return {
// 说明:传入后台的参数包括offset开始索引,limit步长,sort排序列,order:desc或者,以及所有列的键值对
limit : params.limit,
offset : params.offset,
barCode:$.trim($("#barCode").val()),
category:$("#category").val(),
cateIdStr:$('#cateId').val() ? JSON.stringify($('#cateId').val()) : '',
businessId:$("#businessId").val(),
billTypeIdStr:$('#billTypeId').val() ? JSON.stringify($('#billTypeId').val()) : '',
bigAreaIdStr:$('#bigAreaId').val() ? JSON.stringify($('#bigAreaId').val()) : '',
storeIdStr:$('#storeId').val() ? JSON.stringify($('#storeId').val()) : '',
companyIdStr:$('#companyId').val() ? JSON.stringify($('#companyId').val()) : '',
billNo:$.trim($("#billNo").val()),
startSaleTime:$("#startSaleTime").val(),
endSaleTime:$("#endSaleTime").val(),
startEntryDate:$("#startEntryDate").val(),
endEntryDate:$("#endEntryDate").val()
};
},
//表格渲染完成后执行
onLoadSuccess: function () {
shouHead(706)//菜单id
},
//表格显示下拉列属性改成false
showColumns : false,
columns : [
{
field : 'billType',
title : '退货类型'
4、html
<script type="text/javascript" src="http://127.0.0.1:8000/CLodopfuncs.js?priority=1"></script>
<div th:include="include::footer"></div>
<script type="text/javascript" src="/js/plugins/bootstrap/bootstrap-select.js" charset="UTF-8"></script>
<script type="text/javascript" src="/js/plugins/bootstrap/locales/defaults-zh_CN.min.js" charset="UTF-8"></script>
<script type="text/javascript" src="/js/plugins/bootstrap/bootstrap-datepicker.js" charset="UTF-8"></script>
<script type="text/javascript" src="/js/plugins/bootstrap/locales/bootstrap-datepicker.zh-CN.min.js"charset="UTF-8"></script>
<script type="text/javascript" src="/js/appjs/warehouse/commonWarehouse.js"></script>
<script type="text/javascript" src="/js/appjs/saleReport/list.js?v=2"></script>
<script type="text/javascript">
$('#startSaleTime').datepicker({
language: 'zh-CN',
format: 'yyyy-mm-dd',
autoclose: true
});
$('#endSaleTime').datepicker({
language: 'zh-CN',
format: 'yyyy-mm-dd',
autoclose: true
})
$('#startEntryDate').datepicker({
language: 'zh-CN',
format: 'yyyy-mm-dd',
autoclose: true
});
$('#endEntryDate').datepicker({
language: 'zh-CN',
format: 'yyyy-mm-dd',
autoclose: true
})
</script>
二、微服务
1、SalesReturnBillController相关Controller
private static final Logger log = LoggerFactory.getLogger(SalesReturnBillController.class); @Autowired private ISalesReturnBillService returnBillService;
/** * 获取销售退货单列表 * @param salesReturnBill * @return */ @ResponseBody @RequestMapping("/list") ResponseResult list(@RequestBody SalesReturnBill salesReturnBill){ PageUtils<SalesReturnBill> result; try { result = returnBillService.list(salesReturnBill); return new ResponseResult<>(WebConstants.SUCCESS, "成功", result); } catch (Exception e) { log.error("SalesReturnBillController-list error:",e); e.printStackTrace(); return new ResponseResult<>(WebConstants.ERROR,"失败",e); } }
/**
* 获取销售退货单-退货货品列表
* @param billIds
* @return
*/
@ResponseBody
@RequestMapping("/listMaterial")
ResponseResult listMaterial(String billIds){
List<SalesReturnBillMaterial> result;
try {
result = returnBillService.listMaterial(billIds);
return new ResponseResult<>(WebConstants.SUCCESS, "成功", result);
} catch (Exception e) {
log.error("SalesReturnBillController-listMaterial error:",e);
e.printStackTrace();
return new ResponseResult<>(WebConstants.ERROR,"失败",e);
}
}
2、ISalesReturnBillService服务接口类
/**
* 获取销售退货单列表
* @param returnBill
* @return
*/
PageUtils<SalesReturnBill> list(SalesReturnBill returnBill);
/**
* 获取销售退货单实出货品列表
* @param billIds
* @return
*/
List<SalesReturnBillMaterial> listMaterial(String billIds);
3、SalesReturnBillServiceImpl服务实现类
@Autowired
OrderServiceAPI orderServiceAPI;
@Autowired
ISalesReturnBillDao billDao;
@Override
public PageUtils<SalesReturnBill> list(SalesReturnBill returnBill) {
PageUtils<SalesReturnBill> result = new PageUtils<>();
List<SalesReturnBill> rows = null;
int count = billDao.count(returnBill);
if(count > 0) {
rows = billDao.list(returnBill);
}
result.setRows(rows);
result.setTotal(count);
return result;
}
4、ISalesReturnBillDao相关DAO
public interface ISalesReturnBillDao { /** * 销售退货单列表 * @param salesReturnBill * @return */ List<SalesReturnBill> list(SalesReturnBill salesReturnBill); /** * 销售退货单数量 * @param salesReturnBill * @return */ int count(SalesReturnBill salesReturnBill);
5、Mapper
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.derier.warehouseservice.dao.ordersales.ISalesReturnBillDao">
<select id="list" parameterType="SalesReturnBill" resultType="SalesReturnBill">
SELECT
b.id,
b.bill_id,
b.source_bill_no,
b.bill_no,
b.source_bill_type_id,
(SELECT t.bill_type_name FROM st_base_bill_type t WHERE t.id = b.source_bill_type_id) AS sourceBillTypeName,
b.bill_type_id,
(SELECT t.bill_type_name FROM st_base_bill_type t WHERE t.id = b.bill_type_id) AS billType,
b.store_id,
(SELECT s.name FROM tb_store s WHERE s.id = b.store_id) AS storeName,
b.customer_id,
b.warehouse_id,
(SELECT w.warehouse_name FROM st_base_warehouse w WHERE w.id = b.warehouse_id) AS warehouseName,
b.location_id,
(SELECT l.storage_location_name FROM st_base_storage_location l WHERE l.id = b.location_id) as locationName,
b.delivery_date,
b.state,
b.remark,
c.customer_name,
c.customer_code,
<select id="count" parameterType="SalesReturnBill" resultType="int">
SELECT
COUNT(1)
FROM sl_return_bill b,cus_customer c
WHERE b.customer_id = c.id
<if test="id != null and id != ''">
AND b.id IN (${id})
</if>
<if test="barCode != null and barCode != ''">
AND EXISTS(
SELECT
m.id
FROM sl_return_bill_material m
WHERE m.bill_id = b.id
AND m.bar_code = #{barCode}
)
</if>
<if test="billId != null and billId != ''">
AND b.bill_id = #{billId}
</if>
<if test="sourceBillNo != null and sourceBillNo != ''">
AND b.source_bill_no = #{sourceBillNo}
</if>
<if test="billNo != null and billNo != ''">
AND b.bill_no = #{billNo}
</if>
<if test="billTypeId != null and billTypeId != ''">
AND b.bill_type_id IN (${billTypeId})
</if>
<if test="state != null and state != ''">
AND b.state IN (${state})
</if>
<if test="warehouseId != null and warehouseId != ''">
AND b.warehouse_id IN (${warehouseId})
</if>
<if test="locationId != null and locationId != ''">
AND b.location_id IN (${locationId})
</if>
<if test="customerName != null and customerName != ''">
AND c.customer_name = #{customerName}
</if>
<if test="customerContact != null and customerContact != ''">
AND c.phone = #{customerContact}
</if>
<if test="customerCode != null and customerCode != ''">
AND c.customer_code = #{customerCode}
</if>
<if test="deliveryDateStart != null and deliveryDateStart != ''">
AND b.delivery_date >= #{deliveryDateStart}
</if>
<if test="deliveryDateEnd != null and deliveryDateEnd != ''">
AND b.delivery_date <= #{deliveryDateEnd}
</if>
<if test="createTimeStart != null and createTimeStart != ''">
AND DATE_FORMAT(b.create_time,'%Y-%m-%d') >= #{createTimeStart}
</if>
<if test="createTimeEnd != null and createTimeEnd != ''">
AND DATE_FORMAT(b.create_time,'%Y-%m-%d') <= #{createTimeEnd}
</if>
<if test="checkTimeStart != null and checkTimeStart != ''">
AND DATE_FORMAT(b.check_time,'%Y-%m-%d') >= #{checkTimeStart}
</if>
<if test="checkTimeEnd != null and checkTimeEnd != ''">
AND DATE_FORMAT(b.check_time,'%Y-%m-%d') <= #{checkTimeEnd}
</if>
</select>
三、数据
1、微服务跟踪
com.derier.warehouseservice.dao.ordersales.ISalesReturnBillDao.count|==> Preparing: SELECT COUNT(1) FROM sl_return_bill b,cus_customer c WHERE b.customer_id = c.id
20211020-17:49:14.104+0800|default|http-nio-18302-exec-3|DEBUG|com.derier.warehouseservice.dao.ordersales.ISalesReturnBillDao.count|==> Parameters:
20211020-17:49:14.107+0800|default|http-nio-18302-exec-3|DEBUG|com.derier.warehouseservice.dao.ordersales.ISalesReturnBillDao.count|<== Total: 1
20211020-17:49:14.108+0800|default|http-nio-18302-exec-3|DEBUG|com.derier.warehouseservice.dao.ordersales.ISalesReturnBillDao.list|==> Preparing: SELECT b.id, b.bill_id, b.source_bill_no, b.bill_no, b.source_bill_type_id, (SELECT t.bill_type_name FROM st_base_bill_type t WHERE t.id = b.source_bill_type_id) AS sourceBillTypeName, b.bill_type_id, (SELECT t.bill_type_name FROM st_base_bill_type t WHERE t.id = b.bill_type_id) AS billType, b.store_id, (SELECT s.name FROM tb_store s WHERE s.id = b.store_id) AS storeName, b.customer_id, b.warehouse_id, (SELECT w.warehouse_name FROM st_base_warehouse w WHERE w.id = b.warehouse_id) AS warehouseName, b.location_id, (SELECT l.storage_location_name FROM st_base_storage_location l WHERE l.id = b.location_id) as locationName, b.delivery_date, b.state, b.remark, c.customer_name, c.customer_code, c.phone AS customerContact, (SELECT u.username FROM sys_user u WHERE u.user_id = b.create_by) AS createBy, CONCAT(b.create_time,'') AS createTime, (SELECT u.username FROM sys_user u WHERE u.user_id = b.check_by) AS checkBy, CONCAT(b.check_time,'') AS checkTime FROM sl_return_bill b,cus_customer c WHERE b.customer_id = c.id ORDER BY b.create_time DESC LIMIT 0,10
20211020-17:49:14.108+0800|default|http-nio-18302-exec-3|DEBUG|com.derier.warehouseservice.dao.ordersales.ISalesReturnBillDao.list|==> Parameters:
20211020-17:49:14.113+0800|default|http-nio-18302-exec-3|DEBUG|com.derier.warehouseservice.dao.ordersales.ISalesReturnBillDao.list|<== Total: 10
2、页面接口数据 3、页面接口地址 http://172.26.0.110:8070/orderSales/returnBill/list
4、页面数据 5、erp服务跟踪
四、实体
/**
* sendMaterialReconciliation实体对象
* getSendReturnList
* @author jinjian
* @Date 2018-11-1
*/
public class SendMaterialReconciliationDto implements Serializable {
private static final long serialVersionUID = 966778587427484638L;
/** 主键id */
private Integer id;
/** 加工单id/定制工单id */
private Integer machiningId;
/** 加工单号/定制工单号*/
private String sourceBillNo;
/**来源单类型,1:加工单 2:定制工单*/
private Integer sourceBillType;
/**加工单单据类型名称*/
private String machiningBillTypeName;
/** 发料单号 */
private String billNo;
/** 单据类型id */
private String billTypeId;
/** 单据类型名称*/
private String billTypeName;
/** 供应商id,参照tb_supplier中ID */
private String supplyId;
五、build gradle
group 'com.dj.erp' version '1.0-SNAPSHOT' apply plugin: 'java' apply plugin: 'war' sourceCompatibility = 1.8 version = '1.0' buildscript { ext { springBootVersion = '2.0.3.RELEASE' } repositories { jcenter() mavenCentral() } dependencies { classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}") } } apply plugin: 'java' apply plugin: 'org.springframework.boot' apply plugin: 'io.spring.dependency-management' apply plugin: 'application' mainClassName = "com.dj.erp.MllAdminApplication" jar { baseName = 'admin' version = '1.0-SNAPSHOT' } repositories { mavenCentral() maven{ url 'http://repo.spring.io/milestone/' } maven{ url 'http://172.20.0.91:8081/repository/maven-public/' } } ext { springCloudVersion = 'Finchley.RELEASE' } dependencies { compile("org.springframework.boot:spring-boot-starter:${springBootVersion}") compile ("org.springframework.boot:spring-boot-starter-log4j:1.3.8.RELEASE") { exclude group: 'org.slf4j', module: 'slf4j-log4j12' } compile ("org.springframework.boot:spring-boot-starter-web:${springBootVersion}") compile ("org.springframework.boot:spring-boot-starter-activemq:${springBootVersion}") compile ("org.springframework.boot:spring-boot-devtools:${springBootVersion}") compile ("com.github.theborakompanioni:thymeleaf-extras-shiro:1.2.1") compile ("org.apache.velocity:velocity:1.7") compile ("net.sourceforge.nekohtml:nekohtml:1.9.22") compile ("commons-fileupload:commons-fileupload:1.3.1") compile ("cn.songxinqiang:com.baidu.ueditor:1.1.2-offical") // compile group: 'org.springframework.boot', name: 'spring-boot-starter-activemq', version: '2.0.0.M1' compile ("org.apache.cxf:cxf-spring-boot-starter-jaxws:3.2.1") compile ("axis:axis:1.4") compile ("com.github.theborakompanioni:thymeleaf-extras-shiro:2.0.0") compile ("org.springframework.boot:spring-boot-starter-cache") // https://mvnrepository.com/artifact/net.sf.ehcache/ehcache compile group: 'net.sf.ehcache', name: 'ehcache', version: '2.10.5' compile ("org.springframework.boot:spring-boot-starter-thymeleaf") compile ("org.springframework.cloud:spring-cloud-starter-netflix-eureka-client") compile ("org.springframework.cloud:spring-cloud-starter-zipkin") compile ("org.springframework.boot:spring-boot-starter-actuator") compile ("org.springframework.cloud:spring-cloud-starter-openfeign") compile ("org.springframework.cloud:spring-cloud-starter-netflix-hystrix") compile ("org.springframework.cloud:spring-cloud-starter-netflix-hystrix-dashboard") // compile ("org.activiti:activiti-spring-boot-starter-basic:6.0.0.RC1") compile ("org.activiti:activiti-engine:6.0.0") testCompile("org.springframework.boot:spring-boot-starter-test") compile group: 'io.github.openfeign', name: 'feign-httpclient', version: '9.7.0' compile ("org.springframework.boot:spring-boot-starter-data-jpa") // providedRuntime 'org.springframework.boot:spring-boot-starter-tomcat' // compile group: 'org.springframework.cloud', name: 'spring-cloud-starter-sleuth', version: '2.0.2.RELEASE' // compile group: 'org.springframework.cloud', name: 'spring-cloud-starter-zipkin', version: '2.0.2.RELEASE' // compile group: 'org.springframework.cloud', name: 'spring-cloud-stream-binder-rabbit', version: '2.0.2.RELEASE' // https://mvnrepository.com/artifact/org.bidib.jbidib.org.qbang.rxtx/rxtxcomm compile group: 'org.bidib.jbidib.org.qbang.rxtx', name: 'rxtxcomm', version: '2.2' // 条形码jar compile group: 'net.sf.barcode4j', name: 'barcode4j', version: '2.0' compile group: 'javax.ws.rs', name: 'jsr311-api', version: '1.1.1' //内部组件依赖 // compile ("com.dj:api-common:2.7-SNAPSHOT") compile project(':erp-domain') compile project(':erp-common') compile project(':erp-service') } dependencyManagement { imports { mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}" } }