| | |
| | | import com.baomidou.mybatisplus.mapper.Wrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.core.common.DateUtils; |
| | | import zy.cloud.wms.manager.entity.Pickout; |
| | | import zy.cloud.wms.manager.entity.PickoutDetl; |
| | | import zy.cloud.wms.manager.service.PickoutDetlService; |
| | | import zy.cloud.wms.manager.service.PickoutService; |
| | | import zy.cloud.wms.manager.entity.*; |
| | | import zy.cloud.wms.manager.service.*; |
| | | import com.core.annotations.ManagerAuth; |
| | | import com.core.common.BaseRes; |
| | | import com.core.common.Cools; |
| | |
| | | private PickoutService pickoutService; |
| | | @Autowired |
| | | private PickoutDetlService pickoutDetlService; |
| | | @Autowired |
| | | private WaveService waveService; |
| | | @Autowired |
| | | private OrderService orderService; |
| | | @Autowired |
| | | private WaveDetlService waveDetlService; |
| | | @Autowired |
| | | private OrderDetlService orderDetlService; |
| | | |
| | | @RequestMapping(value = "/pickout/{id}/auth") |
| | | @ManagerAuth |
| | |
| | | EntityWrapper<Pickout> wrapper = new EntityWrapper<>(); |
| | | excludeTrash(param); |
| | | convert(param, wrapper); |
| | | if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));} |
| | | // if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));} |
| | | wrapper.orderBy("wrk_sts",true); |
| | | Page<Pickout> pickoutPage = pickoutService.selectPage(new Page<>(curr, limit), wrapper); |
| | | |
| | | return R.ok(pickoutPage); |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 打印完成之后,将'未打印'状态替换为'拣货中' |
| | | * @param pickout |
| | | * @return |
| | | */ |
| | | @RequestMapping("/pickout/print/auth") |
| | | @ManagerAuth |
| | | public R printed(@RequestBody Pickout pickout){ |
| | | /** |
| | | * 打印完成,向后台更新数据 |
| | | */ |
| | | Date now = new Date(); |
| | | pickout.setPrintTimes(pickout.getPrintTimes() + 1); |
| | | pickout.setUpdateTime(now); |
| | | pickout.setUpdateBy(getUserId().intValue()); |
| | | pickout.setPickStaff(getUserId()); |
| | | pickout.setPickStart(now); |
| | | pickout.setWrkSts(2L); |
| | | pickoutService.update(pickout,new EntityWrapper<Pickout>() |
| | | .eq("id",pickout.getId())); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 点击完成按钮时,将状态从'拣货中'调整至'已完成' |
| | | */ |
| | | @RequestMapping("/pickout/done/auth") |
| | | @ManagerAuth |
| | | public R donePickOut(@RequestBody Pickout pickout){ |
| | | HashSet<String> orderNos = new HashSet<>(); |
| | | /** |
| | | * 反写拣货单 |
| | | */ |
| | | pickout.setWrkSts(3L); |
| | | pickout.setPickEnd(new Date()); |
| | | pickoutService.update(pickout,new EntityWrapper<Pickout>() |
| | | .eq("id",pickout.getId())); |
| | | List<PickoutDetl> pickoutDetls = pickoutDetlService.selectList(new EntityWrapper<PickoutDetl>() |
| | | .eq("head_id", pickout.getId())); |
| | | if (Cools.isEmpty(pickoutDetls)) { |
| | | return R.error("找不到拣货单明细"); |
| | | } |
| | | /** |
| | | * 反写波次 |
| | | */ |
| | | Wave wave = waveService.selectOne(new EntityWrapper<Wave>() |
| | | .eq("wave_no", pickout.getWaveNo())); |
| | | if (Cools.isEmpty(wave)) { |
| | | return R.error("找不到对应波次"); |
| | | } |
| | | wave.setStatus((short) 2); |
| | | waveService.update(wave,new EntityWrapper<Wave>() |
| | | .eq("id",wave.getId())); |
| | | List<WaveDetl> waveDetls = waveDetlService.selectList(new EntityWrapper<WaveDetl>() |
| | | .eq("wave_id", wave.getId())); |
| | | if (Cools.isEmpty(waveDetls)) { |
| | | return R.error("找不到对应波次明细"); |
| | | } |
| | | |
| | | /** |
| | | * 反写出库订单 |
| | | */ |
| | | for (WaveDetl waveDetl : waveDetls) { |
| | | String[] split = waveDetl.getOrderNos().split(","); |
| | | for (String s : split) { |
| | | orderNos.add(s); |
| | | } |
| | | } |
| | | for (PickoutDetl pickoutDetl : pickoutDetls) { |
| | | Double anfme = pickoutDetl.getAnfme(); |
| | | String matnr = pickoutDetl.getMatnr(); |
| | | List<OrderDetl> orderDetls = orderDetlService.selectOutList(matnr,new ArrayList<String>(orderNos)); |
| | | |
| | | } |
| | | |
| | | return R.ok(); |
| | | } |
| | | |
| | | } |