| | |
| | | package com.zy.asrs.task.handler; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.zy.asrs.entity.LocDetl; |
| | | import com.zy.asrs.entity.LocMast; |
| | | import com.zy.asrs.entity.WrkDetl; |
| | | import com.zy.asrs.entity.WrkMast; |
| | | import com.zy.asrs.service.LocDetlService; |
| | | import com.zy.asrs.service.LocMastService; |
| | | import com.zy.asrs.service.WrkDetlService; |
| | | import com.zy.asrs.service.WrkMastService; |
| | | import com.zy.asrs.entity.*; |
| | | import com.zy.asrs.service.*; |
| | | import com.zy.asrs.task.AbstractHandler; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | private LocMastService locMastService; |
| | | @Autowired |
| | | private LocDetlService locDetlService; |
| | | @Autowired |
| | | private WaitPakinService waitPakinService; |
| | | |
| | | public void start() { |
| | | List<WrkMast> wrkMasts = wrkMastService.selectToBeCompleteData(); |
| | |
| | | |
| | | private void doIn(WrkMast wrkMast){ |
| | | Date now = new Date(); |
| | | LocMast locMast = locMastService.selectById(wrkMast.getLocNo()); |
| | | if (null == locMast) { |
| | | exceptionHandle(""); // todo |
| | | } |
| | | switch (wrkMast.getIoType()) { |
| | | // 空板入库 |
| | | case 10: |
| | | // 修改库位状态=D |
| | | LocMast locMast = locMastService.selectById(wrkMast.getLocNo()); |
| | | if (null != locMast && (locMast.getLocType().equals("S") || locMast.getLocType().equals("Q"))) { |
| | | locMast.setLocType("D"); |
| | | locMast.setIoTime(now); |
| | |
| | | } |
| | | } |
| | | break; |
| | | // 全板入库 |
| | | case 1: |
| | | |
| | | // 清除所属库位之前的库存明细 |
| | | List<LocDetl> locDetls = locDetlService.selectList(new EntityWrapper<LocDetl>().eq("loc_no", wrkMast.getLocNo())); |
| | | if (!locDetls.isEmpty()) { |
| | | locDetlService.delete(new EntityWrapper<LocDetl>().eq("loc_no", wrkMast.getLocNo())); |
| | |
| | | if (wrkDetls.isEmpty()) { |
| | | exceptionHandle(""); // todo |
| | | } |
| | | |
| | | // 遍历工作明细,更新库存明细和入库通知档 |
| | | for (WrkDetl wrkDetl : wrkDetls) { |
| | | |
| | | LocDetl locDetl = locDetlService.selectOne(new EntityWrapper<LocDetl>().eq("loc_no", wrkMast.getLocNo()).eq("matnr", wrkDetl.getMatnr())); |
| | | if (null != locDetl) { |
| | | locDetl.setAnfme(wrkDetl.getAnfme()); |
| | |
| | | null, // 转储请求编号 |
| | | null, // 行项目 |
| | | null, // 物料标签ID |
| | | null, // 物料描述 |
| | | wrkDetl.getMaktx(), // 物料描述 |
| | | null, // 工厂 |
| | | null, // 数量 |
| | | null, // 单位 |
| | | null, // 托盘条码 |
| | | wrkDetl.getAnfme(), // 数量 |
| | | wrkDetl.getAltme(), // 单位 |
| | | wrkDetl.getZpallet(), // 托盘条码 |
| | | null, // 用户ID |
| | | null, // 备注 |
| | | null, // 修改人员 |
| | | null, // 修改时间 |
| | | now, // 修改时间 |
| | | null, // 创建者 |
| | | null // 添加时间 |
| | | now // 添加时间 |
| | | ); |
| | | // todo |
| | | |
| | | if (!locDetlService.insert(locDetl)) { |
| | | exceptionHandle(""); // todo |
| | | } |
| | | } |
| | | |
| | | |
| | | // 更新入库通知档 status ===>> Y |
| | | WaitPakin setParam = new WaitPakin(); |
| | | setParam.setStatus("Y"); |
| | | boolean updateRes = waitPakinService.update(setParam |
| | | , new EntityWrapper<WaitPakin>().eq("barcode", wrkDetl.getZpallet()) |
| | | .eq("matnr", wrkDetl.getMatnr()) |
| | | .eq("anfme", wrkDetl.getAnfme())); |
| | | if (!updateRes) { |
| | | exceptionHandle(""); // todo |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | // 修改库位状态 S ====>> F |
| | | if (locMast.getLocType().equals("S")) { |
| | | locMast.setLocType("F"); |
| | | locMast.setBarcode(wrkMast.getBarcode()); |
| | | locMast.setIoTime(now); |
| | | locMast.setModiTime(now); |
| | | if (!locMastService.updateById(locMast)) { |
| | | exceptionHandle(""); // todo |
| | | } |
| | | } |
| | | break; |
| | | case 53: |
| | | break; |