Browse Source

[feat]采购管理: 供应商修复delFlag属性设置失败的问题,改为直接调佣delete的SQL ,供应商资料修改del_flag 查询条件,删除del_flag字段查询。

dev
zhangsiqi 4 months ago
parent
commit
0d226cf0f3
  1. 153
      ruoyi-admin/src/main/java/com/ruoyi/purchase/controller/PurchaseOrderController.java
  2. 6
      ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysSupplierServiceImpl.java
  3. 6
      ruoyi-admin/src/main/resources/mapper/purchase/PurchaseQuoteChildMapper.xml
  4. 1
      ruoyi-admin/src/main/resources/mapper/system/SysSupplierMapper.xml

153
ruoyi-admin/src/main/java/com/ruoyi/purchase/controller/PurchaseOrderController.java

@ -287,6 +287,7 @@ public class PurchaseOrderController extends BaseController
if("submit".equals(instanceType)){
// 使用状态-是
purchaseOrderVo.setUseStatus("1");
purchaseOrderService.addPurchaseOrderPayable(purchaseOrderVo);
}
// 作废
else if("cancel".equals(instanceType)){
@ -351,83 +352,83 @@ public class PurchaseOrderController extends BaseController
return "操作成功!";
}
@RequiresPermissions("purchase:purchaseOrder:export")
@Log(title = "采购订单", businessType = BusinessType.EXPORT)
@RequestMapping("/exportSelected/{purchaseOrderId}")
@ResponseBody
public void exportSelected(@PathVariable("purchaseOrderId") Long purchaseOrderId, HttpServletResponse response) throws IOException {
// @RequiresPermissions("purchase:purchaseOrder:export")
// @Log(title = "采购订单", businessType = BusinessType.EXPORT)
// @RequestMapping("/exportSelected/{purchaseOrderId}")
// @ResponseBody
// public void exportSelected(@PathVariable("purchaseOrderId") Long purchaseOrderId, HttpServletResponse response) throws IOException {
////
//
System.out.println(purchaseOrderId);
PurchaseOrder purchaseOrder = purchaseOrderService.selectPurchaseOrderById(purchaseOrderId);
PurchaseOrderDto purchaseOrderDto = new PurchaseOrderDto();
BeanUtils.copyProperties(purchaseOrder,purchaseOrderDto);
PurchaseMaterial purchaseMaterial = new PurchaseMaterial();
purchaseMaterial.setPurchaseOrderNumber(purchaseOrder.getPurchaseOrderCode());
purchaseMaterial.setSupplierCode(purchaseOrder.getSupplierCode());
purchaseMaterial.setSupplierName(purchaseOrder.getSupplierName());
// 创建列合并工具类对象
// ExcelFillCellMergePrevColUtils mergePrevColUtils = new ExcelFillCellMergePrevColUtils();
List<PurchaseMaterial> purchaseMaterialList = purchaseMaterialService.selectPurchaseMaterialList(purchaseMaterial);
List<PurchaseMaterialDto> purchaseMaterialDtoList = new ArrayList<>();
double total = 0.00;
int number = 0;
try {
Iterator values= purchaseMaterialList.iterator();
while(values.hasNext()) {
Object source = values.next();
PurchaseMaterialDto target = PurchaseMaterialDto.class.newInstance();
BeanUtils.copyProperties(source, target);
// mergePrevColUtils.add(number+8,1,1);
// mergePrevColUtils.add(number+8,10,1);
target.setNumber(++number);
purchaseMaterialDtoList.add(target);
total = total + Double.parseDouble(target.getAmountMoney());
}
}catch (Exception e) {
log.error(">>>>>>异常<<<<<<", e);
}
System.out.println(purchaseMaterialDtoList);
Map<Integer, Integer> colMap = new HashMap<>();
colMap.put(2, 3);
colMap.put(11, 12);
// response.setCharacterEncoding("utf-8");
// String fileName = URLEncoder.encode("采购订单", "UTF-8").replaceAll("\\+", "%20");
// response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx");
String templateFileName = "C:\\exportTemplates\\exportPurchaseOrder.xlsx";
try (ExcelWriter excelWriter = EasyExcel
.write(response.getOutputStream(), PurchaseMaterialDto.class)
.withTemplate(templateFileName)
// .registerWriteHandler(mergePrevColUtils)
//样式注册
// .registerWriteHandler(horizontalCellStyleStrategyBuilder())
// .registerWriteHandler(new CustomRowWriteHandler(1))
// .registerWriteHandler(new CustomRowWriteHandler(10))
.registerWriteHandler(new CustomRowWriteCellHandler(colMap))
.build()) {
WriteSheet writeSheet = EasyExcel.writerSheet().build();
FillConfig fillConfig = FillConfig.builder().forceNewRow(Boolean.TRUE).build();
excelWriter.fill(purchaseMaterialDtoList, fillConfig, writeSheet);
Map<String, Object> map = MapUtils.newHashMap();
// map.put("date", DateTimeFormatter.ofPattern("yyyy/MM/dd").format(LocalDateTime.now()));
map.put("supplierName", purchaseOrderDto.getSupplierName());
map.put("contactNumber", purchaseOrderDto.getContactNumber());
map.put("customerFax", purchaseOrderDto.getCustomerFax());
map.put("customerContact", purchaseOrderDto.getCustomerContact());
map.put("purchaseOrderNumber", purchaseOrderDto.getPurchaseOrderNumber());
map.put("paymentTerms", purchaseOrderDto.getPaymentTerms());
map.put("taxRate", purchaseOrderDto.getTaxRate());
map.put("approveName", purchaseOrderDto.getApproveName());
map.put("auditName", purchaseOrderDto.getAuditName());
map.put("purchaseCommander", purchaseOrderDto.getPurchaseCommander());
map.put("total", total);
excelWriter.fill(map, writeSheet);
// excelWriter.close();
}
}
// System.out.println(purchaseOrderId);
// PurchaseOrder purchaseOrder = purchaseOrderService.selectPurchaseOrderById(purchaseOrderId);
// PurchaseOrderDto purchaseOrderDto = new PurchaseOrderDto();
// BeanUtils.copyProperties(purchaseOrder,purchaseOrderDto);
//
// PurchaseMaterial purchaseMaterial = new PurchaseMaterial();
// purchaseMaterial.setPurchaseOrderNumber(purchaseOrder.getPurchaseOrderCode());
// purchaseMaterial.setSupplierCode(purchaseOrder.getSupplierCode());
// purchaseMaterial.setSupplierName(purchaseOrder.getSupplierName());
//
// // 创建列合并工具类对象
//// ExcelFillCellMergePrevColUtils mergePrevColUtils = new ExcelFillCellMergePrevColUtils();
// List<PurchaseMaterial> purchaseMaterialList = purchaseMaterialService.selectPurchaseMaterialList(purchaseMaterial);
// List<PurchaseMaterialDto> purchaseMaterialDtoList = new ArrayList<>();
// double total = 0.00;
// int number = 0;
// try {
// Iterator values= purchaseMaterialList.iterator();
// while(values.hasNext()) {
// Object source = values.next();
// PurchaseMaterialDto target = PurchaseMaterialDto.class.newInstance();
// BeanUtils.copyProperties(source, target);
//// mergePrevColUtils.add(number+8,1,1);
//// mergePrevColUtils.add(number+8,10,1);
// target.setNumber(++number);
// purchaseMaterialDtoList.add(target);
// total = total + Double.parseDouble(target.getAmountMoney());
// }
// }catch (Exception e) {
// log.error(">>>>>>异常<<<<<<", e);
// }
// System.out.println(purchaseMaterialDtoList);
//
// Map<Integer, Integer> colMap = new HashMap<>();
// colMap.put(2, 3);
// colMap.put(11, 12);
//// response.setCharacterEncoding("utf-8");
//// String fileName = URLEncoder.encode("采购订单", "UTF-8").replaceAll("\\+", "%20");
//// response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx");
// String templateFileName = "C:\\exportTemplates\\exportPurchaseOrder.xlsx";
// try (ExcelWriter excelWriter = EasyExcel
// .write(response.getOutputStream(), PurchaseMaterialDto.class)
// .withTemplate(templateFileName)
//// .registerWriteHandler(mergePrevColUtils)
// //样式注册
//// .registerWriteHandler(horizontalCellStyleStrategyBuilder())
//// .registerWriteHandler(new CustomRowWriteHandler(1))
//// .registerWriteHandler(new CustomRowWriteHandler(10))
// .registerWriteHandler(new CustomRowWriteCellHandler(colMap))
// .build()) {
// WriteSheet writeSheet = EasyExcel.writerSheet().build();
// FillConfig fillConfig = FillConfig.builder().forceNewRow(Boolean.TRUE).build();
// excelWriter.fill(purchaseMaterialDtoList, fillConfig, writeSheet);
// Map<String, Object> map = MapUtils.newHashMap();
//// map.put("date", DateTimeFormatter.ofPattern("yyyy/MM/dd").format(LocalDateTime.now()));
// map.put("supplierName", purchaseOrderDto.getSupplierName());
// map.put("contactNumber", purchaseOrderDto.getContactNumber());
// map.put("customerFax", purchaseOrderDto.getCustomerFax());
// map.put("customerContact", purchaseOrderDto.getCustomerContact());
// map.put("purchaseOrderNumber", purchaseOrderDto.getPurchaseOrderNumber());
// map.put("paymentTerms", purchaseOrderDto.getPaymentTerms());
// map.put("taxRate", purchaseOrderDto.getTaxRate());
// map.put("approveName", purchaseOrderDto.getApproveName());
// map.put("auditName", purchaseOrderDto.getAuditName());
// map.put("purchaseCommander", purchaseOrderDto.getPurchaseCommander());
// map.put("total", total);
// excelWriter.fill(map, writeSheet);
//// excelWriter.close();
// }
// }
public HorizontalCellStyleStrategy horizontalCellStyleStrategyBuilder() {
WriteCellStyle headWriteCellStyle = new WriteCellStyle();

6
ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysSupplierServiceImpl.java

@ -168,7 +168,7 @@ public class SysSupplierServiceImpl implements ISysSupplierService{
SysAttach attach = new SysAttach();
attach.setCreateBy(loginName);
attach.setCreateTime(new Date());
attach.setSourceType("erpMaterial");
attach.setSourceType("supplier");
attach.setSourceSubType("photo");
attach.setRelId(id);
attachService.insertSysAttach(attach);
@ -206,7 +206,7 @@ public class SysSupplierServiceImpl implements ISysSupplierService{
SysAttach attach = new SysAttach();
attach.setCreateBy(loginName);
attach.setCreateTime(new Date());
attach.setSourceType("erpMaterial");
attach.setSourceType("supplier");
attach.setSourceSubType("photo");
attach.setRelId(id);
attachService.insertSysAttach(attach);
@ -313,7 +313,7 @@ public class SysSupplierServiceImpl implements ISysSupplierService{
@Override
@Transactional(rollbackFor = Exception.class)
public ProcessInstance cancelSysSupplierById(Long id) {
SysSupplierVo sysSupplierVo = sysSupplierMapper.cancelSysSupplierById(id);
SysSupplierVo sysSupplierVo = sysSupplierMapper.selectSysSupplierById(id);
// 审核状态-待审核
sysSupplierVo.setAuditStatus("0");
SysUser user = ShiroUtils.getSysUser();

6
ruoyi-admin/src/main/resources/mapper/purchase/PurchaseQuoteChildMapper.xml

@ -46,7 +46,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
material_num, material_sole, material_rmb, material_noRmb,supplier_code, supplier_name,
create_by, create_time, update_by, update_time, remark, use_status, audit_status,
del_flag from purchase_quote_child
<where>
<where>
<if test="purchaseQuoteCode != null and purchaseQuoteCode != ''"> and purchase_quote_code = #{purchaseQuoteCode}</if>
<if test="materialId != null "> and material_id = #{materialId}</if>
<if test="materialCode != null and materialCode != ''"> and material_code = #{materialCode}</if>
@ -164,8 +164,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</update>
<update id="deletePurchaseQuoteChildByQuoteCode" parameterType="String">
update purchase_quote_child
set del_flag = '1' where purchase_quote_code = #{purchaseQuoteCode}
delete from purchase_quote_child
where purchase_quote_code = #{purchaseQuoteCode}
</update>
<update id="deletePurchaseQuoteChildByIds" parameterType="String">

1
ruoyi-admin/src/main/resources/mapper/system/SysSupplierMapper.xml

@ -104,7 +104,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
) as file
on sup.supplier_id = file.rel_id
<where>
del_flag = '0'
<if test="supplierCode != null and supplierCode != ''"> and sup.supplier_code like concat('%', #{supplierCode}, '%')</if>
<if test="supplierName != null and supplierName != ''"> and sup.supplier_name like concat('%', #{supplierName}, '%')</if>
<if test="supplierType != null and supplierType != ''"> and sup.supplier_type = #{supplierType}</if>

Loading…
Cancel
Save