19 changed files with 190 additions and 40 deletions
@ -0,0 +1,107 @@ |
|||||
|
package org.nl.start; |
||||
|
|
||||
|
import cn.hutool.core.date.DateUtil; |
||||
|
import cn.hutool.core.util.IdUtil; |
||||
|
import com.alibaba.fastjson.JSONObject; |
||||
|
import lombok.RequiredArgsConstructor; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.nl.wms.basedata_manage.service.IStructattrService; |
||||
|
import org.nl.wms.basedata_manage.service.dao.Structattr; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.boot.ApplicationArguments; |
||||
|
import org.springframework.boot.ApplicationRunner; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
|
||||
|
import java.math.BigDecimal; |
||||
|
|
||||
|
/** |
||||
|
* 随项目启动模块 |
||||
|
*/ |
||||
|
@Slf4j |
||||
|
@Component |
||||
|
@RequiredArgsConstructor |
||||
|
public class Init implements ApplicationRunner { |
||||
|
|
||||
|
@Autowired |
||||
|
private IStructattrService iStructattrService; |
||||
|
|
||||
|
@Override |
||||
|
public void run(ApplicationArguments args) throws Exception { |
||||
|
// initTwoAttr(4,30,3,2, "2");
|
||||
|
// createAttr();
|
||||
|
// initTwoAttr2(9,11,3);
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 仓位初始化 |
||||
|
* row_num: 当前排 |
||||
|
* col_all:共多少列 |
||||
|
* layer_all: 共多少层 |
||||
|
*/ |
||||
|
private void initTwoAttr2(int row_num, int col_all, int layer_all) { |
||||
|
|
||||
|
// 排
|
||||
|
String row = row_num + ""; |
||||
|
|
||||
|
if (row_num < 10) { |
||||
|
row = "0" + row_num + ""; |
||||
|
} |
||||
|
|
||||
|
for (int j = 1; j < layer_all + 1; j++) { |
||||
|
|
||||
|
// 层
|
||||
|
String layer_num = j + ""; |
||||
|
if (j < 10) { |
||||
|
layer_num = "0" + j; |
||||
|
} |
||||
|
|
||||
|
for (int i = 1; i < col_all + 1; i++) { |
||||
|
Structattr json = new Structattr(); |
||||
|
json.setStruct_id(org.nl.config.IdUtil.getStringId()); |
||||
|
|
||||
|
// 列
|
||||
|
String col_num = i + ""; |
||||
|
if (i < 10) { |
||||
|
col_num = "0" + i; |
||||
|
} |
||||
|
|
||||
|
String struct_code = "B" + row + "-" + col_num + "-" + layer_num + ""; |
||||
|
|
||||
|
// 新增仓位
|
||||
|
json.setSect_id("1945408460665524224"); |
||||
|
json.setSect_code("ZC01"); |
||||
|
json.setSect_name("主存区"); |
||||
|
json.setStor_id("1582991156504039424"); |
||||
|
json.setStor_code("BA01"); |
||||
|
json.setStor_name("北安仓库"); |
||||
|
json.setLock_type("0"); |
||||
|
|
||||
|
json.setRow_num(BigDecimal.valueOf(row_num)); |
||||
|
json.setCol_num(BigDecimal.valueOf(i)); |
||||
|
json.setLayer_num(BigDecimal.valueOf(j)); |
||||
|
json.setBlock_num(BigDecimal.valueOf(1)); |
||||
|
|
||||
|
json.setStruct_code(struct_code); |
||||
|
json.setStruct_name(row + "排" + col_num+ "列"+ layer_num +"层"); |
||||
|
json.setSimple_name(json.getStruct_name()); |
||||
|
|
||||
|
// 长宽高
|
||||
|
json.setZdepth(BigDecimal.valueOf(2700)); |
||||
|
json.setWidth(BigDecimal.valueOf(1100)); |
||||
|
json.setHeight(BigDecimal.valueOf(4000)); |
||||
|
|
||||
|
// 载具类型
|
||||
|
json.setStoragevehicle_type("3"); |
||||
|
|
||||
|
json.setCreate_id("1"); |
||||
|
json.setCreate_name("管理员"); |
||||
|
json.setCreate_time(DateUtil.now()); |
||||
|
iStructattrService.save(json); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} |
Loading…
Reference in new issue