| | |
| | | package com.zy.asrs.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.core.common.R; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.entity.InventoryFlowDto; |
| | | import com.zy.asrs.entity.WrkMast; |
| | | import com.zy.asrs.entity.WrkMastLog; |
| | | import com.zy.asrs.mapper.WrkMastLogMapper; |
| | | import com.zy.asrs.service.WrkMastLogService; |
| | | import com.zy.asrs.service.WrkMastService; |
| | | import org.springframework.beans.BeanUtils; |
| | | 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.Map; |
| | | import java.util.Objects; |
| | | |
| | | @Service("wrkMastLogService") |
| | | public class WrkMastLogServiceImpl extends ServiceImpl<WrkMastLogMapper, WrkMastLog> implements WrkMastLogService { |
| | | |
| | | @Autowired |
| | | private WrkMastService wrkMastService; |
| | | @Autowired |
| | | private WrkMastLogService wrkMastLogService; |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean save(Integer workNo) { |
| | | WrkMast mast = wrkMastService.selectOne(new EntityWrapper<WrkMast>().eq("wrk_no", workNo)); |
| | | if (Objects.isNull(mast)) { |
| | | throw new CoolException("数据错误:任务不存在!!"); |
| | | } |
| | | Date now = new Date(); |
| | | WrkMastLog wrkMastLog = new WrkMastLog(); |
| | | wrkMastLog.setWrkNo(mast.getWrkNo()); |
| | | wrkMastLog.setIoTime(now); |
| | | wrkMastLog.setWrkSts(Math.toIntExact(mast.getWrkSts())); |
| | | wrkMastLog.setIoType(mast.getIoType()); |
| | | wrkMastLog.setIoPri(mast.getIoPri()); // 优先级 |
| | | wrkMastLog.setCrnNo(mast.getCrnNo()); |
| | | wrkMastLog.setSourceLocNo(mast.getSourceLocNo()); |
| | | wrkMastLog.setLocNo(mast.getLocNo()); |
| | | wrkMastLog.setBarcode(mast.getBarcode()); // 托盘码 |
| | | wrkMastLog.setFullPlt(mast.getFullPlt()); // 满板:Y |
| | | wrkMastLog.setPicking(mast.getPicking()); // 拣料 |
| | | wrkMastLog.setExitMk(mast.getExitMk()); // 退出 |
| | | wrkMastLog.setEmptyMk(mast.getEmptyMk()); // 空板 |
| | | wrkMastLog.setLinkMis(mast.getLinkMis()); |
| | | wrkMastLog.setWrkDate(mast.getWrkDate()); |
| | | wrkMastLog.setPic(mast.getPic()); |
| | | // 操作人员数据 |
| | | wrkMastLog.setAppeTime(now); |
| | | wrkMastLog.setModiTime(now); |
| | | wrkMastLog.setAppeUser(mast.getAppeUser()); |
| | | wrkMastLog.setModiUser(mast.getModiUser()); |
| | | wrkMastLog.setLogId(mast.getId()); |
| | | boolean res = wrkMastLogService.insert(wrkMastLog); |
| | | |
| | | if (!res) { |
| | | throw new CoolException("任务日志保存失败!!"); |
| | | } |
| | | |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | public R inventoryFlowList(Integer curr, Integer limit, Map<String, Object> param) { |
| | | Page<InventoryFlowDto> page = new Page<>(); |
| | | page.setCurrent(curr); |
| | | page.setSize(limit); |
| | | page.setTotal(this.baseMapper.inventoryFlowListCount(param)); |
| | | page.setRecords(this.baseMapper.inventoryFlowList(curr, limit, param)); |
| | | return R.ok(page); |
| | | } |
| | | |
| | | } |