Browse Source

[feat] 销售管理

新增 导出出货发票2模板后端接口和具体实现类:含税单价和不含税单价新增填充值之前要进行非空校验
销售出货发票新增导出销售出货发票1前端按钮和js方法,导出前进行选择的数据校验
附件目录新增销售出货发票2excel模板
dev
liuxiaoxu 3 months ago
parent
commit
1b2c3f6807
  1. 11
      ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysSalesShippingInformController.java
  2. 5
      ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysSalesShippingInformService.java
  3. 82
      ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysSalesShippingInformServiceImpl.java
  4. 2
      ruoyi-admin/src/main/resources/mapper/system/SysSalesOrderChildMapper.xml
  5. BIN
      ruoyi-admin/src/main/resources/static/attachments/销售出货发票1.xlsx
  6. BIN
      ruoyi-admin/src/main/resources/static/attachments/销售出货发票2.xlsx

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

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

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

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

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

@ -749,6 +749,88 @@ public class SysSalesShippingInformServiceImpl implements ISysSalesShippingInfor
} }
} }
/**
* 导出出货单发票2模板
* */
@Override
public void exportShippingInvoiceTwo(String outOrderCode, HttpServletResponse response) {
String fileName = "销售出货发票2.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, materialRmbSum, materialRmb, select id, quoteId, materialId, materialCode, materialName, materialType, processMethod, brand, materialRmbSum, materialRmb, materialUsd, materialUsdSum,
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.

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

Binary file not shown.
Loading…
Cancel
Save