瀏覽代碼

feat: 发货提醒相关判断调整

hejq 7 年之前
父節點
當前提交
77ef43a79f

+ 4 - 4
src/main/java/com/uas/platform/b2b/controller/SaleNoticeController.java

@@ -254,12 +254,12 @@ public class SaleNoticeController {
 			send = purchaseNoticeService.send(noticeId, send);
 			tokenService.delete(token);
 		}
-		if (send != null) {
-			logger.log("客户送货提醒", "给单个客户送货提醒填写数量并确认发货", send.sendDescription(), null, noticeId);
+		if (null != send && null != send.getId()) {
+			logger.log("客户送货提醒", "给单个客户送货提醒填写数量并确认发货", send.sendDescription(), send.getCode(), noticeId);
 			map.put("id", send.getId());
-			return new ResponseEntity<ModelMap>(map, HttpStatus.OK);
+			return new ResponseEntity<>(map, HttpStatus.OK);
 		} else {
-			throw new IllegalOperatorException("程序错误");
+			throw new IllegalOperatorException("发货失败");
 		}
 	}
 

+ 1 - 1
src/main/java/com/uas/platform/b2b/dao/SaleSendDao.java

@@ -42,5 +42,5 @@ public interface SaleSendDao extends JpaSpecificationExecutor<SaleSend>, JpaRepo
 	 * @param uuid 唯一标识
 	 * @return
 	 */
-	List<SaleSend> findByUuid(String uuid);
+	Integer countByUuid(String uuid);
 }

+ 10 - 4
src/main/java/com/uas/platform/b2b/service/impl/PurchaseNoticeServiceImpl.java

@@ -340,8 +340,13 @@ public class PurchaseNoticeServiceImpl implements PurchaseNoticeService {
 
 	@Override
 	public SaleSend send(Long noticeId, SaleSend send) {
-		PurchaseNotice notice = purchaseNoticeDao.findOne(noticeId);
-		List<SaleSend> sends = saleSendDao.findByUuid(send.getUuid());
+		Integer count = saleSendDao.countByUuid(send.getUuid());
+		// 重复点击发货
+        if (count > 0) {
+            throw new IllegalOperatorException("请不要重复点击发货");
+        }
+        PurchaseNotice notice = purchaseNoticeDao.findOne(noticeId);
+        List<SaleSend> sends = saleSendDao.findByEnUUAndCode(send.getEnUU(), send.getCode());
 		//限制同一个供应商给同一个客户发货单号不可以重复,(避免一次发货产生多张单)
 		if (notice != null && CollectionUtils.isEmpty(sends)) {
 			if (notice.getEnd() != null && notice.getEnd() == Constant.YES) {
@@ -404,8 +409,9 @@ public class PurchaseNoticeServiceImpl implements PurchaseNoticeService {
 	@Override
 	public SaleSend send(SaleSend saleSend) {
 		//限制同一个供应商给同一个客户发货单号不可以重复,(避免一次发货产生多张单),存在时不做处理
-		List<SaleSend> sendList = saleSendDao.findByUuid(saleSend.getUuid());
-		if (saleSend != null && CollectionUtils.isEmpty(sendList)) {
+        Integer count = saleSendDao.countByUuid(saleSend.getUuid());
+		List<SaleSend> sendList = saleSendDao.findByEnUUAndCode(saleSend.getEnUU(), saleSend.getCode());
+		if (count == 0 && CollectionUtils.isEmpty(sendList)) {
 			saleSend.setBackStatus((short) Status.NOT_UPLOAD.value());
 			saleSend.setSendStatus((short) Status.NOT_UPLOAD.value());
 			saleSend.setEnUU(SystemSession.getUser().getEnterprise().getUu());