From 28bc6d67f2f35e312fc1fa30095359cc8b3135a4 Mon Sep 17 00:00:00 2001
From: buhuazhen <hua100783@gmail.com>
Date: 星期五, 29 五月 2026 15:33:12 +0800
Subject: [PATCH] feat: 发货审批原由调整
---
src/main/java/com/ruoyi/sales/controller/ShippingInfoController.java | 75 ++++++++++++++++++++++++-------------
1 files changed, 48 insertions(+), 27 deletions(-)
diff --git a/src/main/java/com/ruoyi/sales/controller/ShippingInfoController.java b/src/main/java/com/ruoyi/sales/controller/ShippingInfoController.java
index 1c657e9..2b7dba1 100644
--- a/src/main/java/com/ruoyi/sales/controller/ShippingInfoController.java
+++ b/src/main/java/com/ruoyi/sales/controller/ShippingInfoController.java
@@ -16,6 +16,7 @@
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.other.service.impl.TempFileServiceImpl;
+import com.ruoyi.procurementrecord.utils.StockUtils;
import com.ruoyi.sales.dto.ShippingInfoDto;
import com.ruoyi.sales.mapper.ShipmentApprovalMapper;
import com.ruoyi.sales.mapper.ShippingInfoMapper;
@@ -50,25 +51,20 @@
@Autowired
private ShippingInfoService shippingInfoService;
- @Autowired
- private ShipmentApprovalMapper shipmentApprovalMapper;
- @Autowired
- private ISalesLedgerProductService salesLedgerProductService;
-
- @Autowired
- private TempFileServiceImpl tempFileService;
@Autowired
private CommonFileServiceImpl commonFileService;
@Autowired
private ApproveProcessServiceImpl approveProcessService;
+ @Autowired
+ private StockUtils stockUtils;
@GetMapping("/listPage")
@ApiOperation("鍙戣揣淇℃伅鍒楄〃")
public AjaxResult listPage(Page page, ShippingInfo req) {
- IPage<ShippingInfo> listPage = shippingInfoService.listPage(page,req);
+ IPage<ShippingInfoDto> listPage = shippingInfoService.listPage(page,req);
return AjaxResult.success(listPage);
}
@@ -78,12 +74,19 @@
@Log(title = "鍙戣揣淇℃伅绠$悊", businessType = BusinessType.INSERT)
public AjaxResult add(@RequestBody ShippingInfoDto req) throws Exception {
LoginUser loginUser = SecurityUtils.getLoginUser();
- String sh = OrderUtils.countTodayByCreateTime(shippingInfoMapper, "SH");
+ String sh = OrderUtils.countTodayByCreateTime(shippingInfoMapper, "SH","shipping_no");
// 鍙戣揣瀹℃壒
ApproveProcessVO approveProcessVO = new ApproveProcessVO();
approveProcessVO.setApproveType(7);
- approveProcessVO.setApproveDeptId(loginUser.getTenantId());
- approveProcessVO.setApproveReason(req.getType() + ":" +sh);
+ approveProcessVO.setApproveDeptId(loginUser.getCurrentDeptId());
+ // 瀹℃壒鍘熷洜鏍煎紡锛氬彂璐у崟鍙�:{鍙戣揣绫诲瀷}:{鍙戣揣杞︾墝鍙穧
+ String approveReason = "鍙戣揣鍗曞彿:" + sh + "\n" + req.getType();
+ if ("璐ц溅".equals(req.getType()) && req.getShippingCarNumber() != null) {
+ approveReason += ":" + req.getShippingCarNumber();
+ } else if ("蹇��".equals(req.getType()) && req.getExpressCompany() != null) {
+ approveReason += ":" + req.getExpressCompany();
+ }
+ approveProcessVO.setApproveReason(approveReason);
approveProcessVO.setApproveUserIds(req.getApproveUserIds());
approveProcessVO.setApproveUser(loginUser.getUserId());
approveProcessVO.setApproveTime(LocalDate.now().toString());
@@ -100,19 +103,7 @@
@Transactional(rollbackFor = Exception.class)
@Log(title = "鍙戣揣淇℃伅绠$悊", businessType = BusinessType.UPDATE)
public AjaxResult deductStock(@RequestBody ShippingInfoDto req) throws IOException {
- ShippingInfo byId = shippingInfoService.getById(req.getId());
- if (byId == null) {
- return AjaxResult.error("鍙戣揣淇℃伅涓嶅瓨鍦�");
- }
- byId.setExpressNumber(req.getExpressNumber());
- byId.setExpressCompany(req.getExpressCompany());
- byId.setShippingCarNumber(req.getShippingCarNumber());
- boolean update = shippingInfoService.updateById(req);
- // 杩佺Щ鏂囦欢
- if(CollectionUtils.isNotEmpty(req.getTempFileIds())){
- tempFileService.migrateTempFilesToFormal(req.getId(), req.getTempFileIds(), FileNameType.SHIP.getValue());
- }
- return update ? AjaxResult.success() : AjaxResult.error();
+ return shippingInfoService.deductStock( req) ? AjaxResult.success() : AjaxResult.error();
}
@PostMapping("/update")
@@ -133,9 +124,8 @@
@Transactional(rollbackFor = Exception.class)
@Log(title = "鍙戣揣淇℃伅绠$悊", businessType = BusinessType.DELETE)
public AjaxResult delete(@RequestBody List<Long> ids) {
- commonFileService.deleteByBusinessIds(ids, FileNameType.SHIP.getValue());
- boolean delete = shippingInfoService.removeBatchByIds(ids);
- return delete ? AjaxResult.success("鍒犻櫎鎴愬姛") : AjaxResult.error("鍒犻櫎澶辫触");
+
+ return shippingInfoService.delete(ids) ? AjaxResult.success("鍒犻櫎鎴愬姛") : AjaxResult.error("鍒犻櫎澶辫触");
}
@Autowired
@@ -152,4 +142,35 @@
util.exportExcel(response, list, "鍙戣揣淇℃伅");
}
+
+ @GetMapping("/getByCustomerName")
+ @ApiOperation("閫氳繃瀹㈡埛鍚嶇О鏌ヨ")
+ public AjaxResult getByCustomerName(String customerName) {
+ return AjaxResult.success(shippingInfoService.getShippingInfoByCustomerName(customerName));
+ }
+
+ /**
+ * 涓�閿彂璐� - 鑷姩瀹℃壒閫氳繃骞跺嚭搴�
+ */
+ @PostMapping("/oneClickShipping")
+ @ApiOperation("涓�閿彂璐�")
+ @Transactional(rollbackFor = Exception.class)
+ @Log(title = "鍙戣揣淇℃伅绠$悊", businessType = BusinessType.INSERT)
+ public AjaxResult oneClickShipping(@RequestBody ShippingInfoDto req) throws IOException {
+ return shippingInfoService.oneClickShipping(req) ? AjaxResult.success("鍙戣揣鎴愬姛") : AjaxResult.error("鍙戣揣澶辫触");
+ }
+
+ /**
+ * 鎵归噺涓�閿彂璐� - 灏嗛攢鍞彴璐︿笅鎵�鏈夋湭鍙戣揣鐨勪骇鍝佸叏閮ㄥ彂璐�
+ */
+ @PostMapping("/batchOneClickShipping")
+ @ApiOperation("鎵归噺涓�閿彂璐�")
+ @Transactional(rollbackFor = Exception.class)
+ @Log(title = "鍙戣揣淇℃伅绠$悊", businessType = BusinessType.INSERT)
+ public AjaxResult batchOneClickShipping(@RequestBody ShippingInfoDto req) throws IOException {
+ if (req.getSalesLedgerId() == null) {
+ return AjaxResult.error("閿�鍞彴璐D涓嶈兘涓虹┖");
+ }
+ return shippingInfoService.batchOneClickShipping(req.getSalesLedgerId(), req) ? AjaxResult.success("鎵归噺鍙戣揣鎴愬姛") : AjaxResult.error("鎵归噺鍙戣揣澶辫触");
+ }
}
--
Gitblit v1.9.3