自动化立体仓库 - WMS系统
#
Administrator
22 小时以前 50eb871e7dfcf064639cc15e53573baf28e60f26
#
15个文件已修改
193 ■■■■■ 已修改文件
license.lic 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/api/controller/HmesApiController.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/api/service/impl/HmesApiServiceImpl.java 68 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/api/service/impl/WcsApiServiceImpl.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/entity/WrkMast.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/impl/WorkServiceImpl.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/task/WorkMastScheduler.java 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/common/web/WcsController.java 25 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/system/entity/license/LicenseCheckListener.java 44 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/application-dev.yml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/license.lic 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/LocDetlMapper.xml 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/WrkMastMapper.xml 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/static/js/locAroundBind/locAroundBind.js 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/views/basDevice/basDevice.html 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
license.lic
Binary files differ
src/main/java/com/zy/api/controller/HmesApiController.java
@@ -1,6 +1,7 @@
package com.zy.api.controller;
import com.alibaba.fastjson.JSONObject;
import com.core.annotations.ManagerAuth;
import com.core.common.Cools;
import com.core.common.R;
@@ -9,6 +10,7 @@
import com.zy.asrs.entity.param.OpenOrderPakoutParam;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
@@ -19,6 +21,7 @@
@Api(value = "HMES对接")
@RestController
@Slf4j
@RequestMapping("/api")
public class HmesApiController {
@@ -35,6 +38,7 @@
    @ApiOperation("下发生产任务")
    @PostMapping("/work/tasks")
    public R menauWork(@RequestBody OpenOrderPakoutParam params) {
        log.info("下发生产任务={}", JSONObject.toJSONString(params));
        if (Objects.isNull(params)) {
            return R.error("参数不能为空!!");
        }
src/main/java/com/zy/api/service/impl/HmesApiServiceImpl.java
@@ -17,6 +17,7 @@
import com.zy.asrs.service.impl.OrderDetlPakoutServiceImpl;
import com.zy.asrs.service.impl.OrderPakoutServiceImpl;
import com.zy.common.model.DetlDto;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -25,6 +26,7 @@
import java.util.stream.Collectors;
@Service
@Slf4j
public class HmesApiServiceImpl implements HmesApiService {
    @Autowired
@@ -75,12 +77,46 @@
        // 如果单据不存在则添加;如果单据存在,作业中无法修改,反之则修改单据
        if (!Cools.isEmpty(order)) {
            if (order.getSettle() > 1L) {
                log.error(param.getOrderNo() + "正在出库,无法修改单据");
                throw new CoolException(param.getOrderNo() + "正在出库,无法修改单据");
            }
            orderPakoutService.remove(order.getId());
        }
        DocType docType = docTypeService.selectOrAdd(param.getBillType(), Boolean.FALSE);
        Date now = new Date();
        // 单据明细档
        List<DetlDto> list = new ArrayList<>();
        List<DetlDto> orderDetails = param.getMatList();
        for (DetlDto detail : orderDetails) {
            DetlDto dto = new DetlDto(detail.getMatnr(), detail.getBatch(),detail.getBrand(),detail.getDevNo(),detail.getStandby2(),detail.getStandby3(),detail.getLineNumber(),
                    detail.getBoxType1(),detail.getBoxType2(),detail.getBoxType3(), detail.getAnfme());
            if (DetlDto.hasLineNumber(list, dto)) {
                DetlDto detlDto = DetlDto.findLineNumber(list, dto.getMatnr(), dto.getBatch(),dto.getBrand(),dto.getDevNo(),dto.getStandby2(),dto.getStandby3(),dto.getLineNumber(),
                        dto.getBoxType1(),dto.getBoxType2(),dto.getBoxType3());
                assert detlDto != null;
                detlDto.setAnfme(detlDto.getAnfme() + detail.getAnfme());
            } else {
                list.add(dto);
            }
        }
        //下发的订单明细,查看库存是否有足够的库存,排除机台的库位
        for (DetlDto detail : list) {
            List<LocDetl> matnr = locDetlService.selectList(new EntityWrapper<LocDetl>().eq("matnr", detail.getMatnr()));
            Double count=0.0;
            for (LocDetl detl : matnr) {
                LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", detl.getLocNo()).eq("loc_sts","F"));
                if (locMast != null) {
                    LocAroundBind bLocNo = locAroundBindService.selectOne(new EntityWrapper<LocAroundBind>().eq("b_loc_no", locMast.getLocNo()));
                    if (Cools.isEmpty(bLocNo)) {
                        count=detl.getAnfme()+count;
                    }
                }
            }
            if (count<detail.getAnfme()) {
                return R.error("物料="+detail.getMatnr()+"库存不足无法生成订单");
            }
        }
        // 单据主档
        order = new OrderPakout(
                String.valueOf(snowflakeIdWorker.nextId()),    // 编号[非空]
@@ -120,38 +156,6 @@
        );
        if (!orderPakoutService.insert(order)) {
            throw new CoolException("生成单据主档失败,请联系管理员");
        }
        // 单据明细档
        List<DetlDto> list = new ArrayList<>();
        List<DetlDto> orderDetails = param.getMatList();
        for (DetlDto detail : orderDetails) {
            DetlDto dto = new DetlDto(detail.getMatnr(), detail.getBatch(),detail.getBrand(),detail.getDevNo(),detail.getStandby2(),detail.getStandby3(),detail.getLineNumber(),
                    detail.getBoxType1(),detail.getBoxType2(),detail.getBoxType3(), detail.getAnfme());
            if (DetlDto.hasLineNumber(list, dto)) {
                DetlDto detlDto = DetlDto.findLineNumber(list, dto.getMatnr(), dto.getBatch(),dto.getBrand(),dto.getDevNo(),dto.getStandby2(),dto.getStandby3(),dto.getLineNumber(),
                        dto.getBoxType1(),dto.getBoxType2(),dto.getBoxType3());
                assert detlDto != null;
                detlDto.setAnfme(detlDto.getAnfme() + detail.getAnfme());
            } else {
                list.add(dto);
            }
        }
        //下发的订单明细,查看库存是否有足够的库存,排除机台的库位
        for (DetlDto detail : list) {
            List<LocDetl> matnr = locDetlService.selectList(new EntityWrapper<LocDetl>().eq("matnr", detail.getMatnr()));
            Double count=0.0;
            for (LocDetl detl : matnr) {
                LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", detl.getLocNo()).eq("loc_sts","F"));
                if (locMast != null) {
                    LocAroundBind bLocNo = locAroundBindService.selectOne(new EntityWrapper<LocAroundBind>().eq("b_loc_no", locMast.getLocNo()));
                    if (Cools.isEmpty(bLocNo)) {
                        count=detl.getAnfme()+count;
                    }
                }
            }
            if (count<detail.getAnfme()) {
                return R.error("物料="+detail.getMatnr()+"库存不足无法生成订单");
            }
        }
        for (DetlDto detlDto : list) {
            Mat mat = matService.selectByMatnr(detlDto.getMatnr());
src/main/java/com/zy/api/service/impl/WcsApiServiceImpl.java
@@ -201,7 +201,7 @@
                                }
                            }
                        }
                    }else if (wrkMast.getIoType()==101){
                    }else if (wrkMast.getIoType()==101 || wrkMast.getIoType()==110) {
                        wrkMast.setWrkSts(12L);
                        wrkMast.setModiTime(new Date());
                        wrkMastService.updateById(wrkMast);
@@ -371,6 +371,17 @@
                                } else {
                                    throw new CoolException("任务号截取失败,请检查主任务档任档wrkCode字段");
                                }
                            }else{
                                String wrkNo = mast.getWrkCode();
                                WrkMast orgWrk = wrkMastService.selectOne(new EntityWrapper<WrkMast>().eq("wrk_no", wrkNo));
                                if (Objects.isNull(orgWrk)) {
                                    throw new CoolException("数据错误,主任务档不存在或已删除!!");
                                }
                                mast.setOveMk("Y");
                                orgWrk.setOveMk("Y");
                                if (!wrkMastService.updateById(orgWrk)) {
                                    throw new CoolException("任务档修改失败!!");
                                }
                            }
                        }
                    } else {
src/main/java/com/zy/asrs/entity/WrkMast.java
@@ -32,6 +32,8 @@
    private Integer wrkNo;
    @ApiModelProperty("任务类型: agv, crn")
    @TableField("task_type")
    @TableId(value = "task_type")
    private String taskType;
    @ApiModelProperty("任务编码")
src/main/java/com/zy/asrs/service/impl/WorkServiceImpl.java
@@ -350,6 +350,7 @@
            wrkMast.setCrnNo(locMast.getCrnNo());
            wrkMast.setSourceStaNo(staDesc.getCrnStn() + ""); // 源站
            wrkMast.setStaNo(staDesc.getStnNo() + ""); // 目标站
            wrkMast.setOveMk(staDesc.getStnNo()==1076? "Y":"N");
            wrkMast.setSourceLocNo(dto.getLocNo()); // 源库位
            wrkMast.setFullPlt("Y"); // 满板:Y
            wrkMast.setPicking("N"); // 拣料
@@ -458,7 +459,8 @@
                .eq("dev_no", basDevice.getType()).orderBy("order_no"));
        if (Objects.isNull(binds)) {
            throw new CoolException("机台未设置默认工作位!!");
            log.error("没有可用机台");
            return;
        }
//
//        Set<String> locs = binds.stream().map(LocAroundBind::getBlocNo).collect(Collectors.toSet());
@@ -723,6 +725,8 @@
            wrkMast.setExitMk("N"); // 退出
            wrkMast.setEmptyMk("Y"); // 空板
            wrkMast.setLinkMis("N");
            wrkMast.setOveMk("Y");
            wrkMast.setBarcode(locMast.getBarcode());
            wrkMast.setAppeUser(userId);
            wrkMast.setAppeTime(now);
            wrkMast.setModiUser(userId);
src/main/java/com/zy/asrs/task/WorkMastScheduler.java
@@ -102,12 +102,12 @@
            }else {
                continue;
            }
            Integer crnNo = wrkMast.getCrnNo();
            //该堆垛机已经下发任务给wcs后不再下发新的搬运任务
            List<WrkMast> wrkMasts1 = wrkMastService.selectList(new EntityWrapper<WrkMast>().eq("crn_no", crnNo).in("wrk_sts", Arrays.asList(2L, 12L)));
            if (!wrkMasts1.isEmpty()) {
                continue;
            }
//            Integer crnNo = wrkMast.getCrnNo();
//            //该堆垛机已经下发任务给wcs后不再下发新的搬运任务
//            List<WrkMast> wrkMasts1 = wrkMastService.selectList(new EntityWrapper<WrkMast>().eq("crn_no", crnNo).in("wrk_sts", Arrays.asList(2L, 12L)));
//            if (!wrkMasts1.isEmpty()) {
//                continue;
//            }
            //源库位为冻结库位时禁止下发搬运任务给堆垛机
            if (!Cools.isEmpty(wrkMast.getSourceLocNo())){
                LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>()
@@ -132,7 +132,7 @@
            String wcsLocNo = Cools.isEmpty(wrkMast.getLocNo()) ? "" : Utils.WMSLocToWCSLoc(wrkMast.getLocNo());
            WorkTaskParams params = new WorkTaskParams();
            //出库和移库
            if(wrkMast.getIoType()==101&&!Cools.isEmpty(wrkMast.getStaNo())&& !wrkMast.getStaNo().equals("0")) {
            if((wrkMast.getIoType()==101||wrkMast.getIoType()==110)&&!Cools.isEmpty(wrkMast.getStaNo())&& !wrkMast.getStaNo().equals("0")) {
                params.setType("out")
                        .setTaskNo(wrkMast.getWrkNo()+"")
                        .setSourceLocNo(wcsSourceLocNo)
@@ -144,6 +144,7 @@
                params.setType("in")
                        .setTaskNo(wrkMast.getWrkNo()+"")
                        .setSourceStaNo(wrkMast.getSourceStaNo())
                        .setStaNo(wrkMast.getStaNo())
                        .setLocNo(wcsLocNo)
                        .setTaskPri(wrkMast.getIoPri().intValue())
                        .setBarcode(wrkMast.getBarcode());
src/main/java/com/zy/common/web/WcsController.java
@@ -62,6 +62,7 @@
    @PostMapping("/pakin/loc/v1")
    @ResponseBody
    public synchronized R getLocNo(@RequestBody SearchLocParam param) {
        StartupDto dto = null;
        log.info("收到WCS入库接口请求====>>入参:{}", param);
        if (Cools.isEmpty(param.getIoType())) {
            return R.error("入出库类型不能为空");
@@ -75,7 +76,7 @@
            //3S19000677895,M22003772,3  ,KP, 0A2030  ,0A2030202306050023
            //3S箱码号      ,端子物料号 ,数量,单位,供应商编号,供应商批次号
            //数量和重量转换出来的是否差不多
            //weight 为 43.39  去皮2.35  = 41.05
            //weight 为 43.39  去皮2.45  = 40.95
            //托盘码例子  845000820308,M11000787,1000,MT,0A1263,0A126320260120
            //换算需要41.05*24.36约等于1000
            if (Cools.isEmpty(param.getBarcode())) {
@@ -91,8 +92,22 @@
            String threeCode = param.getBarcode();
            param.setBarcode(barcode);
            //实际称重数量
            Double m = param.getWeight() -2.35;
            Double m = param.getWeight() -2.45;
            WrkMast wrkMast1 = wrkMastService.selectByBarcode(barcode);
            if (!Cools.isEmpty(wrkMast1)&&wrkMast1.getWrkSts()==2) {
                StartupDto dto1 =new StartupDto();
                dto1.setBarcode(barcode);
                dto1.setSourceStaNo(Integer.valueOf(wrkMast1.getSourceStaNo()));
                dto1.setStaNo(Integer.valueOf(wrkMast1.getStaNo()));
                String s = Utils.WMSLocToWCSLoc(wrkMast1.getLocNo());
                dto1.setLocNo(s);
                dto1.setCrnNo(wrkMast1.getCrnNo());
                dto1.setWorkNo(wrkMast1.getWrkNo());
                dto1.setTaskPri((int) Math.round(wrkMast1.getIoPri()));
                return R.ok(dto1);
            }
            Mat mat = matService.selectByMatnr(matnr);
            if(mat==null){
                log.info("没有找到该物料档案--"+matnr+"组托时自动新增物料,默认24.36KG/M");
@@ -132,6 +147,7 @@
                waitPakin.setZpallet(param.getBarcode());
                waitPakin.setAnfme(m);
                waitPakin.setThreeCode(threeCode);
                waitPakins.add(waitPakin);
                waitPakinService.insert(waitPakin);
            }else {
                for(WaitPakin waitPakin : waitPakins){
@@ -148,7 +164,9 @@
            if(Cools.isEmpty(waitPakin.getBeBatch())||waitPakin.getBeBatch()!=1){
                flag = true;
            }
            if (flag && (weight - m < -2.0 || weight - m > 2.0)) {
            //2.5KG * 每公斤长度 = 误差值
            Double dou= 2.5*mat.getVolume();
            if (flag && (weight - m < -dou || weight - m > dou)) {
                return R.error("二维码="+threeCode+"的物料实际称重转换成的米数和物料标签提供的米数相差较大需要退回或者标记后才能入库!");
            }
@@ -167,7 +185,6 @@
        sourceStaNo.setLocType1(param.getLocType1());
        LocTypeDto locTypeDto = new LocTypeDto(sourceStaNo);
        StartupDto dto = null;
        switch (param.getIoType()) {
            case 1://满托盘入库
                assert waitPakins != null;
src/main/java/com/zy/system/entity/license/LicenseCheckListener.java
@@ -69,11 +69,11 @@
            logger.info("++++++++ 开始加载许可证 ++++++++");
            try {
//                String publicKeysStoreFileName = this.getClass().getClassLoader().getResource(publicKeysStorePath).getPath();
//                File publicKeysStoreFile = new File(publicKeysStoreFileName);
//
//                String licensePathFileName = this.getClass().getClassLoader().getResource(licensePath).getPath();
//                File licensePathFile = new File(licensePathFileName);
                String publicKeysStoreFileName = this.getClass().getClassLoader().getResource(publicKeysStorePath).getPath();
                File publicKeysStoreFile = new File(publicKeysStoreFileName);
                String licensePathFileName = this.getClass().getClassLoader().getResource(licensePath).getPath();
                File licensePathFile = new File(licensePathFileName);
                LicenseVerifyParam param = new LicenseVerifyParam();
                param.setSubject(subject);
@@ -84,29 +84,29 @@
                LicenseVerify licenseVerify = new LicenseVerify();
                //安装证书
//                LicenseContent install = licenseVerify.install(param);
                LicenseContent install = licenseVerify.install(param);
                logger.info("++++++++ 许可证加载结束 ++++++++");
                logger.info("++++++++ 许可证加载标记,搜索修改 ++++++++");
                licenseTimer.setSystemSupport(true);
                licenseTimer.setLicenseDays(9999);
                return true;
//                licenseTimer.setLicenseDays(9999);
//                return true;
//                licenseTimer.setSystemSupport(install!=null);
//
//                if (install != null) {
//                    Date start = new Date();
//                    Date end = install.getNotAfter();
//                    Long starTime = start.getTime();
//                    Long endTime = end.getTime();
//                    Long num = endTime - starTime;//时间戳相差的毫秒数
//                    int day = (int) (num / 24 / 60 / 60 / 1000);
//                    licenseTimer.setLicenseDays(day);
//                }
//
//
//                return install != null;
                licenseTimer.setSystemSupport(install!=null);
                if (install != null) {
                    Date start = new Date();
                    Date end = install.getNotAfter();
                    Long starTime = start.getTime();
                    Long endTime = end.getTime();
                    Long num = endTime - starTime;//时间戳相差的毫秒数
                    int day = (int) (num / 24 / 60 / 60 / 1000);
                    licenseTimer.setLicenseDays(day);
                }
                return install != null;
            } catch (Exception e) {
                return false;
            }
src/main/resources/application-dev.yml
@@ -48,7 +48,7 @@
#License相关配置
license:
  subject: integrationasrs
  subject: jxhtasrs
  publicAlias: publicCert
  storePass: public_zhongyang_123456789
  licensePath: license.lic
src/main/resources/license.lic
Binary files differ
src/main/resources/mapper/LocDetlMapper.xml
@@ -51,6 +51,8 @@
        <result column="box_type1" property="boxType1" />
        <result column="box_type2" property="boxType2" />
        <result column="box_type3" property="boxType3" />
        <result column="area_id" property="areaId" />
    </resultMap>
    <sql id="batchSeq">
src/main/resources/mapper/WrkMastMapper.xml
@@ -60,6 +60,7 @@
        <result column="full_plt" property="fullPlt" />
        <result column="pre_have" property="preHave" />
        <result column="take_none" property="takeNone" />
        <result column="task_type" property="taskType" />
    </resultMap>
    <select id="selectToBeCompleteData" resultMap="BaseResultMap">
src/main/webapp/static/js/locAroundBind/locAroundBind.js
@@ -30,6 +30,7 @@
            , {field: 'blocNo', align: 'center', title: '工位'}
            , {field: 'locType$', align: 'center', title: '工位状态'}
            , {field: 'def$', align: 'center', title: '工位类型'}
            , {field: 'freeze', align: 'center', title: '是否冻结'}
            , {fixed: 'right', title: '操作', align: 'center', toolbar: '#operate', width: 240}
        ]],
        request: {
src/main/webapp/views/basDevice/basDevice.html
@@ -18,9 +18,15 @@
            <div class="layui-form toolbar" id="search-box">
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">编号:</label>
                        <label class="layui-form-label">机台号:</label>
                        <div class="layui-input-inline">
                            <input class="layui-input" type="text" name="id" placeholder="编号" autocomplete="off">
                            <input class="layui-input" type="text" name="dev_no" placeholder="机台号" autocomplete="off">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">内部编号:</label>
                        <div class="layui-input-inline">
                            <input class="layui-input" type="text" name="type" placeholder="内部编号" autocomplete="off">
                        </div>
                    </div>
                    <div class="layui-inline">&emsp;