Browse Source

企业台账新增产品信息表商品序号新增自动生成

heguanxun 4 months ago
parent
commit
d6d1ff3231

+ 13 - 0
snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/qyrecordinfo/entity/BusinessIdGenerator.java

@@ -29,6 +29,7 @@ public class BusinessIdGenerator {
         return businessId.toString();
     }
 
+    //商品序号
     public static String generateBusinessIdForProduct(int currentSerialNumber) {
         StringBuilder businessId = new StringBuilder();
         businessId.append(PREFIX_P);
@@ -39,6 +40,7 @@ public class BusinessIdGenerator {
         return businessId.toString();
     }
 
+    //产品录入编号
     public static String generateBusinessIdForProductYl(int currentSerialNumber) {
         StringBuilder businessId = new StringBuilder();
         businessId.append(getDatePart());
@@ -48,6 +50,17 @@ public class BusinessIdGenerator {
         return businessId.toString();
     }
 
+    //产品加工增值
+    public static String generateBusinessIdForProductZz(int currentSerialNumber) {
+        StringBuilder businessId = new StringBuilder();
+        businessId.append("JZ");
+        businessId.append(getDatePart());
+        businessId.append(FIXED_MIDDLE_PART);
+        businessId.append(getSerialNumberPart(currentSerialNumber));
+        System.out.println(businessId);
+        return businessId.toString();
+    }
+
     private static String getDatePart() {
         SimpleDateFormat sdf = new SimpleDateFormat("yyMMddHHmmss");
         return sdf.format(new Date());

+ 4 - 0
snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/qyrecordinfo/service/impl/QyRecordInfoServiceImpl.java

@@ -123,8 +123,10 @@ public class QyRecordInfoServiceImpl extends ServiceImpl<QyRecordInfoMapper, QyR
                 item.setQyRecordInfoId(qyRecordInfo.getId());
                 String ylCode = BusinessIdGenerator.generateBusinessIdForProductYl(i.get());
                 String ylCodeProduce = BusinessIdGenerator.generateBusinessIdForProduct(i.get());
+                String ylCodeProduceZz = BusinessIdGenerator.generateBusinessIdForProductZz(i.get());
                 item.setYlCode(ylCode);
                 item.setProductCode(ylCodeProduce);
+                item.setRecordNumber(ylCodeProduceZz);
                 i.getAndIncrement();
                 QyRecordProduct qyRecordProduct = BeanUtil.toBean(item, QyRecordProduct.class);
                 qyRecordProductService.save(qyRecordProduct);
@@ -206,8 +208,10 @@ public class QyRecordInfoServiceImpl extends ServiceImpl<QyRecordInfoMapper, QyR
                 item.setQyRecordInfoId(qyRecordInfo.getId());
                 String ylCode = BusinessIdGenerator.generateBusinessIdForProductYl(i.get());
                 String ylCodeProduce = BusinessIdGenerator.generateBusinessIdForProduct(i.get());
+                String ylCodeProduceZz = BusinessIdGenerator.generateBusinessIdForProductZz(i.get());
                 item.setYlCode(ylCode);
                 item.setProductCode(ylCodeProduce);
+                item.setRecordNumber(ylCodeProduceZz);
                 QyRecardBody qyRecardBody = BeanUtil.toBean(item, QyRecardBody.class);
                 qyRecardBody.setQyRecordInfoId(qyRecordInfo.getId());
                 qyRecardBody.setId(null);