自动化立体仓库 - WMS系统
LSH
2024-03-27 1a7a451e82e99cc0c0d56d44fc4b981c5d8a06ee
#测试特殊处理
5个文件已修改
1个文件已添加
349 ■■■■■ 已修改文件
src/main/java/com/zy/asrs/task/WrkMastStaInIt2Scheduler.java 315 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/task/WrkMastStaInItScheduler.java 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/common/web/AuthController.java 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/system/controller/LicenseCreatorController.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/system/entity/license/LicenseCheckListener.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/views/index.html 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/task/WrkMastStaInIt2Scheduler.java
New file
@@ -0,0 +1,315 @@
package com.zy.asrs.task;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.core.common.Cools;
import com.zy.asrs.entity.*;
import com.zy.asrs.service.*;
import com.zy.asrs.task.core.ReturnT;
import com.zy.asrs.task.handler.WrkMastStaInItHandler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;
/**
 * Created by Monkey D. Luffy on 2023.07.25
 * 徐工汉云..............以下.............上饶江铜.............自动补空板
 */
@Component
public class WrkMastStaInIt2Scheduler {
    private static final Logger log = LoggerFactory.getLogger(WorkMastScheduler.class);
    @Autowired
    private WrkMastStaInItHandler wrkMastStaInItHandler;
    @Autowired
    private BasDevpService basDevpService;
    @Autowired
    private WrkMastService wrkMastService;
    @Autowired
    private RgvOneSignService rgvOneSignService;
    @Autowired
    private WrkMastStaService wrkMastStaService;
    @Autowired
    private WrkDetlService wrkDetlService;
    @Autowired
    private LocDetlService locDetlService;
    public static final List<Integer> STA_WORK_CU = new ArrayList<Integer>() {{
        add(110);add(111);add(113);add(114);add(116);add(117);
    }};
    public static final List<Integer> STA_WORK_CU_CAR = new ArrayList<Integer>() {{
        add(120);add(121);
    }};
    public static final List<Integer> STA_WORK_CU_CAR_TWO = new ArrayList<Integer>() {{
        add(120);add(121);
    }};
    public static final List<Integer> STA_WORK_CU_CAR_THREE  = new ArrayList<Integer>() {{
        add(120);
    }};
    public static final List<Integer> STA_WORK_CU_CAR_FOUR  = new ArrayList<Integer>() {{
        add(121);
    }};
    public static final List<Integer> STA_WORK_RU = new ArrayList<Integer>() {{
        add(120);add(121);add(122);add(123);
    }};
    @Scheduled(cron = "0/3 * * * * ? ")
    private void execute(){
        for(Integer staNo : STA_WORK_CU){
            try{
                BasDevp basDevp = basDevpService.selectById(staNo);
                if (basDevp.getWrkNo()!=0 && basDevp.getLoading().equals("Y") && basDevp.getAutoing().equals("Y")){
                    WrkMast wrkMast = wrkMastService.selectOne(new EntityWrapper<WrkMast>().eq("wrk_no", basDevp.getWrkNo()));
                    if(Cools.isEmpty(wrkMast)){
                        continue;
                    }
                    if (wrkMast.getIoType()<100 || wrkMast.getIoType()==110){
                        if (!wrkMast.getStaNo().equals(122)){
                            continue;
                        }
                    }
                    if (wrkMast.getWrkSts()!=14 && wrkMast.getWrkSts()!=15){
                        continue;
                    }
                    if (wrkMast.getStaNo()==118 || wrkMast.getStaNo()==119 || wrkMast.getStaNo()==120 || wrkMast.getStaNo()==121){
                        continue;
                    }
                    boolean wrkTypeSign = fullKM(wrkMast);
                    if (!Cools.isEmpty(wrkMast)){
                        if (wrkTypeSign) {
                            ReturnT<String> result = wrkMastStaInItHandler.start(wrkMast,basDevp,13);//3:取放
                            if (result.getCode()==200){
                                continue;
                            }else {
                                System.out.println(staNo+"失败!");
                            }
                        } else {
                            ReturnT<String> result = wrkMastStaInItHandler.start(wrkMast,basDevp,23);//5:满取
                            if (result.getCode()==200){
                                continue;
                            }else {
                                System.out.println(staNo+"失败!");
                            }
                        }
                    }
                }
            }catch (Exception e){
                log.error("自动补空板STA_WORK_CU处理失败,当前站点号:"+staNo+"异常信息"+e);
            }
        }
        for(Integer staNo : STA_WORK_RU){
            try{
                BasDevp basDevp = basDevpService.selectById(staNo);
                if (basDevp.getWrkNo()!=0 && basDevp.getLoading().equals("Y") && basDevp.getAutoing().equals("Y")){
                    WrkMast wrkMast = wrkMastService.selectOne(new EntityWrapper<WrkMast>().eq("wrk_no", basDevp.getWrkNo()));
                    if (Cools.isEmpty(wrkMast)){
                        continue;
                    }
                    if (wrkMast.getWrkSts()!=2 || wrkMast.getIoType()==10){
                        continue;
                    }
//                boolean wrkTypeSign = fullKM(wrkMast);
                    if (!Cools.isEmpty(wrkMast)){
//                    if (wrkTypeSign){
                        ReturnT<String> result = wrkMastStaInItHandler.start(wrkMast,basDevp,13);
                        if (result.getCode()==200) {
                            continue;
                        } else {
                            System.out.println(staNo+"失败!");
                        }
                    }
                }
            }catch (Exception e){
                log.error("自动补空板STA_WORK_RU处理失败,当前站点号:"+staNo+"异常信息"+e);
            }
        }
    }
    @Scheduled(cron = "0/3 * * * * ? ")
    private void execute2(){
        try{
            for(Integer staNo : STA_WORK_CU){
                try{
                    BasDevp basDevp = basDevpService.selectById(staNo);
                    if (basDevp.getWrkNo()!=0 && basDevp.getLoading().equals("Y") && basDevp.getAutoing().equals("Y")){
                        WrkMast wrkMast = wrkMastService.selectOne(new EntityWrapper<WrkMast>().eq("wrk_no", basDevp.getWrkNo()));
                        if(Cools.isEmpty(wrkMast)){
                            continue;
                        }
                        if (wrkMast.getIoType()!=101 && wrkMast.getIoType()!=103){
                            continue;
                        }
                        if (wrkMast.getWrkSts()!=14 && wrkMast.getWrkSts()!=15){
                            continue;
                        }
                        if (wrkMast.getStaNo()<118 || wrkMast.getStaNo()>121){
                            continue;
                        }
                        int count = wrkMastStaService.selectCount(new EntityWrapper<WrkMastSta>().eq("sta_start", wrkMast.getStaNo()).or().eq("sta_end", wrkMast.getStaNo()));
                        if (count!=0){
                            continue;
                        }
                        int countStart = wrkMastStaService.selectCount(new EntityWrapper<WrkMastSta>().eq("sta_start", staNo).or().eq("sta_end", staNo).or().eq("wrk_no", wrkMast.getWrkNo()));
                        if (countStart!=0){
                            continue;
                        }
                        BasDevp basDevpEnd = basDevpService.selectById(wrkMast.getStaNo());
                        if (!basDevpEnd.getAutoing().equals("Y") || basDevpEnd.getWrkNo()!=0 || basDevpEnd.getLoading().equals("Y") || basDevpEnd.getReportSign()!=0){
                            continue;
                        }
                        if (wrkMast.getStaNo()==118 || wrkMast.getStaNo()==119){
                            RgvOneSign rgvOneSign = rgvOneSignService.selectOne(new EntityWrapper<RgvOneSign>().eq("rgv_one_type","oneSign"));
                            if (rgvOneSign.getRgvOneSign()==1){
                                continue;
                            }
                        }
                        if (wrkMast.getIoType()!=101){
                            List<WrkDetl> wrkDetls = wrkDetlService.selectByWrkNo(wrkMast.getWrkNo());
                            if (wrkDetls.size()!=0){
                                String origin = wrkDetls.get(0).getOrigin();
                                if (origin.equals("1")){
                                    if (!STA_WORK_CU_CAR_FOUR.contains(wrkMast.getStaNo())){
                                        continue;
                                    }
                                }else {
                                    if (!STA_WORK_CU_CAR_THREE.contains(wrkMast.getStaNo())){
                                        continue;
                                    }
                                }
                            }else {
                                log.error("未查询到工作明细");
                                continue;
                            }
                        }
//
                        boolean wrkTypeSign = fullKM(wrkMast);
                        if (!Cools.isEmpty(wrkMast)){
                            if (wrkTypeSign) {
                                ReturnT<String> result = wrkMastStaInItHandler.start(wrkMast,basDevp,13);//3:取放
                                if (result.getCode()==200){
                                    continue;
                                }else {
                                    System.out.println(staNo+"失败!");
                                }
                            }
                        }
                    }
                }catch (Exception e){
                    log.error("STA_WORK_CU处理失败,当前站点号:"+staNo+"异常信息"+e);
                }
            }
            for(Integer staNo : STA_WORK_CU){
                try{
                    BasDevp basDevp = basDevpService.selectById(staNo);
                    if (basDevp.getWrkNo()!=0 && basDevp.getLoading().equals("Y") && basDevp.getAutoing().equals("Y")){
                        List<Integer> STA_WORK_CU_CAR_NOW = STA_WORK_CU_CAR;
                        WrkMast wrkMast = wrkMastService.selectOne(new EntityWrapper<WrkMast>().eq("wrk_no", basDevp.getWrkNo()));
                        if(Cools.isEmpty(wrkMast)){
                            continue;
                        }
                        if (wrkMast.getIoType()!=101 && wrkMast.getIoType()!=103){
                            continue;
                        }
                        if (wrkMast.getWrkSts()!=14 && wrkMast.getWrkSts()!=15){
                            continue;
                        }
                        Integer wrkMastStaNo = wrkMast.getStaNo();
                        if (wrkMastStaNo<118 || wrkMastStaNo>121){
                            continue;
                        }
                        String origin = null;
                        boolean sign = false;
                        if (wrkMast.getIoType()!=101){
                            List<WrkDetl> wrkDetls = wrkDetlService.selectByWrkNo(wrkMast.getWrkNo());
                            if (wrkDetls.size()!=0){
                                origin = wrkDetls.get(0).getOrigin();
                                if (origin.equals("1")){
                                    if (!STA_WORK_CU_CAR_FOUR.contains(wrkMastStaNo)){
                                        sign = true;
                                    }
                                }else {
                                    if (!STA_WORK_CU_CAR_THREE.contains(wrkMastStaNo)){
                                        sign = true;
                                    }
                                }
                            }else {
                                log.error("未查询到工作明细");
                                continue;
                            }
                        }
                        int count = wrkMastStaService.selectCount(new EntityWrapper<WrkMastSta>().eq("sta_start", wrkMastStaNo).or().eq("sta_end", wrkMastStaNo));
                        if (count!=0){
                            continue;
                        }
                        int countStart = wrkMastStaService.selectCount(new EntityWrapper<WrkMastSta>().eq("sta_start", staNo).or().eq("sta_end", staNo).or().eq("wrk_no", wrkMast.getWrkNo()));
                        if (countStart!=0){
                            continue;
                        }
                        RgvOneSign rgvOneSign = rgvOneSignService.selectOne(new EntityWrapper<RgvOneSign>().eq("rgv_one_type","oneSign"));
                        if (rgvOneSign.getRgvOneSign()==1){
                            STA_WORK_CU_CAR_NOW = STA_WORK_CU_CAR_TWO;
                        }
                        BasDevp basDevpEnd = basDevpService.selectById(wrkMastStaNo);
                        if (sign || !basDevpEnd.getAutoing().equals("Y") || basDevpEnd.getWrkNo()!=0 || basDevpEnd.getLoading().equals("Y") || basDevpEnd.getReportSign()!=0) {
                            for (Integer staNoOther : STA_WORK_CU_CAR_NOW) {
                                if (staNoOther.equals(wrkMastStaNo)) continue;
                                if (sign){
                                    if (origin.equals("1")){
                                        if (!STA_WORK_CU_CAR_FOUR.contains(staNoOther)){
                                            continue;
                                        }
                                    }else {
                                        if (!STA_WORK_CU_CAR_THREE.contains(staNoOther)){
                                            continue;
                                        }
                                    }
                                }
                                int countOther = wrkMastStaService.selectCount(new EntityWrapper<WrkMastSta>().eq("sta_start", staNoOther).or().eq("sta_end", staNoOther));
                                if (countOther!=0){
                                    continue;
                                }
                                BasDevp basDevpOther = basDevpService.selectById(staNoOther);
                                if (!basDevpOther.getAutoing().equals("Y") || basDevpOther.getWrkNo()!=0 || basDevpOther.getLoading().equals("Y") || basDevpOther.getReportSign()!=0) {
                                    continue;
                                }
                                wrkMast.setStaNo(staNoOther);
                                wrkMastService.updateById(wrkMast);
                                log.info("工作号"+wrkMast.getWrkNo()+"修改目标站为:"+staNoOther+";原目标站为:"+wrkMastStaNo);
                                return;
                            }
                        }
                    }
                }catch (Exception e){
                    log.error("STA_WORK_CU处理失败,当前站点号:"+staNo+"异常信息"+e);
                }
            }
        }catch (Exception e){
            log.error("目标为拆垛位置的任务生成小车工作档案失败!!"+e);
        }
    }
    public boolean fullKM(WrkMast wrkMast){
        if (wrkMast.getIoType()!=10 && wrkMast.getIoType()!=110){
            return true;
        }
        return false;
    }
}
src/main/java/com/zy/asrs/task/WrkMastStaInItScheduler.java
@@ -41,25 +41,25 @@
    public static final List<Integer> STA_WORK_CU = new ArrayList<Integer>() {{
        add(101);add(102);add(104);add(105);add(107);add(108);add(110);add(111);add(113);add(114);add(116);add(117);
        add(101);add(102);add(104);add(105);add(107);add(108);
    }};
    public static final List<Integer> STA_WORK_CU_CAR = new ArrayList<Integer>() {{
        add(118);add(119);add(120);add(121);
        add(118);add(119);
    }};
    public static final List<Integer> STA_WORK_CU_CAR_TWO = new ArrayList<Integer>() {{
        add(120);add(121);
    }};
    public static final List<Integer> STA_WORK_CU_CAR_THREE  = new ArrayList<Integer>() {{
        add(118);add(120);
        add(118);
    }};
    public static final List<Integer> STA_WORK_CU_CAR_FOUR  = new ArrayList<Integer>() {{
        add(119);add(121);
        add(119);
    }};
    public static final List<Integer> STA_WORK_RU = new ArrayList<Integer>() {{
        add(118);add(119);add(120);add(121);add(122);add(123);
        add(118);add(119);add(122);
    }};
src/main/java/com/zy/common/web/AuthController.java
@@ -50,12 +50,12 @@
    @RequestMapping("/login.action")
    @ManagerAuth(value = ManagerAuth.Auth.NONE, memo = "登录")
    public R loginAction(String username, String password){
        //验证许可证是否有效
        LicenseVerify licenseVerify = new LicenseVerify();
        boolean verify = licenseVerify.verify();
        if (!verify) {//许可证已失效
            return R.parse(CodeRes.SYSTEM_20001);
        }
//        //验证许可证是否有效
//        LicenseVerify licenseVerify = new LicenseVerify();
//        boolean verify = licenseVerify.verify();
//        if (!verify) {//许可证已失效
//            return R.parse(CodeRes.SYSTEM_20001);
//        }
        if (username.equals("super") && password.equals(Cools.md5(superPwd))) {
            Map<String, Object> res = new HashMap<>();
            res.put("username", username);
src/main/java/com/zy/system/controller/LicenseCreatorController.java
@@ -69,6 +69,9 @@
     */
    @RequestMapping(value = "/getLicenseDays")
    public R getLicenseDays() {
        if (true){
            return R.ok().add(0);
        }
        LicenseVerify licenseVerify = new LicenseVerify();
        LicenseContent verifyInfo = licenseVerify.getVerifyInfo();
        if (verifyInfo == null) {
src/main/java/com/zy/system/entity/license/LicenseCheckListener.java
@@ -79,11 +79,12 @@
                LicenseVerify licenseVerify = new LicenseVerify();
                //安装证书
                LicenseContent install = licenseVerify.install(param);
//                LicenseContent install = licenseVerify.install(param);
                logger.info("++++++++ 许可证加载结束 ++++++++");
                return install != null;
//                return install != null;
                return true;
            } catch (Exception e) {
                return false;
            }
src/main/webapp/views/index.html
@@ -45,7 +45,7 @@
<!--        <a ew-event="note" title="便签"><i class="layui-icon layui-icon-note"></i></a>-->
<!--      </li>-->
      <li class="layui-nav-item" lay-unselect id="licenseShow" style="display: none;user-select: none;">
        <div style="color: red;">许可证有效期:<span id="licenseDays">29</span>天</div>
<!--        <div style="color: red;">许可证有效期:<span id="licenseDays">29</span>天</div>-->
      </li>
      <li class="layui-nav-item layui-hide-xs" lay-unselect>
        <a ew-event="fullScreen" title="全屏"><i class="layui-icon layui-icon-screen-full"></i></a>