1
zhang
1 天以前 912d09bc076272770a507517e71703078c8ae9d7
zy-asc-conveyor/src/main/java/com/zy/acs/conveyor/core/operation/handler/AppleLocOperationHandler.java
@@ -14,7 +14,6 @@
import com.zy.acs.conveyor.core.properties.SlaveProperties;
import com.zy.acs.conveyor.core.service.StationService;
import com.zy.acs.conveyor.entity.Job;
import com.zy.acs.conveyor.enums.WorkNoTypeType;
import com.zy.acs.conveyor.service.JobService;
import com.zy.acs.conveyor.service.WmsMainService;
import com.zy.acs.conveyor.service.WrkLastnoService;
@@ -89,12 +88,25 @@
                        News.error("{}:站点:{},无物", config.getMark(), staProtocol.getSiteId());
                        continue;
                    }
                    if (staProtocol.isWeightErr()) {
                        News.error("{}:站点:{},重量异常:{}", config.getMark(), staProtocol.getSiteId(), staProtocol.getWeight());
                        continue;
                    }
                    if (staProtocol.isBarcodeErr()) {
                        News.error("{}:站点:{},条码异常:{}", config.getMark(), staProtocol.getSiteId(), staProtocol.getBarcode());
                        continue;
                    }
                    if (staProtocol.isLoadErr()) {
                        News.error("{}:站点:{},入库时检测托盘上有无货物", config.getMark(), staProtocol.getSiteId());
                        continue;
                    }
                    String barcode = staProtocol.getBarcode();
                    if (Cools.isEmpty(barcode)) {
                        News.error("站点:{},未扫到码值:{}", staProtocol.getSiteId(), barcode);
                        continue;
                    }
                    Job job = jobService.getJobByBarcode(barcode);
                    Job job = jobService.getJobByJobNo(staProtocol.getWorkNo());
                    //Job job = jobService.getJobByBarcode(barcode);
                    if (job == null) {
                        News.error("{}:站点:{},找不到任务", config.getMark(), staProtocol.getSiteId());
                        continue;
@@ -107,14 +119,22 @@
                        continue;
                    }
                    ApplyInRepsonseDto locOfWms = wmsMainService.getLocOfWms(applyIn(barcode, inSta.getStaNo() + "", staProtocol));
                    ApplyInRepsonseDto locOfWms = wmsMainService.getLocOfWms(applyIn(job, barcode, inSta.getStaNo() + "", staProtocol));
                    if (locOfWms != null) {
                        Integer workNo = getWorkNo();
                        staProtocol.setWorkNo(workNo);
                        staProtocol.setWorkNo(staProtocol.getWorkNo());
                        staProtocol.setStaNo(inSta.getTargetSta());
                        redis.push(RedisConveyorConstant.CONVEYOR_TASK_FLAG, staProtocol);
                        if (jobService.insert(initJob(locOfWms, barcode, workNo, inSta.getTargetSta() + ""))) {
                        job.setLoc(locOfWms.getLocNo());
                        job.setStaNo(String.valueOf(inSta.getTargetSta() + 1));
                        job.setTaskNo(locOfWms.getTaskNo());
                        job.setBatchNo(locOfWms.getBatchNo());
                        job.setBarcode(barcode);
                        job.setWmsTime(new Date());
                        job.setJobSts(ConveyorStateType.INBOUND.getStatus());
                        //if (jobService.insert(initJob(locOfWms, barcode, workNo, inSta.getTargetSta() + ""))) {
                        if (jobService.updateById(job)) {
                            News.info("申请入库成功,条码:{},站点:{}", barcode, inSta.getStaNo());
                        }
                    } else {
                        News.error("WMS未返回库位信息,条码:{},站点:{}", barcode, inSta.getStaNo());
@@ -141,15 +161,12 @@
        return job;
    }
    private Integer getWorkNo() {
        return wrkLastnoService.nextWorkNo(WorkNoTypeType.WORK_NO_TYPE.type);
    }
    private ApplyInDto applyIn(String barcode, String staNo, StaProtocol staProtocol) {
    private ApplyInDto applyIn(Job job, String barcode, String staNo, StaProtocol staProtocol) {
        ApplyInDto applyInDto = new ApplyInDto();
        applyInDto.setStaNo(staNo);
        applyInDto.setBarcode(barcode);
        applyInDto.setFull(staProtocol.isFullPlt());
        applyInDto.setFull(Boolean.valueOf(job.getFull()));
        applyInDto.setWeight(staProtocol.getWeight());
        return applyInDto;
    }