Browse Source

[feat] 销售管理

新增 导出出货箱单模板实体类
新增 导出出货单箱单1模板后端接口,新增导出出货单箱单1模板后端接口具体实现类
销售出货通知前端列表新增 导出销售出货箱单1按钮和js方法
附件目录新增:销售出货箱单1.xlsx文件模板
dev
liuxiaoxu 3 months ago
parent
commit
dedc177cf7
  1. 15
      ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysSalesShippingInformController.java
  2. 2
      ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysSalesShippingInform.java
  3. 22
      ruoyi-admin/src/main/java/com/ruoyi/system/dto/ExportShippingPackingDto.java
  4. 8
      ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysSalesShippingInformService.java
  5. 74
      ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysSalesShippingInformServiceImpl.java
  6. BIN
      ruoyi-admin/src/main/resources/attachments/销售出货箱单1.xlsx
  7. 52
      ruoyi-admin/src/main/resources/templates/system/salesShippingInform/salesShippingInform.html

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

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

2
ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysSalesShippingInform.java

@ -75,7 +75,7 @@ public class SysSalesShippingInform extends BaseEntity
private String customerContact;
/** 联系电话 */
@Excel(name = "收货联系人(Ship To)")
@Excel(name = "收货联系人电话(Ship To)")
private String contactNumber;
/** 收货地址 */

22
ruoyi-admin/src/main/java/com/ruoyi/system/dto/ExportShippingPackingDto.java

@ -0,0 +1,22 @@
package com.ruoyi.system.dto;
import lombok.Data;
/**
* 导出出货箱单模板实体类
* */
@Data
public class ExportShippingPackingDto {
private Integer index;
private String materialModel;
private String materialDescribe;
private String makeNo;
private Integer materialNum;
}

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

@ -121,8 +121,16 @@ public interface ISysSalesShippingInformService
* */
void exportShippingOrderTwo(String outOrderCode, HttpServletResponse response);
/**
* 导出出货单箱单1模板
* */
void exportShippingPackingOne(String outOrderCode, HttpServletResponse response);
/**
* 导出出货通知单模板
* */
void exportShippingInformOrder(String outOrderCode, HttpServletResponse response);
}

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

@ -23,6 +23,7 @@ import com.ruoyi.common.utils.file.FileDownloadUtils;
import com.ruoyi.system.domain.*;
import com.ruoyi.system.dto.ExportShippingInformOrderDto;
import com.ruoyi.system.dto.ExportShippingOrderDto;
import com.ruoyi.system.dto.ExportShippingPackingDto;
import com.ruoyi.system.mapper.*;
import com.ruoyi.warehouse.domain.WarehouseOutOrder;
import com.ruoyi.warehouse.mapper.WarehouseOutOrderMapper;
@ -465,6 +466,11 @@ public class SysSalesShippingInformServiceImpl implements ISysSalesShippingInfor
SysSalesShippingInform salesShippingInform = sysSalesShippingInformMapper.selectSysSalesShippingInformByCode(outOrderCode);
if (StringUtils.isEmpty(outOrderCode)){
log.warn("出库单号为空:{}",outOrderCode);
throw new RuntimeException("出库单号为空,请检查");
}
List<SysSalesShippingInformDetail> salesShippingInformDetails = shippingInformDetailMapper.selectSysSalesShippingInformDetailByCode(outOrderCode);
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
String deliverTime = dateFormat.format(salesShippingInform.getDeliverTime());
@ -519,6 +525,74 @@ public class SysSalesShippingInformServiceImpl implements ISysSalesShippingInfor
}
}
@Override
public void exportShippingPackingOne(String outOrderCode, HttpServletResponse response) {
String fileName = "销售出货箱单1.xlsx";
FileDownloadUtils fileDownloadUtils = new FileDownloadUtils();
try {
String fileRelativePath = fileDownloadUtils.getFileAbsolutePath(fileName);
SysSalesShippingInform sysSalesShippingInform = sysSalesShippingInformMapper.selectSysSalesShippingInformByCode(outOrderCode);
String salesOrderCode = sysSalesShippingInform.getSalesOrderCode();
if (StringUtils.isEmpty(salesOrderCode)){
log.warn("销售订单号为空,请检查:{}", salesOrderCode);
throw new RuntimeException("销售订单号为空,请检查");
}
String realFileName = salesOrderCode + "-" + fileName.substring(0, fileName.lastIndexOf(".")) + ".xlsx";
//设置响应头,指定文件和文件类型
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(realFileName, "UTF-8"));
response.setContentType("application/octet-stream");
SysMakeOrder sysMakeOrder = sysMakeOrderMapper.selectMakeOrderBySaleNo(salesOrderCode);
if (sysMakeOrder == null){
log.warn("未找到对应的生产订单,请检查:{}", salesOrderCode);
throw new RuntimeException("未找到对应的生产订单,请检查");
}
Map<String, Object> map = new HashMap<>();
map.put("customerContactBillto",sysSalesShippingInform.getCustomerContactBillto());
map.put("contactAddressBillto",sysSalesShippingInform.getContactAddressBillto());
map.put("customerContact",sysSalesShippingInform.getCustomerContact());
map.put("customerContactAddress",sysSalesShippingInform.getCustomerContactAddress());
List<ExportShippingPackingDto> shippingPackingDtos = new ArrayList<>();
AtomicInteger index = new AtomicInteger(1);
List<AfterSalesShippingDevice> shippingDeviceList = salesShippingDeviceMapper.selectShippingDeviceBySalesOrderCode(salesOrderCode);
for (AfterSalesShippingDevice shippingDevice : shippingDeviceList) {
ExportShippingPackingDto exportShippingPackingDto = new ExportShippingPackingDto();
exportShippingPackingDto.setIndex(index.getAndIncrement());
exportShippingPackingDto.setMaterialDescribe(shippingDevice.getMaterialDescribe());
exportShippingPackingDto.setMaterialModel(shippingDevice.getMaterialModelCode());
exportShippingPackingDto.setMakeNo(shippingDevice.getMakeNo());
exportShippingPackingDto.setMaterialNum(1);
shippingPackingDtos.add(exportShippingPackingDto);
}
//构建模板
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(shippingPackingDtos, fillConfig, sheet);
workBook.finish();
} catch (IOException e) {
throw new RuntimeException("文件处理失败",e);
}
}
/**
* 导出出货通知单模板

BIN
ruoyi-admin/src/main/resources/attachments/销售出货箱单1.xlsx

Binary file not shown.

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

@ -56,6 +56,13 @@
<i class="fa fa-download"></i> 导出销售出货单2
</a>
<a class="btn btn-warning" onclick="exportShippingPackingOne()" shiro:hasPermission="system:salesShippingInform:exportShippingPackingOne">
<i class="fa fa-download"></i> 导出销售出货箱单1
</a>
<a class="btn btn-warning" onclick="exportShippingPackingTwo()" shiro:hasPermission="system:salesShippingInform:exportShippingPackingTwo">
<i class="fa fa-download"></i> 导出销售出货箱单2
</a>
<a class="btn btn-warning" onclick="exportShippingInformOrder()" shiro:hasPermission="system:salesShippingInform:exportShippingInformOrder">
<i class="fa fa-download"></i> 导出销售出货通知单
</a>
@ -360,6 +367,51 @@
}
//导出出货箱单1
function exportShippingPackingOne() {
// 获取选中的行
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 + "/exportShippingPackingOne/" + outOrderCode;
$('#bootstrap-table').bootstrapTable('refresh'); // 刷新表格
});
}
//导出出货箱单2
function exportShippingPackingTwo() {
// 获取选中的行
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 + "/exportShippingPackingTwo/" + outOrderCode;
$('#bootstrap-table').bootstrapTable('refresh'); // 刷新表格
});
}
//导出通知单
function exportShippingInformOrder() {

Loading…
Cancel
Save