Browse Source

Merge remote-tracking branch 'origin/dev' into dev

dev
zhangsiqi 3 months ago
parent
commit
dfe74e785f
  1. 14
      ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysSalesShippingInformController.java
  2. 17
      ruoyi-admin/src/main/java/com/ruoyi/system/dto/ExportShippingInformOrderDto.java
  3. 2
      ruoyi-admin/src/main/java/com/ruoyi/system/dto/ExportShippingOrderDto.java
  4. 5
      ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysSalesShippingInformService.java
  5. 128
      ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysSalesShippingInformServiceImpl.java
  6. BIN
      ruoyi-admin/src/main/resources/attachments/出货通知单.xlsx
  7. 8
      ruoyi-admin/src/main/resources/templates/system/salesOrder/salesOrder.html
  8. 26
      ruoyi-admin/src/main/resources/templates/system/salesShippingInform/salesShippingInform.html

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

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

17
ruoyi-admin/src/main/java/com/ruoyi/system/dto/ExportShippingInformOrderDto.java

@ -0,0 +1,17 @@
package com.ruoyi.system.dto;
import lombok.Data;
/**
* 销售出货通知单导出模板
* */
@Data
public class ExportShippingInformOrderDto {
private String materialName;
private String deviceModelCode;
}

2
ruoyi-admin/src/main/java/com/ruoyi/system/dto/ExportSalesShippingInformDto.java → ruoyi-admin/src/main/java/com/ruoyi/system/dto/ExportShippingOrderDto.java

@ -6,7 +6,7 @@ import lombok.Data;
* 导出销售出货单模板数据 * 导出销售出货单模板数据
* */ * */
@Data @Data
public class ExportSalesShippingInformDto { public class ExportShippingOrderDto {
private Integer index; private Integer index;

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

@ -120,4 +120,9 @@ public interface ISysSalesShippingInformService
* 导出出货单2模板 * 导出出货单2模板
* */ * */
void exportShippingOrderTwo(String outOrderCode, HttpServletResponse response); void exportShippingOrderTwo(String outOrderCode, HttpServletResponse response);
/**
* 导出出货通知单模板
* */
void exportShippingInformOrder(String outOrderCode, HttpServletResponse response);
} }

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

@ -10,9 +10,10 @@ import java.util.concurrent.atomic.AtomicInteger;
import com.alibaba.excel.EasyExcel; import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelWriter; import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.util.MapUtils; import com.alibaba.excel.util.MapUtils;
import com.alibaba.excel.write.builder.ExcelWriterBuilder;
import com.alibaba.excel.write.metadata.WriteSheet; import com.alibaba.excel.write.metadata.WriteSheet;
import com.alibaba.excel.write.metadata.fill.FillConfig; import com.alibaba.excel.write.metadata.fill.FillConfig;
import com.ruoyi.aftersales.domain.AfterSalesShippingDevice;
import com.ruoyi.aftersales.mapper.AfterSalesShippingDeviceMapper;
import com.ruoyi.common.core.redis.RedisCache; import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.exception.BusinessException; import com.ruoyi.common.exception.BusinessException;
import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.DateUtils;
@ -20,22 +21,18 @@ import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.common.utils.StringUtils; 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.ExportSalesShippingInformDto; import com.ruoyi.system.dto.ExportShippingInformOrderDto;
import com.ruoyi.system.mapper.SysSalesOrderChildMapper; import com.ruoyi.system.dto.ExportShippingOrderDto;
import com.ruoyi.system.mapper.SysSalesOrderMapper; import com.ruoyi.system.mapper.*;
import com.ruoyi.system.mapper.SysSalesShippingInformDetailMapper;
import com.ruoyi.warehouse.domain.WarehouseOutOrder; import com.ruoyi.warehouse.domain.WarehouseOutOrder;
import com.ruoyi.warehouse.mapper.WarehouseOutOrderMapper; import com.ruoyi.warehouse.mapper.WarehouseOutOrderMapper;
import com.ruoyi.warehouse.mapper.WarehouseStorageOrderMapper;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.SysSalesShippingInformMapper;
import com.ruoyi.system.service.ISysSalesShippingInformService; import com.ruoyi.system.service.ISysSalesShippingInformService;
import com.ruoyi.common.core.text.Convert; import com.ruoyi.common.core.text.Convert;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
/** /**
@ -65,6 +62,13 @@ public class SysSalesShippingInformServiceImpl implements ISysSalesShippingInfor
@Autowired @Autowired
private SysSalesOrderChildMapper salesOrderChildMapper; private SysSalesOrderChildMapper salesOrderChildMapper;
@Autowired
private SysMakeOrderMapper sysMakeOrderMapper;
@Autowired
private AfterSalesShippingDeviceMapper salesShippingDeviceMapper;
/** /**
* 查询销售出货通知 * 查询销售出货通知
* *
@ -401,19 +405,19 @@ public class SysSalesShippingInformServiceImpl implements ISysSalesShippingInfor
AtomicInteger index = new AtomicInteger(1); AtomicInteger index = new AtomicInteger(1);
//处理物料数据 //处理物料数据
List<ExportSalesShippingInformDto> exportSalesShippingInformDtos = new ArrayList<>(); List<ExportShippingOrderDto> exportShippingOrderDtos = new ArrayList<>();
for (SysSalesShippingInformDetail salesShippingInformDetail : salesShippingInformDetails) { for (SysSalesShippingInformDetail salesShippingInformDetail : salesShippingInformDetails) {
ExportSalesShippingInformDto exportSalesShippingInformDto = new ExportSalesShippingInformDto(); ExportShippingOrderDto exportShippingOrderDto = new ExportShippingOrderDto();
exportSalesShippingInformDto.setIndex(index.getAndIncrement()); exportShippingOrderDto.setIndex(index.getAndIncrement());
exportSalesShippingInformDto.setMaterialName(salesShippingInformDetail.getMaterialName()); exportShippingOrderDto.setMaterialName(salesShippingInformDetail.getMaterialName());
exportSalesShippingInformDto.setMaterialNo(salesShippingInformDetail.getMaterialNo()); exportShippingOrderDto.setMaterialNo(salesShippingInformDetail.getMaterialNo());
exportSalesShippingInformDto.setMaterialDescribe(salesShippingInformDetail.getMaterialDescribe()); exportShippingOrderDto.setMaterialDescribe(salesShippingInformDetail.getMaterialDescribe());
exportSalesShippingInformDto.setMaterialUnit(salesShippingInformDetail.getMaterialUnit()); exportShippingOrderDto.setMaterialUnit(salesShippingInformDetail.getMaterialUnit());
exportSalesShippingInformDto.setMakeNum(salesShippingInformDetail.getMakeNum()); exportShippingOrderDto.setMakeNum(salesShippingInformDetail.getMakeNum());
exportSalesShippingInformDto.setSalesOrderNumber(salesShippingInform.getSalesOrderNumber()); exportShippingOrderDto.setSalesOrderNumber(salesShippingInform.getSalesOrderNumber());
exportSalesShippingInformDto.setRemark(salesShippingInform.getRemark()); exportShippingOrderDto.setRemark(salesShippingInform.getRemark());
exportSalesShippingInformDtos.add(exportSalesShippingInformDto); exportShippingOrderDtos.add(exportShippingOrderDto);
} }
@ -435,7 +439,7 @@ public class SysSalesShippingInformServiceImpl implements ISysSalesShippingInfor
// 写入数据 // 写入数据
workBook.fill(map, sheet); workBook.fill(map, sheet);
workBook.fill(exportSalesShippingInformDtos, fillConfig, sheet); workBook.fill(exportShippingOrderDtos, fillConfig, sheet);
workBook.finish(); workBook.finish();
} catch (IOException e) { } catch (IOException e) {
@ -470,19 +474,19 @@ public class SysSalesShippingInformServiceImpl implements ISysSalesShippingInfor
AtomicInteger index = new AtomicInteger(1); AtomicInteger index = new AtomicInteger(1);
//处理物料数据 //处理物料数据
List<ExportSalesShippingInformDto> exportSalesShippingInformDtos = new ArrayList<>(); List<ExportShippingOrderDto> exportShippingOrderDtos = new ArrayList<>();
for (SysSalesShippingInformDetail salesShippingInformDetail : salesShippingInformDetails) { for (SysSalesShippingInformDetail salesShippingInformDetail : salesShippingInformDetails) {
ExportSalesShippingInformDto exportSalesShippingInformDto = new ExportSalesShippingInformDto(); ExportShippingOrderDto exportShippingOrderDto = new ExportShippingOrderDto();
exportSalesShippingInformDto.setIndex(index.getAndIncrement()); exportShippingOrderDto.setIndex(index.getAndIncrement());
exportSalesShippingInformDto.setMaterialName(salesShippingInformDetail.getMaterialName()); exportShippingOrderDto.setMaterialName(salesShippingInformDetail.getMaterialName());
exportSalesShippingInformDto.setMaterialNo(salesShippingInformDetail.getMaterialNo()); exportShippingOrderDto.setMaterialNo(salesShippingInformDetail.getMaterialNo());
exportSalesShippingInformDto.setMaterialDescribe(salesShippingInformDetail.getMaterialDescribe()); exportShippingOrderDto.setMaterialDescribe(salesShippingInformDetail.getMaterialDescribe());
exportSalesShippingInformDto.setMaterialUnit(salesShippingInformDetail.getMaterialUnit()); exportShippingOrderDto.setMaterialUnit(salesShippingInformDetail.getMaterialUnit());
exportSalesShippingInformDto.setMakeNum(salesShippingInformDetail.getMakeNum()); exportShippingOrderDto.setMakeNum(salesShippingInformDetail.getMakeNum());
exportSalesShippingInformDto.setSalesOrderNumber(salesShippingInform.getSalesOrderNumber()); exportShippingOrderDto.setSalesOrderNumber(salesShippingInform.getSalesOrderNumber());
exportSalesShippingInformDto.setRemark(salesShippingInform.getRemark()); exportShippingOrderDto.setRemark(salesShippingInform.getRemark());
exportSalesShippingInformDtos.add(exportSalesShippingInformDto); exportShippingOrderDtos.add(exportShippingOrderDto);
} }
@ -504,11 +508,71 @@ public class SysSalesShippingInformServiceImpl implements ISysSalesShippingInfor
// 写入数据 // 写入数据
workBook.fill(map, sheet); workBook.fill(map, sheet);
workBook.fill(exportSalesShippingInformDtos, fillConfig, sheet); workBook.fill(exportShippingOrderDtos, fillConfig, sheet);
workBook.finish(); workBook.finish();
} catch (IOException e) { } catch (IOException e) {
throw new RuntimeException("文件处理失败",e); throw new RuntimeException("文件处理失败",e);
} }
} }
/**
* 导出出货通知单模板
* */
@Override
public void exportShippingInformOrder(String outOrderCode, HttpServletResponse response) {
String fileName = "出货通知单.xlsx";
FileDownloadUtils fileDownloadUtils = new FileDownloadUtils();
try {
String fileRelativePath = fileDownloadUtils.getFileRelativePath(fileName);
SysSalesShippingInform sysSalesShippingInform = sysSalesShippingInformMapper.selectSysSalesShippingInformByCode(outOrderCode);
String salesOrderCode = sysSalesShippingInform.getSalesOrderCode();
SysMakeOrder sysMakeOrder = sysMakeOrderMapper.selectMakeOrderBySaleNo(salesOrderCode);
String realFileName = sysSalesShippingInform.getSalesOrderCode() +"-"+ fileName.substring(0, fileName.lastIndexOf("."))+ ".xlsx";
// 设置响应头,指定文件名和文件类型
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(realFileName, "UTF-8"));
response.setContentType("application/octet-stream");
List<AfterSalesShippingDevice> salesShippingDeviceList = salesShippingDeviceMapper.selectShippingDeviceBySalesOrderCode(salesOrderCode);
ArrayList<ExportShippingInformOrderDto> shippingInformOrderDtos = new ArrayList<>();
for (AfterSalesShippingDevice afterSalesShippingDevice : salesShippingDeviceList) {
ExportShippingInformOrderDto shippingInformOrderDto = new ExportShippingInformOrderDto();
shippingInformOrderDto.setDeviceModelCode(afterSalesShippingDevice.getDeviceModelCode());
shippingInformOrderDto.setMaterialName(afterSalesShippingDevice.getMaterialName());
shippingInformOrderDtos.add(shippingInformOrderDto);
}
HashMap<String, Object> map = new HashMap<>();
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
String shippingDate = dateFormat.format(new Date());
map.put("makeNo",sysMakeOrder.getMakeNo());
map.put("salesOrderNumber",sysSalesShippingInform.getSalesOrderNumber());
map.put("customerContactAddress",sysSalesShippingInform.getCustomerContactAddress());
map.put("shippingDate",shippingDate);
map.put("customerName",sysSalesShippingInform.getCustomerName());
map.put("businessMembers",sysSalesShippingInform.getBusinessMembers());
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(shippingInformOrderDtos, fillConfig, sheet);
workBook.finish();
} catch (IOException e) {
throw new RuntimeException("文件处理失败",e);
}
}
} }

BIN
ruoyi-admin/src/main/resources/attachments/出货通知单.xlsx

Binary file not shown.

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

@ -350,12 +350,12 @@
if(row.auditStatus=="1" && row.useStatus=="1" && !row.cancelInstanceId) { if(row.auditStatus=="1" && row.useStatus=="1" && !row.cancelInstanceId) {
// 作废 // 作废
actions.push('<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="$.operate.cancel(\'' + row.salesOrderId + '\')"><i class="fa fa-remove"></i> 作废</a>'); actions.push('<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="$.operate.cancel(\'' + row.salesOrderId + '\')"><i class="fa fa-remove"></i> 作废</a>');
// 编辑
actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.salesOrderId + '\')"><i class="fa fa-edit"></i> 编辑</a> ');
// 已作废 // 已作废
}else{
actions.push('<a class="btn btn-default btn-xs" href="javascript:void(0)" disabled><i class="fa fa-edit"></i> 编辑</a> ');
} }
// }else{
// actions.push('<a class="btn btn-default btn-xs" href="javascript:void(0)" disabled><i class="fa fa-edit"></i> 编辑</a> ');
// }
// 有流程实例id // 有流程实例id
if(row.useStatus=="2" && !row.restoreInstanceId){ if(row.useStatus=="2" && !row.restoreInstanceId){
// 恢复 // 恢复

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

@ -56,6 +56,10 @@
<i class="fa fa-download"></i> 导出销售出货单2 <i class="fa fa-download"></i> 导出销售出货单2
</a> </a>
<a class="btn btn-warning" onclick="exportShippingInformOrder()" shiro:hasPermission="system:salesShippingInform:exportShippingInformOrder">
<i class="fa fa-download"></i> 导出销售出货通知单
</a>
</div> </div>
<div class="col-sm-12 select-table table-striped"> <div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table"></table> <table id="bootstrap-table"></table>
@ -356,6 +360,28 @@
} }
//导出通知单
function exportShippingInformOrder() {
// 获取选中的行
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 + "/exportShippingInformOrder/" + outOrderCode;
$('#bootstrap-table').bootstrapTable('refresh'); // 刷新表格
});
}
</script> </script>
</body> </body>
</html> </html>
Loading…
Cancel
Save