Browse Source

[feat] 销售管理

修改通过生成单号查询出货设备的后端接口,由单个实体查询为多个对象
新增 出货发票导出模板类
新增 导出出货发票1模板后端接口和具体实现类
销售出货发票新增导出销售出货发票1前端按钮和js方法,导出前进行选择的数据校验
修改 通过销售订单号查询销售订单子表后端接口:新增含税单价美元和含税总价美元字段
附件目录新增销售出货发票1excel模板
dev
liuxiaoxu 3 months ago
parent
commit
3d84db4496
  1. 7
      ruoyi-admin/src/main/java/com/ruoyi/aftersales/mapper/AfterSalesShippingDeviceMapper.java
  2. 14
      ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysSalesShippingInformController.java
  3. 26
      ruoyi-admin/src/main/java/com/ruoyi/system/dto/ExportShippingInvoiceDto.java
  4. 4
      ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysSalesShippingInformService.java
  5. 83
      ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysSalesShippingInformServiceImpl.java
  6. 2
      ruoyi-admin/src/main/resources/mapper/system/SysSalesOrderChildMapper.xml
  7. BIN
      ruoyi-admin/src/main/resources/static/attachments/销售出货发票1.xlsx
  8. 52
      ruoyi-admin/src/main/resources/templates/system/salesShippingInform/salesShippingInform.html

7
ruoyi-admin/src/main/java/com/ruoyi/aftersales/mapper/AfterSalesShippingDeviceMapper.java

@ -34,7 +34,12 @@ public interface AfterSalesShippingDeviceMapper
* @param makeNo 关联生产订单号 * @param makeNo 关联生产订单号
* @return 选择设备信息 * @return 选择设备信息
*/ */
public AfterSalesShippingDevice selectShippingDeviceByMakeNo(String makeNo); public List<AfterSalesShippingDevice> selectShippingDeviceByMakeNo(String makeNo);
/** /**
* 查询出货设备列表 * 查询出货设备列表

14
ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysSalesShippingInformController.java

@ -138,6 +138,20 @@ public class SysSalesShippingInformController extends BaseController
} }
/**
* 导出出货发票1模板
* */
@RequiresPermissions("system:salesShippingInform:exportShippingInvoiceOne")
@Log(title = "销售出货单", businessType = BusinessType.EXPORT)
@GetMapping("/exportShippingInvoiceOne/{outOrderCode}")
public void exportShippingInvoiceOne(@PathVariable("outOrderCode") String outOrderCode,HttpServletResponse response) {
sysSalesShippingInformService.exportShippingInvoiceOne(outOrderCode, response);
}
/** /**
* 导出出货单通知单模板 * 导出出货单通知单模板
* */ * */

26
ruoyi-admin/src/main/java/com/ruoyi/system/dto/ExportShippingInvoiceDto.java

@ -0,0 +1,26 @@
package com.ruoyi.system.dto;
import lombok.Data;
import java.math.BigDecimal;
/**
* 出货发票导出模板类
* */
@Data
public class ExportShippingInvoiceDto {
private Integer index;
private String materialName;
private String makeNo;
private Integer materialNum;
private BigDecimal materialUsd;
private BigDecimal materialUsdSum;
}

4
ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysSalesShippingInformService.java

@ -139,4 +139,8 @@ public interface ISysSalesShippingInformService
* */ * */
void exportShippingInformOrder(String outOrderCode, HttpServletResponse response); void exportShippingInformOrder(String outOrderCode, HttpServletResponse response);
/**
* 导出出货发票1模板
* */
void exportShippingInvoiceOne(String outOrderCode, HttpServletResponse response);
} }

83
ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysSalesShippingInformServiceImpl.java

@ -22,6 +22,7 @@ import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.file.FileDownloadUtils; import com.ruoyi.common.utils.file.FileDownloadUtils;
import com.ruoyi.system.domain.*; import com.ruoyi.system.domain.*;
import com.ruoyi.system.dto.ExportShippingInformOrderDto; import com.ruoyi.system.dto.ExportShippingInformOrderDto;
import com.ruoyi.system.dto.ExportShippingInvoiceDto;
import com.ruoyi.system.dto.ExportShippingOrderDto; import com.ruoyi.system.dto.ExportShippingOrderDto;
import com.ruoyi.system.dto.ExportShippingPackingDto; import com.ruoyi.system.dto.ExportShippingPackingDto;
import com.ruoyi.system.mapper.*; import com.ruoyi.system.mapper.*;
@ -666,6 +667,88 @@ public class SysSalesShippingInformServiceImpl implements ISysSalesShippingInfor
} }
} }
/**
* 导出出货单发票1模板
* */
@Override
public void exportShippingInvoiceOne(String outOrderCode, HttpServletResponse response) {
String fileName = "销售出货发票1.xlsx";
FileDownloadUtils fileDownloadUtils = new FileDownloadUtils();
try {
String fileRelativePath = fileDownloadUtils.getFileRelativePath(fileName);
if (StringUtils.isEmpty(outOrderCode)){
log.warn("出货单号为空,请检查:{}", outOrderCode);
throw new RuntimeException("出货单号为空,请检查");
}
String realFileName = outOrderCode + "-" + fileName.substring(0, fileName.lastIndexOf(".")) + ".xlsx";
//设置响应头,指定文件和文件类型
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(realFileName, "UTF-8"));
response.setContentType("application/octet-stream");
SysSalesShippingInform sysSalesShippingInform = sysSalesShippingInformMapper.selectSysSalesShippingInformByCode(outOrderCode);
String salesOrderCode = sysSalesShippingInform.getSalesOrderCode();
SysMakeOrder sysMakeOrder = sysMakeOrderMapper.selectMakeOrderBySaleNo(salesOrderCode);
List<SysSalesOrderChild> sysSalesOrderChildren = salesOrderChildMapper.selectOrderChildListBySalesOrderCode(salesOrderCode);
String makeNo = sysMakeOrder.getMakeNo();
if (!StringUtils.isEmpty(makeNo)){
List<AfterSalesShippingDevice> afterSalesShippingDevices = salesShippingDeviceMapper.selectShippingDeviceByMakeNo(makeNo);
}
Map<String, Object> map = new HashMap<>();
map.put("customerContact",sysSalesShippingInform.getCustomerContact());
map.put("customerContactAddress",sysSalesShippingInform.getCustomerContactAddress());
map.put("customerContactBillto",sysSalesShippingInform.getCustomerContactBillto());
map.put("contactAddressBillto",sysSalesShippingInform.getContactAddressBillto());
ArrayList<ExportShippingInvoiceDto> exportShippingInvoiceDtos = new ArrayList<>();
AtomicInteger index = new AtomicInteger(1);
for (SysSalesOrderChild sysSalesOrderChild : sysSalesOrderChildren) {
ExportShippingInvoiceDto exportShippingInvoiceDto = new ExportShippingInvoiceDto();
exportShippingInvoiceDto.setIndex(index.getAndIncrement());
exportShippingInvoiceDto.setMaterialName(sysSalesOrderChild.getMaterialName());
exportShippingInvoiceDto.setMaterialNum(1);
if (sysSalesOrderChild.getMaterialUsd() != null) {
exportShippingInvoiceDto.setMaterialUsd(new BigDecimal(sysSalesOrderChild.getMaterialUsd()));
} else {
// 如果 materialUsd 为 null,可以设置为默认值或者保持不变
exportShippingInvoiceDto.setMaterialUsd(BigDecimal.ZERO); // 示例: 设置为0
}
if (sysSalesOrderChild.getMaterialUsdSum() != null) {
exportShippingInvoiceDto.setMaterialUsdSum(new BigDecimal(sysSalesOrderChild.getMaterialUsdSum()));
} else {
// 如果 materialUsdSum 为 null,可以设置为默认值或者保持不变
exportShippingInvoiceDto.setMaterialUsdSum(BigDecimal.ZERO); // 示例: 设置为0
}
exportShippingInvoiceDto.setMakeNo(makeNo);
// to do 缺少物料型号
exportShippingInvoiceDtos.add(exportShippingInvoiceDto);
}
ExcelWriter workBook = EasyExcel.write(response.getOutputStream()).withTemplate(fileRelativePath).build();
WriteSheet sheet = EasyExcel.writerSheet().build();
FillConfig fillConfig = FillConfig.builder().forceNewRow(true).build();
workBook.fill(map, sheet);
workBook.fill(exportShippingInvoiceDtos, fillConfig, sheet);
workBook.finish();
} catch (IOException e) {
throw new RuntimeException("文件处理失败",e);
}
}
/** /**
* 导出出货通知单模板 * 导出出货通知单模板
* */ * */

2
ruoyi-admin/src/main/resources/mapper/system/SysSalesOrderChildMapper.xml

@ -106,7 +106,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select> </select>
<select id="selectOrderChildListBySalesOrderCode" resultMap="SysSalesOrderChildResult"> <select id="selectOrderChildListBySalesOrderCode" resultMap="SysSalesOrderChildResult">
select id, quoteId, materialId, materialCode, materialName, materialType, processMethod, brand, select id, quoteId, materialId, materialCode, materialName, materialType, processMethod, brand, materialRmbSum, materialRmb,
warehouseDept,materialNum, photoUrl,finish_num,apply_shipping_num,has_apply_shipping_num, has_check_num, out_bound_quantity warehouseDept,materialNum, photoUrl,finish_num,apply_shipping_num,has_apply_shipping_num, has_check_num, out_bound_quantity
from sys_sales_order_child from sys_sales_order_child
where quoteId = #{quoteId} where quoteId = #{quoteId}

BIN
ruoyi-admin/src/main/resources/static/attachments/销售出货发票1.xlsx

Binary file not shown.

52
ruoyi-admin/src/main/resources/templates/system/salesShippingInform/salesShippingInform.html

@ -63,6 +63,14 @@
<i class="fa fa-download"></i> 导出销售出货箱单2 <i class="fa fa-download"></i> 导出销售出货箱单2
</a> </a>
<a class="btn btn-warning" onclick="exportShippingInvoiceOne()" shiro:hasPermission="system:salesShippingInform:exportShippingInvoiceOne">
<i class="fa fa-download"></i> 导出销售出货发票1
</a>
<a class="btn btn-warning" onclick="exportShippingInvoiceTwo()" shiro:hasPermission="system:salesShippingInform:exportShippingInvoiceTwo">
<i class="fa fa-download"></i> 导出销售出货发票2
</a>
<a class="btn btn-warning" onclick="exportShippingInformOrder()" shiro:hasPermission="system:salesShippingInform:exportShippingInformOrder"> <a class="btn btn-warning" onclick="exportShippingInformOrder()" shiro:hasPermission="system:salesShippingInform:exportShippingInformOrder">
<i class="fa fa-download"></i> 导出销售出货通知单 <i class="fa fa-download"></i> 导出销售出货通知单
</a> </a>
@ -412,6 +420,50 @@
} }
//导出出货发票1
function exportShippingInvoiceOne() {
// 获取选中的行
const selectedRows = $("#bootstrap-table").bootstrapTable('getSelections');
if (selectedRows.length !== 1) {
showWarning("请先选择一条销售出货通知单");
return;
}
const row = selectedRows[0];
// 使用 $.modal.confirm 显示确认对话框
$.modal.confirm("确定导出这条数据的出货单吗?", function() {
// 如果用户点击确定,继续导出
var outOrderCode = row.outOrderCode;
window.location.href = prefix + "/exportShippingInvoiceOne/" + outOrderCode;
$('#bootstrap-table').bootstrapTable('refresh'); // 刷新表格
});
}
//导出出货发票2
function exportShippingInvoiceTwo() {
// 获取选中的行
const selectedRows = $("#bootstrap-table").bootstrapTable('getSelections');
if (selectedRows.length !== 1) {
showWarning("请先选择一条销售出货通知单");
return;
}
const row = selectedRows[0];
// 使用 $.modal.confirm 显示确认对话框
$.modal.confirm("确定导出这条数据的出货单吗?", function() {
// 如果用户点击确定,继续导出
var outOrderCode = row.outOrderCode;
window.location.href = prefix + "/exportShippingInvoiceTwo/" + outOrderCode;
$('#bootstrap-table').bootstrapTable('refresh'); // 刷新表格
});
}
//导出通知单 //导出通知单
function exportShippingInformOrder() { function exportShippingInformOrder() {

Loading…
Cancel
Save