|
|
@ -1,6 +1,7 @@
|
|
|
|
package com.op.wms.service.impl;
|
|
|
|
package com.op.wms.service.impl;
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
import java.util.concurrent.atomic.AtomicInteger;
|
|
|
|
|
|
|
|
|
|
|
|
import com.baomidou.dynamic.datasource.annotation.DS;
|
|
|
|
import com.baomidou.dynamic.datasource.annotation.DS;
|
|
|
|
import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
|
|
|
|
import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
|
|
|
@ -66,6 +67,22 @@ public class BpProcureOrderServiceImpl implements IBpProcureOrderService
|
|
|
|
bpProcureOrder.setID(IdUtils.fastSimpleUUID());
|
|
|
|
bpProcureOrder.setID(IdUtils.fastSimpleUUID());
|
|
|
|
BaseProduct baseProduct = baseProductMapper.selectBaseProductByProductName(bpProcureOrder.getMaterialName());
|
|
|
|
BaseProduct baseProduct = baseProductMapper.selectBaseProductByProductName(bpProcureOrder.getMaterialName());
|
|
|
|
bpProcureOrder.setMaterialCode(baseProduct.getProductCode());
|
|
|
|
bpProcureOrder.setMaterialCode(baseProduct.getProductCode());
|
|
|
|
|
|
|
|
AtomicInteger SEQUENCE = new AtomicInteger(101923);
|
|
|
|
|
|
|
|
// 生成序列号,确保唯一性
|
|
|
|
|
|
|
|
int sequence = SEQUENCE.getAndIncrement();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 序列号超过8位数范围时重置(理论上不会发生,除非你的程序运行了很长时间)
|
|
|
|
|
|
|
|
if (sequence > 99999999) {
|
|
|
|
|
|
|
|
SEQUENCE.set(0);
|
|
|
|
|
|
|
|
sequence = SEQUENCE.getAndIncrement();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 格式化为8位数字,前面补零
|
|
|
|
|
|
|
|
String formattedSequence = String.format("%08d", sequence);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 拼接上4作为前缀
|
|
|
|
|
|
|
|
String s ="4" + formattedSequence;
|
|
|
|
|
|
|
|
bpProcureOrder.setProcureCode(s);
|
|
|
|
return bpProcureOrderMapper.insertBpProcureOrder(bpProcureOrder);
|
|
|
|
return bpProcureOrderMapper.insertBpProcureOrder(bpProcureOrder);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|