From bd23124565f616f617fb4e65d1ed4903883ebe31 Mon Sep 17 00:00:00 2001 From: anthonywj Date: Sat, 13 May 2023 10:45:33 +0800 Subject: [PATCH] =?UTF-8?q?bug=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../inout/IoCodeTempController.java | 15 + .../inout/IoOrderDetailBizController.java | 3 + .../inout/IoOrderReviewController.java | 9 +- .../sync/SpsSyncDownloadController.java | 1 - .../system/SysParamConfigController.java | 4 + .../api/res/purchase/PurOrderResponse.java | 2 +- .../inout/impl/IoOrderServiceImpl.java | 2 +- .../purchase/impl/PurOrderServiceImpl.java | 3 + .../mapper/purchase/PurOrderDetailDao.xml | 261 +++++++++--------- 9 files changed, 161 insertions(+), 139 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 13a52857..a577f7f6 100644 --- a/src/main/java/com/glxp/api/controller/inout/IoCodeTempController.java +++ b/src/main/java/com/glxp/api/controller/inout/IoCodeTempController.java @@ -1113,8 +1113,23 @@ public class IoCodeTempController extends BaseController { if (codeTempEntity.getMyCount() <= 0) { return ResultVOUtils.error(500, "数量需要大于0"); } + + IoCodeTempEntity tempEntity = codeTempService.selectById(codeTempEntity.getId()); codeTempEntity.setReCount(codeTempEntity.getMyCount() * udiCalCountUtil.getActCount(codeTempEntity.getNameCode())); + int count = tempEntity.getCount() - codeTempEntity.getCount(); + + //更新扫码详情 + IoOrderDetailCodeEntity orderDetailCodeEntity = ioOrderDetailCodeService.findByUnique(codeTempEntity.getOrderId(), codeTempEntity.getRelId(), codeTempEntity.getBatchNo()); + if (orderDetailCodeEntity != null) { + //扫码数量-1 + int orderCount = orderDetailCodeEntity.getCount(); + orderDetailCodeEntity.setCount(orderCount - count); + orderDetailCodeEntity.setReCount(orderDetailCodeEntity.getCount() * udiCalCountUtil.getActCount(codeTempEntity.getNameCode())); + ioOrderDetailCodeService.update(orderDetailCodeEntity); + } int b = codeTempService.updateById(codeTempEntity); + + if (b > 0) return ResultVOUtils.success("修改成功"); else return ResultVOUtils.error(500, "修改失败!"); diff --git a/src/main/java/com/glxp/api/controller/inout/IoOrderDetailBizController.java b/src/main/java/com/glxp/api/controller/inout/IoOrderDetailBizController.java index 47a326cd..521aa2db 100644 --- a/src/main/java/com/glxp/api/controller/inout/IoOrderDetailBizController.java +++ b/src/main/java/com/glxp/api/controller/inout/IoOrderDetailBizController.java @@ -432,6 +432,9 @@ public class IoOrderDetailBizController extends BaseController { purOrderEntity = purOrderService.selectById(purOrderEntity.getId()); List purOrderDetailEntities = purOrderDetailService.findByOrderId(purOrderEntity.getId() + ""); BasicBusTypeChangeEntity basicBusTypeChangeEntity = basicBusTypeChangeService.selectByOriginAction(purOrderEntity.getBillType()); + if (basicBusTypeChangeEntity == null) { + return ResultVOUtils.error(500, "采购订单未配置转换单据类型!"); + } BasicBussinessTypeEntity bussinessTypeEntity = basicBussinessTypeService.findByAction(basicBusTypeChangeEntity.getTargetAction()); AuthAdmin authAdmin = getUser(); diff --git a/src/main/java/com/glxp/api/controller/inout/IoOrderReviewController.java b/src/main/java/com/glxp/api/controller/inout/IoOrderReviewController.java index 4289a2d8..ecf03798 100644 --- a/src/main/java/com/glxp/api/controller/inout/IoOrderReviewController.java +++ b/src/main/java/com/glxp/api/controller/inout/IoOrderReviewController.java @@ -33,10 +33,7 @@ import com.glxp.api.service.basic.IBasicBussinessTypeService; import com.glxp.api.service.inout.*; import com.glxp.api.service.sync.SpsSyncDownloadService; import com.glxp.api.service.system.SystemParamConfigService; -import com.glxp.api.util.CustomUtil; -import com.glxp.api.util.GennerOrderUtils; -import com.glxp.api.util.OrderNoTypeBean; -import com.glxp.api.util.RedisUtil; +import com.glxp.api.util.*; import com.glxp.api.util.udi.UdiCalCountUtil; import lombok.extern.slf4j.Slf4j; import org.springframework.validation.BindingResult; @@ -338,11 +335,11 @@ public class IoOrderReviewController extends BaseController { for (IoCodeEntity checkOrderCodesBean : codesList) { if (checkOrderCodesBean.getCode().toUpperCase(Locale.ROOT).equals(code.toUpperCase(Locale.ROOT))) { if (checkOrderCodesBean.getStatus() == Constant.DB_CHECK_ED - && checkOrderCodesBean.getMyCount() == checkOrderCodesBean.getScanCount()) { + && IntUtil.value(checkOrderCodesBean.getReCount()) == checkOrderCodesBean.getScanCount()) { return Constant.CHECK_REPEAT; } int curCount = checkOrderCodesBean.getScanCount() + calCountUtil.getActCount(checkOrderCodesBean.getNameCode()); - if (curCount == checkOrderCodesBean.getMyCount()) { + if (curCount == IntUtil.value(checkOrderCodesBean.getReCount())) { checkOrderCodesBean.setStatus(Constant.DB_CHECK_ED); } checkOrderCodesBean.setScanCount(curCount); diff --git a/src/main/java/com/glxp/api/controller/sync/SpsSyncDownloadController.java b/src/main/java/com/glxp/api/controller/sync/SpsSyncDownloadController.java index 1482cca8..6409a716 100644 --- a/src/main/java/com/glxp/api/controller/sync/SpsSyncDownloadController.java +++ b/src/main/java/com/glxp/api/controller/sync/SpsSyncDownloadController.java @@ -797,7 +797,6 @@ public class SpsSyncDownloadController { orderEntity.setUpdateTime(null); PurOrderEntity temp = purOrderService.selectByBillNo(orderEntity.getBillNo()); if (temp == null) { - orderEntity.setId(null); purOrderService.insert(orderEntity); if (CollUtil.isNotEmpty(spsSyncBusOrderResponse.getPurOrderDetailEntities())) { List purOrderDetailEntities = spsSyncBusOrderResponse.getPurOrderDetailEntities(); diff --git a/src/main/java/com/glxp/api/controller/system/SysParamConfigController.java b/src/main/java/com/glxp/api/controller/system/SysParamConfigController.java index 660d471a..95a1f10e 100644 --- a/src/main/java/com/glxp/api/controller/system/SysParamConfigController.java +++ b/src/main/java/com/glxp/api/controller/system/SysParamConfigController.java @@ -28,6 +28,7 @@ import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; import javax.validation.Valid; +import java.util.Comparator; import java.util.List; import java.util.stream.Collectors; @@ -189,6 +190,9 @@ public class SysParamConfigController { filterParamConfigRequest.setParamType(2); filterParamConfigRequest.setParamStatus(1); List systemParamConfigEntities = systemParamConfigService.queryPage(filterParamConfigRequest); + systemParamConfigEntities = systemParamConfigEntities.stream().sorted(Comparator.comparing(SystemParamConfigEntity::getParamKey)) + .collect(Collectors.toList()); + ProductRemarkSetEntity productRemarkSetEntity = new ProductRemarkSetEntity(); if (CollUtil.isNotEmpty(systemParamConfigEntities) && systemParamConfigEntities.size() == 8) { diff --git a/src/main/java/com/glxp/api/res/purchase/PurOrderResponse.java b/src/main/java/com/glxp/api/res/purchase/PurOrderResponse.java index a4ff03f5..9f9d5d6a 100644 --- a/src/main/java/com/glxp/api/res/purchase/PurOrderResponse.java +++ b/src/main/java/com/glxp/api/res/purchase/PurOrderResponse.java @@ -11,7 +11,7 @@ public class PurOrderResponse { /** * */ - private Integer id; + private Long id; /** * 单据号 */ diff --git a/src/main/java/com/glxp/api/service/inout/impl/IoOrderServiceImpl.java b/src/main/java/com/glxp/api/service/inout/impl/IoOrderServiceImpl.java index f2470cf4..856f4813 100644 --- a/src/main/java/com/glxp/api/service/inout/impl/IoOrderServiceImpl.java +++ b/src/main/java/com/glxp/api/service/inout/impl/IoOrderServiceImpl.java @@ -285,7 +285,7 @@ public class IoOrderServiceImpl implements IoOrderService { //查询条码 IoOrderEntity orderEntity = findByBillNo(billNo); if (orderEntity.getStatus() == ConstantStatus.ORDER_STATUS_AUDITED - || orderEntity.getStatus() == ConstantStatus.ORDER_STATUS_CHECK_SUCCESS) { + || orderEntity.getStatus() == ConstantStatus.ORDER_STATUS_CHECK_SUCCESS || orderEntity.getStatus() == ConstantStatus.ORDER_STATUS_CHECK_REW) { //更新正式表 IoCodeEntity ioCodeEntity = codeService.findByUnique(billNo, code); if (ioCodeEntity.getMyCount() > 1) { diff --git a/src/main/java/com/glxp/api/service/purchase/impl/PurOrderServiceImpl.java b/src/main/java/com/glxp/api/service/purchase/impl/PurOrderServiceImpl.java index 25f3e2e7..69f0c293 100644 --- a/src/main/java/com/glxp/api/service/purchase/impl/PurOrderServiceImpl.java +++ b/src/main/java/com/glxp/api/service/purchase/impl/PurOrderServiceImpl.java @@ -1,5 +1,6 @@ package com.glxp.api.service.purchase.impl; +import cn.hutool.core.util.IdUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.github.pagehelper.PageHelper; import com.glxp.api.dao.purchase.PurOrderDao; @@ -54,6 +55,8 @@ public class PurOrderServiceImpl implements PurOrderService { @Override public Boolean insert(PurOrderEntity purOrderEntity) { + if (purOrderEntity.getId() == null) + purOrderEntity.setId(IdUtil.getSnowflakeNextId()); return purOrderDao.insert(purOrderEntity) > 0 ? true : false; } diff --git a/src/main/resources/mybatis/mapper/purchase/PurOrderDetailDao.xml b/src/main/resources/mybatis/mapper/purchase/PurOrderDetailDao.xml index 48c97616..1d9052d9 100644 --- a/src/main/resources/mybatis/mapper/purchase/PurOrderDetailDao.xml +++ b/src/main/resources/mybatis/mapper/purchase/PurOrderDetailDao.xml @@ -1,133 +1,134 @@ - - - - - - - - - - - - - - id, orderIdFk, productId, productName, `count`, supId, zczbhhzbapzbh - - - - - - - - - - - - DELETE FROM pur_order_detail WHERE id in - - #{item} - - - - - - - - DELETE - FROM pur_order_detail - WHERE orderIdFk = #{orderIdFk} - - - - UPDATE pur_order_detail - - orderIdFk=#{orderIdFk}, - productId=#{productId}, - productName=#{productName}, - `count`=#{count}, - supId=#{supId}, - zczbhhzbapzbh=#{zczbhhzbapzbh}, - - WHERE id = #{id} - - - - - REPLACE INTO pur_order_detail - ( orderIdFk,productId,productName,count,supId,zczbhhzbapzbh) values - - - ( - #{item.orderIdFk}, - #{item.productId}, - #{item.productName}, - #{item.count}, - #{item.supId}, - #{item.zczbhhzbapzbh} - ) - - - - - - \ No newline at end of file + + + + + + + + + + + + + + id, orderIdFk, productId, productName, `count`, supId, zczbhhzbapzbh + + + + + + + + + + DELETE + FROM pur_order_detail WHERE id in + + #{item} + + + + + + DELETE + FROM pur_order_detail + WHERE orderIdFk = #{orderIdFk} + + + + UPDATE pur_order_detail + + + orderIdFk=#{orderIdFk}, + + + productId=#{productId}, + + + productName=#{productName}, + + + `count`=#{count}, + + + supId=#{supId}, + + + zczbhhzbapzbh=#{zczbhhzbapzbh}, + + + WHERE id = #{id} + + + + + REPLACE INTO pur_order_detail + (orderIdFk, productId, productName, count, supId, zczbhhzbapzbh) values + + + (#{item.orderIdFk}, + #{item.productId}, + #{item.productName}, + #{item.count}, + #{item.supId}, + #{item.zczbhhzbapzbh}) + + + + +