From 8e9f2f6925530be0e9f63d0a7205a98f8e6dae47 Mon Sep 17 00:00:00 2001 From: luxiaotao1123 <t1341870251@63.com> Date: 星期二, 24 五月 2022 13:03:47 +0800 Subject: [PATCH] # --- src/main/java/com/zy/asrs/service/impl/BasCrnpServiceImpl.java | 72 ++++++++++++++++++++++++++++++++++++ 1 files changed, 72 insertions(+), 0 deletions(-) diff --git a/src/main/java/com/zy/asrs/service/impl/BasCrnpServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/BasCrnpServiceImpl.java index dd95c78..d5fc975 100644 --- a/src/main/java/com/zy/asrs/service/impl/BasCrnpServiceImpl.java +++ b/src/main/java/com/zy/asrs/service/impl/BasCrnpServiceImpl.java @@ -1,12 +1,84 @@ package com.zy.asrs.service.impl; import com.baomidou.mybatisplus.service.impl.ServiceImpl; +import com.core.common.Cools; +import com.core.exception.CoolException; import com.zy.asrs.entity.BasCrnp; import com.zy.asrs.mapper.BasCrnpMapper; import com.zy.asrs.service.BasCrnpService; +import com.zy.asrs.service.WrkMastService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; +@Slf4j @Service("basCrnpService") public class BasCrnpServiceImpl extends ServiceImpl<BasCrnpMapper, BasCrnp> implements BasCrnpService { + @Autowired + private WrkMastService wrkMastService; + + @Value("${store.bufferCount}") + private int bufferCount; + + @Override + public BasCrnp checkSiteStatus(Integer crnId) { + BasCrnp crnp = this.selectById(crnId); + if (Cools.isEmpty(crnp)) { + throw new CoolException(crnId + "鍙峰爢鍨涙満涓嶅瓨鍦�"); + } + if ("N".equals(crnp.getInEnable())) { + throw new CoolException(crnId + "鍫嗗灈鏈轰笉鍙叆"); + } + if ("N".equals(crnp.getOutEnable())) { + throw new CoolException(crnId + "鍫嗗灈鏈轰笉鍙嚭"); + } + return crnp; + } + + @Override + public boolean checkSiteError(Integer crnNo, boolean pakin) { + BasCrnp crnp = this.selectById(crnNo); + if (Cools.isEmpty(crnp)) { + log.error("{}鍙峰爢鍨涙満涓嶅瓨鍦�", crnNo); + return false; + } + if (pakin) { + //TODO鎺у埗鍏ュ簱鏆傚瓨鏁帮紝闃叉涓诲共閬撳牭濉烇紝2022-5-24 ADD + int storeCount = wrkMastService.getStoreCount(crnNo); + int maxCount = bufferCount; + if(crnNo==1){ + maxCount = 3; + } + + if(storeCount >= maxCount){ + log.error("{}鍙峰爢鍨涙満鏆傚瓨鏁板凡婊�!", crnNo); + return false; + } + + if ("N".equals(crnp.getInEnable())) { + log.error("{}鍙峰爢鍨涙満涓嶅彲鍏�", crnNo); + return false; + } + } else { + if ("N".equals(crnp.getOutEnable())) { + log.error("{}鍙峰爢鍨涙満涓嶅彲鍑�", crnNo); + return false; + } + } +// if (crnp.getCrnSts() != null) { +// if (crnp.getCrnSts() == 10) { +// log.error("{}鍙峰爢鍨涙満鐘舵�佷负10.閿欒", crnNo); +// return false; +// } +// } + if (crnp.getCrnErr() != null) { + if (crnp.getCrnErr() != 0) { + log.error("{}鍙峰爢鍨涙満寮傚父锛屽紓甯哥爜{}", crnNo, crnp.getCrnErr()); + return false; + } + } + return true; + } } -- Gitblit v1.9.1