From 4f113d1862ee978e7d0756f31af79ad73b1dc6d7 Mon Sep 17 00:00:00 2001 From: Junjie <540245094@qq.com> Date: 星期四, 12 九月 2024 16:33:39 +0800 Subject: [PATCH] # --- zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/service/impl/OrderServiceImpl.java | 39 +++++++++++++++++++++++++++++++++++---- 1 files changed, 35 insertions(+), 4 deletions(-) diff --git a/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/service/impl/OrderServiceImpl.java b/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/service/impl/OrderServiceImpl.java index cd2d84d..e050386 100644 --- a/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/service/impl/OrderServiceImpl.java +++ b/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/service/impl/OrderServiceImpl.java @@ -1,6 +1,7 @@ package com.zy.asrs.wms.asrs.service.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.zy.asrs.framework.common.Cools; import com.zy.asrs.framework.exception.CoolException; import com.zy.asrs.wms.asrs.entity.*; import com.zy.asrs.wms.asrs.entity.param.CreateOrderParam; @@ -8,6 +9,7 @@ import com.zy.asrs.wms.asrs.mapper.OrderMapper; import com.zy.asrs.wms.asrs.service.*; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.zy.asrs.wms.utils.OrderUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -28,16 +30,40 @@ private OrderDetlService orderDetlService; @Autowired private OrderDetlFieldService orderDetlFieldService; + @Autowired + private OrderNoRuleService orderNoRuleService; + @Autowired + private OrderUtils orderUtils; + + @Override + @Transactional + public boolean createOrder(List<CreateOrderParam> list) { + for (CreateOrderParam orderParam : list) { + createOrder(orderParam); + } + return true; + } @Override @Transactional public boolean createOrder(CreateOrderParam param) { SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + List<Order> orderList = this.list(new LambdaQueryWrapper<Order>().eq(Order::getOrderNo, param.getOrderNo())); + if (!orderList.isEmpty()) { + throw new CoolException("璁㈠崟宸插瓨鍦�"); + } + + String orderNo = param.getOrderNo(); + if (Cools.isEmpty(param.getOrderNo())) { + orderNo = orderNoRuleService.getOrderNo(param.getOrderType().intValue()); + } + Order order = new Order(); - order.setOrderNo(param.getOrderNo()); + order.setOrderNo(orderNo); order.setOrderType(param.getOrderType()); order.setOrderSettle(param.getOrderSettle()); + order.setIoPri(orderUtils.getIoPri()); order.setOrderTime(format.format(new Date())); order.setCreateTime(new Date()); order.setCreateBy(9527L); @@ -50,8 +76,14 @@ double anfme = Double.parseDouble(map.get("anfme").toString()); String batch = map.get("batch").toString(); String matnr = map.get("matnr").toString(); - Double qty = Double.parseDouble(map.get("qty").toString()); - Double workQty = Double.parseDouble(map.get("workQty").toString()); + Double qty = 0D; + Double workQty = 0D; + if (map.containsKey("qty")) { + qty = Double.parseDouble(map.get("qty").toString()); + } + if (map.containsKey("workQty")) { + workQty = Double.parseDouble(map.get("workQty").toString()); + } String memo = map.getOrDefault("memo", "").toString(); Mat mat = matService.getOne(new LambdaQueryWrapper<Mat>().eq(Mat::getMatnr, matnr)); if (mat == null) { @@ -98,7 +130,6 @@ @Override public boolean updateOrder(UpdateOrderParam param) { Order order = this.getOne(new LambdaQueryWrapper<Order>().eq(Order::getId, param.getOrderId())); - order.setOrderNo(param.getOrderNo()); order.setOrderType(param.getOrderType()); order.setOrderSettle(param.getOrderSettle()); order.setUpdateTime(new Date()); -- Gitblit v1.9.1