|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.text.SimpleDateFormat; | 
|---|
|  |  |  | import java.util.Date; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.zy.asrs.common.utils.Synchro; | 
|---|
|  |  |  | import org.springframework.format.annotation.DateTimeFormat; | 
|---|
|  |  |  | import java.text.SimpleDateFormat; | 
|---|
|  |  |  | import java.util.Date; | 
|---|
|  |  |  | 
|---|
|  |  |  | return null; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public void sync(Object source) { | 
|---|
|  |  |  | Synchro.Copy(source, this); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | private Integer ioType; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 堆垛机 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @ApiModelProperty(value= "堆垛机") | 
|---|
|  |  |  | private Integer crnNo; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 优先级 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @ApiModelProperty(value= "优先级") | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public WrkMast() {} | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public WrkMast(Integer wrkNo,Long wrkSts,Integer ioType,Integer crnNo,Double ioPri,String locNo,Integer staNo,Integer sourceStaNo,String sourceLocNo,String picking,String exitMk,Integer pltType,String emptyMk,Date ioTime,Integer ctnType,String modiUser,Date modiTime,String appeUser,Date appeTime,Date errorTime,String errorMemo,String manuType,String memo,String barcode,String fullPlt,Long hostId) { | 
|---|
|  |  |  | public WrkMast(Integer wrkNo,Long wrkSts,Integer ioType,Double ioPri,String locNo,Integer staNo,Integer sourceStaNo,String sourceLocNo,String picking,String exitMk,Integer pltType,String emptyMk,Date ioTime,Integer ctnType,String modiUser,Date modiTime,String appeUser,Date appeTime,Date errorTime,String errorMemo,String manuType,String memo,String barcode,String fullPlt,Long hostId) { | 
|---|
|  |  |  | this.wrkNo = wrkNo; | 
|---|
|  |  |  | this.wrkSts = wrkSts; | 
|---|
|  |  |  | this.ioType = ioType; | 
|---|
|  |  |  | this.crnNo = crnNo; | 
|---|
|  |  |  | this.ioPri = ioPri; | 
|---|
|  |  |  | this.locNo = locNo; | 
|---|
|  |  |  | this.staNo = staNo; | 
|---|
|  |  |  | 
|---|
|  |  |  | private Integer ioType; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 堆垛机 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @ApiModelProperty(value= "堆垛机") | 
|---|
|  |  |  | private Integer crnNo; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 优先级 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @ApiModelProperty(value= "优先级") | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public WrkMastLog() {} | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public WrkMastLog(Long id,Integer wrkNo,Long wrkSts,Integer ioType,Integer crnNo,Double ioPri,String locNo,Integer staNo,Integer sourceStaNo,String sourceLocNo,String picking,String exitMk,Integer pltType,String emptyMk,Date ioTime,Integer ctnType,String modiUser,Date modiTime,String appeUser,Date appeTime,Date errorTime,String errorMemo,String manuType,String memo,String barcode,String fullPlt,Long hostId) { | 
|---|
|  |  |  | public WrkMastLog(Long id,Integer wrkNo,Long wrkSts,Integer ioType,Double ioPri,String locNo,Integer staNo,Integer sourceStaNo,String sourceLocNo,String picking,String exitMk,Integer pltType,String emptyMk,Date ioTime,Integer ctnType,String modiUser,Date modiTime,String appeUser,Date appeTime,Date errorTime,String errorMemo,String manuType,String memo,String barcode,String fullPlt,Long hostId) { | 
|---|
|  |  |  | this.id = id; | 
|---|
|  |  |  | this.wrkNo = wrkNo; | 
|---|
|  |  |  | this.wrkSts = wrkSts; | 
|---|
|  |  |  | this.ioType = ioType; | 
|---|
|  |  |  | this.crnNo = crnNo; | 
|---|
|  |  |  | this.ioPri = ioPri; | 
|---|
|  |  |  | this.locNo = locNo; | 
|---|
|  |  |  | this.staNo = staNo; | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 检测目标站 | 
|---|
|  |  |  | BasDevp staNo = basDevpService.getById(staDesc.getDeviceNo()); | 
|---|
|  |  |  | BasDevp staNo = basDevpService.getById(staDesc.getDeviceStn()); | 
|---|
|  |  |  | if (!staNo.getAutoing().equals("Y")) { | 
|---|
|  |  |  | throw new CoolException("目标站" + staDesc.getDeviceNo() + "不可用"); | 
|---|
|  |  |  | throw new CoolException("目标站" + staDesc.getDeviceStn() + "不可用"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 生成工作号 | 
|---|
|  |  |  | 
|---|
|  |  |  | import com.zy.asrs.common.domain.dto.LocTypeDto; | 
|---|
|  |  |  | import com.zy.asrs.common.domain.dto.StartupDto; | 
|---|
|  |  |  | import com.zy.asrs.common.domain.param.FullStoreParam; | 
|---|
|  |  |  | import com.zy.asrs.common.wms.entity.BasDevp; | 
|---|
|  |  |  | import com.zy.asrs.common.wms.entity.LocMast; | 
|---|
|  |  |  | import com.zy.asrs.common.wms.entity.WrkMast; | 
|---|
|  |  |  | import com.zy.asrs.common.wms.entity.*; | 
|---|
|  |  |  | import com.zy.asrs.common.wms.service.*; | 
|---|
|  |  |  | import com.zy.asrs.framework.common.BaseRes; | 
|---|
|  |  |  | import com.zy.asrs.framework.common.Cools; | 
|---|
|  |  |  | 
|---|
|  |  |  | private WrkDetlService wrkDetlService; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private LocMastService locMastService; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private MatService matService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | @Transactional | 
|---|
|  |  |  | 
|---|
|  |  |  | wrkMast.setWrkSts(1L); // 工作状态:生成入库 | 
|---|
|  |  |  | wrkMast.setIoType(1); // 入出库状态:1.入库 | 
|---|
|  |  |  | wrkMast.setIoPri(13D); // 优先级:13 | 
|---|
|  |  |  | wrkMast.setCrnNo(dto.getCrnNo()); | 
|---|
|  |  |  | wrkMast.setSourceStaNo(dto.getSourceStaNo()); | 
|---|
|  |  |  | wrkMast.setStaNo(dto.getStaNo()); | 
|---|
|  |  |  | wrkMast.setLocNo(dto.getLocNo()); | 
|---|
|  |  |  | 
|---|
|  |  |  | detlDtos.add(detlDto); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | //        wrkDetlService.createWorkDetail(workNo, detlDtos, param.getBarcode(), userId); | 
|---|
|  |  |  | //        // 更新源站点信息 | 
|---|
|  |  |  | //        sourceStaNo.setWrkNo(workNo); | 
|---|
|  |  |  | //        sourceStaNo.setModiUser(userId); | 
|---|
|  |  |  | //        sourceStaNo.setModiTime(now); | 
|---|
|  |  |  | //        if (!basDevpService.updateById(sourceStaNo)){ | 
|---|
|  |  |  | //            throw new CoolException("更新源站失败"); | 
|---|
|  |  |  | //        } | 
|---|
|  |  |  | //        // 更新目标库位状态 | 
|---|
|  |  |  | //        LocMast locMast = locMastService.getOne(new LambdaQueryWrapper<LocMast>().eq(LocMast::getLocNo, dto.getLocNo())); | 
|---|
|  |  |  | //        if (locMast.getLocSts().equals("O")){ | 
|---|
|  |  |  | //            locMast.setLocSts("S"); // S.入库预约 | 
|---|
|  |  |  | //            locMast.setModiUser(userId); | 
|---|
|  |  |  | //            locMast.setModiTime(now); | 
|---|
|  |  |  | //            if (!locMastService.updateById(locMast)){ | 
|---|
|  |  |  | //                throw new CoolException("改变库位状态失败"); | 
|---|
|  |  |  | //            } | 
|---|
|  |  |  | //        } else { | 
|---|
|  |  |  | //            throw new CoolException(dto.getLocNo()+"目标库位已被占用"); | 
|---|
|  |  |  | //        } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | for (DetlDto detlDto : detlDtos) { | 
|---|
|  |  |  | Mat mat = matService.getOne(new LambdaQueryWrapper<Mat>().eq(Mat::getMatnr, detlDto.getMatnr()).eq(Mat::getHostId, hostId)); | 
|---|
|  |  |  | if (Cools.isEmpty(mat)){ | 
|---|
|  |  |  | throw new CoolException(detlDto.getMatnr() + "商品维护失败"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | // 保持工作档明细 | 
|---|
|  |  |  | WrkDetl wrkDetl = new WrkDetl(); | 
|---|
|  |  |  | wrkDetl.sync(mat); | 
|---|
|  |  |  | wrkDetl.setWrkNo(workNo); | 
|---|
|  |  |  | wrkDetl.setIoTime(now); | 
|---|
|  |  |  | wrkDetl.setBatch(detlDto.getBatch()); | 
|---|
|  |  |  | wrkDetl.setAnfme(detlDto.getAnfme()); // 数量 | 
|---|
|  |  |  | wrkDetl.setZpallet(param.getBarcode()); // 托盘条码 | 
|---|
|  |  |  | wrkDetl.setAppeUser(userId); | 
|---|
|  |  |  | wrkDetl.setAppeTime(now); | 
|---|
|  |  |  | wrkDetl.setModiUser(userId); | 
|---|
|  |  |  | wrkDetl.setModiTime(now); | 
|---|
|  |  |  | if (!wrkDetlService.save(wrkDetl)) { | 
|---|
|  |  |  | throw new CoolException("保存工作明细失败"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 更新目标库位状态 | 
|---|
|  |  |  | LocMast locMast = locMastService.getOne(new LambdaQueryWrapper<LocMast>().eq(LocMast::getLocNo, dto.getLocNo()).eq(LocMast::getHostId, hostId)); | 
|---|
|  |  |  | if (locMast.getLocSts().equals("O")){ | 
|---|
|  |  |  | locMast.setLocSts("S"); // S.入库预约 | 
|---|
|  |  |  | locMast.setModiUser(userId); | 
|---|
|  |  |  | locMast.setModiTime(now); | 
|---|
|  |  |  | if (!locMastService.updateById(locMast)){ | 
|---|
|  |  |  | throw new CoolException("改变库位状态失败"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | throw new CoolException(dto.getLocNo()+"目标库位已被占用"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return dto.getLocNo(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | ,{field: 'wrkSts$', align: 'center',title: '工作状态'} | 
|---|
|  |  |  | ,{field: 'ioType$', align: 'center',title: '入出库类型'} | 
|---|
|  |  |  | ,{field: 'ioPri', align: 'center',title: '优先级'} | 
|---|
|  |  |  | ,{field: 'crnNo$', align: 'center',title: '堆垛机'} | 
|---|
|  |  |  | ,{field: 'sourceStaNo$', align: 'center',title: '源站'} | 
|---|
|  |  |  | ,{field: 'staNo$', align: 'center',title: '目标站'} | 
|---|
|  |  |  | ,{field: 'sourceLocNo$', align: 'center',title: '源库位'} | 
|---|
|  |  |  | ,{field: 'locNo$', align: 'center',title: '目标库位'} | 
|---|
|  |  |  | ,{field: 'barcode', align: 'center',title: '条码'} | 
|---|
|  |  |  | ,{field: 'invWh', align: 'center',title: '确认否', width:75} | 
|---|
|  |  |  | ,{field: 'preHave', align: 'center',title: '先入品', hide: true} | 
|---|
|  |  |  | ,{field: 'takeNone', align: 'center',title: '空操作', hide: true} | 
|---|
|  |  |  | // ,{field: 'picking', align: 'center',title: '拣料', templet:function(row){ | 
|---|