diff --git a/pom.xml b/pom.xml index 1d2924c8..14a460f6 100644 --- a/pom.xml +++ b/pom.xml @@ -362,6 +362,12 @@ minio 3.0.10 + + + org.redisson + redisson + 3.6.0 + diff --git a/src/main/java/com/glxp/api/annotation/CusRedissonAnnotation.java b/src/main/java/com/glxp/api/annotation/CusRedissonAnnotation.java new file mode 100644 index 00000000..e846ab26 --- /dev/null +++ b/src/main/java/com/glxp/api/annotation/CusRedissonAnnotation.java @@ -0,0 +1,32 @@ +package com.glxp.api.annotation; + +import javax.validation.constraints.Min; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import java.lang.annotation.*; + +/** + * redisson分布式锁 + */ +@Documented +@Retention(RetentionPolicy.RUNTIME) +@Target({ElementType.METHOD}) +public @interface CusRedissonAnnotation { + + @NotBlank(message = "redisson使用的缓存名称不能为空") + String cacheName(); + + @NotEmpty(message = "redisson使用的key不能为空") + String[] key(); + + @NotBlank(message = "redisson的超时信息不能为空") + String timeOutMsg(); + + /** + * 等待锁的时间,默认1秒,小于0时默认为0 + * + * @return + */ + @Min(value = 0, message = "等待时间最小值为0") + int waitTime() default 1; +} diff --git a/src/main/java/com/glxp/api/aspect/RedissonAspect.java b/src/main/java/com/glxp/api/aspect/RedissonAspect.java new file mode 100644 index 00000000..d1594125 --- /dev/null +++ b/src/main/java/com/glxp/api/aspect/RedissonAspect.java @@ -0,0 +1,94 @@ +package com.glxp.api.aspect; + + +import cn.hutool.core.util.ArrayUtil; +import cn.hutool.core.util.StrUtil; +import com.glxp.api.annotation.CusRedissonAnnotation; +import com.glxp.api.exception.JsonException; +import org.aspectj.lang.JoinPoint; +import org.aspectj.lang.annotation.After; +import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.annotation.Before; +import org.aspectj.lang.reflect.MethodSignature; +import org.redisson.api.RLock; +import org.redisson.api.RedissonClient; +import org.springframework.core.DefaultParameterNameDiscoverer; +import org.springframework.expression.EvaluationContext; +import org.springframework.expression.Expression; +import org.springframework.expression.ExpressionParser; +import org.springframework.expression.spel.standard.SpelExpressionParser; +import org.springframework.expression.spel.support.StandardEvaluationContext; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.TimeUnit; + +@Aspect +@Component +public class RedissonAspect { + + private final ExpressionParser expressionParser = new SpelExpressionParser(); + + private final DefaultParameterNameDiscoverer nameDiscoverer = new DefaultParameterNameDiscoverer(); + + @Resource + private RedissonClient redissonClient; + + @Before("@annotation(annotation)") + public void before(JoinPoint joinPoint, CusRedissonAnnotation annotation) throws InterruptedException { + if (StrUtil.isBlank(parseKey(joinPoint, annotation))) { + throw new RuntimeException("redisson使用的key不能为空"); + } + if (StrUtil.isBlank(annotation.timeOutMsg())) { + throw new RuntimeException("redisson的超时信息不能为空"); + } + + RLock lock = redissonClient.getLock(parseKey(joinPoint, annotation)); + int waitTime = annotation.waitTime(); + boolean tryLock = lock.tryLock(waitTime, TimeUnit.SECONDS); + if (!tryLock) { + throw new JsonException(500, annotation.timeOutMsg()); + } + + } + + @After("@annotation(cusRedissonAnnotation)") + public void after(JoinPoint joinPoint, CusRedissonAnnotation cusRedissonAnnotation) { + MethodSignature signature = (MethodSignature) joinPoint.getSignature(); + CusRedissonAnnotation annotation = signature.getMethod().getAnnotation(CusRedissonAnnotation.class); + RLock lock = redissonClient.getLock(parseKey(joinPoint, annotation)); + try { + lock.unlock(); + } catch (Exception e) { + e.printStackTrace(); + } + + + } + + private String parseKey(JoinPoint joinPoint, CusRedissonAnnotation annotation) { + + MethodSignature methodSignature = (MethodSignature) joinPoint.getSignature(); + Method method = methodSignature.getMethod(); + String[] paramNames = nameDiscoverer.getParameterNames(method); + List keyValue = new ArrayList<>(annotation.key().length); + for (String s : annotation.key()) { + Expression expression = expressionParser.parseExpression(s); + EvaluationContext context = new StandardEvaluationContext(); + Object[] args = joinPoint.getArgs(); + for (int i = 0; i < args.length; i++) { + context.setVariable(paramNames[i], args[i]); + } + if (s.contains("#")) { + keyValue.add(expression.getValue(context, String.class)); + } else { + keyValue.add(s); + } + } + return String.format("%s:%s", annotation.cacheName(), ArrayUtil.join(keyValue.toArray(), "_")); + } + +} diff --git a/src/main/java/com/glxp/api/config/RedisConfig.java b/src/main/java/com/glxp/api/config/RedisConfig.java index 37801727..27117b3f 100644 --- a/src/main/java/com/glxp/api/config/RedisConfig.java +++ b/src/main/java/com/glxp/api/config/RedisConfig.java @@ -3,6 +3,10 @@ package com.glxp.api.config; import com.fasterxml.jackson.annotation.JsonAutoDetect; import com.fasterxml.jackson.annotation.PropertyAccessor; import com.fasterxml.jackson.databind.ObjectMapper; +import org.redisson.Redisson; +import org.redisson.api.RedissonClient; +import org.redisson.config.Config; +import org.springframework.boot.autoconfigure.data.redis.RedisProperties; import org.springframework.cache.annotation.CachingConfigurerSupport; import org.springframework.cache.annotation.EnableCaching; import org.springframework.context.annotation.Bean; @@ -12,8 +16,11 @@ import org.springframework.data.redis.core.*; import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer; import org.springframework.data.redis.serializer.StringRedisSerializer; +import javax.annotation.Resource; + /** * redis配置类 + * * @program: springbootdemo * @Date: 2019/2/22 15:20 * @Author: zjjlive @@ -23,8 +30,23 @@ import org.springframework.data.redis.serializer.StringRedisSerializer; @EnableCaching //开启注解 public class RedisConfig extends CachingConfigurerSupport { + + @Resource + private RedisProperties redisProperties; + + @Bean + public RedissonClient redisson() { + Config config = new Config(); + config.useSingleServer() + .setAddress(String.format("redis://%s:%s", redisProperties.getHost(), redisProperties.getPort())) + .setPassword(redisProperties.getPassword()) + .setDatabase(redisProperties.getDatabase()); + return Redisson.create(config); + } + /** * retemplate相关配置 + * * @param factory * @return */ diff --git a/src/main/java/com/glxp/api/constant/RedissonCacheKey.java b/src/main/java/com/glxp/api/constant/RedissonCacheKey.java new file mode 100644 index 00000000..0716ba7f --- /dev/null +++ b/src/main/java/com/glxp/api/constant/RedissonCacheKey.java @@ -0,0 +1,41 @@ +package com.glxp.api.constant; + +//redisson缓存key +public interface RedissonCacheKey { + + /** + * 注册审核 + */ + String REGISTER_AUDIT = "register_audit"; + + /** + * web添加单据 + */ + String WEB_ADD_ORDER = "web_add_order"; + + /** + * 升级 + */ + String UPGRADE = "upgrade"; + + /** + * 提交单据 + */ + String SUBMIT_ORDER = "submit_order"; + + /** + * app提交单据 + */ + String APP_SUBMIT_ORDER = "app_submit_order"; + + /** + * 删除临时码表 + */ + String DELETE_CODE_TEMP = "delete_code_temp"; + + + /** + * web添加单据 + */ + String WEB_ADD_CODE = "web_add_code"; +} diff --git a/src/main/java/com/glxp/api/controller/basic/BasicOrderPrintController.java b/src/main/java/com/glxp/api/controller/basic/BasicOrderPrintController.java index c35664c6..5aeffbf5 100644 --- a/src/main/java/com/glxp/api/controller/basic/BasicOrderPrintController.java +++ b/src/main/java/com/glxp/api/controller/basic/BasicOrderPrintController.java @@ -9,25 +9,15 @@ import com.glxp.api.entity.basic.BasicBussinessTypeEntity; import com.glxp.api.entity.basic.UdiProductEntity; import com.glxp.api.entity.inout.IoCodeEntity; import com.glxp.api.entity.inout.IoOrderDetailBizEntity; -import com.glxp.api.entity.inout.IoOrderEntity; -import com.glxp.api.entity.purchase.SupCertEntity; -import com.glxp.api.entity.purchase.SupManufacturerEntity; -import com.glxp.api.entity.purchase.SupProductEntity; import com.glxp.api.entity.system.*; import com.glxp.api.req.basic.FilterOrderPrintRequest; import com.glxp.api.req.inout.FilterOrderRequest; -import com.glxp.api.req.inout.InspectionPDFTemplateRequest; -import com.glxp.api.req.purchase.FilterSupManufacturerRequest; -import com.glxp.api.req.purchase.purPlanPrintRequest; -import com.glxp.api.req.system.FilterPdfTemplateRequest; -import com.glxp.api.res.inout.IoOrderInvoiceResponse; import com.glxp.api.res.inout.IoOrderResponse; -import com.glxp.api.res.system.SystemPDFTemplateRelevanceResponse; import com.glxp.api.service.basic.IBasicBussinessTypeService; import com.glxp.api.service.basic.UdiProductService; -import com.glxp.api.service.inout.IoCodeService; import com.glxp.api.service.inout.IoOrderDetailBizService; import com.glxp.api.service.inout.IoOrderService; +import com.glxp.api.service.inout.impl.IoCodeService; import com.glxp.api.service.system.SystemPDFModuleService; import com.glxp.api.service.system.SystemPDFTemplateRelevanceCodeService; import com.glxp.api.service.system.SystemPDFTemplateRelevanceService; @@ -43,7 +33,6 @@ import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import java.math.BigDecimal; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.HashMap; diff --git a/src/main/java/com/glxp/api/controller/basic/UdiContrastController.java b/src/main/java/com/glxp/api/controller/basic/UdiContrastController.java index 8c6fc97e..0b58b53e 100644 --- a/src/main/java/com/glxp/api/controller/basic/UdiContrastController.java +++ b/src/main/java/com/glxp/api/controller/basic/UdiContrastController.java @@ -28,10 +28,12 @@ import com.glxp.api.res.PageSimpleResponse; import com.glxp.api.res.basic.UdiRelevanceResponse; import com.glxp.api.service.auth.CustomerService; import com.glxp.api.service.basic.*; +import com.glxp.api.service.inout.IoOrderDetailCodeService; import com.glxp.api.service.system.CompanyService; import com.glxp.api.service.thrsys.ThrDataService; import com.glxp.api.service.thrsys.ThrSystemService; import com.glxp.api.util.CustomUtil; +import com.glxp.api.util.IntUtil; import com.glxp.api.util.udi.UdiInfoUtil; import org.springframework.beans.BeanUtils; import org.springframework.transaction.annotation.Transactional; @@ -71,7 +73,8 @@ public class UdiContrastController { CompanyService companyService; @Resource private CompanyProductRelevanceService companyProductRelevanceService; - + @Resource + IoOrderDetailCodeService orderDetailCodeService; /** * 耗材字典添加 @@ -304,6 +307,13 @@ public class UdiContrastController { } } } + + //判断单据是否存在相关对照的产品组合 + Boolean exitUuid = orderDetailCodeService.isExit(udiRelevanceEntity.getId(), udiRelevanceEntity.getUuid()); + if (IntUtil.value(exitUuid)) { + return ResultVOUtils.error(500, "该产品已关联单据,无法解绑!"); + } + ThrSystemEntity thrSystemEntity = thrSystemService.selectMainThrSys(); ThrProductsEntity thrProductsEntity = thrDataService.getProducts(udiRelevanceEntity.getMainId(), thrSystemEntity.getThirdId()); UdiProductEntity UdiInfoRequest = new UdiProductEntity(); diff --git a/src/main/java/com/glxp/api/controller/basic/UdiRelevanceController.java b/src/main/java/com/glxp/api/controller/basic/UdiRelevanceController.java index 5b03efd4..35babe7e 100644 --- a/src/main/java/com/glxp/api/controller/basic/UdiRelevanceController.java +++ b/src/main/java/com/glxp/api/controller/basic/UdiRelevanceController.java @@ -29,7 +29,7 @@ import com.glxp.api.res.basic.BasicProductThirdSysResponse; import com.glxp.api.res.basic.UdiRelevanceResponse; import com.glxp.api.service.auth.CustomerService; import com.glxp.api.service.basic.*; -import com.glxp.api.service.inout.IoCodeService; +import com.glxp.api.service.inout.impl.IoCodeService; import com.glxp.api.service.inv.InvPreProductService; import com.glxp.api.service.inv.InvProductService; import com.glxp.api.service.system.SystemParamConfigService; @@ -275,19 +275,18 @@ public class UdiRelevanceController extends BaseController { String ids = deleteRequest.getId(); UdiRelevanceEntity udiRelevanceEntity = udiRelevanceService.selectById(Long.parseLong(ids)); if (udiRelevanceEntity != null && udiRelevanceEntity.getUuid() != null) { -// if (codeService.isExitByRelId(udiRelevanceEntity.getId() + "")) { -// return ResultVOUtils.error(500, "该产品已关联单据,无法删除!"); -// } -// if (companyProductRelevanceService.isExitByRelId(udiRelevanceEntity.getId() + "")) { -// return ResultVOUtils.error(500, "该产品已被已被供应商选入,无法删除!"); -// } + if (codeService.isExitByRelId(udiRelevanceEntity.getId() + "")) { + return ResultVOUtils.error(500, "该产品已关联单据,无法删除!"); + } + if (companyProductRelevanceService.isExitByRelId(udiRelevanceEntity.getId() + "")) { + return ResultVOUtils.error(500, "该产品已被已被供应商选入,无法删除!"); + } + } + udiRelevanceService.deleteById(ids); + List udiRelevanceEntities = udiRelevanceService.selectByUuid(udiRelevanceEntity.getUuid()); + if (udiRelevanceEntities == null || udiRelevanceEntities.isEmpty()) { + udiProductService.deleteByUuid(udiRelevanceEntity.getUuid()); } - -// udiRelevanceService.deleteById(ids); -// List udiRelevanceEntities = udiRelevanceService.selectByUuid(udiRelevanceEntity.getUuid()); -// if (udiRelevanceEntities == null || udiRelevanceEntities.isEmpty()) { -// udiProductService.deleteByUuid(udiRelevanceEntity.getUuid()); -// } BasicDataRequest basicDataRequest = new BasicDataRequest(); basicDataRequest.setDeleteRequest(deleteRequest); @@ -397,13 +396,13 @@ public class UdiRelevanceController extends BaseController { @PostMapping("/udi/udirel/check/udi") public BaseResponse checkUdi(@RequestBody UdiCombineRequest udiCombineRequest) { - List keys = udiCombineRequest.getKeys(); + List keys = udiCombineRequest.getDevKeys(); if (keys != null && keys.size() > 0) { List datas = udiRelevanceService.batchSelectByUuid(keys); if (datas.isEmpty()) { return ResultVOUtils.success("无被选入!"); } else { - return ResultVOUtils.error(499, "所选产品DI已经被" + "第三方产品ID" + "绑定,您确定继续对照"); + return ResultVOUtils.error(499, "所选产品DI已存在耗材字典,继续对照将会出现不可预估错误,是否继续选入?"); } } return ResultVOUtils.success("未选择产品"); diff --git a/src/main/java/com/glxp/api/controller/inout/IoCodeController.java b/src/main/java/com/glxp/api/controller/inout/IoCodeController.java index ecc17afe..10d999c8 100644 --- a/src/main/java/com/glxp/api/controller/inout/IoCodeController.java +++ b/src/main/java/com/glxp/api/controller/inout/IoCodeController.java @@ -9,7 +9,7 @@ import com.glxp.api.entity.inout.IoCodeEntity; import com.glxp.api.req.inout.FilterCodeRequest; import com.glxp.api.res.PageSimpleResponse; import com.glxp.api.res.inout.IoCodeResponse; -import com.glxp.api.service.inout.IoCodeService; +import com.glxp.api.service.inout.impl.IoCodeService; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; 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 549c9073..9756164c 100644 --- a/src/main/java/com/glxp/api/controller/inout/IoCodeTempController.java +++ b/src/main/java/com/glxp/api/controller/inout/IoCodeTempController.java @@ -6,14 +6,13 @@ import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.StrUtil; import com.github.pagehelper.PageInfo; import com.glxp.api.annotation.AuthRuleAnnotation; +import com.glxp.api.annotation.CusRedissonAnnotation; import com.glxp.api.annotation.Log; import com.glxp.api.common.enums.ResultEnum; import com.glxp.api.common.res.BaseResponse; import com.glxp.api.common.util.ResultVOUtils; -import com.glxp.api.constant.BusinessType; +import com.glxp.api.constant.*; import com.glxp.api.constant.Constant; -import com.glxp.api.constant.ConstantStatus; -import com.glxp.api.constant.ConstantType; import com.glxp.api.controller.BaseController; import com.glxp.api.entity.auth.AuthAdmin; import com.glxp.api.entity.auth.InvWarehouseEntity; @@ -41,7 +40,9 @@ import com.glxp.api.res.inout.IoCodeTempResponse; import com.glxp.api.service.auth.InvWarehouseService; import com.glxp.api.service.basic.*; import com.glxp.api.service.inout.*; +import com.glxp.api.service.inout.impl.IoCodeService; import com.glxp.api.service.inv.*; +import com.glxp.api.service.inv.impl.InvProductDetailService; import com.glxp.api.service.purchase.SupCertService; import com.glxp.api.service.purchase.SupProductService; import com.glxp.api.service.system.SystemParamConfigService; @@ -339,6 +340,7 @@ public class IoCodeTempController extends BaseController { //前端扫码提交 @AuthRuleAnnotation("") @PostMapping("warehouse/inout/addOrderWeb") + @CusRedissonAnnotation(cacheName = RedissonCacheKey.WEB_ADD_CODE, key = {"#addOrderRequest.corpOrderId", "#addOrderRequest.code"}, timeOutMsg = "系统正在处理,请勿重复扫码") @Log(title = "单据管理", businessType = BusinessType.INSERT) public BaseResponse addOrderWeb(@RequestBody AddOrderRequest addOrderRequest, BindingResult bindingResult) { @@ -622,9 +624,11 @@ public class IoCodeTempController extends BaseController { //先生成扫码单据 IoOrderEntity orderEntity = orderService.findByBillNo(orderId); + String inBatch = ""; if (StringUtils.isBlank(orderId) || orderEntity == null) { String orderNo = gennerOrderUtils.createScOrderNo(new OrderNoTypeBean(Constant.SCAN_ORDER + StrUtil.trimToEmpty(bussinessTypeEntity.getPrefix()), "yyyyMMdd")); orderId = orderNo; + inBatch = orderNo.substring((Constant.SCAN_ORDER + StrUtil.trimToEmpty(bussinessTypeEntity.getPrefix())).length()); } List codeEnttitys = codeTempService.findByOrderId(orderId); @@ -808,7 +812,8 @@ public class IoCodeTempController extends BaseController { } } } - + codeEnttity.setPrice(udiRelevanceResponse.getPrice()); + codeEnttity.setInBatchNo(inBatch); //是否边扫边校验 if (addOrderRequest.getOrderType() == ConstantStatus.ORDER_TYPE_NORMAL && bussinessTypeEntity.isCheckEnable()) { String errMsg = ioCheckInoutService.checkCode(codeEnttity); @@ -1013,7 +1018,11 @@ public class IoCodeTempController extends BaseController { } else { int count = invProductDetailService.vailStockCount(codeTempEntity.getRelId(), codeTempEntity.getBatchNo(), codeTempEntity.getSupId(), codeTempEntity.getDeptCode(), codeTempEntity.getInvCode(), null); if (count <= 0) { - return ResultVOUtils.error(500, "当前库存不足,不允许0库存出库"); + + if (count == -1) { + return ResultVOUtils.error(500, "该产品未入库"); + } else + return ResultVOUtils.error(500, "当前库存不足"); } else { //查询此单据已扫描的条码数量 if (codeTempEntity.getMyReCount() > count) { diff --git a/src/main/java/com/glxp/api/controller/inout/IoOrderController.java b/src/main/java/com/glxp/api/controller/inout/IoOrderController.java index 7a059c65..33c79085 100644 --- a/src/main/java/com/glxp/api/controller/inout/IoOrderController.java +++ b/src/main/java/com/glxp/api/controller/inout/IoOrderController.java @@ -7,14 +7,12 @@ import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.github.pagehelper.PageInfo; import com.glxp.api.annotation.AuthRuleAnnotation; +import com.glxp.api.annotation.CusRedissonAnnotation; import com.glxp.api.annotation.Log; import com.glxp.api.common.enums.ResultEnum; import com.glxp.api.common.res.BaseResponse; import com.glxp.api.common.util.ResultVOUtils; -import com.glxp.api.constant.BusinessType; -import com.glxp.api.constant.Constant; -import com.glxp.api.constant.ConstantStatus; -import com.glxp.api.constant.SocketMsgType; +import com.glxp.api.constant.*; import com.glxp.api.controller.BaseController; import com.glxp.api.controller.sync.SpsSyncWebSocket; import com.glxp.api.entity.auth.AuthAdmin; @@ -38,7 +36,9 @@ import com.glxp.api.service.auth.InvWarehouseService; import com.glxp.api.service.basic.EntrustReceService; import com.glxp.api.service.basic.IBasicBussinessTypeService; import com.glxp.api.service.inout.*; +import com.glxp.api.service.inout.impl.IoCodeService; import com.glxp.api.service.inout.impl.IoOrderInvoiceService; +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; @@ -82,7 +82,8 @@ public class IoOrderController extends BaseController { IoCheckInoutService ioCheckInoutService; @Resource IoOrderInvoiceService orderInvoiceService; - + @Resource + private SystemParamConfigService systemParamConfigService; /** * 查询单据列表 @@ -286,6 +287,7 @@ public class IoOrderController extends BaseController { //等待校验-立即提交 @AuthRuleAnnotation("") @PostMapping("warehouse/inout/submitOrderWeb") + @CusRedissonAnnotation(cacheName = RedissonCacheKey.SUBMIT_ORDER, key = {"#addOrderRequest.billNo"}, timeOutMsg = "系统正在处理,请勿重复提交") @Log(title = "单据管理", businessType = BusinessType.UPDATE) public BaseResponse submitOrderWeb(@RequestBody AddOrderRequest addOrderRequest) { @@ -679,10 +681,9 @@ public class IoOrderController extends BaseController { @Log(title = "单据管理", businessType = BusinessType.UPDATE) public BaseResponse updateOrder(@RequestBody IoOrderEntity ioOrderEntity) { ioOrderEntity.setUpdateTime(new Date()); + ioOrderEntity.setUpdateUser(getUserId() + ""); orderService.updateByBillNo(ioOrderEntity); - // webSocketServer.sendMessage(SocketMsgEntity.builder().type(SocketMsgType.TASK_SYNC_DELETE).content(ioOrderEntity.getBillNo()).remark("单据删除").build(), null); - webSocketServer.sendMessage(SocketMsgEntity.builder().type(SocketMsgType.TASK_INVOICE_CONFIRM).content(ioOrderEntity.getBillNo()).remark("发票确认").build(), null); return ResultVOUtils.success(); } diff --git a/src/main/java/com/glxp/api/controller/inout/IoOrderDetailResultController.java b/src/main/java/com/glxp/api/controller/inout/IoOrderDetailResultController.java index 04cb3c4f..eb31e1ff 100644 --- a/src/main/java/com/glxp/api/controller/inout/IoOrderDetailResultController.java +++ b/src/main/java/com/glxp/api/controller/inout/IoOrderDetailResultController.java @@ -29,6 +29,7 @@ import com.glxp.api.res.inout.IoOrderDetailResultResponse; import com.glxp.api.service.auth.AuthCompanyService; import com.glxp.api.service.basic.IBasicBussinessTypeService; import com.glxp.api.service.inout.*; +import com.glxp.api.service.inout.impl.IoCodeService; import com.glxp.api.service.inout.impl.IoOrderInvoiceService; import com.glxp.api.service.system.SystemPDFModuleService; import com.glxp.api.service.system.SystemPDFTemplateService; 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 1e0c8a79..ac7b19cb 100644 --- a/src/main/java/com/glxp/api/controller/inout/IoOrderReviewController.java +++ b/src/main/java/com/glxp/api/controller/inout/IoOrderReviewController.java @@ -31,6 +31,7 @@ import com.glxp.api.service.auth.AuthAdminService; import com.glxp.api.service.basic.EntrustReceService; import com.glxp.api.service.basic.IBasicBussinessTypeService; import com.glxp.api.service.inout.*; +import com.glxp.api.service.inout.impl.IoCodeService; import com.glxp.api.service.sync.SpsSyncDownloadService; import com.glxp.api.service.system.SystemParamConfigService; import com.glxp.api.util.*; diff --git a/src/main/java/com/glxp/api/controller/inv/InvProductController.java b/src/main/java/com/glxp/api/controller/inv/InvProductController.java index d090418d..f6dec2e8 100644 --- a/src/main/java/com/glxp/api/controller/inv/InvProductController.java +++ b/src/main/java/com/glxp/api/controller/inv/InvProductController.java @@ -22,9 +22,8 @@ import com.glxp.api.res.inv.InvProductPageResponse; import com.glxp.api.res.inv.InvProductResponse; import com.glxp.api.service.auth.CustomerService; import com.glxp.api.service.auth.WarehouseUserService; -import com.glxp.api.service.inv.InvProductDetailService; import com.glxp.api.service.inv.InvProductService; -import com.glxp.api.util.DateUtil; +import com.glxp.api.service.inv.impl.InvProductDetailService; import com.glxp.api.util.udi.FilterUdiUtils; import lombok.extern.slf4j.Slf4j; import org.springframework.validation.BindingResult; diff --git a/src/main/java/com/glxp/api/controller/inv/UdiTraceController.java b/src/main/java/com/glxp/api/controller/inv/UdiTraceController.java index 5963f4ea..dfd88528 100644 --- a/src/main/java/com/glxp/api/controller/inv/UdiTraceController.java +++ b/src/main/java/com/glxp/api/controller/inv/UdiTraceController.java @@ -9,7 +9,6 @@ import com.glxp.api.common.util.ResultVOUtils; import com.glxp.api.entity.basic.UdiEntity; import com.glxp.api.entity.basic.UdiProductEntity; import com.glxp.api.entity.inv.InvProductDetailEntity; -import com.glxp.api.req.basic.FilterUdiInfoRequest; import com.glxp.api.req.basic.FilterUdiRelRequest; import com.glxp.api.req.inout.FilterOrderRequest; import com.glxp.api.req.inv.FilterCodeTraceRequest; @@ -21,10 +20,9 @@ import com.glxp.api.res.inv.UdiTraceResponse; import com.glxp.api.service.basic.UdiProductService; import com.glxp.api.service.basic.UdiRelevanceService; import com.glxp.api.service.inout.IoOrderService; -import com.glxp.api.service.inv.InvProductDetailService; +import com.glxp.api.service.inv.impl.InvProductDetailService; import com.glxp.api.util.DateUtil; import com.glxp.api.util.udi.FilterUdiUtils; -import org.springframework.beans.BeanUtils; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; diff --git a/src/main/java/com/glxp/api/controller/sync/SyncDelController.java b/src/main/java/com/glxp/api/controller/sync/SyncDelController.java index 8a329a5b..cbc96479 100644 --- a/src/main/java/com/glxp/api/controller/sync/SyncDelController.java +++ b/src/main/java/com/glxp/api/controller/sync/SyncDelController.java @@ -21,8 +21,8 @@ import com.glxp.api.req.system.DeleteRequest; import com.glxp.api.service.auth.InvBusUserService; import com.glxp.api.service.auth.WarehouseBussinessTypeService; import com.glxp.api.service.basic.*; -import com.glxp.api.service.inout.IoCodeService; import com.glxp.api.service.inout.IoOrderService; +import com.glxp.api.service.inout.impl.IoCodeService; import com.glxp.api.service.inv.DeviceInspectTaskDetailService; import com.glxp.api.service.inv.DeviceInspectTaskService; import com.glxp.api.service.sync.SyncEditLogService; diff --git a/src/main/java/com/glxp/api/entity/inout/IoCodeEntity.java b/src/main/java/com/glxp/api/entity/inout/IoCodeEntity.java index 8bafcc5d..b0f36729 100644 --- a/src/main/java/com/glxp/api/entity/inout/IoCodeEntity.java +++ b/src/main/java/com/glxp/api/entity/inout/IoCodeEntity.java @@ -11,6 +11,7 @@ import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer; import org.springframework.http.codec.json.Jackson2JsonEncoder; import java.io.Serializable; +import java.math.BigDecimal; import java.util.Date; @Data @@ -139,6 +140,16 @@ public class IoCodeEntity implements Serializable { @TableField(value = "createTime") private Date createTime; + @TableField(value = "price") + private BigDecimal price; + + /** + * 入院批号 + */ + @TableField(value = "inBatchNo") + private String inBatchNo; + + @TableField(exist = false) private int status; //条码校验状态//条码校验状态(数据类型请勿修改) @TableField(exist = false) diff --git a/src/main/java/com/glxp/api/entity/inout/IoCodeTempEntity.java b/src/main/java/com/glxp/api/entity/inout/IoCodeTempEntity.java index 4c661f2f..2770128b 100644 --- a/src/main/java/com/glxp/api/entity/inout/IoCodeTempEntity.java +++ b/src/main/java/com/glxp/api/entity/inout/IoCodeTempEntity.java @@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.annotation.TableName; import com.fasterxml.jackson.annotation.JsonIdentityReference; import lombok.Data; +import java.math.BigDecimal; import java.util.Date; @@ -136,6 +137,16 @@ public class IoCodeTempEntity { @TableField(value = "createTime") private Date createTime; + + /** + * 入院批号 + */ + @TableField(value = "inBatchNo") + private String inBatchNo; + + @TableField(value = "price") + private BigDecimal price; + @TableField(exist = false) private int status; //条码校验状态(数据类型请勿修改) @TableField(exist = false) 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 f34c0604..487293d0 100644 --- a/src/main/java/com/glxp/api/entity/inout/IoOrderDetailCodeEntity.java +++ b/src/main/java/com/glxp/api/entity/inout/IoOrderDetailCodeEntity.java @@ -178,6 +178,13 @@ public class IoOrderDetailCodeEntity implements Serializable { @TableField(value = "remark4") private String remark4; + /** + * 入院批号 + */ + + @TableField(exist = false) + private String inBatchNo; + /** * 扩展字段5 */ diff --git a/src/main/java/com/glxp/api/entity/inv/InvPreInProductDetailEntity.java b/src/main/java/com/glxp/api/entity/inv/InvPreInProductDetailEntity.java index e40500e7..d5bfc44b 100644 --- a/src/main/java/com/glxp/api/entity/inv/InvPreInProductDetailEntity.java +++ b/src/main/java/com/glxp/api/entity/inv/InvPreInProductDetailEntity.java @@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; +import java.math.BigDecimal; import java.util.Date; /** @@ -133,6 +134,19 @@ public class InvPreInProductDetailEntity { private Date updateTime; + /** + * 价格 + */ + @TableField(value = "price") + private BigDecimal price; + + /** + * 入院批号 + */ + @TableField(value = "inBatchNo") + private String inBatchNo; + + public static final String COL_ID = "id"; public static final String COL_CODE = "code"; diff --git a/src/main/java/com/glxp/api/entity/inv/InvPreProductDetailEntity.java b/src/main/java/com/glxp/api/entity/inv/InvPreProductDetailEntity.java index bd4b0ae2..f03a6c40 100644 --- a/src/main/java/com/glxp/api/entity/inv/InvPreProductDetailEntity.java +++ b/src/main/java/com/glxp/api/entity/inv/InvPreProductDetailEntity.java @@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; +import java.math.BigDecimal; import java.util.Date; /** @@ -134,6 +135,17 @@ public class InvPreProductDetailEntity { @TableField(value = "updateTime") private Date updateTime; + /** + * 价格 + */ + @TableField(value = "price") + private BigDecimal price; + /** + * 入院批号 + */ + @TableField(value = "inBatchNo") + private String inBatchNo; + public static final String COL_ID = "id"; diff --git a/src/main/java/com/glxp/api/entity/inv/InvPreProductEntity.java b/src/main/java/com/glxp/api/entity/inv/InvPreProductEntity.java index 84d5dcd0..e52218aa 100644 --- a/src/main/java/com/glxp/api/entity/inv/InvPreProductEntity.java +++ b/src/main/java/com/glxp/api/entity/inv/InvPreProductEntity.java @@ -6,11 +6,12 @@ import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; +import java.math.BigDecimal; import java.util.Date; /** - * 寄售库存表 - */ + * 寄售库存表 + */ @Data @TableName(value = "inv_pre_product") public class InvPreProductEntity { @@ -101,6 +102,13 @@ public class InvPreProductEntity { @TableField(value = "updateTime") private Date updateTime; + /** + * 价格 + */ + @TableField(value = "price") + private BigDecimal price; + + public static final String COL_ID = "id"; public static final String COL_RELIDFK = "relIdFk"; diff --git a/src/main/java/com/glxp/api/entity/inv/InvPreinProductEntity.java b/src/main/java/com/glxp/api/entity/inv/InvPreinProductEntity.java index a144bb69..40890408 100644 --- a/src/main/java/com/glxp/api/entity/inv/InvPreinProductEntity.java +++ b/src/main/java/com/glxp/api/entity/inv/InvPreinProductEntity.java @@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; +import java.math.BigDecimal; import java.util.Date; /** @@ -101,6 +102,12 @@ public class InvPreinProductEntity { @TableField(value = "updateTime") private Date updateTime; + /** + * 价格 + */ + @TableField(value = "price") + private BigDecimal price; + public static final String COL_ID = "id"; public static final String COL_RELIDFK = "relIdFk"; diff --git a/src/main/java/com/glxp/api/entity/inv/InvProductDetailEntity.java b/src/main/java/com/glxp/api/entity/inv/InvProductDetailEntity.java index 3ae7b3ce..deeeacc7 100644 --- a/src/main/java/com/glxp/api/entity/inv/InvProductDetailEntity.java +++ b/src/main/java/com/glxp/api/entity/inv/InvProductDetailEntity.java @@ -122,6 +122,16 @@ public class InvProductDetailEntity { private String mainAction; @TableField(value = "action") private String action; + /** + * 价格 + */ + @TableField(value = "price") + private BigDecimal price; + /** + * 入院批号 + */ + @TableField(value = "inBatchNo") + private String inBatchNo; } diff --git a/src/main/java/com/glxp/api/entity/inv/InvProductEntity.java b/src/main/java/com/glxp/api/entity/inv/InvProductEntity.java index 5427cc0b..040d3e15 100644 --- a/src/main/java/com/glxp/api/entity/inv/InvProductEntity.java +++ b/src/main/java/com/glxp/api/entity/inv/InvProductEntity.java @@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; +import java.math.BigDecimal; import java.util.Date; @Data @@ -136,4 +137,10 @@ public class InvProductEntity { @TableField(value = "availableStock") private Integer availableStock; + + /** + * 价格 + */ + @TableField(value = "price") + private BigDecimal price; } diff --git a/src/main/java/com/glxp/api/req/basic/UdiCombineRequest.java b/src/main/java/com/glxp/api/req/basic/UdiCombineRequest.java index c6122240..0fde4980 100644 --- a/src/main/java/com/glxp/api/req/basic/UdiCombineRequest.java +++ b/src/main/java/com/glxp/api/req/basic/UdiCombineRequest.java @@ -10,6 +10,7 @@ import java.util.List; public class UdiCombineRequest { List keys; + List devKeys; private String thirdId; private List thirdIds; private String erpName; diff --git a/src/main/java/com/glxp/api/req/inv/FilterInvProductDetailRequest.java b/src/main/java/com/glxp/api/req/inv/FilterInvProductDetailRequest.java index 160d5cac..5235eefe 100644 --- a/src/main/java/com/glxp/api/req/inv/FilterInvProductDetailRequest.java +++ b/src/main/java/com/glxp/api/req/inv/FilterInvProductDetailRequest.java @@ -3,6 +3,7 @@ package com.glxp.api.req.inv; import com.glxp.api.util.page.ListPageRequest; import lombok.Data; +import java.math.BigDecimal; import java.util.List; /** @@ -87,4 +88,6 @@ public class FilterInvProductDetailRequest extends ListPageRequest { private String expireDate; private String orderBy; + + private BigDecimal price; } diff --git a/src/main/java/com/glxp/api/res/inv/InvProductDetailResponse.java b/src/main/java/com/glxp/api/res/inv/InvProductDetailResponse.java index 92d8e96c..4fe2a4ff 100644 --- a/src/main/java/com/glxp/api/res/inv/InvProductDetailResponse.java +++ b/src/main/java/com/glxp/api/res/inv/InvProductDetailResponse.java @@ -2,6 +2,7 @@ package com.glxp.api.res.inv; import lombok.Data; +import java.math.BigDecimal; import java.util.Date; /** @@ -126,4 +127,6 @@ public class InvProductDetailResponse { * 单据日期 */ private String orderTime; + + private BigDecimal price; } diff --git a/src/main/java/com/glxp/api/res/inv/InvProductResponse.java b/src/main/java/com/glxp/api/res/inv/InvProductResponse.java index 2f4d1b13..da0401d3 100644 --- a/src/main/java/com/glxp/api/res/inv/InvProductResponse.java +++ b/src/main/java/com/glxp/api/res/inv/InvProductResponse.java @@ -2,6 +2,8 @@ package com.glxp.api.res.inv; import lombok.Data; +import java.math.BigDecimal; + /** * 库存数据VO */ @@ -113,4 +115,8 @@ public class InvProductResponse { */ private String spaceName; + + private BigDecimal price; + + } diff --git a/src/main/java/com/glxp/api/service/inout/IoAddInoutService.java b/src/main/java/com/glxp/api/service/inout/IoAddInoutService.java index 8262b9d4..4fd64f82 100644 --- a/src/main/java/com/glxp/api/service/inout/IoAddInoutService.java +++ b/src/main/java/com/glxp/api/service/inout/IoAddInoutService.java @@ -6,7 +6,6 @@ import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; -import com.glxp.api.common.enums.ResultEnum; import com.glxp.api.common.res.BaseResponse; import com.glxp.api.common.util.ResultVOUtils; import com.glxp.api.constant.Constant; @@ -23,7 +22,8 @@ import com.glxp.api.req.inout.PostOrderRequest; import com.glxp.api.req.udims.PostUdimsOrderRequest; import com.glxp.api.res.basic.UdiRelevanceResponse; import com.glxp.api.service.basic.*; -import com.glxp.api.service.inv.InvProductDetailService; +import com.glxp.api.service.inout.impl.IoCodeService; +import com.glxp.api.service.inv.impl.InvProductDetailService; import com.glxp.api.service.system.SystemParamConfigService; import com.glxp.api.util.CustomUtil; import com.glxp.api.util.DateUtil; @@ -31,7 +31,6 @@ import com.glxp.api.util.GennerOrderUtils; import com.glxp.api.util.OrderNoTypeBean; import com.glxp.api.util.udi.FilterUdiUtils; import com.glxp.api.util.udi.UdiCalCountUtil; -import com.glxp.api.util.udi.UdiInfoUtil; import org.springframework.beans.BeanUtils; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; @@ -692,6 +691,15 @@ public class IoAddInoutService { ioOrderDetailCodeEntity.setMeasname(udiRelevanceResponse.getMeasname()); ioOrderDetailCodeEntity.setSpec(udiRelevanceResponse.getGgxh()); ioOrderDetailCodeEntity.setSupId(codeTempEntity.getSupId()); + + if (codeTempEntity.getPrice() == null) { + ioOrderDetailCodeEntity.setPrice(udiRelevanceResponse.getPrice()); + codeTempEntity.setPrice(udiRelevanceResponse.getPrice()); + codeTempService.updateById(codeTempEntity); + } else { + ioOrderDetailCodeEntity.setPrice(codeTempEntity.getPrice()); + } + ioOrderDetailCodeEntity.setPrice(udiRelevanceResponse.getPrice()); ioOrderDetailCodeEntity.setCount(codeTempEntity.getCount()); ioOrderDetailCodeEntity.setReCount(codeTempEntity.getMyReCount()); @@ -745,8 +753,8 @@ public class IoAddInoutService { IoCodeTempEntity codeEnttity = new IoCodeTempEntity(); BeanUtil.copyProperties(msCodeEntities.get(index), codeEnttity); UdiProductEntity uuid = udiProductService.findByNameCode(codeEnttity.getNameCode()); - if (uuid==null){ - throw new JsonException(500,"未找到对应耗材字典"); + if (uuid == null) { + throw new JsonException(500, "未找到对应耗材字典"); } codeEnttity.setAction(orderSaveRequest.getAction()); codeEnttity.setMainAction(orderSaveRequest.getMainAction()); diff --git a/src/main/java/com/glxp/api/service/inout/IoChangeInoutService.java b/src/main/java/com/glxp/api/service/inout/IoChangeInoutService.java index 4976dac1..ef5a7412 100644 --- a/src/main/java/com/glxp/api/service/inout/IoChangeInoutService.java +++ b/src/main/java/com/glxp/api/service/inout/IoChangeInoutService.java @@ -12,13 +12,12 @@ import com.glxp.api.entity.basic.BasicBusTypePreEntity; import com.glxp.api.entity.basic.BasicBussinessTypeEntity; import com.glxp.api.entity.inout.*; import com.glxp.api.entity.inv.InvProductDetailEntity; -import com.glxp.api.entity.system.SystemParamConfigEntity; import com.glxp.api.service.auth.InvWarehouseService; import com.glxp.api.service.basic.IBasicBusTypePreService; import com.glxp.api.service.basic.IBasicBussinessTypeService; +import com.glxp.api.service.inout.impl.IoCodeService; import com.glxp.api.service.inout.impl.IoOrderInvoiceService; -import com.glxp.api.service.inv.InvProductDetailService; -import com.glxp.api.service.inv.InvProductService; +import com.glxp.api.service.inv.impl.InvProductDetailService; import com.glxp.api.service.system.SystemParamConfigService; import com.glxp.api.util.CustomUtil; import com.glxp.api.util.DateUtil; diff --git a/src/main/java/com/glxp/api/service/inout/IoCheckInoutService.java b/src/main/java/com/glxp/api/service/inout/IoCheckInoutService.java index a2bb00fd..565a7066 100644 --- a/src/main/java/com/glxp/api/service/inout/IoCheckInoutService.java +++ b/src/main/java/com/glxp/api/service/inout/IoCheckInoutService.java @@ -22,6 +22,7 @@ import com.glxp.api.res.inout.IoOrderDetailBizResponse; import com.glxp.api.res.inout.IoOrderDetailCodeResponse; import com.glxp.api.service.auth.InvWarehouseService; import com.glxp.api.service.basic.IBasicBussinessTypeService; +import com.glxp.api.service.inout.impl.IoCodeService; import com.glxp.api.service.inout.impl.IoOrderInvoiceService; import com.glxp.api.service.inv.InvPreinDetailService; import com.glxp.api.service.inv.InvPreinOrderService; @@ -283,6 +284,8 @@ public class IoCheckInoutService { if (curCount > bizEntity.getCount()) { return "当前产品数量超出!"; } + if (bizEntity.getPrice() != null) + codeEntity.setPrice(bizEntity.getPrice()); return null; } @@ -307,6 +310,8 @@ public class IoCheckInoutService { if (curCount > bizEntity.getCount()) { return "当前产品数量超出!"; } + if (bizEntity.getPrice() != null) + codeTempEntity.setPrice(bizEntity.getPrice()); return null; } @@ -415,6 +420,7 @@ public class IoCheckInoutService { bizEntity.setCheckSuccess(true); bizEntity.setScanCount(codeEntity.getReCount()); codeEntity.setCheckSuccess(true); + codeEntity.setPrice(bizEntity.getPrice()); } else { bizEntity.setScanCount(codeEntity.getReCount()); bizEntity.setCheckSuccess(false); @@ -485,6 +491,8 @@ public class IoCheckInoutService { BeanUtils.copyProperties(codeTempEntity, codeEnttity); codeService.insert(codeEnttity); } + //更新扫码详情表 + orderDetailCodeDao.updateBatchById(orderDetailCodeEntities); codeTempService.deleteByBillNo(orderEntity.getBillNo()); orderEntity.setErrMsg("校验成功!"); orderEntity.setStatus(ConstantStatus.ORDER_STATUS_CHECK_SUCCESS); diff --git a/src/main/java/com/glxp/api/service/inout/IoCodeService.java b/src/main/java/com/glxp/api/service/inout/IoCodeService.java deleted file mode 100644 index c04f895b..00000000 --- a/src/main/java/com/glxp/api/service/inout/IoCodeService.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.glxp.api.service.inout; - -import com.glxp.api.common.res.BaseResponse; -import com.glxp.api.entity.inout.IoCodeEntity; -import com.glxp.api.req.inout.FilterCodeRequest; -import com.glxp.api.res.inout.IoCodeResponse; - -import java.util.List; - -public interface IoCodeService { - - int insert(IoCodeEntity codeEnttity); - - boolean insertBatch(List codeEnttities); - - List findByOrderId(String billNo); - - int updateById(IoCodeEntity codeEnttity); - - int deleteById(Integer id); - - public IoCodeEntity findByUnique(String orderId, String code); - - List findByOrderIds(List orderIds, String code); - - int findByOrderIdsCount(List orderIds, String code); - - - boolean isExitByRelId(String relId); - - /** - * 查询正式码表实体数据 - * - * @param filterCodeRequest - * @return - */ - List filterCodeList(FilterCodeRequest filterCodeRequest); - - /** - * 查询正式码表VO数据 - */ - List filterList(FilterCodeRequest filterCodeRequest); - - /** - * 根据单号删除正式码表数据 - * - * @param orderId - * @return - */ - BaseResponse deleteCodeByOrderId(String orderId); - - /** - * 查询单据编辑条码列表 - * - * @param filterCodeRequest - * @return - */ - List getCodeListForEdit(FilterCodeRequest filterCodeRequest); -} diff --git a/src/main/java/com/glxp/api/service/inout/IoGenInvService.java b/src/main/java/com/glxp/api/service/inout/IoGenInvService.java index 0403f229..53452034 100644 --- a/src/main/java/com/glxp/api/service/inout/IoGenInvService.java +++ b/src/main/java/com/glxp/api/service/inout/IoGenInvService.java @@ -18,7 +18,9 @@ import com.glxp.api.entity.system.SystemParamConfigEntity; import com.glxp.api.service.auth.InvWarehouseService; import com.glxp.api.service.basic.IBasicBusTypePreService; import com.glxp.api.service.basic.IBasicBussinessTypeService; +import com.glxp.api.service.inout.impl.IoCodeService; import com.glxp.api.service.inv.*; +import com.glxp.api.service.inv.impl.InvProductDetailService; import com.glxp.api.service.system.SystemParamConfigService; import com.glxp.api.util.CustomUtil; import com.glxp.api.util.DateUtil; @@ -74,7 +76,7 @@ public class IoGenInvService { //生成库存产品表 for (IoOrderDetailResultEntity orderDetailResultEntity : orderDetailResultEntities) { - InvProductEntity invProductEntity = invProductService.selectByUnique(orderDetailResultEntity.getBindRlFk(), orderDetailResultEntity.getBatchNo(), orderDetailResultEntity.getSupId(), orderEntity.getDeptCode(), orderEntity.getInvCode()); + InvProductEntity invProductEntity = invProductService.selectByUnique(orderDetailResultEntity.getBindRlFk(), orderDetailResultEntity.getBatchNo(), orderDetailResultEntity.getSupId(), orderEntity.getDeptCode(), orderEntity.getInvCode(), orderDetailResultEntity.getPrice()); if (invProductEntity == null) { invProductEntity = new InvProductEntity(); invProductEntity.setRelIdFk(orderDetailResultEntity.getBindRlFk()); @@ -88,6 +90,7 @@ public class IoGenInvService { invProductEntity.setDeptCode(orderEntity.getDeptCode()); invProductEntity.setInvCode(orderEntity.getInvCode()); invProductEntity.setCreateTime(new Date()); + invProductEntity.setPrice(orderDetailResultEntity.getPrice()); invProductEntity.setUpdateTime(new Date()); invProductService.insert(invProductEntity); } @@ -145,7 +148,7 @@ public class IoGenInvService { //生成库存产品表 for (IoOrderDetailResultEntity orderDetailResultEntity : orderDetailResultEntities) { - InvPreProductEntity invPreProductEntity = invPreProductService.selectByUnique(orderDetailResultEntity.getBindRlFk(), orderDetailResultEntity.getBatchNo(), orderDetailResultEntity.getSupId(), orderEntity.getDeptCode(), orderEntity.getInvCode()); + InvPreProductEntity invPreProductEntity = invPreProductService.selectByUnique(orderDetailResultEntity.getBindRlFk(), orderDetailResultEntity.getBatchNo(), orderDetailResultEntity.getSupId(), orderEntity.getDeptCode(), orderEntity.getInvCode(), orderDetailResultEntity.getPrice()); if (invPreProductEntity == null) { invPreProductEntity = new InvPreProductEntity(); invPreProductEntity.setRelIdFk(orderDetailResultEntity.getBindRlFk()); @@ -157,6 +160,7 @@ public class IoGenInvService { invPreProductEntity.setOutCount(0); invPreProductEntity.setSupId(orderDetailResultEntity.getSupId()); invPreProductEntity.setDeptCode(orderEntity.getDeptCode()); + invPreProductEntity.setPrice(orderDetailResultEntity.getPrice()); invPreProductEntity.setInvCode(orderEntity.getInvCode()); invPreProductEntity.setCreateTime(new Date()); invPreProductEntity.setUpdateTime(new Date()); @@ -227,7 +231,7 @@ public class IoGenInvService { List orderDetailResultEntities = orderDetailResultService.findByOrderId(orderId); //生成库存产品表 for (IoOrderDetailResultEntity orderDetailResultEntity : orderDetailResultEntities) { - InvPreinProductEntity invProductEntity = invPreinProductService.selectByUnique(orderDetailResultEntity.getBindRlFk(), orderDetailResultEntity.getBatchNo(), orderDetailResultEntity.getSupId(), orderEntity.getDeptCode(), orderEntity.getInvCode()); + InvPreinProductEntity invProductEntity = invPreinProductService.selectByUnique(orderDetailResultEntity.getBindRlFk(), orderDetailResultEntity.getBatchNo(), orderDetailResultEntity.getSupId(), orderEntity.getDeptCode(), orderEntity.getInvCode(), orderDetailResultEntity.getPrice()); if (invProductEntity == null) { invProductEntity = new InvPreinProductEntity(); invProductEntity.setRelIdFk(orderDetailResultEntity.getBindRlFk()); @@ -240,6 +244,7 @@ public class IoGenInvService { invProductEntity.setSupId(orderDetailResultEntity.getSupId()); invProductEntity.setDeptCode(orderEntity.getDeptCode()); invProductEntity.setInvCode(orderEntity.getInvCode()); + invProductEntity.setPrice(orderDetailResultEntity.getPrice()); invProductEntity.setCreateTime(new Date()); invProductEntity.setUpdateTime(new Date()); invPreinProductService.insert(invProductEntity); 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 d1294be9..c4d9c2f4 100644 --- a/src/main/java/com/glxp/api/service/inout/IoOrderDetailCodeService.java +++ b/src/main/java/com/glxp/api/service/inout/IoOrderDetailCodeService.java @@ -5,6 +5,7 @@ import com.glxp.api.entity.inout.IoOrderDetailCodeEntity; import com.glxp.api.req.inout.FilterOrderDetailCodeRequest; import com.glxp.api.res.inout.IoOrderDetailCodeResponse; +import java.math.BigDecimal; import java.util.List; public interface IoOrderDetailCodeService { @@ -41,6 +42,10 @@ public interface IoOrderDetailCodeService { boolean isExit(String orderId); + boolean isExit(Long relId, String bacthNo, Long ignoreId, String orderId); + + boolean isExit(Long relId, String uuid); + /** * 扫码明细实体类数据转换VO类 * diff --git a/src/main/java/com/glxp/api/service/inout/impl/IoCodeServiceImpl.java b/src/main/java/com/glxp/api/service/inout/impl/IoCodeService.java similarity index 93% rename from src/main/java/com/glxp/api/service/inout/impl/IoCodeServiceImpl.java rename to src/main/java/com/glxp/api/service/inout/impl/IoCodeService.java index 023b4e6f..49c9cf26 100644 --- a/src/main/java/com/glxp/api/service/inout/impl/IoCodeServiceImpl.java +++ b/src/main/java/com/glxp/api/service/inout/impl/IoCodeService.java @@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.github.pagehelper.PageHelper; import com.glxp.api.common.enums.ResultEnum; import com.glxp.api.common.res.BaseResponse; @@ -16,7 +17,6 @@ import com.glxp.api.entity.inout.IoOrderEntity; import com.glxp.api.req.inout.FilterCodeRequest; import com.glxp.api.res.inout.IoCodeResponse; import com.glxp.api.res.inout.IoCodeTempResponse; -import com.glxp.api.service.inout.IoCodeService; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -27,7 +27,7 @@ import java.util.List; @Service @Transactional(rollbackFor = Exception.class) -public class IoCodeServiceImpl implements IoCodeService { +public class IoCodeService extends ServiceImpl { @Resource private IoCodeDao ioCodeDao; @@ -36,38 +36,38 @@ public class IoCodeServiceImpl implements IoCodeService { @Resource private IoCodeTempDao ioCodeTempDao; - @Override + public int insert(IoCodeEntity codeEnttity) { codeEnttity.setId(null); return ioCodeDao.insert(codeEnttity); } - @Override + public boolean insertBatch(List codeEnttities) { return ioCodeDao.insertBatch(codeEnttities); } - @Override + public List findByOrderId(String billNo) { return ioCodeDao.selectList(new QueryWrapper().eq("orderId", billNo)); } - @Override - public int updateById(IoCodeEntity codeEnttity) { - return ioCodeDao.updateById(codeEnttity); + + public boolean updateById(IoCodeEntity codeEnttity) { + return ioCodeDao.updateById(codeEnttity) > 0; } - @Override + public int deleteById(Integer id) { return ioCodeDao.deleteById(id); } - @Override + public IoCodeEntity findByUnique(String orderId, String code) { return ioCodeDao.selectOne(new QueryWrapper().eq("orderId", orderId).eq("code", code)); } - @Override + public List findByOrderIds(List orderIds, String code) { if (StrUtil.isNotEmpty(code)) @@ -77,7 +77,7 @@ public class IoCodeServiceImpl implements IoCodeService { } } - @Override + public int findByOrderIdsCount(List orderIds, String code) { List codeEntities = findByOrderIds(orderIds, code); if (CollUtil.isNotEmpty(codeEntities)) { @@ -91,13 +91,13 @@ public class IoCodeServiceImpl implements IoCodeService { return 0; } - @Override + public boolean isExitByRelId(String relId) { // return ioCodeDao.selectList(new QueryWrapper().eq("relId", relId).last("limit 1")); return ioCodeDao.exists(new QueryWrapper().eq("relId", relId)); } - @Override + public List filterCodeList(FilterCodeRequest filterCodeRequest) { if (null == filterCodeRequest) { return Collections.emptyList(); @@ -108,7 +108,7 @@ public class IoCodeServiceImpl implements IoCodeService { return ioCodeDao.filterCodeList(filterCodeRequest); } - @Override + public List filterList(FilterCodeRequest filterCodeRequest) { if (null == filterCodeRequest) { return Collections.emptyList(); @@ -119,7 +119,7 @@ public class IoCodeServiceImpl implements IoCodeService { return ioCodeDao.filterList(filterCodeRequest); } - @Override + public BaseResponse deleteCodeByOrderId(String orderId) { if (StrUtil.isBlank(orderId)) { return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, "单据号不能为空"); @@ -128,7 +128,7 @@ public class IoCodeServiceImpl implements IoCodeService { return ResultVOUtils.success("删除成功"); } - @Override + public List getCodeListForEdit(FilterCodeRequest filterCodeRequest) { List ioCodeResponses = new ArrayList<>(); //查询此单的数据 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 79c06635..df0eeff4 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 @@ -49,6 +49,7 @@ public class IoOrderDetailCodeServiceImpl implements IoOrderDetailCodeService { .isNull(StrUtil.isEmpty(bacthNo), "batchNo")); } + @Override public Integer findByRelIdCount(String orderId, Long relId) { return ioOrderDetailCodeDao.findByRelIdCount(orderId, relId); @@ -103,6 +104,19 @@ public class IoOrderDetailCodeServiceImpl implements IoOrderDetailCodeService { return ioOrderDetailCodeDao.exists(new QueryWrapper().eq("orderIdFk", orderId)); } + + @Override + public boolean isExit(Long relId, String bacthNo, Long ignoreId, String orderId) { + return ioOrderDetailCodeDao.exists(new QueryWrapper().eq("bindRlFk", relId).eq(StrUtil.isNotEmpty(bacthNo), "batchNo", bacthNo) + .isNull(StrUtil.isEmpty(bacthNo), "batchNo").eq("orderIdFk", orderId).ne("id", ignoreId)); + } + + @Override + public boolean isExit(Long relId, String uuid) { + return ioOrderDetailCodeDao.exists(new QueryWrapper().eq("bindRlFk", relId).eq("uuidFk", uuid)); + + } + @Override public List getDetailCodeResponse(List orderEntityList) { if (CollUtil.isEmpty(orderEntityList)) { 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 48f66d84..02f697f2 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 @@ -39,6 +39,7 @@ import com.glxp.api.res.inout.OrderNoResult; import com.glxp.api.service.basic.IBasicBussinessTypeService; import com.glxp.api.service.inout.*; import com.glxp.api.service.inv.*; +import com.glxp.api.service.inv.impl.InvProductDetailService; import com.glxp.api.service.system.SyncUploadDataBustypeService; import com.glxp.api.util.DateUtil; import com.glxp.api.util.IntUtil; @@ -209,7 +210,8 @@ public class IoOrderServiceImpl implements IoOrderService { if (CollUtil.isNotEmpty(invProductDetailEntities)) { for (InvPreInProductDetailEntity invProductDetailEntity : invProductDetailEntities) { //更新库存 - InvPreinProductEntity invProductEntity = invPreinProductService.selectByUnique(invProductDetailEntity.getRelId(), invProductDetailEntity.getBatchNo(), invProductDetailEntity.getSupId(), invProductDetailEntity.getDeptCode(), invProductDetailEntity.getInvCode()); + InvPreinProductEntity invProductEntity = invPreinProductService.selectByUnique(invProductDetailEntity.getRelId(), invProductDetailEntity.getBatchNo(), invProductDetailEntity.getSupId(), + invProductDetailEntity.getDeptCode(), invProductDetailEntity.getInvCode(), invProductDetailEntity.getPrice()); if (invProductEntity != null) { if (ConstantType.TYPE_PUT.equals(invProductDetailEntity.getMainAction())) { int count = invProductEntity.getInCount() - invProductDetailEntity.getReCount(); @@ -233,7 +235,8 @@ public class IoOrderServiceImpl implements IoOrderService { if (CollUtil.isNotEmpty(invProductDetailEntities)) { for (InvPreProductDetailEntity invProductDetailEntity : invProductDetailEntities) { //更新库存 - InvPreProductEntity invProductEntity = invPreProductService.selectByUnique(invProductDetailEntity.getRelId(), invProductDetailEntity.getBatchNo(), invProductDetailEntity.getSupId(), invProductDetailEntity.getDeptCode(), invProductDetailEntity.getInvCode()); + InvPreProductEntity invProductEntity = invPreProductService.selectByUnique(invProductDetailEntity.getRelId(), invProductDetailEntity.getBatchNo(), + invProductDetailEntity.getSupId(), invProductDetailEntity.getDeptCode(), invProductDetailEntity.getInvCode(), invProductDetailEntity.getPrice()); if (invProductEntity != null) { if (ConstantType.TYPE_PUT.equals(invProductDetailEntity.getMainAction())) { int count = invProductEntity.getInCount() - invProductDetailEntity.getReCount(); @@ -258,7 +261,7 @@ public class IoOrderServiceImpl implements IoOrderService { if (CollUtil.isNotEmpty(invProductDetailEntities)) { for (InvProductDetailEntity invProductDetailEntity : invProductDetailEntities) { //更新库存 - InvProductEntity invProductEntity = invProductService.selectByUnique(invProductDetailEntity.getRelId(), invProductDetailEntity.getBatchNo(), invProductDetailEntity.getSupId(), invProductDetailEntity.getDeptCode(), invProductDetailEntity.getInvCode()); + InvProductEntity invProductEntity = invProductService.selectByUnique(invProductDetailEntity.getRelId(), invProductDetailEntity.getBatchNo(), invProductDetailEntity.getSupId(), invProductDetailEntity.getDeptCode(), invProductDetailEntity.getInvCode(), invProductDetailEntity.getPrice()); if (invProductEntity != null) { if (ConstantType.TYPE_PUT.equals(invProductDetailEntity.getMainAction())) { int count = invProductEntity.getInCount() - invProductDetailEntity.getReCount(); @@ -333,7 +336,7 @@ public class IoOrderServiceImpl implements IoOrderService { //预验收库存 if (basicBussinessTypeEntity.getActionType() == ConstantStatus.ACTION_TYPE_PREIN) { - InvPreInProductDetailEntity invProductDetailEntity = invPreinProductDetailService.selectByCode(billNo, code); + InvPreInProductDetailEntity invProductDetailEntity = invPreinProductDetailService.selectByCode(billNo, code, ioCodeEntity.getPrice()); int count = invProductDetailEntity.getCount() - 1; if (count == 0) { invPreinProductDetailService.deleteById(invProductDetailEntity.getId() + ""); @@ -345,7 +348,7 @@ public class IoOrderServiceImpl implements IoOrderService { invPreinProductDetailService.update(invProductDetailEntity); } //更新产品表 - InvPreinProductEntity invProductEntity = invPreinProductService.selectByUnique(invProductDetailEntity.getRelId(), invProductDetailEntity.getBatchNo(), invProductDetailEntity.getSupId(), invProductDetailEntity.getDeptCode(), invProductDetailEntity.getInvCode()); + InvPreinProductEntity invProductEntity = invPreinProductService.selectByUnique(invProductDetailEntity.getRelId(), invProductDetailEntity.getBatchNo(), invProductDetailEntity.getSupId(), invProductDetailEntity.getDeptCode(), invProductDetailEntity.getInvCode(), invProductDetailEntity.getPrice()); if (invProductEntity != null) { if (ConstantType.TYPE_PUT.equals(invProductDetailEntity.getMainAction())) { int inCount = invProductEntity.getInCount() - invProductDetailEntity.getReCount(); @@ -371,7 +374,7 @@ public class IoOrderServiceImpl implements IoOrderService { invPreProductDetailService.update(invProductDetailEntity); } //更新产品表 - InvPreProductEntity invProductEntity = invPreProductService.selectByUnique(invProductDetailEntity.getRelId(), invProductDetailEntity.getBatchNo(), invProductDetailEntity.getSupId(), invProductDetailEntity.getDeptCode(), invProductDetailEntity.getInvCode()); + InvPreProductEntity invProductEntity = invPreProductService.selectByUnique(invProductDetailEntity.getRelId(), invProductDetailEntity.getBatchNo(), invProductDetailEntity.getSupId(), invProductDetailEntity.getDeptCode(), invProductDetailEntity.getInvCode(), invProductDetailEntity.getPrice()); if (invProductEntity != null) { if (ConstantType.TYPE_PUT.equals(invProductDetailEntity.getMainAction())) { int inCount = invProductEntity.getInCount() - invProductDetailEntity.getReCount(); @@ -451,7 +454,7 @@ public class IoOrderServiceImpl implements IoOrderService { if (CollUtil.isNotEmpty(invProductDetailEntities)) { for (InvPreInProductDetailEntity invProductDetailEntity : invProductDetailEntities) { InvPreinProductEntity invProductEntity = invPreinProductService.selectByUnique(invProductDetailEntity.getRelId(), invProductDetailEntity.getBatchNo(), invProductDetailEntity.getSupId(), - invProductDetailEntity.getDeptCode(), invProductDetailEntity.getInvCode()); + invProductDetailEntity.getDeptCode(), invProductDetailEntity.getInvCode(), invProductDetailEntity.getPrice()); if (ConstantType.TYPE_PUT.equals(invProductDetailEntity.getMainAction())) { int count = invProductEntity.getInCount() - invProductDetailEntity.getReCount(); @@ -470,7 +473,7 @@ public class IoOrderServiceImpl implements IoOrderService { if (CollUtil.isNotEmpty(invProductDetailEntities)) { for (InvPreProductDetailEntity invProductDetailEntity : invProductDetailEntities) { InvPreProductEntity invProductEntity = invPreProductService.selectByUnique(invProductDetailEntity.getRelId(), invProductDetailEntity.getBatchNo(), invProductDetailEntity.getSupId(), - invProductDetailEntity.getDeptCode(), invProductDetailEntity.getInvCode()); + invProductDetailEntity.getDeptCode(), invProductDetailEntity.getInvCode(), invProductDetailEntity.getPrice()); if (ConstantType.TYPE_PUT.equals(invProductDetailEntity.getMainAction())) { int count = invProductEntity.getInCount() - invProductDetailEntity.getReCount(); diff --git a/src/main/java/com/glxp/api/service/inv/InvPreProductDetailService.java b/src/main/java/com/glxp/api/service/inv/InvPreProductDetailService.java index 258f161e..90a63624 100644 --- a/src/main/java/com/glxp/api/service/inv/InvPreProductDetailService.java +++ b/src/main/java/com/glxp/api/service/inv/InvPreProductDetailService.java @@ -7,6 +7,7 @@ import com.glxp.api.req.inv.FilterInvPreProductDetailRequest; import com.glxp.api.req.inv.FilterInvProductDetailRequest; import com.glxp.api.res.inv.InvPreProductDetailResponse; +import java.math.BigDecimal; import java.util.List; /** @@ -20,6 +21,8 @@ public interface InvPreProductDetailService { List selectByOrderIdFk(String billNo); + InvPreProductDetailEntity selectByCode(String billNo, String code, BigDecimal price); + InvPreProductDetailEntity selectByCode(String billNo, String code); boolean update(InvPreProductDetailEntity invPreProductDetailEntity); diff --git a/src/main/java/com/glxp/api/service/inv/InvPreProductService.java b/src/main/java/com/glxp/api/service/inv/InvPreProductService.java index 8db3bcdc..645a4ace 100644 --- a/src/main/java/com/glxp/api/service/inv/InvPreProductService.java +++ b/src/main/java/com/glxp/api/service/inv/InvPreProductService.java @@ -6,6 +6,7 @@ import com.glxp.api.entity.inv.InvProductEntity; import com.glxp.api.req.inv.FilterInvPreProductRequest; import com.glxp.api.res.inv.InvPreProductResponse; +import java.math.BigDecimal; import java.util.List; /** @@ -18,7 +19,7 @@ public interface InvPreProductService { boolean update(InvPreProductEntity invPreProductEntity); - InvPreProductEntity selectByUnique(Long relId, String batchNo, String supId, String deptCode, String invCode); + InvPreProductEntity selectByUnique(Long relId, String batchNo, String supId, String deptCode, String invCode, BigDecimal price); boolean deleteById(Integer id); diff --git a/src/main/java/com/glxp/api/service/inv/InvPreinProductDetailService.java b/src/main/java/com/glxp/api/service/inv/InvPreinProductDetailService.java index ecf3dc25..4187ad99 100644 --- a/src/main/java/com/glxp/api/service/inv/InvPreinProductDetailService.java +++ b/src/main/java/com/glxp/api/service/inv/InvPreinProductDetailService.java @@ -7,6 +7,7 @@ import com.glxp.api.req.inv.FilterInvPreProductDetailRequest; import com.glxp.api.req.inv.FilterInvProductDetailRequest; import com.glxp.api.res.inv.InvPreProductDetailResponse; +import java.math.BigDecimal; import java.util.List; /** @@ -22,7 +23,7 @@ public interface InvPreinProductDetailService { List findByCode(String code); - InvPreInProductDetailEntity selectByCode(String billNo, String code); + InvPreInProductDetailEntity selectByCode(String billNo, String code, BigDecimal price); boolean update(InvPreInProductDetailEntity invPreInProductDetailEntity); @@ -55,4 +56,6 @@ public interface InvPreinProductDetailService { int findCountByCode(String code); InvPreInProductDetailEntity findUseOneByCode(String code); + + } diff --git a/src/main/java/com/glxp/api/service/inv/InvPreinProductService.java b/src/main/java/com/glxp/api/service/inv/InvPreinProductService.java index 70d71cc5..b65ace80 100644 --- a/src/main/java/com/glxp/api/service/inv/InvPreinProductService.java +++ b/src/main/java/com/glxp/api/service/inv/InvPreinProductService.java @@ -5,6 +5,7 @@ import com.glxp.api.req.inv.FilterInvPreinDetailRequest; import com.glxp.api.req.inv.FilterInvPreinProductRequest; import com.glxp.api.res.inv.InvPreinProductResponse; +import java.math.BigDecimal; import java.util.List; /** @@ -17,7 +18,7 @@ public interface InvPreinProductService { boolean update(InvPreinProductEntity invPreinProductEntity); - InvPreinProductEntity selectByUnique(Long relId, String batchNo, String supId, String deptCode, String invCode); + InvPreinProductEntity selectByUnique(Long relId, String batchNo, String supId, String deptCode, String invCode, BigDecimal price); boolean deleteById(Integer id); diff --git a/src/main/java/com/glxp/api/service/inv/InvProductDetailService.java b/src/main/java/com/glxp/api/service/inv/InvProductDetailService.java deleted file mode 100644 index da1b00c4..00000000 --- a/src/main/java/com/glxp/api/service/inv/InvProductDetailService.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.glxp.api.service.inv; - -import com.glxp.api.entity.inv.InvPreinDetailEntity; -import com.glxp.api.entity.inv.InvProductDetailEntity; -import com.glxp.api.req.inv.FilterInvProductDetailRequest; -import com.glxp.api.res.inv.InvProductDetailResponse; - -import java.util.List; - -public interface InvProductDetailService { - - int insert(InvProductDetailEntity invProductDetailEntity); - - - List selectByOrderIdFk(String billNo); - - - InvProductDetailEntity selectByCode(String billNo, String code); - - int deleteByOrderId(String billNo); - - int deleteById(Integer id); - - int update(InvProductDetailEntity invProductDetailEntity); - - List selectByUnique(Long relId, String batchNo, String supId, String deptCode, String invCode); - - InvProductDetailEntity sortFindByCode(String code); - - boolean insertList(List invProductDetailEntities); - - /** - * 查询库存详情列表 - * - * @param filterInvProductDetailRequest - * @return - */ - List filterInvProductDetailList(FilterInvProductDetailRequest filterInvProductDetailRequest); - - boolean deleteInvProductDetail(FilterInvProductDetailRequest detailRequest); - - /** - * 库存详情封装单据相关信息 - * - * @param response - */ - void setOrderInfo(InvProductDetailResponse response); - - - int vailStockCount(Long relId, String batchNo, String supId, String deptCode, String invCode, String invSpaceCode); - - -} diff --git a/src/main/java/com/glxp/api/service/inv/InvProductService.java b/src/main/java/com/glxp/api/service/inv/InvProductService.java index 7c137d80..428aae1d 100644 --- a/src/main/java/com/glxp/api/service/inv/InvProductService.java +++ b/src/main/java/com/glxp/api/service/inv/InvProductService.java @@ -4,6 +4,7 @@ import com.glxp.api.entity.inv.InvProductEntity; import com.glxp.api.req.inv.FilterInvProductRequest; import com.glxp.api.res.inv.InvProductResponse; +import java.math.BigDecimal; import java.util.List; public interface InvProductService { @@ -15,6 +16,9 @@ public interface InvProductService { boolean updateBatch(List invProductEntities); + InvProductEntity selectByUnique(Long relId, String batchNo, String supId, String deptCode, String invCode, BigDecimal price); + + InvProductEntity selectByUnique(Long relId, String batchNo, String supId, String deptCode, String invCode); /** diff --git a/src/main/java/com/glxp/api/service/inv/impl/InvPreInProductDetailServiceImpl.java b/src/main/java/com/glxp/api/service/inv/impl/InvPreInProductDetailServiceImpl.java index c24e0462..7692761c 100644 --- a/src/main/java/com/glxp/api/service/inv/impl/InvPreInProductDetailServiceImpl.java +++ b/src/main/java/com/glxp/api/service/inv/impl/InvPreInProductDetailServiceImpl.java @@ -27,6 +27,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; +import java.math.BigDecimal; import java.util.Collections; import java.util.List; @@ -74,9 +75,9 @@ public class InvPreInProductDetailServiceImpl implements InvPreinProductDetailSe } @Override - public InvPreInProductDetailEntity selectByCode(String billNo, String code) { + public InvPreInProductDetailEntity selectByCode(String billNo, String code, BigDecimal price) { List invProductDetailEntities = invPreInProductDetailDao.selectList - (new QueryWrapper().eq("code", code).eq("orderId", billNo)); + (new QueryWrapper().eq("code", code).eq("orderId", billNo).eq(price != null, "price", price)); if (CollUtil.isNotEmpty(invProductDetailEntities)) return invProductDetailEntities.get(0); else @@ -143,7 +144,7 @@ public class InvPreInProductDetailServiceImpl implements InvPreinProductDetailSe response.setActionName(busType.getName()); //设置单据日期 IoOrderEntity order = orderDao.selectOne(new QueryWrapper().select("createTime").eq("billNo", response.getOrderId())); - if (order!=null){ + if (order != null) { response.setOrderTime(DateUtil.toDateStr(order.getCreateTime(), "yyyy-MM-dd HH:mm:ss")); } diff --git a/src/main/java/com/glxp/api/service/inv/impl/InvPreProductDetailServiceImpl.java b/src/main/java/com/glxp/api/service/inv/impl/InvPreProductDetailServiceImpl.java index 3c949421..d6a4ba01 100644 --- a/src/main/java/com/glxp/api/service/inv/impl/InvPreProductDetailServiceImpl.java +++ b/src/main/java/com/glxp/api/service/inv/impl/InvPreProductDetailServiceImpl.java @@ -26,6 +26,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; +import java.math.BigDecimal; import java.util.Collections; import java.util.List; @@ -66,6 +67,16 @@ public class InvPreProductDetailServiceImpl implements InvPreProductDetailServic return invProductDetailEntities; } + @Override + public InvPreProductDetailEntity selectByCode(String billNo, String code, BigDecimal price) { + List invProductDetailEntities = invPreProductDetailDao.selectList + (new QueryWrapper().eq("code", code).eq("orderId", billNo).eq(price != null, "price", price)); + if (CollUtil.isNotEmpty(invProductDetailEntities)) + return invProductDetailEntities.get(0); + else + return null; + } + @Override public InvPreProductDetailEntity selectByCode(String billNo, String code) { List invProductDetailEntities = invPreProductDetailDao.selectList diff --git a/src/main/java/com/glxp/api/service/inv/impl/InvPreProductServiceImpl.java b/src/main/java/com/glxp/api/service/inv/impl/InvPreProductServiceImpl.java index b4f6a5d9..2195504a 100644 --- a/src/main/java/com/glxp/api/service/inv/impl/InvPreProductServiceImpl.java +++ b/src/main/java/com/glxp/api/service/inv/impl/InvPreProductServiceImpl.java @@ -14,6 +14,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; +import java.math.BigDecimal; import java.util.Collections; import java.util.List; @@ -36,9 +37,10 @@ public class InvPreProductServiceImpl implements InvPreProductService { } @Override - public InvPreProductEntity selectByUnique(Long relId, String batchNo, String supId, String deptCode, String invCode) { + public InvPreProductEntity selectByUnique(Long relId, String batchNo, String supId, String deptCode, String invCode, BigDecimal price) { return invPreProductDao.selectOne(new QueryWrapper().eq("relIdFk", relId).eq(StrUtil.isNotEmpty(batchNo), "batchNo", batchNo) - .isNull(StrUtil.isEmpty(batchNo), "batchNo").eq("supId", supId).eq("deptCode", deptCode).eq("invCode", invCode)); + .isNull(StrUtil.isEmpty(batchNo), "batchNo").eq("supId", supId).eq("deptCode", deptCode).eq("invCode", invCode) + .eq(price != null, "price", price).isNull(price == null, "price")); } diff --git a/src/main/java/com/glxp/api/service/inv/impl/InvPreinProductServiceImpl.java b/src/main/java/com/glxp/api/service/inv/impl/InvPreinProductServiceImpl.java index fa195182..8d94b456 100644 --- a/src/main/java/com/glxp/api/service/inv/impl/InvPreinProductServiceImpl.java +++ b/src/main/java/com/glxp/api/service/inv/impl/InvPreinProductServiceImpl.java @@ -13,6 +13,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; +import java.math.BigDecimal; import java.util.Collections; import java.util.List; @@ -35,9 +36,10 @@ public class InvPreinProductServiceImpl implements InvPreinProductService { } @Override - public InvPreinProductEntity selectByUnique(Long relId, String batchNo, String supId, String deptCode, String invCode) { + public InvPreinProductEntity selectByUnique(Long relId, String batchNo, String supId, String deptCode, String invCode, BigDecimal price) { return invPreinProductDao.selectOne(new QueryWrapper().eq("relIdFk", relId).eq(StrUtil.isNotEmpty(batchNo), "batchNo", batchNo) - .isNull(StrUtil.isEmpty(batchNo), "batchNo").eq("supId", supId).eq("deptCode", deptCode).eq("invCode", invCode)); + .isNull(StrUtil.isEmpty(batchNo), "batchNo").eq("supId", supId).eq("deptCode", deptCode).eq("invCode", invCode) + .eq(price != null, "price", price).isNull(price == null, "price")); } diff --git a/src/main/java/com/glxp/api/service/inv/impl/InvProductDetailServiceImpl.java b/src/main/java/com/glxp/api/service/inv/impl/InvProductDetailService.java similarity index 95% rename from src/main/java/com/glxp/api/service/inv/impl/InvProductDetailServiceImpl.java rename to src/main/java/com/glxp/api/service/inv/impl/InvProductDetailService.java index 96f13c11..f3398e98 100644 --- a/src/main/java/com/glxp/api/service/inv/impl/InvProductDetailServiceImpl.java +++ b/src/main/java/com/glxp/api/service/inv/impl/InvProductDetailService.java @@ -3,6 +3,7 @@ package com.glxp.api.service.inv.impl; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.github.pagehelper.PageHelper; import com.glxp.api.constant.ConstantType; import com.glxp.api.dao.basic.BasicBussinessTypeDao; @@ -14,7 +15,6 @@ import com.glxp.api.entity.inout.IoOrderEntity; import com.glxp.api.entity.inv.InvProductDetailEntity; import com.glxp.api.req.inv.FilterInvProductDetailRequest; import com.glxp.api.res.inv.InvProductDetailResponse; -import com.glxp.api.service.inv.InvProductDetailService; import com.glxp.api.util.DateUtil; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -25,7 +25,7 @@ import java.util.List; @Service @Transactional(rollbackFor = Exception.class) -public class InvProductDetailServiceImpl implements InvProductDetailService { +public class InvProductDetailService extends ServiceImpl { @Resource private InvProductDetailDao invProductDetailDao; @@ -37,7 +37,6 @@ public class InvProductDetailServiceImpl implements InvProductDetailService { private UdiProductDao udiProductDao; - @Override public int insert(InvProductDetailEntity invProductDetailEntity) { invProductDetailEntity.setId(null); if (invProductDetailEntity.getMainAction().equals(ConstantType.TYPE_PUT)) { @@ -48,7 +47,7 @@ public class InvProductDetailServiceImpl implements InvProductDetailService { return invProductDetailDao.insert(invProductDetailEntity); } - @Override + public List selectByOrderIdFk(String billNo) { if (StrUtil.isEmpty(billNo)) return null; @@ -56,7 +55,7 @@ public class InvProductDetailServiceImpl implements InvProductDetailService { return invProductDetailEntities; } - @Override + public InvProductDetailEntity selectByCode(String billNo, String code) { List invProductDetailEntities = invProductDetailDao.selectList (new QueryWrapper().eq("code", code).eq("orderId", billNo)); @@ -66,17 +65,17 @@ public class InvProductDetailServiceImpl implements InvProductDetailService { return null; } - @Override + public int deleteByOrderId(String billNo) { return invProductDetailDao.delete(new QueryWrapper().eq("orderId", billNo)); } - @Override + public int deleteById(Integer id) { return invProductDetailDao.deleteById(id); } - @Override + public int update(InvProductDetailEntity invProductDetailEntity) { if (invProductDetailEntity.getMainAction().equals(ConstantType.TYPE_PUT)) { invProductDetailEntity.setInCount(invProductDetailEntity.getReCount()); @@ -87,13 +86,13 @@ public class InvProductDetailServiceImpl implements InvProductDetailService { return invProductDetailDao.updateById(invProductDetailEntity); } - @Override + public List selectByUnique(Long relId, String batchNo, String supId, String deptCode, String invCode) { return invProductDetailDao.selectList(new QueryWrapper().eq("relId", relId).eq(StrUtil.isNotEmpty(batchNo), "batchNo", batchNo) .isNull(StrUtil.isEmpty(batchNo), "batchNo").eq("supId", supId).eq("deptCode", deptCode).eq("invCode", invCode)); } - @Override + public InvProductDetailEntity sortFindByCode(String code) { List invProductDetailEntities = invProductDetailDao.selectList(new QueryWrapper().eq("code", code).orderByDesc("id")); if (CollUtil.isNotEmpty(invProductDetailEntities)) @@ -102,12 +101,12 @@ public class InvProductDetailServiceImpl implements InvProductDetailService { return null; } - @Override + public boolean insertList(List invProductDetailEntities) { return invProductDetailDao.insertBatch(invProductDetailEntities); } - @Override + public List filterInvProductDetailList(FilterInvProductDetailRequest filterInvProductDetailRequest) { if (null == filterInvProductDetailRequest) { return Collections.emptyList(); @@ -118,12 +117,12 @@ public class InvProductDetailServiceImpl implements InvProductDetailService { return invProductDetailDao.filterInvProductDetailList(filterInvProductDetailRequest); } - @Override + public boolean deleteInvProductDetail(FilterInvProductDetailRequest detailRequest) { return invProductDetailDao.deleteInvProductDetail(detailRequest); } - @Override + public void setOrderInfo(InvProductDetailResponse response) { //查询DI层级,根据DI层级设置数量取值 Integer packLevel = udiProductDao.selectPackLevel(response.getNameCode()); @@ -150,15 +149,14 @@ public class InvProductDetailServiceImpl implements InvProductDetailService { //设置单据类型名称 BasicBussinessTypeEntity busType = bussinessTypeDao.selectOne(new QueryWrapper().select("name").eq("action", response.getAction())); - if(busType!=null) - response.setActionName(busType.getName()); + if (busType != null) + response.setActionName(busType.getName()); //设置单据日期 IoOrderEntity order = orderDao.selectOne(new QueryWrapper().select("createTime").eq("billNo", response.getOrderId())); response.setOrderTime(DateUtil.toDateStr(order.getCreateTime(), "yyyy-MM-dd HH:mm:ss")); } - @Override public int vailStockCount(Long relId, String batchNo, String supId, String deptCode, String invCode, String invSpaceCode) { if (relId == null) { return 0; diff --git a/src/main/java/com/glxp/api/service/inv/impl/InvProductServiceImpl.java b/src/main/java/com/glxp/api/service/inv/impl/InvProductServiceImpl.java index 87da4e0a..2c8386ac 100644 --- a/src/main/java/com/glxp/api/service/inv/impl/InvProductServiceImpl.java +++ b/src/main/java/com/glxp/api/service/inv/impl/InvProductServiceImpl.java @@ -12,6 +12,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; +import java.math.BigDecimal; import java.util.Collections; import java.util.List; @@ -38,6 +39,17 @@ public class InvProductServiceImpl implements InvProductService { return invProductDao.updateBatchById(invProductEntities); } + @Override + public InvProductEntity selectByUnique(Long relId, String batchNo, String supId, String deptCode, String invCode, BigDecimal price) { + return invProductDao.selectOne(new QueryWrapper().eq("relIdFk", relId) + .eq(StrUtil.isNotEmpty(batchNo), "batchNo", batchNo).isNull(StrUtil.isEmpty(batchNo), "batchNo") + .eq("supId", supId) + .eq("deptCode", deptCode) + .eq("invCode", invCode) + .eq(price != null, "price", price).isNull(price == null, "price") + ); + } + @Override public InvProductEntity selectByUnique(Long relId, String batchNo, String supId, String deptCode, String invCode) { return invProductDao.selectOne(new QueryWrapper().eq("relIdFk", relId).eq(StrUtil.isNotEmpty(batchNo), "batchNo", batchNo) diff --git a/src/main/java/com/glxp/api/service/sync/SpsSyncDownloadService.java b/src/main/java/com/glxp/api/service/sync/SpsSyncDownloadService.java index 9cf9da1e..c91c2f0f 100644 --- a/src/main/java/com/glxp/api/service/sync/SpsSyncDownloadService.java +++ b/src/main/java/com/glxp/api/service/sync/SpsSyncDownloadService.java @@ -33,6 +33,7 @@ import com.glxp.api.res.sync.SpsSyncOrderResponse; import com.glxp.api.res.system.SyncDataSetResponse; import com.glxp.api.service.basic.*; import com.glxp.api.service.inout.*; +import com.glxp.api.service.inout.impl.IoCodeService; import com.glxp.api.service.inout.impl.IoOrderInvoiceService; import com.glxp.api.service.inv.DeviceInspectTaskDetailService; import com.glxp.api.service.inv.DeviceInspectTaskService; diff --git a/src/main/resources/mybatis/mapper/basic/UdiRelevanceDao.xml b/src/main/resources/mybatis/mapper/basic/UdiRelevanceDao.xml index b7ae2b3f..fdb9a8a9 100644 --- a/src/main/resources/mybatis/mapper/basic/UdiRelevanceDao.xml +++ b/src/main/resources/mybatis/mapper/basic/UdiRelevanceDao.xml @@ -1142,7 +1142,7 @@ diff --git a/src/main/resources/schemas/schema_v2.3.sql b/src/main/resources/schemas/schema_v2.3.sql index 64970840..2f6f98c1 100644 --- a/src/main/resources/schemas/schema_v2.3.sql +++ b/src/main/resources/schemas/schema_v2.3.sql @@ -601,3 +601,23 @@ INSERT ignore INTO `auth_menu`(`menu_id`, `menu_name`, `parent_id`, `order_num`, VALUES (2004, '任务管理', 1703, 5, 'taskManage', NULL, NULL, 1, 0, 'M', '0', '0', NULL, NULL, '超级用户', '2023-08-18 14:40:53', NULL, NULL, NULL); CALL Pro_Temp_ColumnWork('basic_bussiness_type', 'editType', 'tinyint', 1); + + +CALL Pro_Temp_ColumnWork('io_code', 'price', 'decimal(10, 3)', 1); +CALL Pro_Temp_ColumnWork('io_code_temp', 'price', 'decimal(10, 3)', 1); +CALL Pro_Temp_ColumnWork('inv_prein_product', 'price', 'decimal(10, 3)', 1); +CALL Pro_Temp_ColumnWork('inv_product', 'price', 'decimal(10, 3)', 1); +CALL Pro_Temp_ColumnWork('inv_pre_product', 'price', 'decimal(10, 3)', 1); +CALL Pro_Temp_ColumnWork('inv_product_detail', 'price', 'decimal(10, 3)', 1); +CALL Pro_Temp_ColumnWork('inv_prein_product_detail', 'price', 'decimal(10, 3)', 1); +CALL Pro_Temp_ColumnWork('inv_pre_product_detail', 'price', 'decimal(10, 3)', 1); + + +CALL Pro_Temp_ColumnWork('io_code', 'inBatchNo', 'varchar(255)', 1); +CALL Pro_Temp_ColumnWork('io_code_temp', 'inBatchNo', 'varchar(255)', 1); +CALL Pro_Temp_ColumnWork('inv_product_detail', 'inBatchNo', 'varchar(255)', 1); +CALL Pro_Temp_ColumnWork('inv_prein_product_detail', 'inBatchNo', 'varchar(255)', 1); +CALL Pro_Temp_ColumnWork('inv_pre_product_detail', 'inBatchNo', 'varchar(255)', 1); +INSERT ignore INTO `sys_param_config`(`id`, `parentId`, `paramName`, `paramKey`, `paramValue`, `paramStatus`, + `paramType`, `paramExplain`, `updateTime`) +VALUES (20078, 0, '是否启用价格先进先出策略', 'price_fifo', '1', 1, 0, '0:否;1:是', '2023-10-10 10:10:08');