|  |  | 
 |  |  | package com.zy.asrs.service.impl; | 
 |  |  |  | 
 |  |  | import com.baomidou.mybatisplus.service.impl.ServiceImpl; | 
 |  |  | import com.core.common.Cools; | 
 |  |  | import com.core.exception.CoolException; | 
 |  |  | import com.zy.asrs.entity.MatCode; | 
 |  |  | import com.zy.asrs.entity.WaitPakin; | 
 |  |  | import com.zy.asrs.entity.WrkDetl; | 
 |  |  | import com.zy.asrs.mapper.WrkDetlMapper; | 
 |  |  | import com.zy.asrs.service.MatCodeService; | 
 |  |  | import com.zy.asrs.service.WrkDetlService; | 
 |  |  | import com.zy.asrs.utils.VersionUtils; | 
 |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
 |  |  | import org.springframework.stereotype.Service; | 
 |  |  | import org.springframework.transaction.annotation.Transactional; | 
 |  |  |  | 
 |  |  | import java.util.Date; | 
 |  |  | import java.util.List; | 
 |  |  | 
 |  |  | @Service("wrkDetlService") | 
 |  |  | public class WrkDetlServiceImpl extends ServiceImpl<WrkDetlMapper, WrkDetl> implements WrkDetlService { | 
 |  |  |  | 
 |  |  |     @Autowired | 
 |  |  |     private MatCodeService matCodeService; | 
 |  |  |  | 
 |  |  |     @Override | 
 |  |  |     @Transactional | 
 |  |  |     public void createWorkDetail(Integer workNo, List<WaitPakin> waitPakins, String barcode) { | 
 |  |  |         if (waitPakins.isEmpty()){ | 
 |  |  |             return; | 
 |  |  |         } | 
 |  |  |         for (WaitPakin waitPakin : waitPakins) { | 
 |  |  |             MatCode matCode = matCodeService.selectById(waitPakin.getMatnr()); | 
 |  |  |             if (Cools.isEmpty(matCode)){ | 
 |  |  |                 throw new CoolException("物料条码数据为空"); | 
 |  |  |             } | 
 |  |  |             // 保持工作档明细 | 
 |  |  |             WrkDetl wrkDetl = new WrkDetl(); | 
 |  |  |             wrkDetl.setWrkNo(workNo); | 
 |  |  |             wrkDetl.setIoTime(new Date()); | 
 |  |  |             VersionUtils.setWrkDetl(wrkDetl, matCode); // 版本控制 | 
 |  |  |             wrkDetl.setZpallet(barcode); // 托盘条码 | 
 |  |  |             wrkDetl.setAppeTime(new Date()); | 
 |  |  |             wrkDetl.setModiTime(new Date()); | 
 |  |  |             if (!this.insert(wrkDetl)) { | 
 |  |  |                 throw new CoolException("保存工作明细失败"); | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @Override | 
 |  |  |     public List<WrkDetl> findByWorkNo(Integer workNo) { | 
 |  |  |         return this.baseMapper.findByWorkNo(workNo); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @Override | 
 |  |  |     public boolean updateIoTime(Integer workNo, Date ioTime) { | 
 |  |  |         return this.baseMapper.updateIoTime(workNo, ioTime) > 0; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  | } |