From af7b9db27bf72c92108329815ec771fb46e5b877 Mon Sep 17 00:00:00 2001
From: zhang <zc857179121@qq.com>
Date: 星期五, 31 十月 2025 16:09:20 +0800
Subject: [PATCH] Merge branch 'jsxswms' into integrationWms
---
src/main/java/com/zy/asrs/service/impl/BasContainerServiceImpl.java | 71 +++++++++++++++++++++++++++++++++++
1 files changed, 71 insertions(+), 0 deletions(-)
diff --git a/src/main/java/com/zy/asrs/service/impl/BasContainerServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/BasContainerServiceImpl.java
new file mode 100644
index 0000000..3919e27
--- /dev/null
+++ b/src/main/java/com/zy/asrs/service/impl/BasContainerServiceImpl.java
@@ -0,0 +1,71 @@
+package com.zy.asrs.service.impl;
+
+import com.baomidou.mybatisplus.mapper.EntityWrapper;
+import com.core.common.R;
+import com.core.exception.CoolException;
+import com.zy.asrs.entity.param.ContainerParams;
+import com.zy.asrs.enums.CommonEnum;
+import com.zy.asrs.enums.ContainerType;
+import com.zy.asrs.mapper.BasContainerMapper;
+import com.zy.asrs.entity.BasContainer;
+import com.zy.asrs.service.BasContainerService;
+import com.baomidou.mybatisplus.service.impl.ServiceImpl;
+import org.apache.tika.utils.StringUtils;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.awt.*;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Objects;
+
+@Service("basContainerService")
+public class BasContainerServiceImpl extends ServiceImpl<BasContainerMapper, BasContainer> implements BasContainerService {
+
+ /**
+ * @author Ryan
+ * @date 2025/9/26
+ * @description: 瀹瑰櫒鍒濆鍖�
+ * @version 1.0
+ */
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public R init(ContainerParams container) {
+ Integer length = 7;
+ if (Objects.isNull(container.getType())) {
+ throw new CoolException("瀹瑰櫒绫诲瀷涓嶈兘涓虹┖锛�");
+ }
+ if (!Objects.isNull(container.getLength())) {
+ length = container.getLength();
+ }
+ if (!Objects.isNull(container.getFlagInit()) && container.getFlagInit().equals(CommonEnum.COMMON_ENUM_Y.type)) {
+ this.delete(new EntityWrapper<>());
+ }
+ for (int i = container.getStart(); i <= container.getEnd(); i++) {
+ BasContainer basContainer = new BasContainer();
+ String prefix = "", ruleCode = "";
+ if (container.getType().equals(ContainerType.CONTAINER_TYPE_BOX.type)) {
+ prefix = "LX2";
+ basContainer.setMixMax(3);
+ } else if (container.getType().equals(ContainerType.CONTAINER_TYPE_CAGE.type)) {
+ prefix = "LK3";
+ basContainer.setMixMax(2);
+ } else if (container.getType().equals(ContainerType.CONTAINER_TYPE_SALVER.type)) {
+ prefix = "TP4";
+ basContainer.setMixMax(2);
+ }
+ ruleCode = prefix + StringUtils.leftPad(i + "", length, "0");
+ basContainer.setType(container.getType())
+ .setCreateTime(new Date())
+ .setUpdateTime(new Date())
+ .setId(null)
+ .setFlagMix(1)
+ .setBarcode(ruleCode);
+ if (!this.insert(basContainer)) {
+ throw new CoolException("瀹瑰櫒淇濆瓨澶辫触锛侊紒");
+ }
+ }
+ return R.ok();
+ }
+}
--
Gitblit v1.9.1