From f086482fdd4ab2425b1db07ebbdeeefed4a50305 Mon Sep 17 00:00:00 2001 From: anthonywj Date: Thu, 2 Feb 2023 14:41:24 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=9F=E6=88=90=E5=8D=95=E6=8D=AE=E8=AF=A6?= =?UTF-8?q?=E6=83=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../inout/IoCodeTempController.java | 37 ++++++++------- .../entity/inout/IoOrderDetailCodeEntity.java | 4 +- .../glxp/api/entity/inout/IoOrderEntity.java | 2 +- .../api/res/basic/UdiRelevanceResponse.java | 3 +- .../inout/IoOrderDetailBizService.java | 10 ++++ .../inout/IoOrderDetailCodeService.java | 11 +++++ .../inout/IoOrderDetailResultService.java | 12 +++++ .../service/inout/IoTransInoutService.java | 47 ++++++++++++++++++- .../impl/IoOrderDetailBizServiceImpl.java | 32 ++++++++++++- .../impl/IoOrderDetailCodeServiceImpl.java | 31 +++++++++++- .../impl/IoOrderDetailResultServiceImpl.java | 28 +++++++++++ 11 files changed, 192 insertions(+), 25 deletions(-) diff --git a/src/main/java/com/glxp/api/controller/inout/IoCodeTempController.java b/src/main/java/com/glxp/api/controller/inout/IoCodeTempController.java index 0d259c52..9f08f5b4 100644 --- a/src/main/java/com/glxp/api/controller/inout/IoCodeTempController.java +++ b/src/main/java/com/glxp/api/controller/inout/IoCodeTempController.java @@ -576,25 +576,25 @@ public class IoCodeTempController extends BaseController { IoOrderEntity isExit = orderService.findById(orderId); if (isExit == null) { - IoOrderEntity orderSaveRequest = new IoOrderEntity(); - orderSaveRequest.setBillNo(orderId); - orderSaveRequest.setCorpOrderId(addOrderRequest.getCorpOrderId()); - orderSaveRequest.setMainAction(bussinessTypeEntity.getMainAction()); - orderSaveRequest.setAction(bussinessTypeEntity.getAction()); - orderSaveRequest.setFromCorp(addOrderRequest.getFromCorp()); - orderSaveRequest.setFromInvCode(addOrderRequest.getFromInvCode()); - orderSaveRequest.setFromType(ConstantStatus.FROM_WEBNEW); - orderSaveRequest.setStatus(ConstantStatus.ORDER_STATUS_TEMP_SAVE); - orderSaveRequest.setDealStatus(ConstantStatus.ORDER_DEAL_DRAFT); + orderEntity = new IoOrderEntity(); + orderEntity.setBillNo(orderId); + orderEntity.setCorpOrderId(addOrderRequest.getCorpOrderId()); + orderEntity.setMainAction(bussinessTypeEntity.getMainAction()); + orderEntity.setAction(bussinessTypeEntity.getAction()); + orderEntity.setFromCorp(addOrderRequest.getFromCorp()); + orderEntity.setFromInvCode(addOrderRequest.getFromInvCode()); + orderEntity.setFromType(ConstantStatus.FROM_WEBNEW); + orderEntity.setStatus(ConstantStatus.ORDER_STATUS_TEMP_SAVE); + orderEntity.setDealStatus(ConstantStatus.ORDER_DEAL_DRAFT); AuthAdmin authAdmin = getUser(); - orderSaveRequest.setCreateUser(authAdmin.getId() + ""); - orderSaveRequest.setCreateTime(new Date()); - orderSaveRequest.setUpdateUser(authAdmin.getId() + ""); - orderSaveRequest.setUpdateTime(new Date()); - orderSaveRequest.setCustomerId(authAdmin.getCustomerId()); - orderSaveRequest.setDeptCode(invWarehouseEntity.getParentId()); - orderSaveRequest.setInvCode(addOrderRequest.getInvCode()); - orderService.insertOrder(orderSaveRequest); + orderEntity.setCreateUser(authAdmin.getId() + ""); + orderEntity.setCreateTime(new Date()); + orderEntity.setUpdateUser(authAdmin.getId() + ""); + orderEntity.setUpdateTime(new Date()); + orderEntity.setCustomerId(authAdmin.getCustomerId()); + orderEntity.setDeptCode(invWarehouseEntity.getParentId()); + orderEntity.setInvCode(addOrderRequest.getInvCode()); + orderService.insertOrder(orderEntity); } BaseResponse baseResponse = checkRelId(codeEnttity, unitFk); @@ -614,6 +614,7 @@ public class IoCodeTempController extends BaseController { } } addCodeResult.setOrderId(orderId); + transInoutService.genOrderDetailCode(orderEntity, codeEnttity); return ResultVOUtils.success(addCodeResult); } diff --git a/src/main/java/com/glxp/api/entity/inout/IoOrderDetailCodeEntity.java b/src/main/java/com/glxp/api/entity/inout/IoOrderDetailCodeEntity.java index 0121b8fb..cedaaf20 100644 --- a/src/main/java/com/glxp/api/entity/inout/IoOrderDetailCodeEntity.java +++ b/src/main/java/com/glxp/api/entity/inout/IoOrderDetailCodeEntity.java @@ -4,8 +4,10 @@ import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; + import java.io.Serializable; import java.math.BigDecimal; + import lombok.Data; @Data @@ -24,7 +26,7 @@ public class IoOrderDetailCodeEntity implements Serializable { * 耗材字典ID外键 */ @TableField(value = "bindRlFk") - private String bindRlFk; + private Long bindRlFk; /** * DI信息UUID外键 diff --git a/src/main/java/com/glxp/api/entity/inout/IoOrderEntity.java b/src/main/java/com/glxp/api/entity/inout/IoOrderEntity.java index 87b606e8..8e3a2c2e 100644 --- a/src/main/java/com/glxp/api/entity/inout/IoOrderEntity.java +++ b/src/main/java/com/glxp/api/entity/inout/IoOrderEntity.java @@ -13,7 +13,7 @@ import lombok.Data; @Data @TableName(value = "io_order") public class IoOrderEntity implements Serializable { - @TableId(value = "id", type = IdType.INPUT) + @TableId(value = "id", type = IdType.AUTO) private Integer id; /** diff --git a/src/main/java/com/glxp/api/res/basic/UdiRelevanceResponse.java b/src/main/java/com/glxp/api/res/basic/UdiRelevanceResponse.java index 1546ec34..f8de7548 100644 --- a/src/main/java/com/glxp/api/res/basic/UdiRelevanceResponse.java +++ b/src/main/java/com/glxp/api/res/basic/UdiRelevanceResponse.java @@ -2,6 +2,7 @@ package com.glxp.api.res.basic; import lombok.Data; +import java.math.BigDecimal; import java.util.Date; @Data @@ -81,7 +82,7 @@ public class UdiRelevanceResponse { private String basicPrductRemak6; private String basicPrductRemak7; private String basicPrductRemak8; - private String price; + private BigDecimal price; //关联查询字典 private String unitFk; //供应商ID diff --git a/src/main/java/com/glxp/api/service/inout/IoOrderDetailBizService.java b/src/main/java/com/glxp/api/service/inout/IoOrderDetailBizService.java index defae309..4c7634fd 100644 --- a/src/main/java/com/glxp/api/service/inout/IoOrderDetailBizService.java +++ b/src/main/java/com/glxp/api/service/inout/IoOrderDetailBizService.java @@ -1,4 +1,14 @@ package com.glxp.api.service.inout; +import com.glxp.api.entity.inout.IoOrderDetailBizEntity; + +import java.util.List; + public interface IoOrderDetailBizService { + + List findByOrderId(String orderId); + + int insert(IoOrderDetailBizEntity orderDetailBizEntity); + + int update(IoOrderDetailBizEntity orderDetailBizEntity); } diff --git a/src/main/java/com/glxp/api/service/inout/IoOrderDetailCodeService.java b/src/main/java/com/glxp/api/service/inout/IoOrderDetailCodeService.java index 4e84696c..38bea222 100644 --- a/src/main/java/com/glxp/api/service/inout/IoOrderDetailCodeService.java +++ b/src/main/java/com/glxp/api/service/inout/IoOrderDetailCodeService.java @@ -1,4 +1,15 @@ package com.glxp.api.service.inout; +import com.glxp.api.entity.inout.IoOrderDetailCodeEntity; + +import java.util.List; + public interface IoOrderDetailCodeService { + + List findByOrderId(String orderId); + + int insert(IoOrderDetailCodeEntity orderDetailCodeEntity); + + int update(IoOrderDetailCodeEntity orderDetailCodeEntity); + } diff --git a/src/main/java/com/glxp/api/service/inout/IoOrderDetailResultService.java b/src/main/java/com/glxp/api/service/inout/IoOrderDetailResultService.java index 51b2d6ba..a0186de6 100644 --- a/src/main/java/com/glxp/api/service/inout/IoOrderDetailResultService.java +++ b/src/main/java/com/glxp/api/service/inout/IoOrderDetailResultService.java @@ -1,4 +1,16 @@ package com.glxp.api.service.inout; +import com.glxp.api.entity.inout.IoOrderDetailBizEntity; +import com.glxp.api.entity.inout.IoOrderDetailCodeEntity; +import com.glxp.api.entity.inout.IoOrderDetailResultEntity; + +import java.util.List; + public interface IoOrderDetailResultService { + + List findByOrderId(String orderId); + + int insert(IoOrderDetailResultEntity orderDetailResultEntity); + + int update(IoOrderDetailResultEntity orderDetailResultEntity); } diff --git a/src/main/java/com/glxp/api/service/inout/IoTransInoutService.java b/src/main/java/com/glxp/api/service/inout/IoTransInoutService.java index e73a9d91..28296d7f 100644 --- a/src/main/java/com/glxp/api/service/inout/IoTransInoutService.java +++ b/src/main/java/com/glxp/api/service/inout/IoTransInoutService.java @@ -1,5 +1,6 @@ package com.glxp.api.service.inout; +import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.StrUtil; import com.glxp.api.constant.Constant; import com.glxp.api.constant.ConstantStatus; @@ -15,6 +16,7 @@ import com.glxp.api.req.basic.FilterCompanyProductRelevanceRequest; import com.glxp.api.req.inout.PdaCodeEntity; import com.glxp.api.req.inout.PostOrderRequest; import com.glxp.api.res.basic.UdiRelevanceResponse; +import com.glxp.api.service.basic.UdiRelevanceService; import com.glxp.api.service.basic.UdiRlSupService; import com.glxp.api.service.basic.IBasicBussinessTypeService; import com.glxp.api.util.CustomUtil; @@ -26,6 +28,7 @@ import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; import javax.annotation.Resource; +import java.math.BigDecimal; import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -43,6 +46,10 @@ public class IoTransInoutService { IoCodeService codeService; @Resource UdiRlSupService udiRlSupService; + @Resource + IoOrderDetailCodeService orderDetailCodeService; + @Resource + UdiRelevanceService udiRelevanceService; //手持终端上传生成扫码单据 public void creatOrderByPda(PostOrderRequest postOrderRequest) { @@ -197,9 +204,45 @@ public class IoTransInoutService { //生成扫码单据详情 - public void transInout(IoOrderEntity orderEntity, IoCodeTempEntity codeTempEntity) { - + public void genOrderDetailCode(IoOrderEntity orderEntity, IoCodeTempEntity codeTempEntity) { + + List ioOrderDetailCodeEntities = orderDetailCodeService.findByOrderId(orderEntity.getBillNo()); + UdiRelevanceResponse udiRelevanceResponse = udiRelevanceService.selectGroupById(codeTempEntity.getRelId()); + if (CollUtil.isEmpty(ioOrderDetailCodeEntities)) { + orderDetailCodeService.insert(buildEntity(orderEntity, codeTempEntity, udiRelevanceResponse)); + } else { + ioOrderDetailCodeEntities.forEach(orderDetailCodeEntity -> + { + if (orderDetailCodeEntity.getBindRlFk() == udiRelevanceResponse.getId() && orderDetailCodeEntity.getBatchNo().equals(codeTempEntity.getBatchNo())) { + orderDetailCodeEntity.setCount(orderDetailCodeEntity.getCount() + codeTempEntity.getCount()); + orderDetailCodeEntity.setReCount(orderDetailCodeEntity.getReCount() + codeTempEntity.getReCount()); + orderDetailCodeService.update(orderDetailCodeEntity); + } else { + orderDetailCodeService.insert(buildEntity(orderEntity, codeTempEntity, udiRelevanceResponse)); + } + }); + } + } + IoOrderDetailCodeEntity buildEntity(IoOrderEntity orderEntity, IoCodeTempEntity codeTempEntity, UdiRelevanceResponse udiRelevanceResponse) { + IoOrderDetailCodeEntity ioOrderDetailCodeEntity = new IoOrderDetailCodeEntity(); + ioOrderDetailCodeEntity.setOrderIdFk(orderEntity.getBillNo()); + ioOrderDetailCodeEntity.setBindRlFk(udiRelevanceResponse.getId()); + ioOrderDetailCodeEntity.setUuidFk(udiRelevanceResponse.getUuid()); + ioOrderDetailCodeEntity.setBatchNo(codeTempEntity.getBatchNo()); + ioOrderDetailCodeEntity.setNameCode(codeTempEntity.getNameCode()); + ioOrderDetailCodeEntity.setProductDate(codeTempEntity.getProduceDate()); + ioOrderDetailCodeEntity.setExpireDate(codeTempEntity.getExpireDate()); + ioOrderDetailCodeEntity.setCoName(udiRelevanceResponse.getCpmctymc()); + ioOrderDetailCodeEntity.setCertCode(udiRelevanceResponse.getZczbhhzbapzbh()); + ioOrderDetailCodeEntity.setYlqxzcrbarmc(udiRelevanceResponse.getYlqxzcrbarmc()); + ioOrderDetailCodeEntity.setManufacturer(udiRelevanceResponse.getManufactory()); + ioOrderDetailCodeEntity.setMeasname(udiRelevanceResponse.getMeasname()); + ioOrderDetailCodeEntity.setSpec(udiRelevanceResponse.getGgxh()); + ioOrderDetailCodeEntity.setPrice(udiRelevanceResponse.getPrice()); + ioOrderDetailCodeEntity.setCount(codeTempEntity.getCount()); + ioOrderDetailCodeEntity.setReCount(codeTempEntity.getReCount()); + return ioOrderDetailCodeEntity; } } diff --git a/src/main/java/com/glxp/api/service/inout/impl/IoOrderDetailBizServiceImpl.java b/src/main/java/com/glxp/api/service/inout/impl/IoOrderDetailBizServiceImpl.java index 89063c03..0180e0ab 100644 --- a/src/main/java/com/glxp/api/service/inout/impl/IoOrderDetailBizServiceImpl.java +++ b/src/main/java/com/glxp/api/service/inout/impl/IoOrderDetailBizServiceImpl.java @@ -1,4 +1,34 @@ package com.glxp.api.service.inout.impl; -public class IoOrderDetailBizServiceImpl { +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.glxp.api.dao.inout.IoOrderDetailBizDao; +import com.glxp.api.entity.inout.IoOrderDetailBizEntity; +import com.glxp.api.service.inout.IoOrderDetailBizService; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.List; + +@Service +public class IoOrderDetailBizServiceImpl implements IoOrderDetailBizService { + + @Resource + IoOrderDetailBizDao ioOrderDetailBizDao; + + @Override + public List findByOrderId(String orderId) { + return ioOrderDetailBizDao.selectList(new QueryWrapper().eq("orderIdFk", orderId)); + } + + @Override + public int insert(IoOrderDetailBizEntity orderDetailBizEntity) { + return ioOrderDetailBizDao.insert(orderDetailBizEntity); + } + + @Override + public int update(IoOrderDetailBizEntity orderDetailBizEntity) { + return ioOrderDetailBizDao.updateById(orderDetailBizEntity); + } + + } diff --git a/src/main/java/com/glxp/api/service/inout/impl/IoOrderDetailCodeServiceImpl.java b/src/main/java/com/glxp/api/service/inout/impl/IoOrderDetailCodeServiceImpl.java index 71e8a5d5..7f20e4c6 100644 --- a/src/main/java/com/glxp/api/service/inout/impl/IoOrderDetailCodeServiceImpl.java +++ b/src/main/java/com/glxp/api/service/inout/impl/IoOrderDetailCodeServiceImpl.java @@ -1,4 +1,33 @@ package com.glxp.api.service.inout.impl; -public class IoOrderDetailCodeServiceImpl { +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.glxp.api.dao.inout.IoOrderDetailCodeDao; +import com.glxp.api.entity.inout.IoOrderDetailCodeEntity; +import com.glxp.api.service.inout.IoOrderDetailCodeService; +import com.glxp.api.service.inout.IoOrderDetailResultService; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.List; + +@Service +public class IoOrderDetailCodeServiceImpl implements IoOrderDetailCodeService { + + @Resource + IoOrderDetailCodeDao ioOrderDetailCodeDao; + + @Override + public List findByOrderId(String orderId) { + return ioOrderDetailCodeDao.selectList(new QueryWrapper().eq("orderIdFk", orderId)); + } + + @Override + public int insert(IoOrderDetailCodeEntity orderDetailCodeEntity) { + return ioOrderDetailCodeDao.insert(orderDetailCodeEntity); + } + + @Override + public int update(IoOrderDetailCodeEntity orderDetailCodeEntity) { + return ioOrderDetailCodeDao.updateById(orderDetailCodeEntity); + } } diff --git a/src/main/java/com/glxp/api/service/inout/impl/IoOrderDetailResultServiceImpl.java b/src/main/java/com/glxp/api/service/inout/impl/IoOrderDetailResultServiceImpl.java index 5d4911e6..09577fbe 100644 --- a/src/main/java/com/glxp/api/service/inout/impl/IoOrderDetailResultServiceImpl.java +++ b/src/main/java/com/glxp/api/service/inout/impl/IoOrderDetailResultServiceImpl.java @@ -1,8 +1,36 @@ package com.glxp.api.service.inout.impl; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.glxp.api.dao.inout.IoOrderDetailBizDao; +import com.glxp.api.dao.inout.IoOrderDetailCodeDao; +import com.glxp.api.dao.inout.IoOrderDetailResultDao; +import com.glxp.api.entity.inout.IoOrderDetailBizEntity; +import com.glxp.api.entity.inout.IoOrderDetailCodeEntity; +import com.glxp.api.entity.inout.IoOrderDetailResultEntity; import com.glxp.api.service.inout.IoOrderDetailResultService; import org.springframework.stereotype.Service; +import javax.annotation.Resource; +import java.util.List; + @Service public class IoOrderDetailResultServiceImpl implements IoOrderDetailResultService { + + @Resource + IoOrderDetailResultDao orderDetailResultDao; + + @Override + public List findByOrderId(String orderId) { + return orderDetailResultDao.selectList(new QueryWrapper().eq("orderIdFk", orderId)); + } + + @Override + public int insert(IoOrderDetailResultEntity orderDetailResultEntity) { + return orderDetailResultDao.insert(orderDetailResultEntity); + } + + @Override + public int update(IoOrderDetailResultEntity orderDetailResultEntity) { + return orderDetailResultDao.updateById(orderDetailResultEntity); + } }