| | |
| | | import com.baomidou.mybatisplus.mapper.Wrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.core.common.DateUtils; |
| | | import zy.cloud.wms.manager.entity.LocDetl; |
| | | import zy.cloud.wms.manager.entity.Node; |
| | | import zy.cloud.wms.manager.entity.ReceiveDetl; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import zy.cloud.wms.manager.entity.*; |
| | | import zy.cloud.wms.manager.entity.dto.PutShelfDTO; |
| | | import zy.cloud.wms.manager.service.LocDetlService; |
| | | import zy.cloud.wms.manager.service.NodeService; |
| | | import zy.cloud.wms.manager.service.ReceiveDetlService; |
| | | import zy.cloud.wms.manager.service.*; |
| | | import com.core.annotations.ManagerAuth; |
| | | import com.core.common.BaseRes; |
| | | import com.core.common.Cools; |
| | |
| | | private LocDetlService locDetlService; |
| | | @Autowired |
| | | private NodeService nodeService; |
| | | @Autowired |
| | | private ReceiveLogService receiveLogService; |
| | | @Autowired |
| | | private ReceiveService receiveService; |
| | | |
| | | @RequestMapping(value = "/receiveDetl/{id}/auth") |
| | | @ManagerAuth |
| | |
| | | /** |
| | | * 控管与数据初始化 |
| | | */ |
| | | if (Cools.isEmpty(putShelfDTO.getId(),putShelfDTO.getBatch(),putShelfDTO.getRemain(),putShelfDTO.getSelect())){ |
| | | if (Cools.isEmpty(putShelfDTO.getId(),putShelfDTO.getRemain(),putShelfDTO.getSelect())){ |
| | | return R.error("输入数据有误,请重新输入"); |
| | | } |
| | | Date date = new Date(); |
| | |
| | | targetRece.setInQty((int) (targetRece.getInQty() + remain)); |
| | | receiveDetlService.update(targetRece,new EntityWrapper<ReceiveDetl>() |
| | | .eq("id",targetRece.getId())); |
| | | |
| | | /** |
| | | * 上架完成之后,存放数据至上架统计表 man_receive_log |
| | | */ |
| | | ReceiveLog receiveLog = new ReceiveLog(); |
| | | receiveLog.setOrderNo(putShelfDTO.getOrderNo()); |
| | | receiveLog.setNodeId(targetLoc.getId()); |
| | | receiveLog.setNodeName(targetLoc.getName()); |
| | | receiveLog.setMatnr(putShelfDTO.getMatnr()); |
| | | receiveLog.setAnfme(remain); |
| | | receiveLog.setBatch(putShelfDTO.getBatch()); |
| | | receiveLog.setCreateBy(getUserId()); |
| | | receiveLog.setUpdateBy(getUserId()); |
| | | receiveLog.setIoType(1); |
| | | receiveLogService.insert(receiveLog); |
| | | return R.ok("添加成功"); |
| | | } |
| | | |
| | | /** |
| | | * 撤销上架操作 |
| | | */ |
| | | @RequestMapping("/receiveDetl/renew/auth") |
| | | @ManagerAuth |
| | | @Transactional |
| | | public R renew(@RequestBody ReceiveDetl receiveDetl){ |
| | | /** |
| | | * 控管 |
| | | */ |
| | | if (receiveDetl.getInQty() <= 0){ |
| | | return R.error("没有上架记录,无法撤回"); |
| | | } |
| | | Receive receive = receiveService.selectOne(new EntityWrapper<Receive>() |
| | | .eq("id", receiveDetl.getOrderId())); |
| | | if (Cools.isEmpty(receive)) { |
| | | return R.error("找不到该单据,请联系管理员"); |
| | | } |
| | | if (receive.getSettle() == 4){ |
| | | return R.error("该单据已经完结"); |
| | | } |
| | | |
| | | /** |
| | | * 修改库存数量,同时撤回上架完成后,将操作记录反写回上架统计表 man_receive_log |
| | | */ |
| | | List<ReceiveLog> receiveLogs = receiveLogService.selectList(new EntityWrapper<ReceiveLog>() |
| | | .eq("order_no", receiveDetl.getOrderNo()) |
| | | .eq("matnr", receiveDetl.getMatnr()) |
| | | .eq("batch", receiveDetl.getBatch()) |
| | | .eq("io_type", 1)); |
| | | if (Cools.isEmpty(receiveLogs)) { |
| | | return R.error("找不到入库记录"); |
| | | } |
| | | for (ReceiveLog receiveLog : receiveLogs) { |
| | | locDetlService.delete(new EntityWrapper<LocDetl>() |
| | | .eq("loc_no",receiveLog.getNodeName()) |
| | | .eq("matnr",receiveLog.getMatnr()) |
| | | .eq("batch",receiveLog.getBatch())); |
| | | receiveLog.setIoType(101); |
| | | receiveLog.setCreateBy(getUserId()); |
| | | receiveLog.setUpdateBy(getUserId()); |
| | | receiveLogService.insert(receiveLog); |
| | | } |
| | | |
| | | /** |
| | | * 反写回入库档 |
| | | */ |
| | | receiveDetl.setInQty(0); |
| | | receiveDetl.setUpdateTime(new Date()); |
| | | receiveDetl.setUpdateBy(getUserId()); |
| | | receiveDetlService.update(receiveDetl,new EntityWrapper<ReceiveDetl>() |
| | | .eq("id",receiveDetl.getId())); |
| | | return R.ok("撤回成功"); |
| | | } |
| | | |
| | | } |