Browse Source

[feat] 销售管理

销售订单前端新增导出table按钮和js方法,可导出一行,可导出多行
新增销售订单导出选择行和导出所有后端接口
销售订单实体类属性加上@Excel注解,字典类型加上对应的方法
销售订单新增 根据销售单号数组查询销售订单集合后端方法
销售订单新增 查询可使用的销售订单
dev
liuxiaoxu 3 months ago
parent
commit
fb0ec93d82
  1. 21
      ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysSalesOrderController.java
  2. 1
      ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysCustomerQuote.java
  3. 29
      ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysSalesOrder.java
  4. 10
      ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysSalesOrderMapper.java
  5. 10
      ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysSalesOrderService.java
  6. 17
      ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysSalesOrderServiceImpl.java
  7. 58
      ruoyi-admin/src/main/resources/mapper/system/SysSalesOrderMapper.xml
  8. 66
      ruoyi-admin/src/main/resources/templates/system/salesOrder/salesOrder.html

21
ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysSalesOrderController.java

@ -148,6 +148,22 @@ public class SysSalesOrderController extends BaseController
return getDataTable(list);
}
/**
* 导出销售订单列表
*/
@RequiresPermissions("system:salesOrder:export")
@Log(title = "销售订单", businessType = BusinessType.EXPORT)
@PostMapping("/exportAll")
@ResponseBody
public AjaxResult exportAll(SysSalesOrderVo sysSalesOrder)
{
List<SysSalesOrderVo> list = sysSalesOrderService.selectSysSalesOrderAllList(sysSalesOrder);
ExcelUtil<SysSalesOrderVo> util = new ExcelUtil<SysSalesOrderVo>(SysSalesOrderVo.class);
return util.exportExcel(list, "销售订单数据");
}
/**
* 导出销售订单列表
*/
@ -156,15 +172,16 @@ public class SysSalesOrderController extends BaseController
@Log(title = "销售订单", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@ResponseBody
public AjaxResult export(SysSalesOrderVo sysSalesOrder)
public AjaxResult export(@RequestBody String[] salesOrderCodes)
{
List<SysSalesOrderVo> list = sysSalesOrderService.selectSysSalesOrderList(sysSalesOrder);
List<SysSalesOrderVo> list = sysSalesOrderService.selectSysSalesOrderListByCodes(salesOrderCodes);
ExcelUtil<SysSalesOrderVo> util = new ExcelUtil<SysSalesOrderVo>(SysSalesOrderVo.class);
return util.exportExcel(list, "销售订单数据");
}
/**
* 修改保存销售订单
* */

1
ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysCustomerQuote.java

@ -86,7 +86,6 @@ public class SysCustomerQuote extends BaseEntity
private BigDecimal usdSum;
private String businessMembers;
@Excel(name = "审核标志: 0未审核 1审核成功 2审核拒绝")
private String deginFlag;
/** 删除标志(0代表存在 1代表删除) */

29
ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysSalesOrder.java

@ -21,15 +21,25 @@ public class SysSalesOrder extends BaseEntity {
/* 订单id*/
private Long salesOrderId;
/*使用状态 0未使用,1使用,2已作废*/
@Excel(name = "使用状态", dictType = "useStatus")
private String useStatus;
/*审核状态 (0未审核,1审核通过,2审核拒绝)*/
@Excel(name = "审核状态", dictType = "auditStatus")
private String auditStatus;
/*出货状态(0待出货通知,1待准备货,2待出货,3部分收货,4全部收货,5部分出货,6全部出货,7部分验收,8全部验收)*/
@Excel(name = "出货状态", dictType = "sys_delivery_status")
private String deliveryStatus;
/*收款结案状态(0待收款,1部分收款,2全部收款,3已结案)*/
@Excel(name = "收款结案状态", dictType = "sys_close_status")
private String closeStatus;
/**生产状态(0待评审、1待部门主管确认、2待工程审核、3待生产、4生产中、5部分完成、6全部完成)*/
@Excel(name = "生产状态", dictType = "sys_erp_makeStatus")
private String makeStatus;
/* 订单编号*/
@Excel(name = "销售订单编号")
@ -37,7 +47,7 @@ public class SysSalesOrder extends BaseEntity {
/*订单号码*/
@Excel(name = "客户订单编号")
private String salesOrderNumber;
@Excel(name = "订单类型")
@Excel(name = "订单类型", dictType = "sys_order_type")
private String salesOrderType;
/* 客户代码*/
@Excel(name = "客户代码")
@ -45,41 +55,58 @@ public class SysSalesOrder extends BaseEntity {
@Excel(name="币种")
private String commonCurrency;
/*美元汇率*/
@Excel(name = "美元汇率")
private Double usdTax;
/*税率*/
@Excel(name = "税率")
private Double taxRate;
/*是否开票*/
@Excel(name = "是否开票", dictType = "sys_whether")
private String invoice;
/* 客户名称*/
@Excel(name = "客户名称")
private String enterpriseName;
/*事业部*/
@Excel(name = "事业部")
private String customerPurser;
/*客户电话*/
@Excel(name = "客户电话")
private String customerPhone;
/*物料合计*/
@Excel(name = "物料合计")
private Long materialSum;
/*数量合计*/
@Excel(name = "数量合计")
private Long enterpriseSum;
/*不含税单价(RMB)*/
@Excel(name = "不含税单价(RMB)")
private Double noRmbPrice;
/*不含税总价(RMB)*/
@Excel(name = "不含税总价(RMB)")
private Double noRmbSum;
/*含税单价(RMB)*/
@Excel(name = "含税单价(RMB)")
private Double rmbPrice;
/*含税总价(RMB)*/
@Excel(name = "含税总价(RMB)")
private Double rmbTaxSum;
/*不含税单价(美元)*/
@Excel(name = "不含税单价(美元)")
private Double noUsdPrice;
/*不含税总价(美元)*/
@Excel(name = "不含税总价(美元)")
private Double noUsdSum;
/*含税单价(美元)*/
@Excel(name = "含税单价(美元)")
private Double usdPrice;
/*含税总价(美元)*/
@Excel(name = "含税总价(美元)")
private Double usdTaxSum;
/*计划交付时间*/
@Excel(name = "计划交付时间")
private String deliveryTime;
/*客户收货人*/
@Excel(name = "客户收货人")
private String customerDelivery;
/*客户收货人(Bill to)*/

10
ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysSalesOrderMapper.java

@ -76,4 +76,14 @@ public interface SysSalesOrderMapper
* @return 结果
* */
int updateSysSalesOrderBySalesOrderCode(SysSalesOrder sysSalesOrder);
/**
* 根据销售单号数组查询销售订单集合
* */
List<SysSalesOrderVo> selectSysSalesOrderListByCodes(String[] salesOrderCodes);
/**
* 导出查询所有的销售订单
* */
List<SysSalesOrderVo> selectSysSalesOrderAllList(SysSalesOrderVo sysSalesOrder);
}

10
ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysSalesOrderService.java

@ -115,4 +115,14 @@ public interface ISysSalesOrderService
* 导出销售订单数据
*/
void exportSalesOrderByCode(String salesOrderCode, HttpServletResponse response);
/**
* 根据销售单号数组查询销售订单集合
* */
List<SysSalesOrderVo> selectSysSalesOrderListByCodes(String[] salesOrderCodes);
/**
* 查询所有可使用的销售订单
* */
List<SysSalesOrderVo> selectSysSalesOrderAllList(SysSalesOrderVo sysSalesOrder);
}

17
ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysSalesOrderServiceImpl.java

@ -206,6 +206,23 @@ public class SysSalesOrderServiceImpl implements ISysSalesOrderService
return returnList;
}
/**
* 根据销售单号数组查询销售订单集合
* */
@Override
public List<SysSalesOrderVo> selectSysSalesOrderListByCodes(String[] salesOrderCodes) {
return sysSalesOrderMapper.selectSysSalesOrderListByCodes(salesOrderCodes);
}
/**
* 导出查询所有的销售订单
* */
@Override
public List<SysSalesOrderVo> selectSysSalesOrderAllList(SysSalesOrderVo sysSalesOrder) {
return sysSalesOrderMapper.selectSysSalesOrderAllList(sysSalesOrder);
}
/**
* 新增销售订单
*

58
ruoyi-admin/src/main/resources/mapper/system/SysSalesOrderMapper.xml

@ -146,6 +146,64 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where sales_order_code = #{salesOrderCode}
</select>
<select id="selectSysSalesOrderListByCodes" parameterType="String" resultMap="SysSalesOrderResult">
<include refid="selectSysSalesOrderVo"/>
where sales_order_code in
<foreach item="salesOrderCode" index="index" collection="array" open="(" separator="," close=")">
#{salesOrderCode}
</foreach>
</select>
<select id="selectSysSalesOrderAllList" parameterType="SysSalesOrderVo" resultMap="SysSalesOrderResult">
select s.sales_order_id, s.use_status, s.audit_status, s.make_status, s.delivery_status,
s.close_status, s.sales_order_code, s.sales_order_number, s.sales_order_type,s.enterprise_code,
s.customer_purser,s.common_currency,s.enterprise_name,s.enterprise_material_no, s.material_sum, s.enterprise_sum,
s.noRmbPrice, s.noRmbSum, s.rmbPrice, s.rmbTaxSum,s.noUsdPrice, s.noUsdSum, s.usdPrice, s.usdTaxSum,
s.payment_terms, s.delivery_time,s.delivery_conditions, s.delivery_method, s.delivery_address,s.delivery_phone,
s.customer_delivery,s.order_receiving_mode,s.order_receiving_time,s.customer_contact, s.contact_number,s.contact_email, s.contact_post,
s.customer_fax,s.business_members, s.confirm_tax, s.tax_rate, s.usd_tax,s.invoice,s.total_amount, s.billing_time,
s.modification_time,s.standby_one,s.standby_two, s.first_add_time,s.update_info_time, s.file_upload, s.create_by,
s.create_time, s.update_by, s.update_time, s.remark,s.out_bound_quantity, s.un_bound_quantity, s.trade_clause,
s.instance_id, s.instance_type,s.submit_instance_id, s.cancel_instance_id, s.restore_instance_id, s.apply_title, s.apply_user,
s.apply_time,p.dict_value as instance_type_name
from sys_sales_order as s
left join(
select dict_value,dict_label from sys_dict_data
where dict_type = 'processType'
) as p
on s.instance_type = p.dict_value
<where>
<if test="createBy != null and createBy !=''"> and s.create_by = #{createBy}</if>
<if test="salesOrderCode != null and salesOrderCode != ''"> and s.sales_order_code like concat('%', #{salesOrderCode}, '%')</if>
<if test="salesOrderNumber != null and salesOrderNumber != ''"> and s.sales_order_number like concat('%', #{salesOrderNumber}, '%')</if>
<if test="enterpriseCode != null and enterpriseCode != ''"> and s.enterprise_code like concat('%', #{enterpriseCode}, '%')</if>
<if test="enterpriseName != null and enterpriseName != ''"> and s.enterprise_name like concat('%', #{enterpriseName}, '%')</if>
<if test="enterpriseMaterialNo != null and enterpriseMaterialNo != ''"> and s.enterprise_material_no like concat('%', #{enterpriseMaterialNo}, '%')</if>
<if test="customerContact != null and customerContact != ''"> and s.customer_contact = #{customerContact}</if>
<if test="contactNumber != null and contactNumber != ''"> and s.contact_number = #{contactNumber}</if>
<if test="businessMembers != null and businessMembers != ''"> and s.business_members = #{businessMembers}</if>
<if test="useStatus != null and useStatus != ''"> and s.use_status = #{useStatus}</if>
<if test="auditStatus != null and auditStatus != ''"> and s.audit_status = #{auditStatus}</if>
<if test="makeStatus != null and makeStatus != ''"> and s.make_status = #{makeStatus}</if>
<if test="deliveryStatus != null and deliveryStatus != ''"> and s.delivery_status = #{deliveryStatus}</if>
<if test="closeStatus != null and closeStatus != ''"> and s.close_status = #{closeStatus}</if>
<if test="invoice != null and invoice != ''"> and s.invoice = #{invoice}</if>
<if test="instanceType != null and instanceType != ''"> and s.instance_type = #{instanceType}</if>
<if test="instanceId != null and instanceId != ''"> and s.instance_id = #{instanceId}</if>
<if test="applyUser != null and applyUser != ''"> and s.apply_user = #{applyUser}</if>
<if test="applyTime != null and applyTime != ''"> and s.apply_time = #{applyTime}</if>
<if test="applyTitle != null and applyTitle != ''"> and s.apply_title = #{applyTitle}</if>
<if test="applyUsers != null and applyUsers != ''"> and s.apply_user in
<foreach item="user" index="index" collection="applyUsers" open="(" separator="," close=")">
#{user}
</foreach>
</if>
</where>
order by s.audit_status,s.create_time desc
</select>
<insert id="insertSysSalesOrder" parameterType="SysSalesOrder" useGeneratedKeys="true" keyProperty="salesOrderId">
insert into sys_sales_order
<trim prefix="(" suffix=")" suffixOverrides=",">

66
ruoyi-admin/src/main/resources/templates/system/salesOrder/salesOrder.html

@ -185,11 +185,12 @@
</form>
</div>
<div class="btn-group-sm" id="toolbar" role="group">
<a class="btn btn-warning" onclick="exportSalesOrder()" shiro:hasPermission="system:salesOrder:exportSalesOrder">
<a class="btn btn-warning" onclick="exportExcel()" shiro:hasPermission="system:salesOrder:export">
<i class="fa fa-download"></i> 导出
</a>
<a class="btn btn-warning" onclick="exportSalesOrder()" shiro:hasPermission="system:salesOrder:exportSalesOrder">
<i class="fa fa-download"></i> 导出销售订单
</a>
<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:salesOrder:add">
<i class="fa fa-plus"></i> 添加
</a>
@ -452,6 +453,65 @@
}
// 导出
function exportExcel(formId) {
// $.table.set();
var salesOrderCodeData = [];
var selections = $("#bootstrap-table").bootstrapTable("getSelections");
if(selections.length === 0){
$.modal.confirm("确定导出所有出货通知吗?", function() {
var currentId = $.common.isEmpty(formId) ? $('form').attr('id') : formId;
var params = $("#bootstrap-table").bootstrapTable('getOptions');
var dataParam = $("#" + currentId).serializeArray();
dataParam.push({ "name": "orderByColumn", "value": params.sortName });
dataParam.push({ "name": "isAsc", "value": params.sortOrder });
$.modal.loading("正在导出数据,请稍后...");
$.post(prefix + '/exportAll', dataParam, function(result) {
if (result.code == web_status.SUCCESS) {
window.location.href = ctx + "common/download?fileName=" + encodeURI(result.msg) + "&delete=" + true;
} else if (result.code == web_status.WARNING) {
$.modal.alertWarning(result.msg)
} else {
$.modal.alertError(result.msg);
}
$.modal.closeLoading();
});
});
}else {
$.modal.confirm("确定导出选中的所有出货通知吗?", function () {
//·拼接单号
for(let i=0;i<selections.length;i++){
salesOrderCodeData.push(selections[i].salesOrderCode);
}
var salesOrderCodes = JSON.stringify(salesOrderCodeData);
// console.log(bomNos);
$.modal.loading("正在导出数据,请稍后...");
var config = {
url: prefix + '/export',
type: "post",
dataType: "json",
contentType: "application/json;charset=utf-8",
data: salesOrderCodes,
success: function(result) {
window.location.href = ctx + "common/download?fileName=" + encodeURI(result.msg) + "&delete=" + true;
$.modal.alertSuccess("导出成功!")
$.modal.closeLoading();
},
error: function (result){
$.modal.alertError(result.msg);
}
};
$.ajax(config)
});
}
};
/*旧导出销售订单模板*/
// function exportSalesOrder(){
//

Loading…
Cancel
Save