|  |  |  | 
|---|
|  |  |  | package com.zy.asrs.wms.task.handler; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.alibaba.fastjson.JSON; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 
|---|
|  |  |  | import com.zy.asrs.common.wms.entity.*; | 
|---|
|  |  |  | import com.zy.asrs.common.wms.service.*; | 
|---|
|  |  |  | 
|---|
|  |  |  | import org.springframework.transaction.annotation.Transactional; | 
|---|
|  |  |  | import org.springframework.transaction.interceptor.TransactionAspectSupport; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.util.ArrayList; | 
|---|
|  |  |  | import java.util.Date; | 
|---|
|  |  |  | import java.util.List; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | private WaitPakinService waitPakinService; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private OrderDetlService orderDetlService; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private BasZpalletService basZpalletService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public ReturnT<String> start(WrkMast wrkMast) { | 
|---|
|  |  |  | // 99.入库完成 | 
|---|
|  |  |  | 
|---|
|  |  |  | // 修改工作主档状态 | 
|---|
|  |  |  | wrkMast.setWrkSts(200L);//200.库存更新完成 | 
|---|
|  |  |  | wrkMast.setModiTime(now); | 
|---|
|  |  |  | savePicInZpallet(wrkMast.getBarcode(),wrkMast.getPic(),wrkMast.getHostId()); | 
|---|
|  |  |  | if (!wrkMastService.updateById(wrkMast)) { | 
|---|
|  |  |  | exceptionHandle("更新出库完成状态失败;[workNo={0}]", wrkMast.getWrkNo()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | return SUCCESS; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /* | 
|---|
|  |  |  | 保存图片到托盘管理页面 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | private void savePicInZpallet(String barcode, String pic, Long hostId){ | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if(Cools.isEmpty(pic)){ | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | BasZpallet basZpallet = basZpalletService.getOne(new LambdaQueryWrapper<BasZpallet>().eq(BasZpallet::getZpallet, barcode)); | 
|---|
|  |  |  | List<String> list = null; | 
|---|
|  |  |  | if(Cools.isEmpty(basZpallet)){ | 
|---|
|  |  |  | basZpallet = new BasZpallet(); | 
|---|
|  |  |  | basZpallet.setHostId(hostId); | 
|---|
|  |  |  | basZpallet.setCreateTime(new Date()); | 
|---|
|  |  |  | basZpallet.setModifyTime(new Date()); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | list = new ArrayList<>(); | 
|---|
|  |  |  | list.add(pic); | 
|---|
|  |  |  | basZpallet.setPicture(JSON.toJSONString(list)); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | basZpalletService.save(basZpallet); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | }else { | 
|---|
|  |  |  | basZpallet.setHostId(hostId); | 
|---|
|  |  |  | basZpallet.setModifyTime(new Date()); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | String picture = basZpallet.getPicture(); | 
|---|
|  |  |  | list = JSON.parseArray(picture, String.class); | 
|---|
|  |  |  | if(list.size() >= 5){ | 
|---|
|  |  |  | list.remove(0); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | list.add(pic); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | basZpallet.setPicture(JSON.toJSONString(list)); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | basZpalletService.updateById(basZpallet); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public static void main(String[] args) { | 
|---|
|  |  |  | String str = "['abc','bcd','cdg']"; | 
|---|
|  |  |  | List<String> list = JSON.parseArray(str, String.class); | 
|---|
|  |  |  | System.out.println(list); | 
|---|
|  |  |  | list.remove(0); | 
|---|
|  |  |  | System.out.println(list); | 
|---|
|  |  |  | list.add("aaa"); | 
|---|
|  |  |  | System.out.println(list); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|