| | |
| | | import com.zy.asrs.entity.result.WrkTraceVo; |
| | | import com.zy.asrs.service.*; |
| | | import com.zy.common.model.DetlDto; |
| | | import com.zy.common.properties.CrossDockProperties; |
| | | import com.zy.common.web.BaseController; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | private WrkMastService wrkMastService; |
| | | @Autowired |
| | | private WrkMastLogService wrkMastLogService; |
| | | @Autowired |
| | | private ClientService clientService; |
| | | @Autowired |
| | | private CrossDockService crossDockService; |
| | | @Autowired |
| | | private CrossDockProperties crossDockProperties; |
| | | |
| | | @RequestMapping(value = "/order/list/pda/page/auth") |
| | | @ManagerAuth |
| | | public R pdaPageList(@RequestParam(required = true)Long tagId, |
| | | @RequestParam(defaultValue = "1")Integer curr, |
| | | @RequestParam(defaultValue = "10")Integer limit){ |
| | | List<DocType> docTypes = docTypeService.selectList(new EntityWrapper<DocType>().eq("pakin", 1)); |
| | | ArrayList<Integer> arrayList = new ArrayList<>(); |
| | | docTypes.forEach(docType -> { |
| | | arrayList.add(docType.getDocId().intValue()); |
| | | }); |
| | | EntityWrapper<OrderPakin> wrapper = new EntityWrapper<>(); |
| | | // wrapper.eq("tag_id", tagId); |
| | | wrapper.in("doc_type", arrayList); |
| | | wrapper.in("settle",1,2); |
| | | wrapper.orderBy("create_time", false); |
| | | Page<OrderPakin> orderPage = orderService.selectPage(new Page<>(curr, limit), wrapper); |
| | | return R.ok().add(orderPage); |
| | | } |
| | | |
| | | @RequestMapping(value = "/order/nav/list/auth") |
| | | @ManagerAuth |
| | |
| | | if (order != null) { |
| | | return R.error("单据编号已存在"); |
| | | } |
| | | Client client = clientService.selectOne(new EntityWrapper<Client>().eq("name", param.getCstmrName())); |
| | | if (null == client){ |
| | | return R.error("客户不存在"); |
| | | } |
| | | Date now = new Date(); |
| | | order = new OrderPakin( |
| | | String.valueOf(snowflakeIdWorker.nextId()), // 编号[非空] |
| | | param.getOrderNo(), // 订单编号 |
| | | DateUtils.convert(now), // 单据日期 |
| | | param.getOrderTime(), // 单据日期 |
| | | param.getDocType(), // 单据类型 |
| | | null, // 项目编号 |
| | | null, // |
| | | null, // 调拨项目编号 |
| | | null, // 初始票据号 |
| | | null, // 票据号 |
| | | null, // 客户编号 |
| | | null, // 客户 |
| | | client.getCode(), // 客户编号 |
| | | client.getName(), // 客户 |
| | | null, // 联系方式 |
| | | null, // 操作人员 |
| | | null, // 合计金额 |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | // 越库功能:如果是越库入库单,调用越库服务处理 |
| | | if (param.getDocType() != null && param.getDocType().equals(crossDockProperties.getInboundDocTypeId())) { |
| | | String outOrderNo = crossDockService.processCrossDockInbound(order, param, getUserId()); |
| | | return R.ok("越库入库单创建成功,已自动生成越库出库单:" + outOrderNo); |
| | | } |
| | | |
| | | return R.ok("订单添加成功"); |
| | | } |
| | | |
| | |
| | | } |
| | | Date now = new Date(); |
| | | Long userId = getUserId(); |
| | | Client client = clientService.selectOne(new EntityWrapper<Client>().eq("name", param.getCstmrName())); |
| | | if (null == client){ |
| | | return R.error("客户不存在"); |
| | | } |
| | | order.setCstmr(client.getCode()); |
| | | order.setCstmrName(client.getName()); |
| | | // 修改主档 |
| | | if (!param.getDocType().equals(order.getDocType())) { |
| | | if (!param.getDocType().equals(order.getDocType()) || !param.getOrderTime().equals(order.getOrderTime())) { |
| | | |
| | | order.setDocType(param.getDocType()); |
| | | order.setUpdateBy(userId); |
| | | order.setUpdateTime(now); |
| | | if (!orderService.updateById(order)) { |
| | | throw new CoolException("修改订单类型失败"); |
| | | } |
| | | order.setOrderTime(param.getOrderTime()); |
| | | |
| | | } |
| | | order.setUpdateBy(userId); |
| | | order.setUpdateTime(now); |
| | | if (!orderService.updateById(order)) { |
| | | throw new CoolException("修改订单类型失败"); |
| | | } |
| | | // 修改明细档 |
| | | // List<OrderDetl> orderDetls = orderDetlService.selectByOrderId(order.getId()); |
| | |
| | | .add("list", wrkTraceVos) |
| | | .add("orderNo", order.getOrderNo()) |
| | | .add("totalQty", totalQty) |
| | | .add("wrkQty", wrkQty + endQty) |
| | | .add("wrkQty", wrkQty) |
| | | .add("lackQty", lackQty) |
| | | .add("endQty", endQty) |
| | | ); |