代码更新

This commit is contained in:
2023-01-11 18:29:22 +08:00
parent 5eca5cacf6
commit 26fe010d9c
3 changed files with 118 additions and 0 deletions

View File

@@ -80,5 +80,15 @@ public class AcsToWmsController {
return new ResponseEntity<>(acsToWmsService.process(jo), HttpStatus.OK);
}
@PostMapping("/initialize")
@Log("仓位初始化")
@ApiOperation("仓位初始化")
@SaIgnore
@SaCheckPermission("menu:list")
public ResponseEntity<Object> initialize(@RequestBody JSONObject json) {
acsToWmsService.initialize(json);
return new ResponseEntity<>(HttpStatus.OK);
}
}

View File

@@ -69,4 +69,8 @@ public interface AcsToWmsService {
*/
JSONObject process(JSONObject whereJson);
/**
* 仓位初始化
*/
void initialize(JSONObject json);
}

View File

@@ -1,6 +1,7 @@
package org.nl.wms.ext.acs.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONArray;
@@ -545,4 +546,107 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
result.put("dtl_type", "1");
return result;
}
@Override
public void initialize(JSONObject param) {
{
{
int j_size = param.getInteger("j"); // 排
int k_size = param.getInteger("k"); // 列
String block = param.getString("layer"); // 块
JSONObject max_jo = WQLObject.getWQLObject("ST_IVT_StructAttr").query("sect_code = 'ZC01' order by out_order_seq desc ").uniqueResult(0);
int max_no = 0;
if (ObjectUtil.isNotEmpty(max_jo)) {
max_no = max_jo.getIntValue("out_order_seq");
}
max_no++;
for (int i = 1; i < 4; i++) {
for (int j = 1; j < j_size; j++) {
for (int k = 1; k < k_size; k++) {
//排
String row = "";
if (j < 10) {
row = "0" + j;
} else {
row = j + "";
}
//列
String line = "";
if (k < 10) {
line = "0" + k;
} else {
line = k + "";
}
//块
String piece = i + block;
//层
String layer = "0" + i;
JSONObject jo = new JSONObject();
jo.put("struct_id", IdUtil.getSnowflake(1, 1).nextId());
jo.put("struct_code", piece + row + "-" + line + "-" + layer);
jo.put("struct_name", piece + "" + row + "" + line + "" + layer + "");
jo.put("simple_name", piece + "" + row + "" + line + "" + layer + "");
jo.put("sect_id", "1582991348217286656");
jo.put("sect_code", "ZC01");
jo.put("sect_name", "主存区");
jo.put("stor_id", "1582991156504039424");
jo.put("stor_code", "CP01");
jo.put("stor_name", "兰州仓库");
jo.put("stor_type", "03");
jo.put("is_tempstruct", "0");
jo.put("row_num", row);
jo.put("col_num", line);
jo.put("layer_num", layer);
jo.put("block_num", piece);
jo.put("in_order_seq", 0);
jo.put("out_order_seq", max_no);
jo.put("in_empty_seq", 0);
jo.put("out_empty_seq", 0);
jo.put("placement_type", "01");
jo.put("create_id", "1");
jo.put("create_name", "管理员");
jo.put("create_time", DateUtil.now());
jo.put("update_optid", "1");
jo.put("update_optname", "管理员");
jo.put("update_time", DateUtil.now());
jo.put("is_delete", "0");
jo.put("is_used", "1");
jo.put("lock_type", "1");
jo.put("material_height_type", "1");
WQLObject.getWQLObject("ST_IVT_StructAttr").insert(jo);
max_no++;
//插入点位
JSONObject structMap = new JSONObject();
structMap.put("point_id", IdUtil.getSnowflake(1,1).nextId());
structMap.put("point_code", jo.getString("struct_code"));
structMap.put("point_name", jo.getString("struct_name"));
structMap.put("region_id", "1582991348217286656");
structMap.put("region_code", jo.getString("sect_code"));
structMap.put("region_name", jo.getString("sect_name"));
structMap.put("point_type", "2");
structMap.put("point_status", "1");
structMap.put("lock_type", jo.getString("lock_type"));
structMap.put("block_num", jo.getIntValue("block_num"));
structMap.put("row_num", jo.getIntValue("row_num"));
structMap.put("col_num", jo.getIntValue("col_num"));
structMap.put("layer_num", jo.getIntValue("layer_num"));
structMap.put("source_id", jo.getString("struct_id"));
structMap.put("create_id", "1");
structMap.put("create_name", "管理员");
structMap.put("create_time", DateUtil.now());
structMap.put("update_optid", "1");
structMap.put("update_optname", "管理员");
structMap.put("update_time", DateUtil.now());
WQLObject.getWQLObject("sch_base_point").insert(structMap);
}
}
}
}
}
}
}