电器物料管理
安全库存的校验
This commit is contained in:
parent
a648158686
commit
83211bf4a0
@ -64,6 +64,9 @@ user:
|
||||
spring:
|
||||
application:
|
||||
name: ${ruoyi.name}
|
||||
http:
|
||||
connect-timeout: 10000
|
||||
read-timeout: 20000
|
||||
# 资源信息
|
||||
messages:
|
||||
# 国际化资源文件路径
|
||||
|
||||
@ -121,9 +121,10 @@
|
||||
<artifactId>pdfbox</artifactId>
|
||||
<version>2.0.22</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.assertj</groupId>
|
||||
<artifactId>assertj-core</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
@ -68,7 +68,6 @@ public class BomDetailsController extends BaseController {
|
||||
private final IProcessRouteService iProcessRouteService;
|
||||
private static final Logger log = LoggerFactory.getLogger(BomDetailsController.class);
|
||||
|
||||
|
||||
/**
|
||||
* 查询bom明细列表
|
||||
*/
|
||||
@ -113,7 +112,6 @@ public class BomDetailsController extends BaseController {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private Long generateUniqueParentId(Long originalId) {
|
||||
return originalId + 1000;
|
||||
}
|
||||
@ -129,14 +127,13 @@ public class BomDetailsController extends BaseController {
|
||||
child.setStats(bomDetailsVo.getStats());
|
||||
child.setMaterial(bomDetailsVo.getMaterial());
|
||||
child.setRemarks(bomDetailsVo.getRemarks());
|
||||
//child.setTotalWeight(bomDetailsVo.getTotalWeight());
|
||||
// child.setTotalWeight(bomDetailsVo.getTotalWeight());
|
||||
child.setUnitWeight(bomDetailsVo.getUnitWeight());
|
||||
|
||||
// 其他必要的字段赋值
|
||||
return child;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 导出bom明细列表
|
||||
*/
|
||||
@ -155,8 +152,7 @@ public class BomDetailsController extends BaseController {
|
||||
*/
|
||||
@SaCheckPermission("system:details:query")
|
||||
@GetMapping("/{id}")
|
||||
public R<BomDetailsVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long id) {
|
||||
public R<BomDetailsVo> getInfo(@NotNull(message = "主键不能为空") @PathVariable Long id) {
|
||||
return R.ok(iBomDetailsService.queryById(id));
|
||||
}
|
||||
|
||||
@ -190,12 +186,10 @@ public class BomDetailsController extends BaseController {
|
||||
@SaCheckPermission("system:details:remove")
|
||||
@Log(title = "bom明细", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] ids) {
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空") @PathVariable Long[] ids) {
|
||||
return toAjax(iBomDetailsService.deleteWithValidByIds(Arrays.asList(ids), true));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 导入BOM
|
||||
* daorubaon
|
||||
@ -210,9 +204,9 @@ public class BomDetailsController extends BaseController {
|
||||
List<BomDetailsVo> bomDetailsVos = ExcelUtil.importExcel(file.getInputStream(), BomDetailsVo.class);
|
||||
List<String> missingFieldsWarnings = new ArrayList<>();
|
||||
List<BomDetails> materialsToAdd = new ArrayList<>();
|
||||
//成品物料
|
||||
// 成品物料
|
||||
HashMap<String, String> bomFinishedProduct = getBomFinishedProduct(file);
|
||||
//新增成品父级物流
|
||||
// 新增成品父级物流
|
||||
if (loadChengPinMaterialPreservation(bomFinishedProduct) == 1) {
|
||||
log.info("新增成品父级物流成功");
|
||||
}
|
||||
@ -223,17 +217,33 @@ public class BomDetailsController extends BaseController {
|
||||
// 校验属性、材质、数量是否为空,并记录提示信息
|
||||
if (bomDetails.getStats() == null || bomDetails.getMaterial() == null || bomDetails.getQuantity() == null) {
|
||||
String warningMessage = String.format("记录 %s 缺少必要字段: 属性=%s, 材质=%s, 数量=%s",
|
||||
bomDetails.getPartNumber(), bomDetails.getStats(), bomDetails.getMaterial(), bomDetails.getQuantity());
|
||||
bomDetails.getPartNumber(), bomDetails.getStats(), bomDetails.getMaterial(),
|
||||
bomDetails.getQuantity());
|
||||
missingFieldsWarnings.add(warningMessage);
|
||||
}
|
||||
// 验证物料是否存在
|
||||
if (bomDetails.getFNumber() != null && bomDetails.getFName() != null && bomDetails.getPartNumber() != null && bomDetails.getName() != null) {
|
||||
if (bomDetails.getFNumber() != null && bomDetails.getFName() != null && bomDetails.getPartNumber() != null
|
||||
&& bomDetails.getName() != null) {
|
||||
int verification = isMaterialVerification(bomDetails.getPartNumber(), bomDetails.getName());
|
||||
if (verification == 1) {
|
||||
bomDetails.setUnitWeight("是");
|
||||
} else if (verification == 3) {
|
||||
if (bomDetails.getStats() == null || bomDetails.getStats().equals("外购")
|
||||
|| bomDetails.getFName().startsWith("009") || bomDetails.getFName().startsWith("AA")
|
||||
|| bomDetails.getFName().startsWith("AB") || bomDetails.getFName().startsWith("AC")
|
||||
|| bomDetails.getFName().startsWith("015")) {
|
||||
materialsToAdd.add(bomDetails);
|
||||
} else if (bomDetails.getStats().equals("自制")) {
|
||||
materialsToAdd.add(bomDetails);
|
||||
} else if (bomDetails.getStats().equals("委外")) {
|
||||
materialsToAdd.add(bomDetails);
|
||||
}
|
||||
bomDetails.setUnitWeight("编码名称不符");
|
||||
} else {
|
||||
if (bomDetails.getStats() == null || bomDetails.getStats().equals("外购") || bomDetails.getFName().startsWith("009") || bomDetails.getFName().startsWith("AA")
|
||||
|| bomDetails.getFName().startsWith("AB") || bomDetails.getFName().startsWith("AC") || bomDetails.getFName().startsWith("015")) {
|
||||
if (bomDetails.getStats() == null || bomDetails.getStats().equals("外购")
|
||||
|| bomDetails.getFName().startsWith("009") || bomDetails.getFName().startsWith("AA")
|
||||
|| bomDetails.getFName().startsWith("AB") || bomDetails.getFName().startsWith("AC")
|
||||
|| bomDetails.getFName().startsWith("015")) {
|
||||
materialsToAdd.add(bomDetails);
|
||||
} else if (bomDetails.getStats().equals("自制")) {
|
||||
materialsToAdd.add(bomDetails);
|
||||
@ -256,7 +266,7 @@ public class BomDetailsController extends BaseController {
|
||||
ArrayList<BomDetails> bomDetails = new ArrayList<>();
|
||||
// 统一新增不存在的物料
|
||||
for (BomDetails material : materialsToAdd) {
|
||||
//替换属性编码(金蝶)
|
||||
// 替换属性编码(金蝶)
|
||||
if (material == null) {
|
||||
continue; // 如果 material 为空,则跳过当前循环
|
||||
}
|
||||
@ -264,7 +274,7 @@ public class BomDetailsController extends BaseController {
|
||||
String state = determineState(material);
|
||||
log.info("开始新增不存在的物料==> 物料图号: " + material.getPartNumber() + " 物料名称: " + material.getName());
|
||||
System.out.println("state:=======================>" + state);
|
||||
//判断是否是电器物料
|
||||
// 判断是否是电器物料
|
||||
int result;
|
||||
if (material.getTotalWeight().contains("DQ")) {
|
||||
log.info("开始新增不存在的电气物料==> 物料图号: " + material.getPartNumber() + " 物料名称: " + material.getName());
|
||||
@ -317,7 +327,8 @@ public class BomDetailsController extends BaseController {
|
||||
*/
|
||||
public static String determineState(BomDetails stats) {
|
||||
if (stats == null || stats.getStats().equals("外购") || stats.getFName().startsWith("009") ||
|
||||
stats.getFName().startsWith("AA") || stats.getFName().startsWith("AB") || stats.getFName().startsWith("AC")) {
|
||||
stats.getFName().startsWith("AA") || stats.getFName().startsWith("AB")
|
||||
|| stats.getFName().startsWith("AC")) {
|
||||
return "1";
|
||||
} else if (stats.getStats().equals("自制")) {
|
||||
return "2";
|
||||
@ -327,8 +338,7 @@ public class BomDetailsController extends BaseController {
|
||||
return "1";
|
||||
}
|
||||
|
||||
|
||||
/*触发金蝶物料清单按钮*/
|
||||
/* 触发金蝶物料清单按钮 */
|
||||
@Log(title = "金蝶物料清单更新")
|
||||
@SaCheckPermission("system:details:updateMaterial")
|
||||
@PostMapping("/updateMaterial")
|
||||
@ -343,7 +353,7 @@ public class BomDetailsController extends BaseController {
|
||||
List<BomDetails> bomDetails = iBomDetailsService.selectByFNumber(number);
|
||||
System.out.println(number);
|
||||
if (bomDetails != null && !bomDetails.isEmpty()) {
|
||||
//物料清单保存方法
|
||||
// 物料清单保存方法
|
||||
int i1 = loadBillOfMaterialsPreservation(bomDetails);
|
||||
if (i1 == 1) {
|
||||
return R.ok("bom上传成功");
|
||||
@ -356,17 +366,16 @@ public class BomDetailsController extends BaseController {
|
||||
return R.ok("bom上传成功", bomDetailsList);
|
||||
}
|
||||
|
||||
|
||||
/*触发非标项目金蝶物料清单按钮*/
|
||||
/* 触发非标项目金蝶物料清单按钮 */
|
||||
@Log(title = "非标金蝶物料清单更新")
|
||||
@SaCheckPermission("system:details:updateMaterial")
|
||||
@SaCheckPermission("system:details:updateFBMaterial")
|
||||
@PostMapping("/updateFBMaterial")
|
||||
public R updateFBMaterial(@RequestBody List<Map<String, String>> bomDetailParams) {
|
||||
List<BomDetails> bomDetailsList = new ArrayList<>();
|
||||
|
||||
// 遍历前端传来的数据
|
||||
for (Map<String, String> param : bomDetailParams) {
|
||||
String fnumber = param.get("fnumber"); // 物料编码
|
||||
String fnumber = param.get("fnumber"); // 物料编码
|
||||
String totalWeight = param.get("totalWeight"); // 生产令号
|
||||
|
||||
// 根据物料编码和生产令号查询
|
||||
@ -376,7 +385,7 @@ public class BomDetailsController extends BaseController {
|
||||
|
||||
if (bomDetails != null && !bomDetails.isEmpty()) {
|
||||
// 检查金蝶中是否存在该物料的BOM
|
||||
//JsonArray existingBom = checkBomExists(fnumber);
|
||||
// JsonArray existingBom = checkBomExists(fnumber);
|
||||
// 物料清单保存方法
|
||||
FBloadBillOfMaterialsPreservation(bomDetails);
|
||||
bomDetailsList.addAll(bomDetails);
|
||||
@ -385,138 +394,59 @@ public class BomDetailsController extends BaseController {
|
||||
return R.ok("成功", bomDetailsList);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
@PostMapping("/updateFBMaterial")
|
||||
public R updateFBMaterial1(@RequestBody List<Map<String, String>> bomDetailParams) {
|
||||
List<BomDetails> bomDetailsList = new ArrayList<>();
|
||||
|
||||
// 遍历前端传来的数据
|
||||
for (Map<String, String> param : bomDetailParams) {
|
||||
String fnumber = param.get("fnumber"); // 物料编码
|
||||
String totalWeight = param.get("totalWeight"); // 生产令号
|
||||
|
||||
// 根据物料编码和生产令号查询
|
||||
List<BomDetails> bomDetails = iBomDetailsService.selectByFNumberAndTotalWeight(fnumber, totalWeight);
|
||||
|
||||
System.out.println("处理物料编码:" + fnumber + ", 生产令号:" + totalWeight);
|
||||
|
||||
if (bomDetails != null && !bomDetails.isEmpty()) {
|
||||
// 检查金蝶中是否存在该物料的BOM
|
||||
JsonArray existingBom = checkBomExists(fnumber);
|
||||
|
||||
if (existingBom != null && !existingBom.isEmpty()) {
|
||||
// BOM已存在,需要比对用量和子项
|
||||
if (compareBomDetails(existingBom, bomDetails)) {
|
||||
// BOM一致,跳过
|
||||
log.info("物料{}的BOM已存在且一致,无需更新", fnumber);
|
||||
continue;
|
||||
} else {
|
||||
// BOM不一致,需要更新
|
||||
log.info("物料{}的BOM已存在但不一致,准备更新", fnumber);
|
||||
deleteBom(fnumber); // 删除已有BOM
|
||||
}
|
||||
}
|
||||
|
||||
// 新增BOM
|
||||
FBloadBillOfMaterialsPreservation(bomDetails);
|
||||
bomDetailsList.addAll(bomDetails);
|
||||
}
|
||||
}
|
||||
return R.ok("成功",bomDetailsList);
|
||||
}
|
||||
|
||||
private boolean compareBomDetails(JsonArray existingBom, List<BomDetails> bomDetails) {
|
||||
try {
|
||||
// 获取现有BOM的子项和用量
|
||||
Map<String, Double> existingItems = new HashMap<>();
|
||||
for (JsonElement element : existingBom) {
|
||||
JsonObject item = element.getAsJsonObject();
|
||||
JsonArray treeEntity = item.getAsJsonArray("FTreeEntity");
|
||||
for (JsonElement treeItem : treeEntity) {
|
||||
String materialNo = treeItem.getAsJsonObject()
|
||||
.get("FMATERIALIDCHILD")
|
||||
.getAsJsonObject()
|
||||
.get("FNumber")
|
||||
.getAsString();
|
||||
double usage = treeItem.getAsJsonObject()
|
||||
.get("FNUMERATOR")
|
||||
.getAsDouble();
|
||||
existingItems.put(materialNo, usage);
|
||||
}
|
||||
}
|
||||
|
||||
// 比对新BOM
|
||||
for (BomDetails detail : newBom) {
|
||||
Double existingUsage = existingItems.get(detail.getPartNumber());
|
||||
if (existingUsage == null ||
|
||||
Math.abs(existingUsage - detail.getQuantity()) > 0.000001) {
|
||||
return false;
|
||||
}
|
||||
existingItems.remove(detail.getPartNumber());
|
||||
}
|
||||
|
||||
// 检查是否有多余的子项
|
||||
return existingItems.isEmpty();
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("比对BOM失败:", e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
/**
|
||||
* 检查金蝶中是否存在该物料的BOM
|
||||
*//*
|
||||
*
|
||||
*
|
||||
* private JsonArray checkBomExists(String fnumber) {
|
||||
* try {
|
||||
* K3CloudApi client = new K3CloudApi();
|
||||
* String formId = "ENG_BOM";
|
||||
*
|
||||
* JsonObject queryParam = new JsonObject();
|
||||
* queryParam.addProperty("FormId", formId);
|
||||
* queryParam.addProperty("FieldKeys",
|
||||
* "FID,FMATERIALID.FNumber,FTreeEntity.FMATERIALIDCHILD.FNumber,FTreeEntity.FNUMERATOR"
|
||||
* );
|
||||
*
|
||||
* JsonArray filterArray = new JsonArray();
|
||||
* JsonObject filter = new JsonObject();
|
||||
* filter.addProperty("Field", "FMATERIALID.FNumber");
|
||||
* filter.addProperty("Value", fnumber);
|
||||
* filterArray.add(filter);
|
||||
* queryParam.add("FilterString", filterArray);
|
||||
*
|
||||
* String resultJson = client.executeBillQuery(queryParam.toString());
|
||||
* Gson gson = new Gson();
|
||||
* JsonArray result = gson.fromJson(resultJson, JsonArray.class);
|
||||
*
|
||||
* return result;
|
||||
* } catch (Exception e) {
|
||||
* log.error("查询BOM失败:", e);
|
||||
* return null;
|
||||
* }
|
||||
* }
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
private JsonArray checkBomExists(String fnumber) {
|
||||
try {
|
||||
K3CloudApi client = new K3CloudApi();
|
||||
String formId = "ENG_BOM";
|
||||
|
||||
JsonObject queryParam = new JsonObject();
|
||||
queryParam.addProperty("FormId", formId);
|
||||
queryParam.addProperty("FieldKeys", "FID,FMATERIALID.FNumber,FTreeEntity.FMATERIALIDCHILD.FNumber,FTreeEntity.FNUMERATOR");
|
||||
|
||||
JsonArray filterArray = new JsonArray();
|
||||
JsonObject filter = new JsonObject();
|
||||
filter.addProperty("Field", "FMATERIALID.FNumber");
|
||||
filter.addProperty("Value", fnumber);
|
||||
filterArray.add(filter);
|
||||
queryParam.add("FilterString", filterArray);
|
||||
|
||||
String resultJson = client.executeBillQuery(queryParam.toString());
|
||||
Gson gson = new Gson();
|
||||
JsonArray result = gson.fromJson(resultJson, JsonArray.class);
|
||||
|
||||
return result;
|
||||
} catch (Exception e) {
|
||||
log.error("查询BOM失败:", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
/*s
|
||||
物料清单保存方法
|
||||
/*
|
||||
* s
|
||||
* 物料清单保存方法
|
||||
*/
|
||||
public int loadBillOfMaterialsPreservation(List<BomDetails> bomlist) {
|
||||
// TODO: 实现加载和保存物料清单数据的逻辑
|
||||
K3CloudApi client = new K3CloudApi();
|
||||
// 创建一个空的JsonObject
|
||||
JsonObject json = new JsonObject();
|
||||
//拿到第一个物料清单的父级物料编码
|
||||
// 拿到第一个物料清单的父级物料编码
|
||||
BomDetails bomDetails = bomlist.get(0);
|
||||
String fName = bomDetails.getFName();
|
||||
String fNumber = bomDetails.getFNumber();
|
||||
// 验证物料是否存在
|
||||
if (isMaterialVerification(fNumber, fName) == 0) {
|
||||
log.debug("物料不存在");
|
||||
//增加父级物料图号
|
||||
// 增加父级物料图号
|
||||
if (loadMaterialPreservation(bomDetails) == 1) {
|
||||
log.debug("物料增加成功");
|
||||
}
|
||||
@ -537,13 +467,15 @@ public class BomDetailsController extends BaseController {
|
||||
JsonObject fGroupType = new JsonObject();
|
||||
model.add("FGroup", fGroupType);
|
||||
fGroupType.addProperty("FNumber", "X007");
|
||||
/*model.addProperty("FCfgBomId", 0);
|
||||
model.addProperty("FYIELDRATE", 100.0);*/
|
||||
/*
|
||||
* model.addProperty("FCfgBomId", 0);
|
||||
* model.addProperty("FYIELDRATE", 100.0);
|
||||
*/
|
||||
// 创建FMATERIALID对象,并加入Model
|
||||
JsonObject fMaterialId = new JsonObject();
|
||||
model.add("FMATERIALID", fMaterialId);
|
||||
fMaterialId.addProperty("FNumber", bomDetails.getFNumber());
|
||||
//设置父级物料的单位
|
||||
// 设置父级物料的单位
|
||||
String unit = isMaterialVerification2(bomDetails.getFNumber());
|
||||
log.debug("单位为:" + unit);
|
||||
if (!unit.isEmpty()) {
|
||||
@ -584,7 +516,6 @@ public class BomDetailsController extends BaseController {
|
||||
fChildUnitId.addProperty("FNumber", "jian");
|
||||
}
|
||||
|
||||
|
||||
fTreeEntityItem.addProperty("F_HBYT_BJBM", details.getPartdiagramCode());
|
||||
fTreeEntityItem.addProperty("F_HBYT_BJMC", details.getPartdiagramName());
|
||||
fTreeEntityItem.addProperty("FDOSAGETYPE", "2");
|
||||
@ -596,14 +527,14 @@ public class BomDetailsController extends BaseController {
|
||||
log.debug("打印json:" + jsonData);
|
||||
System.out.println(jsonData);
|
||||
try {
|
||||
//业务对象标识
|
||||
// 业务对象标识
|
||||
String formId = "ENG_BOM";
|
||||
//调用接口
|
||||
// 调用接口
|
||||
String resultJson = client.save(formId, jsonData);
|
||||
|
||||
//用于记录结果
|
||||
// 用于记录结果
|
||||
Gson gson = new Gson();
|
||||
//对返回结果进行解析和校验
|
||||
// 对返回结果进行解析和校验
|
||||
RepoRet repoRet = gson.fromJson(resultJson, RepoRet.class);
|
||||
if (repoRet.getResult().getResponseStatus().isIsSuccess()) {
|
||||
log.debug("物料清单bom 保存成功===================>" + "图号:" + bomDetails.getFNumber());
|
||||
@ -620,7 +551,7 @@ public class BomDetailsController extends BaseController {
|
||||
return 1;
|
||||
}
|
||||
|
||||
//FBOM物料清单保存
|
||||
// FBOM物料清单保存
|
||||
public void FBloadBillOfMaterialsPreservation(List<BomDetails> bomlist) {
|
||||
|
||||
BomDetails bomDetails1 = bomlist.get(0);
|
||||
@ -628,7 +559,7 @@ public class BomDetailsController extends BaseController {
|
||||
// 验证父级物料是否存在
|
||||
if (verification == 0) {
|
||||
log.debug("父级物料物料不存在");
|
||||
//父级物料不存在,即调用物料新增接口
|
||||
// 父级物料不存在,即调用物料新增接口
|
||||
int materialVerificationResult = loadFBMaterialPreservation(bomDetails1);
|
||||
if (materialVerificationResult == 1) {
|
||||
log.debug("父级物料保存成功");
|
||||
@ -637,7 +568,6 @@ public class BomDetailsController extends BaseController {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// TODO: 实现加载和保存物料清单数据的逻辑
|
||||
K3CloudApi client = new K3CloudApi();
|
||||
// 创建一个空的JsonObject
|
||||
@ -657,13 +587,15 @@ public class BomDetailsController extends BaseController {
|
||||
JsonObject fGroupType = new JsonObject();
|
||||
model.add("FGroup", fGroupType);
|
||||
fGroupType.addProperty("FNumber", "TT001");
|
||||
/*model.addProperty("FCfgBomId", 0);
|
||||
model.addProperty("FYIELDRATE", 100.0);*/
|
||||
/*
|
||||
* model.addProperty("FCfgBomId", 0);
|
||||
* model.addProperty("FYIELDRATE", 100.0);
|
||||
*/
|
||||
// 创建FMATERIALID对象,并加入Model
|
||||
JsonObject fMaterialId = new JsonObject();
|
||||
model.add("FMATERIALID", fMaterialId);
|
||||
fMaterialId.addProperty("FNumber", bomDetails1.getFNumber());
|
||||
//设置父级物料的单位
|
||||
// 设置父级物料的单位
|
||||
String unit = isMaterialVerification2(bomDetails1.getFNumber());
|
||||
log.debug("单位为:" + unit);
|
||||
if (!unit.isEmpty()) {
|
||||
@ -726,7 +658,6 @@ public class BomDetailsController extends BaseController {
|
||||
fChildUnitId.addProperty("FNumber", "jian");
|
||||
}
|
||||
|
||||
|
||||
fTreeEntityItem.addProperty("F_HBYT_BJBM", details.getPartdiagramCode());
|
||||
fTreeEntityItem.addProperty("F_HBYT_BJMC", details.getPartdiagramName());
|
||||
fTreeEntityItem.addProperty("FDOSAGETYPE", "2");
|
||||
@ -738,14 +669,14 @@ public class BomDetailsController extends BaseController {
|
||||
log.debug("打印json:" + jsonData);
|
||||
System.out.println(jsonData);
|
||||
try {
|
||||
//业务对象标识
|
||||
// 业务对象标识
|
||||
String formId = "ENG_BOM";
|
||||
//调用接口
|
||||
// 调用接口
|
||||
String resultJson = client.save(formId, jsonData);
|
||||
|
||||
//用于记录结果
|
||||
// 用于记录结果
|
||||
Gson gson = new Gson();
|
||||
//对返回结果进行解析和校验
|
||||
// 对返回结果进行解析和校验
|
||||
RepoRet repoRet = gson.fromJson(resultJson, RepoRet.class);
|
||||
if (repoRet.getResult().getResponseStatus().isIsSuccess()) {
|
||||
System.out.printf("接口返回结果: %s%n", gson.toJson(repoRet.getResult()));
|
||||
@ -760,9 +691,10 @@ public class BomDetailsController extends BaseController {
|
||||
// 输出生成的Json
|
||||
}
|
||||
|
||||
/*父级物料保存接口
|
||||
单位 是台
|
||||
* */
|
||||
/*
|
||||
* 父级物料保存接口
|
||||
* 单位 是台
|
||||
*/
|
||||
public int loadMaterialPreservation(BomDetails bomDetails) {
|
||||
K3CloudApi client = new K3CloudApi();
|
||||
// 创建一个空的JsonObject
|
||||
@ -787,7 +719,6 @@ public class BomDetailsController extends BaseController {
|
||||
JsonObject fMaterialGroup = new JsonObject();
|
||||
fMaterialGroup.addProperty("FNumber", "XM-100");
|
||||
|
||||
|
||||
model.add("FMaterialGroup", fMaterialGroup);
|
||||
|
||||
model.addProperty("FIsHandleReserve", true);
|
||||
@ -851,10 +782,12 @@ public class BomDetailsController extends BaseController {
|
||||
JsonObject subHeadEntity3 = new JsonObject();
|
||||
model.add("SubHeadEntity3", subHeadEntity3);
|
||||
|
||||
/* // 创建FPurchaseUnitId对象,并加入SubHeadEntity3
|
||||
JsonObject fPurchaseUnitId = new JsonObject();
|
||||
fPurchaseUnitId.addProperty("FNumber", "008");
|
||||
subHeadEntity3.add("FPurchaseUnitId", fPurchaseUnitId);*/
|
||||
/*
|
||||
* // 创建FPurchaseUnitId对象,并加入SubHeadEntity3
|
||||
* JsonObject fPurchaseUnitId = new JsonObject();
|
||||
* fPurchaseUnitId.addProperty("FNumber", "008");
|
||||
* subHeadEntity3.add("FPurchaseUnitId", fPurchaseUnitId);
|
||||
*/
|
||||
|
||||
// 创建FPurchasePriceUnitId对象,并加入SubHeadEntity3
|
||||
JsonObject fPurchasePriceUnitId = new JsonObject();
|
||||
@ -864,22 +797,21 @@ public class BomDetailsController extends BaseController {
|
||||
subHeadEntity3.addProperty("FIsQuota", false);
|
||||
subHeadEntity3.addProperty("FQuotaType", "1");
|
||||
|
||||
|
||||
// 创建SubHeadEntity6对象,并加入Model 检验项
|
||||
JsonObject subHeadEntity6 = new JsonObject();
|
||||
model.add("SubHeadEntity6", subHeadEntity6);
|
||||
//不同的属性不同的检验方案
|
||||
// 不同的属性不同的检验方案
|
||||
if (bomDetails.getStats().equals("1")) {
|
||||
//外购
|
||||
// 外购
|
||||
subHeadEntity6.addProperty("FCheckIncoming", true);
|
||||
}
|
||||
if (bomDetails.getStats().equals("2")) {
|
||||
//自制
|
||||
// 自制
|
||||
subHeadEntity6.addProperty("FCheckProduct", true);
|
||||
subHeadEntity6.addProperty("FCheckReturnMtrl", true);
|
||||
}
|
||||
if (bomDetails.getStats().equals("3")) {
|
||||
//委外
|
||||
// 委外
|
||||
subHeadEntity6.addProperty("FCheckIncoming", true);
|
||||
subHeadEntity6.addProperty("FCheckProduct", true);
|
||||
subHeadEntity6.addProperty("FCheckSubRtnMtrl", true);
|
||||
@ -917,13 +849,13 @@ public class BomDetailsController extends BaseController {
|
||||
String jsonData = json.toString();
|
||||
System.out.println(jsonData);
|
||||
try {
|
||||
//业务对象标识
|
||||
// 业务对象标识
|
||||
String formId = "BD_MATERIAL";
|
||||
//调用接口
|
||||
// 调用接口
|
||||
String resultJson = client.save(formId, jsonData);
|
||||
//用于记录结果
|
||||
// 用于记录结果
|
||||
Gson gson = new Gson();
|
||||
//对返回结果进行解析和校验
|
||||
// 对返回结果进行解析和校验
|
||||
RepoRet repoRet = gson.fromJson(resultJson, RepoRet.class);
|
||||
if (repoRet.getResult().getResponseStatus().isIsSuccess()) {
|
||||
|
||||
@ -932,7 +864,8 @@ public class BomDetailsController extends BaseController {
|
||||
return 1;
|
||||
} else {
|
||||
fail("接口返回结果: " + gson.toJson(repoRet.getResult().getResponseStatus()));
|
||||
log.error("接口返回结果: " + gson.toJson(repoRet.getResult().getResponseStatus().getErrors().get(0).getMessage().contains("系统中已存在相同编码")));
|
||||
log.error("接口返回结果: " + gson.toJson(repoRet.getResult().getResponseStatus().getErrors().get(0)
|
||||
.getMessage().contains("系统中已存在相同编码")));
|
||||
return 0;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
@ -942,8 +875,9 @@ public class BomDetailsController extends BaseController {
|
||||
|
||||
}
|
||||
|
||||
/*FB父级物料保存接口
|
||||
* */
|
||||
/*
|
||||
* FB父级物料保存接口
|
||||
*/
|
||||
public static int loadFBMaterialPreservation(BomDetails bomDetail) {
|
||||
K3CloudApi client = new K3CloudApi();
|
||||
// 创建一个空的JsonObject
|
||||
@ -977,7 +911,7 @@ public class BomDetailsController extends BaseController {
|
||||
|
||||
// 创建FCategoryID对象,并加入SubHeadEntity
|
||||
JsonObject fCategoryID = new JsonObject();
|
||||
fCategoryID.addProperty("FNumber", "CHLB05_SYS");//产成品
|
||||
fCategoryID.addProperty("FNumber", "CHLB05_SYS");// 产成品
|
||||
subHeadEntity.add("FCategoryID", fCategoryID);
|
||||
|
||||
// 创建FTaxRateId对象,并加入SubHeadEntity
|
||||
@ -1006,7 +940,7 @@ public class BomDetailsController extends BaseController {
|
||||
|
||||
// 创建FStockId对象,并加入SubHeadEntity1
|
||||
JsonObject fStockId = new JsonObject();
|
||||
//判断是产成品还是企标
|
||||
// 判断是产成品还是企标
|
||||
if (bomDetail.getRemarks() != null && bomDetail.getRemarks().equals("企标零件库")) {
|
||||
String cangKu = "CK010";
|
||||
fStockId.addProperty("FNumber", cangKu);
|
||||
@ -1034,10 +968,12 @@ public class BomDetailsController extends BaseController {
|
||||
JsonObject subHeadEntity3 = new JsonObject();
|
||||
model.add("SubHeadEntity3", subHeadEntity3);
|
||||
|
||||
/* // 创建FPurchaseUnitId对象,并加入SubHeadEntity3
|
||||
JsonObject fPurchaseUnitId = new JsonObject();
|
||||
fPurchaseUnitId.addProperty("FNumber", "008");
|
||||
subHeadEntity3.add("FPurchaseUnitId", fPurchaseUnitId);*/
|
||||
/*
|
||||
* // 创建FPurchaseUnitId对象,并加入SubHeadEntity3
|
||||
* JsonObject fPurchaseUnitId = new JsonObject();
|
||||
* fPurchaseUnitId.addProperty("FNumber", "008");
|
||||
* subHeadEntity3.add("FPurchaseUnitId", fPurchaseUnitId);
|
||||
*/
|
||||
|
||||
// 创建FPurchasePriceUnitId对象,并加入SubHeadEntity3
|
||||
JsonObject fPurchasePriceUnitId = new JsonObject();
|
||||
@ -1047,22 +983,21 @@ public class BomDetailsController extends BaseController {
|
||||
subHeadEntity3.addProperty("FIsQuota", false);
|
||||
subHeadEntity3.addProperty("FQuotaType", "1");
|
||||
|
||||
|
||||
// 创建SubHeadEntity6对象,并加入Model 检验项
|
||||
JsonObject subHeadEntity6 = new JsonObject();
|
||||
model.add("SubHeadEntity6", subHeadEntity6);
|
||||
//不同的属性不同的检验方案
|
||||
// 不同的属性不同的检验方案
|
||||
if (bomDetail.getStats().equals("1")) {
|
||||
//外购
|
||||
// 外购
|
||||
subHeadEntity6.addProperty("FCheckIncoming", true);
|
||||
}
|
||||
if (bomDetail.getStats().equals("2")) {
|
||||
//自制
|
||||
// 自制
|
||||
subHeadEntity6.addProperty("FCheckProduct", true);
|
||||
subHeadEntity6.addProperty("FCheckReturnMtrl", true);
|
||||
}
|
||||
if (bomDetail.getStats().equals("3")) {
|
||||
//委外
|
||||
// 委外
|
||||
subHeadEntity6.addProperty("FCheckIncoming", true);
|
||||
subHeadEntity6.addProperty("FCheckProduct", true);
|
||||
subHeadEntity6.addProperty("FCheckSubRtnMtrl", true);
|
||||
@ -1100,13 +1035,13 @@ public class BomDetailsController extends BaseController {
|
||||
String jsonData = json.toString();
|
||||
System.out.println(jsonData);
|
||||
try {
|
||||
//业务对象标识
|
||||
// 业务对象标识
|
||||
String formId = "BD_MATERIAL";
|
||||
//调用接口
|
||||
// 调用接口
|
||||
String resultJson = client.save(formId, jsonData);
|
||||
//用于记录结果
|
||||
// 用于记录结果
|
||||
Gson gson = new Gson();
|
||||
//对返回结果进行解析和校验
|
||||
// 对返回结果进行解析和校验
|
||||
RepoRet repoRet = gson.fromJson(resultJson, RepoRet.class);
|
||||
if (repoRet.getResult().getResponseStatus().isIsSuccess()) {
|
||||
System.out.printf("接口返回结果: %s%n", gson.toJson(repoRet.getResult()));
|
||||
@ -1124,9 +1059,10 @@ public class BomDetailsController extends BaseController {
|
||||
|
||||
}
|
||||
|
||||
/*FB父级物料保存接口
|
||||
单位 是台
|
||||
* */
|
||||
/*
|
||||
* FB父级物料保存接口
|
||||
* 单位 是台
|
||||
*/
|
||||
public int loadChengPinMaterialPreservation(HashMap<String, String> bomDetail) {
|
||||
K3CloudApi client = new K3CloudApi();
|
||||
// 创建一个空的JsonObject
|
||||
@ -1160,7 +1096,7 @@ public class BomDetailsController extends BaseController {
|
||||
|
||||
// 创建FCategoryID对象,并加入SubHeadEntity
|
||||
JsonObject fCategoryID = new JsonObject();
|
||||
fCategoryID.addProperty("FNumber", "CHLB05_SYS");//产成品
|
||||
fCategoryID.addProperty("FNumber", "CHLB05_SYS");// 产成品
|
||||
subHeadEntity.add("FCategoryID", fCategoryID);
|
||||
|
||||
// 创建FTaxRateId对象,并加入SubHeadEntity
|
||||
@ -1175,7 +1111,7 @@ public class BomDetailsController extends BaseController {
|
||||
|
||||
subHeadEntity.addProperty("FIsPurchase", true);
|
||||
subHeadEntity.addProperty("FIsInventory", true);
|
||||
//成品不允许委外
|
||||
// 成品不允许委外
|
||||
// subHeadEntity.addProperty("FIsSubContract", true);
|
||||
subHeadEntity.addProperty("FIsSale", true);
|
||||
subHeadEntity.addProperty("FIsProduce", true);
|
||||
@ -1190,7 +1126,7 @@ public class BomDetailsController extends BaseController {
|
||||
|
||||
// 创建FStockId对象,并加入SubHeadEntity1
|
||||
JsonObject fStockId = new JsonObject();
|
||||
//判断是产成品还是企标
|
||||
// 判断是产成品还是企标
|
||||
String cangKu = "CK011";
|
||||
fStockId.addProperty("FNumber", cangKu);
|
||||
subHeadEntity1.add("FStockId", fStockId);
|
||||
@ -1213,10 +1149,12 @@ public class BomDetailsController extends BaseController {
|
||||
JsonObject subHeadEntity3 = new JsonObject();
|
||||
model.add("SubHeadEntity3", subHeadEntity3);
|
||||
|
||||
/* // 创建FPurchaseUnitId对象,并加入SubHeadEntity3
|
||||
JsonObject fPurchaseUnitId = new JsonObject();
|
||||
fPurchaseUnitId.addProperty("FNumber", "008");
|
||||
subHeadEntity3.add("FPurchaseUnitId", fPurchaseUnitId);*/
|
||||
/*
|
||||
* // 创建FPurchaseUnitId对象,并加入SubHeadEntity3
|
||||
* JsonObject fPurchaseUnitId = new JsonObject();
|
||||
* fPurchaseUnitId.addProperty("FNumber", "008");
|
||||
* subHeadEntity3.add("FPurchaseUnitId", fPurchaseUnitId);
|
||||
*/
|
||||
|
||||
// 创建FPurchasePriceUnitId对象,并加入SubHeadEntity3
|
||||
JsonObject fPurchasePriceUnitId = new JsonObject();
|
||||
@ -1226,7 +1164,6 @@ public class BomDetailsController extends BaseController {
|
||||
subHeadEntity3.addProperty("FIsQuota", false);
|
||||
subHeadEntity3.addProperty("FQuotaType", "1");
|
||||
|
||||
|
||||
// 创建SubHeadEntity6对象,并加入Model 检验项
|
||||
JsonObject subHeadEntity6 = new JsonObject();
|
||||
model.add("SubHeadEntity6", subHeadEntity6);
|
||||
@ -1266,13 +1203,13 @@ public class BomDetailsController extends BaseController {
|
||||
String jsonData = json.toString();
|
||||
System.out.println(jsonData);
|
||||
try {
|
||||
//业务对象标识
|
||||
// 业务对象标识
|
||||
String formId = "BD_MATERIAL";
|
||||
//调用接口
|
||||
// 调用接口
|
||||
String resultJson = client.save(formId, jsonData);
|
||||
//用于记录结果
|
||||
// 用于记录结果
|
||||
Gson gson = new Gson();
|
||||
//对返回结果进行解析和校验
|
||||
// 对返回结果进行解析和校验
|
||||
RepoRet repoRet = gson.fromJson(resultJson, RepoRet.class);
|
||||
if (repoRet.getResult().getResponseStatus().isIsSuccess()) {
|
||||
System.out.printf("接口返回结果: %s%n", gson.toJson(repoRet.getResult()));
|
||||
@ -1311,6 +1248,11 @@ public class BomDetailsController extends BaseController {
|
||||
log.debug("图号为:" + FNumber);
|
||||
log.debug("物料为:" + FName);
|
||||
log.debug("单位为:" + Funit);
|
||||
|
||||
// 检查名称是否一致
|
||||
if (FNumber.equals(DrawingNumber) && !FName.equals(name)) {
|
||||
return 3; // 编码相同但名称不同
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
@ -1341,7 +1283,6 @@ public class BomDetailsController extends BaseController {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public int loadMaterialPreservation(BomDetails bomDetails1, String states) {
|
||||
K3CloudApi client = new K3CloudApi();
|
||||
// 创建一个空的JsonObject
|
||||
@ -1364,7 +1305,7 @@ public class BomDetailsController extends BaseController {
|
||||
FSVRIAssistant.addProperty("FNumber", materialProperties.getMaterialAttributeId());
|
||||
model.add("F_SVRI_Assistant", FSVRIAssistant);
|
||||
} else {
|
||||
//没写材料为默认为空
|
||||
// 没写材料为默认为空
|
||||
JsonObject FSVRIAssistant = new JsonObject();
|
||||
FSVRIAssistant.addProperty("FNumber", "17");
|
||||
model.add("F_SVRI_Assistant", FSVRIAssistant);
|
||||
@ -1424,7 +1365,7 @@ public class BomDetailsController extends BaseController {
|
||||
subHeadEntity1.addProperty("FUnitConvertDir", "1");
|
||||
|
||||
// 创建FStockId对象,并加入SubHeadEntity1
|
||||
//仓库代码为 半成品库007
|
||||
// 仓库代码为 半成品库007
|
||||
JsonObject fStockId = new JsonObject();
|
||||
fStockId.addProperty("FNumber", "007");
|
||||
subHeadEntity1.add("FStockId", fStockId);
|
||||
@ -1457,29 +1398,27 @@ public class BomDetailsController extends BaseController {
|
||||
|
||||
JsonObject subHeadEntity6 = new JsonObject();
|
||||
model.add("SubHeadEntity6", subHeadEntity6);
|
||||
//不同的属性不同的检验方案
|
||||
// 不同的属性不同的检验方案
|
||||
if (states.equals("1")) {
|
||||
//外购
|
||||
// 外购
|
||||
subHeadEntity6.addProperty("FCheckIncoming", true);
|
||||
}
|
||||
if (states.equals("2")) {
|
||||
//自制
|
||||
// 自制
|
||||
subHeadEntity6.addProperty("FCheckProduct", true);
|
||||
subHeadEntity6.addProperty("FCheckReturnMtrl", true);
|
||||
}
|
||||
if (states.equals("3")) {
|
||||
//委外
|
||||
// 委外
|
||||
subHeadEntity6.addProperty("FCheckIncoming", true);
|
||||
subHeadEntity6.addProperty("FCheckProduct", true);
|
||||
subHeadEntity6.addProperty("FCheckReturnMtrl", true);
|
||||
}
|
||||
|
||||
|
||||
// 创建SubHeadEntity5对象,并加入Model
|
||||
JsonObject subHeadEntity5 = new JsonObject();
|
||||
model.add("SubHeadEntity5", subHeadEntity5);
|
||||
|
||||
|
||||
// 创建FProduceUnitId对象,并加入SubHeadEntity5
|
||||
JsonObject fProduceUnitId = new JsonObject();
|
||||
fProduceUnitId.addProperty("FNumber", "jian");
|
||||
@ -1512,13 +1451,13 @@ public class BomDetailsController extends BaseController {
|
||||
String jsonData = json.toString();
|
||||
System.out.println(jsonData);
|
||||
try {
|
||||
//业务对象标识
|
||||
// 业务对象标识
|
||||
String formId = "BD_MATERIAL";
|
||||
//调用接口
|
||||
// 调用接口
|
||||
String resultJson = client.save(formId, jsonData);
|
||||
//用于记录结果
|
||||
// 用于记录结果
|
||||
Gson gson = new Gson();
|
||||
//对返回结果进行解析和校验
|
||||
// 对返回结果进行解析和校验
|
||||
RepoRet repoRet = gson.fromJson(resultJson, RepoRet.class);
|
||||
if (repoRet.getResult().getResponseStatus().isIsSuccess()) {
|
||||
System.out.printf("接口返回结果: %s%n", gson.toJson(repoRet.getResult()));
|
||||
@ -1535,7 +1474,7 @@ public class BomDetailsController extends BaseController {
|
||||
return 1;
|
||||
}
|
||||
|
||||
//创建电气物料
|
||||
// 创建电气物料
|
||||
public int loadMaterialToDQ(BomDetails bomDetails1, String states) {
|
||||
K3CloudApi client = new K3CloudApi();
|
||||
// 创建一个空的JsonObject
|
||||
@ -1549,7 +1488,7 @@ public class BomDetailsController extends BaseController {
|
||||
|
||||
// 添加Model字段
|
||||
model.addProperty("FMATERIALID", 0);
|
||||
model.addProperty("FSpecification", bomDetails1.getRemarks());//备注仓库
|
||||
model.addProperty("FSpecification", bomDetails1.getRemarks());// 备注仓库
|
||||
model.addProperty("FNumber", bomDetails1.getPartNumber());
|
||||
model.addProperty("FName", bomDetails1.getName());
|
||||
MaterialProperties materialProperties = iMaterialPropertiesService.selectByAttribute(bomDetails1.getMaterial());
|
||||
@ -1558,7 +1497,7 @@ public class BomDetailsController extends BaseController {
|
||||
FSVRIAssistant.addProperty("FNumber", materialProperties.getMaterialAttributeId());
|
||||
model.add("F_SVRI_Assistant", FSVRIAssistant);
|
||||
} else {
|
||||
//没写材料为默认为空
|
||||
// 没写材料为默认为空
|
||||
JsonObject FSVRIAssistant = new JsonObject();
|
||||
FSVRIAssistant.addProperty("FNumber", "17");
|
||||
model.add("F_SVRI_Assistant", FSVRIAssistant);
|
||||
@ -1594,7 +1533,7 @@ public class BomDetailsController extends BaseController {
|
||||
|
||||
// 创建FBaseUnitId对象,并加入SubHeadEntity
|
||||
JsonObject fBaseUnitId = new JsonObject();
|
||||
switch (bomDetails1.getWareHouse()) {//单位
|
||||
switch (bomDetails1.getWareHouse()) {// 单位
|
||||
case "把":
|
||||
fBaseUnitId.addProperty("FNumber", "002");
|
||||
break;
|
||||
@ -1692,7 +1631,7 @@ public class BomDetailsController extends BaseController {
|
||||
subHeadEntity1.addProperty("FUnitConvertDir", "1");
|
||||
|
||||
// 创建FStockId对象,并加入SubHeadEntity1
|
||||
//仓库代码为 半成品库007
|
||||
// 仓库代码为 半成品库007
|
||||
JsonObject fStockId = new JsonObject();
|
||||
fStockId.addProperty("FNumber", "007");
|
||||
subHeadEntity1.add("FStockId", fStockId);
|
||||
@ -1799,29 +1738,27 @@ public class BomDetailsController extends BaseController {
|
||||
|
||||
JsonObject subHeadEntity6 = new JsonObject();
|
||||
model.add("SubHeadEntity6", subHeadEntity6);
|
||||
//不同的属性不同的检验方案
|
||||
// 不同的属性不同的检验方案
|
||||
if (states.equals("1")) {
|
||||
//外购
|
||||
// 外购
|
||||
subHeadEntity6.addProperty("FCheckIncoming", true);
|
||||
}
|
||||
if (states.equals("2")) {
|
||||
//自制
|
||||
// 自制
|
||||
subHeadEntity6.addProperty("FCheckProduct", true);
|
||||
subHeadEntity6.addProperty("FCheckReturnMtrl", true);
|
||||
}
|
||||
if (states.equals("3")) {
|
||||
//委外
|
||||
// 委外
|
||||
subHeadEntity6.addProperty("FCheckIncoming", true);
|
||||
subHeadEntity6.addProperty("FCheckProduct", true);
|
||||
subHeadEntity6.addProperty("FCheckReturnMtrl", true);
|
||||
}
|
||||
|
||||
|
||||
// 创建SubHeadEntity5对象,并加入Model
|
||||
JsonObject subHeadEntity5 = new JsonObject();
|
||||
model.add("SubHeadEntity5", subHeadEntity5);
|
||||
|
||||
|
||||
// 创建FProduceUnitId对象,并加入SubHeadEntity5
|
||||
JsonObject fProduceUnitId = new JsonObject();
|
||||
switch (bomDetails1.getWareHouse()) {
|
||||
@ -1928,13 +1865,13 @@ public class BomDetailsController extends BaseController {
|
||||
String jsonData = json.toString();
|
||||
System.out.println(jsonData);
|
||||
try {
|
||||
//业务对象标识
|
||||
// 业务对象标识
|
||||
String formId = "BD_MATERIAL";
|
||||
//调用接口
|
||||
// 调用接口
|
||||
String resultJson = client.save(formId, jsonData);
|
||||
//用于记录结果
|
||||
// 用于记录结果
|
||||
Gson gson = new Gson();
|
||||
//对返回结果进行解析和校验
|
||||
// 对返回结果进行解析和校验
|
||||
RepoRet repoRet = gson.fromJson(resultJson, RepoRet.class);
|
||||
if (repoRet.getResult().getResponseStatus().isIsSuccess()) {
|
||||
System.out.printf("接口返回结果: %s%n", gson.toJson(repoRet.getResult()));
|
||||
@ -1951,5 +1888,4 @@ public class BomDetailsController extends BaseController {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,107 @@
|
||||
package com.ruoyi.system.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.constraints.*;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import com.ruoyi.common.annotation.RepeatSubmit;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.validate.AddGroup;
|
||||
import com.ruoyi.common.core.validate.EditGroup;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.system.domain.vo.EleMaterialsVo;
|
||||
import com.ruoyi.system.domain.bo.EleMaterialsBo;
|
||||
import com.ruoyi.system.service.IEleMaterialsService;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 电器物料管理
|
||||
*
|
||||
* @author tzy
|
||||
* @date 2024-12-28
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/system/materials")
|
||||
public class EleMaterialsController extends BaseController {
|
||||
|
||||
private final IEleMaterialsService iEleMaterialsService;
|
||||
|
||||
/**
|
||||
* 查询电器物料管理列表
|
||||
*/
|
||||
@SaCheckPermission("system:materials:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<EleMaterialsVo> list(EleMaterialsBo bo, PageQuery pageQuery) {
|
||||
return iEleMaterialsService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出电器物料管理列表
|
||||
*/
|
||||
@SaCheckPermission("system:materials:export")
|
||||
@Log(title = "电器物料管理", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(EleMaterialsBo bo, HttpServletResponse response) {
|
||||
List<EleMaterialsVo> list = iEleMaterialsService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "电器物料管理", EleMaterialsVo.class, response);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取电器物料管理详细信息
|
||||
*
|
||||
* @param id 主键
|
||||
*/
|
||||
@SaCheckPermission("system:materials:query")
|
||||
@GetMapping("/{id}")
|
||||
public R<EleMaterialsVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long id) {
|
||||
return R.ok(iEleMaterialsService.queryById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增电器物料管理
|
||||
*/
|
||||
@SaCheckPermission("system:materials:add")
|
||||
@Log(title = "电器物料管理", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody EleMaterialsBo bo) {
|
||||
return toAjax(iEleMaterialsService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改电器物料管理
|
||||
*/
|
||||
@SaCheckPermission("system:materials:edit")
|
||||
@Log(title = "电器物料管理", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody EleMaterialsBo bo) {
|
||||
return toAjax(iEleMaterialsService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除电器物料管理
|
||||
*
|
||||
* @param ids 主键串
|
||||
*/
|
||||
@SaCheckPermission("system:materials:remove")
|
||||
@Log(title = "电器物料管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] ids) {
|
||||
return toAjax(iEleMaterialsService.deleteWithValidByIds(Arrays.asList(ids), true));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,141 @@
|
||||
package com.ruoyi.system.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
|
||||
import com.ruoyi.common.excel.ExcelResult;
|
||||
import com.ruoyi.system.domain.vo.ProcessRouteVo;
|
||||
import com.ruoyi.system.domain.vo.ProductionOrderVo;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.constraints.*;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import com.ruoyi.common.annotation.RepeatSubmit;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.validate.AddGroup;
|
||||
import com.ruoyi.common.core.validate.EditGroup;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.system.domain.vo.NewMaterialsVo;
|
||||
import com.ruoyi.system.domain.bo.NewMaterialsBo;
|
||||
import com.ruoyi.system.service.INewMaterialsService;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
/**
|
||||
* 金蝶物料管理
|
||||
*
|
||||
* @author 田志阳
|
||||
* @date 2025-01-04
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/system/newMaterials")
|
||||
public class NewMaterialsController extends BaseController {
|
||||
|
||||
private final INewMaterialsService iNewMaterialsService;
|
||||
private static final Logger log = LoggerFactory.getLogger(NewMaterialsController.class);
|
||||
|
||||
/**
|
||||
* 查询金蝶物料管理列表
|
||||
*/
|
||||
@SaCheckPermission("system:newMaterials:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<NewMaterialsVo> list(NewMaterialsBo bo, PageQuery pageQuery) {
|
||||
return iNewMaterialsService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出金蝶物料管理列表
|
||||
*/
|
||||
@SaCheckPermission("system:newMaterials:export")
|
||||
@Log(title = "金蝶物料管理", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(NewMaterialsBo bo, HttpServletResponse response) {
|
||||
List<NewMaterialsVo> list = iNewMaterialsService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "金蝶物料管理", NewMaterialsVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取金蝶物料管理详细信息
|
||||
*
|
||||
* @param id 主键
|
||||
*/
|
||||
@SaCheckPermission("system:newMaterials:query")
|
||||
@GetMapping("/{id}")
|
||||
public R<NewMaterialsVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long id) {
|
||||
return R.ok(iNewMaterialsService.queryById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增金蝶物料管理
|
||||
*/
|
||||
@SaCheckPermission("system:newMaterials:add")
|
||||
@Log(title = "金蝶物料管理", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody NewMaterialsBo bo) {
|
||||
return toAjax(iNewMaterialsService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改金蝶物料管理
|
||||
*/
|
||||
@SaCheckPermission("system:newMaterials:edit")
|
||||
@Log(title = "金蝶物料管理", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody NewMaterialsBo bo) {
|
||||
return toAjax(iNewMaterialsService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除金蝶物料管理
|
||||
*
|
||||
* @param ids 主键串
|
||||
*/
|
||||
@SaCheckPermission("system:newMaterials:remove")
|
||||
@Log(title = "金蝶物料管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] ids) {
|
||||
return toAjax(iNewMaterialsService.deleteWithValidByIds(Arrays.asList(ids), true));
|
||||
}
|
||||
/**
|
||||
* 新增金蝶物料管理
|
||||
*/
|
||||
@SaCheckPermission("system:newMaterials:add")
|
||||
@Log(title = "金蝶物料管理", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping("/addToK3")
|
||||
public R<Void> addToK3() {
|
||||
List<NewMaterialsVo> newMaterialsVos = iNewMaterialsService.addToJindie();
|
||||
return R.ok();
|
||||
}
|
||||
@Log(title = "物料导入", businessType = BusinessType.IMPORT)
|
||||
@SaCheckPermission("system:newMaterials:import")
|
||||
@PostMapping(value = "/importData", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
||||
public R<Void> importData(@RequestParam("file") MultipartFile file) throws Exception {
|
||||
String originalFilename = file.getOriginalFilename();
|
||||
log.info("读取文件名: " + originalFilename);
|
||||
ExcelResult<NewMaterialsVo> result = ExcelUtil.importExcelSheet1(file.getInputStream(), NewMaterialsVo.class,
|
||||
true);
|
||||
|
||||
if (iNewMaterialsService.saveData(result.getList())) {
|
||||
return R.ok("上传物料成功");
|
||||
} else {
|
||||
return R.fail("导入失败");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -58,7 +58,64 @@ public class ProcessRouteController extends BaseController {
|
||||
private Long generateUniqueParentId(Long originalId) {
|
||||
return originalId + 1000;
|
||||
}
|
||||
/**
|
||||
* 主动更新可用库存
|
||||
*/
|
||||
@SaCheckPermission("system:route:list")
|
||||
@GetMapping("/list2")
|
||||
public TableDataInfo<ProcessRouteVo> list2(ProcessRouteBo bo, PageQuery pageQuery) {
|
||||
try {
|
||||
// 查询工艺路线数据
|
||||
TableDataInfo<ProcessRouteVo> processRouteVoTableDataInfo = iProcessRouteService.queryPageList2(bo,
|
||||
pageQuery);
|
||||
// 用于存储父子关系的Map,key为"物料编码_物料名称",值为父级ProcessRouteVo
|
||||
Map<String, ProcessRouteVo> routeMap = new HashMap<>();
|
||||
// 存储顶级列表
|
||||
List<ProcessRouteVo> topLevelList = new ArrayList<>();
|
||||
// 获取查询返回的行数据
|
||||
List<ProcessRouteVo> rows = processRouteVoTableDataInfo.getRows();
|
||||
// 遍历所有工艺路线记录
|
||||
for (ProcessRouteVo processRouteVo : rows) {
|
||||
// 组合父级键值,物料编码 + 物料名称
|
||||
String parentCodeAndName = String.format("%s_%s", processRouteVo.getMaterialCode(),
|
||||
processRouteVo.getMaterialName());
|
||||
// 查找是否已存在父节点
|
||||
ProcessRouteVo parent = routeMap.get(parentCodeAndName);
|
||||
if (parent == null) {
|
||||
// 如果父节点不存在,创建并初始化
|
||||
parent = new ProcessRouteVo();
|
||||
parent.setId(generateUniqueParentId(processRouteVo.getId()));
|
||||
parent.setRouteDescription(processRouteVo.getRouteDescription());
|
||||
// parent.setParentId((Long.valueOf(generateUniqueParentId(processRouteVo.getId()))));
|
||||
parent.setMaterialCode(processRouteVo.getMaterialCode());
|
||||
parent.setMaterialName(processRouteVo.getMaterialName());
|
||||
parent.setMaterial(processRouteVo.getMaterial());
|
||||
parent.setDiscWeight(processRouteVo.getDiscWeight());
|
||||
parent.setFirstBatchQuantity(processRouteVo.getFirstBatchQuantity());
|
||||
|
||||
// 初始化子节点列表
|
||||
parent.setChildren(new ArrayList<>());
|
||||
// 将父节点放入Map中
|
||||
routeMap.put(parentCodeAndName, parent);
|
||||
// 将父节点加入顶级列表
|
||||
topLevelList.add(parent);
|
||||
}
|
||||
// 创建子节点,并将其添加到父节点的子集
|
||||
ProcessRouteVo child = createChildVo(processRouteVo, parent.getId(), parent.getMaterialCode(),
|
||||
parent.getMaterialName());
|
||||
parent.getChildren().add(child);
|
||||
}
|
||||
|
||||
// 设置返回的rows为顶级节点列表
|
||||
processRouteVoTableDataInfo.setRows(topLevelList);
|
||||
|
||||
// 返回构建后的数据
|
||||
return processRouteVoTableDataInfo;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return new TableDataInfo<>();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 查询工艺路线列表
|
||||
*/
|
||||
@ -92,6 +149,7 @@ public class ProcessRouteController extends BaseController {
|
||||
parent.setMaterialName(processRouteVo.getMaterialName());
|
||||
parent.setMaterial(processRouteVo.getMaterial());
|
||||
parent.setDiscWeight(processRouteVo.getDiscWeight());
|
||||
parent.setFirstBatchQuantity(processRouteVo.getFirstBatchQuantity());
|
||||
|
||||
// 初始化子节点列表
|
||||
parent.setChildren(new ArrayList<>());
|
||||
@ -138,7 +196,6 @@ public class ProcessRouteController extends BaseController {
|
||||
child.setActivityUnit(processRouteVo.getActivityUnit());
|
||||
child.setUnitQuantity(processRouteVo.getUnitQuantity());
|
||||
child.setBatchQuantity(processRouteVo.getBatchQuantity());
|
||||
child.setFirstBatchQuantity(processRouteVo.getFirstBatchQuantity());
|
||||
child.setPlanStartTime(processRouteVo.getPlanStartTime());
|
||||
child.setPlanEndTime(processRouteVo.getPlanEndTime());
|
||||
child.setXuStartTime(processRouteVo.getXuStartTime());
|
||||
@ -244,7 +301,7 @@ public class ProcessRouteController extends BaseController {
|
||||
* 查询工艺表中所有的需要做工艺的物料
|
||||
*
|
||||
* @return
|
||||
* RequestBody List<ProcessRouteVo> routeVoList
|
||||
* RequestBody List<ProcessRouteVo> routeVoList
|
||||
*/
|
||||
public List<ProcessRoute> getProcessRouteList(@RequestParam String rooteProdet) {
|
||||
List<ProcessRoute> list = iProcessRouteService.pushRawMater(rooteProdet);
|
||||
|
||||
@ -0,0 +1,60 @@
|
||||
package com.ruoyi.system.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
|
||||
/**
|
||||
* 电器物料管理对象 ele_materials
|
||||
*
|
||||
* @author tzy
|
||||
* @date 2024-12-28
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("ele_materials")
|
||||
public class EleMaterials extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@TableId(value = "id")
|
||||
private Long id;
|
||||
/**
|
||||
* 序号
|
||||
*/
|
||||
private Long serialNumber;
|
||||
/**
|
||||
* 物料编码
|
||||
*/
|
||||
private String materialCode;
|
||||
/**
|
||||
* 物料名称
|
||||
*/
|
||||
private String materialName;
|
||||
/**
|
||||
* 型号
|
||||
*/
|
||||
private String model;
|
||||
/**
|
||||
* 材质
|
||||
*/
|
||||
private String materialType;
|
||||
/**
|
||||
* 单位
|
||||
*/
|
||||
private String unit;
|
||||
/**
|
||||
* 品牌
|
||||
*/
|
||||
private String brand;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remarks;
|
||||
|
||||
}
|
||||
@ -0,0 +1,72 @@
|
||||
package com.ruoyi.system.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
|
||||
/**
|
||||
* 金蝶物料管理对象 new_materials
|
||||
*
|
||||
* @author 田志阳
|
||||
* @date 2025-01-04
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("new_materials")
|
||||
public class NewMaterials extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId(value = "id")
|
||||
private Long id;
|
||||
/**
|
||||
* 序号
|
||||
*/
|
||||
private Long serialNumber;
|
||||
/**
|
||||
* 物料编码
|
||||
*/
|
||||
private String materialCode;
|
||||
/**
|
||||
* 物料名称
|
||||
*/
|
||||
private String materialName;
|
||||
/**
|
||||
* 型号
|
||||
*/
|
||||
private String materialModel;
|
||||
/**
|
||||
* 材质
|
||||
*/
|
||||
private String materialType;
|
||||
/**
|
||||
* 单位
|
||||
*/
|
||||
private String materialUnit;
|
||||
/**
|
||||
* 品牌
|
||||
*/
|
||||
private String materialBrand;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remarks;
|
||||
/**
|
||||
* 属性
|
||||
*/
|
||||
private String materialAttribute;
|
||||
/**
|
||||
* 是否存在
|
||||
*/
|
||||
private String existsStatus;
|
||||
/**
|
||||
* 物料分类
|
||||
*/
|
||||
private String materialClassify;
|
||||
|
||||
}
|
||||
@ -105,7 +105,7 @@ public class ProcessRoute extends BaseEntity {
|
||||
/**
|
||||
* 首批数量
|
||||
*/
|
||||
private Long firstBatchQuantity;
|
||||
private Double firstBatchQuantity;
|
||||
|
||||
/**
|
||||
* 计划开始时间
|
||||
|
||||
@ -7,6 +7,7 @@ import com.ruoyi.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
@ -50,6 +51,37 @@ public class WlStockData extends BaseEntity {
|
||||
/**
|
||||
* 单据类型 (1: 最高库存单, 0: 最低库存单)
|
||||
*/
|
||||
private Integer documentType;
|
||||
|
||||
private String documentType;
|
||||
/**
|
||||
* 可用库存
|
||||
*/
|
||||
private BigDecimal availableStock;
|
||||
/**
|
||||
* 库存量
|
||||
*/
|
||||
private BigDecimal secAvbqty;
|
||||
/**
|
||||
* 生产订单数量
|
||||
*/
|
||||
private BigDecimal productionQty;
|
||||
/**
|
||||
* 采购订单数量
|
||||
*/
|
||||
private BigDecimal purchaseQty;
|
||||
/**
|
||||
* 预留量
|
||||
*/
|
||||
private BigDecimal secQty;
|
||||
/**
|
||||
* 最大安全库存
|
||||
*/
|
||||
private BigDecimal maxsafetyStock;
|
||||
/**
|
||||
* 最低安全库存
|
||||
*/
|
||||
private BigDecimal minsafetyStock;
|
||||
/**
|
||||
* 金蝶单据编码
|
||||
*/
|
||||
private String doucCode;
|
||||
}
|
||||
|
||||
@ -0,0 +1,77 @@
|
||||
package com.ruoyi.system.domain.bo;
|
||||
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
import com.ruoyi.common.core.validate.AddGroup;
|
||||
import com.ruoyi.common.core.validate.EditGroup;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
|
||||
/**
|
||||
* 电器物料管理业务对象 ele_materials
|
||||
*
|
||||
* @author tzy
|
||||
* @date 2024-12-28
|
||||
*/
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class EleMaterialsBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@NotNull(message = "不能为空", groups = { EditGroup.class })
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 序号
|
||||
*/
|
||||
@NotNull(message = "序号不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Long serialNumber;
|
||||
|
||||
/**
|
||||
* 物料编码
|
||||
*/
|
||||
@NotBlank(message = "物料编码不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String materialCode;
|
||||
|
||||
/**
|
||||
* 物料名称
|
||||
*/
|
||||
@NotBlank(message = "物料名称不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String materialName;
|
||||
|
||||
/**
|
||||
* 型号
|
||||
*/
|
||||
@NotBlank(message = "型号不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String model;
|
||||
|
||||
/**
|
||||
* 材质
|
||||
*/
|
||||
@NotBlank(message = "材质不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String materialType;
|
||||
|
||||
/**
|
||||
* 单位
|
||||
*/
|
||||
@NotBlank(message = "单位不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String unit;
|
||||
|
||||
/**
|
||||
* 品牌
|
||||
*/
|
||||
@NotBlank(message = "品牌不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String brand;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@NotBlank(message = "备注不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String remarks;
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,95 @@
|
||||
package com.ruoyi.system.domain.bo;
|
||||
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
import com.ruoyi.common.core.validate.AddGroup;
|
||||
import com.ruoyi.common.core.validate.EditGroup;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
|
||||
/**
|
||||
* 金蝶物料管理业务对象 new_materials
|
||||
*
|
||||
* @author 田志阳
|
||||
* @date 2025-01-04
|
||||
*/
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class NewMaterialsBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@NotNull(message = "id不能为空", groups = { EditGroup.class })
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 序号
|
||||
*/
|
||||
@NotNull(message = "序号不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Long serialNumber;
|
||||
|
||||
/**
|
||||
* 物料编码
|
||||
*/
|
||||
@NotBlank(message = "物料编码不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String materialCode;
|
||||
|
||||
/**
|
||||
* 物料名称
|
||||
*/
|
||||
@NotBlank(message = "物料名称不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String materialName;
|
||||
|
||||
/**
|
||||
* 型号
|
||||
*/
|
||||
@NotBlank(message = "型号不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String materialModel;
|
||||
|
||||
/**
|
||||
* 材质
|
||||
*/
|
||||
@NotBlank(message = "材质不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String materialType;
|
||||
|
||||
/**
|
||||
* 单位
|
||||
*/
|
||||
@NotBlank(message = "单位不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String materialUnit;
|
||||
|
||||
/**
|
||||
* 品牌
|
||||
*/
|
||||
@NotBlank(message = "品牌不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String materialBrand;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@NotBlank(message = "备注不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String remarks;
|
||||
|
||||
/**
|
||||
* 属性
|
||||
*/
|
||||
@NotBlank(message = "属性不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String materialAttribute;
|
||||
|
||||
/**
|
||||
* 是否存在
|
||||
*/
|
||||
@NotBlank(message = "是否存在不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String existsStatus;
|
||||
|
||||
/**
|
||||
* 物料分类
|
||||
*/
|
||||
@NotBlank(message = "物料分类不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String materialClassify;
|
||||
|
||||
|
||||
}
|
||||
@ -127,7 +127,7 @@ public class ProcessRouteBo extends BaseEntity {
|
||||
/**
|
||||
* 首批数量
|
||||
*/
|
||||
private Long firstBatchQuantity;
|
||||
private Double firstBatchQuantity;
|
||||
/**
|
||||
* 计划开始时间
|
||||
*/
|
||||
|
||||
@ -8,6 +8,7 @@ import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
@ -60,7 +61,52 @@ public class WlStockDataBo extends BaseEntity {
|
||||
/**
|
||||
* 单据类型 (1: 最高库存单, 0: 最低库存单)
|
||||
*/
|
||||
private Integer documentType;
|
||||
private String documentType;
|
||||
|
||||
/**
|
||||
* 可用库存
|
||||
*/
|
||||
@NotNull(message = "可用库存不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private BigDecimal availableStock;
|
||||
|
||||
/**
|
||||
* 库存量
|
||||
*/
|
||||
@NotNull(message = "库存量不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private BigDecimal secAvbqty;
|
||||
|
||||
/**
|
||||
* 生产订单数量
|
||||
*/
|
||||
@NotNull(message = "生产订单数量不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private BigDecimal productionQty;
|
||||
|
||||
/**
|
||||
* 采购订单数量
|
||||
*/
|
||||
@NotNull(message = "采购订单数量不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private BigDecimal purchaseQty;
|
||||
|
||||
/**
|
||||
* 预留量
|
||||
*/
|
||||
@NotNull(message = "预留量不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private BigDecimal secQty;
|
||||
|
||||
/**
|
||||
* 最大安全库存
|
||||
*/
|
||||
@NotNull(message = "最大安全库存不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private BigDecimal maxsafetyStock;
|
||||
|
||||
/**
|
||||
* 最低安全库存
|
||||
*/
|
||||
@NotNull(message = "最低安全库存不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private BigDecimal minsafetyStock;
|
||||
/**
|
||||
* 金蝶单据编码
|
||||
*/
|
||||
@NotBlank(message = "金蝶单据编码不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String doucCode;
|
||||
}
|
||||
|
||||
@ -0,0 +1,24 @@
|
||||
package com.ruoyi.system.domain.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class InvReserveAnalyzeRptDTO {
|
||||
@JsonProperty("FMATERIALNUMBER")
|
||||
private String FMATERIALNUMBER;
|
||||
@JsonProperty("FMaterialName")
|
||||
private String FMaterialName;
|
||||
@JsonProperty("FDemandTypeName")
|
||||
private String FDemandTypeName;
|
||||
/**
|
||||
* 预留量
|
||||
*/
|
||||
@JsonProperty("FSecQty")
|
||||
private Double FSecQty;
|
||||
/**
|
||||
* 可用库存
|
||||
*/
|
||||
@JsonProperty("FSecAVBQty")
|
||||
private Double FSecAVBQty;
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
package com.ruoyi.system.domain.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ProMoDTO {
|
||||
@JsonProperty("FMaterialId.FNumber")
|
||||
private String FMaterialIdFNumber;
|
||||
@JsonProperty("FMaterialName")
|
||||
private String FMaterialName;
|
||||
@JsonProperty("FQty")
|
||||
private Double FQty;
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
package com.ruoyi.system.domain.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class PurchaseOrderDTO {
|
||||
@JsonProperty("FMaterialId.FNumber")
|
||||
private String FMaterialIdFNumber;
|
||||
@JsonProperty("FMaterialName")
|
||||
private String FMaterialName;
|
||||
@JsonProperty("FQty")
|
||||
private Double FQty;
|
||||
}
|
||||
@ -0,0 +1,77 @@
|
||||
package com.ruoyi.system.domain.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.ruoyi.common.annotation.ExcelDictFormat;
|
||||
import com.ruoyi.common.convert.ExcelDictConvert;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
/**
|
||||
* 电器物料管理视图对象 ele_materials
|
||||
*
|
||||
* @author tzy
|
||||
* @date 2024-12-28
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class EleMaterialsVo {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ExcelProperty(value = "id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 序号
|
||||
*/
|
||||
@ExcelProperty(value = "序号")
|
||||
private Long serialNumber;
|
||||
|
||||
/**
|
||||
* 物料编码
|
||||
*/
|
||||
@ExcelProperty(value = "物料编码")
|
||||
private String materialCode;
|
||||
|
||||
/**
|
||||
* 物料名称
|
||||
*/
|
||||
@ExcelProperty(value = "物料名称")
|
||||
private String materialName;
|
||||
|
||||
/**
|
||||
* 型号
|
||||
*/
|
||||
@ExcelProperty(value = "型号")
|
||||
private String model;
|
||||
|
||||
/**
|
||||
* 材质
|
||||
*/
|
||||
@ExcelProperty(value = "材质")
|
||||
private String materialType;
|
||||
|
||||
/**
|
||||
* 单位
|
||||
*/
|
||||
@ExcelProperty(value = "单位")
|
||||
private String unit;
|
||||
|
||||
/**
|
||||
* 品牌
|
||||
*/
|
||||
@ExcelProperty(value = "品牌")
|
||||
private String brand;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ExcelProperty(value = "备注")
|
||||
private String remarks;
|
||||
|
||||
|
||||
}
|
||||
@ -1,10 +1,7 @@
|
||||
package com.ruoyi.system.domain.vo;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.ruoyi.common.annotation.ExcelDictFormat;
|
||||
import com.ruoyi.common.convert.ExcelDictConvert;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,95 @@
|
||||
package com.ruoyi.system.domain.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.ruoyi.common.annotation.ExcelDictFormat;
|
||||
import com.ruoyi.common.convert.ExcelDictConvert;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
/**
|
||||
* 金蝶物料管理视图对象 new_materials
|
||||
*
|
||||
* @author 田志阳
|
||||
* @date 2025-01-04
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class NewMaterialsVo {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@ExcelProperty(value = "id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 序号
|
||||
*/
|
||||
@ExcelProperty(value = "序号")
|
||||
private Long serialNumber;
|
||||
|
||||
/**
|
||||
* 物料编码
|
||||
*/
|
||||
@ExcelProperty(value = "物料编码")
|
||||
private String materialCode;
|
||||
|
||||
/**
|
||||
* 物料名称
|
||||
*/
|
||||
@ExcelProperty(value = "物料名称")
|
||||
private String materialName;
|
||||
|
||||
/**
|
||||
* 型号
|
||||
*/
|
||||
@ExcelProperty(value = "型号")
|
||||
private String materialModel;
|
||||
|
||||
/**
|
||||
* 材质
|
||||
*/
|
||||
@ExcelProperty(value = "材质")
|
||||
private String materialType;
|
||||
|
||||
/**
|
||||
* 单位
|
||||
*/
|
||||
@ExcelProperty(value = "单位")
|
||||
private String materialUnit;
|
||||
|
||||
/**
|
||||
* 品牌
|
||||
*/
|
||||
@ExcelProperty(value = "品牌")
|
||||
private String materialBrand;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ExcelProperty(value = "备注")
|
||||
private String remarks;
|
||||
|
||||
/**
|
||||
* 属性
|
||||
*/
|
||||
@ExcelProperty(value = "属性")
|
||||
private String materialAttribute;
|
||||
|
||||
/**
|
||||
* 是否存在
|
||||
*/
|
||||
@ExcelProperty(value = "是否存在")
|
||||
private String existsStatus;
|
||||
|
||||
/**
|
||||
* 物料分类
|
||||
*/
|
||||
@ExcelProperty(value = "物料分类")
|
||||
private String materialClassify;
|
||||
|
||||
|
||||
}
|
||||
@ -150,7 +150,7 @@ public class ProcessRouteVo {
|
||||
* 首批数量
|
||||
*/
|
||||
|
||||
private Long firstBatchQuantity;
|
||||
private Double firstBatchQuantity;
|
||||
/**
|
||||
* 计划开始时间
|
||||
*/
|
||||
|
||||
@ -49,4 +49,10 @@ public class SafetyStockVo {
|
||||
|
||||
@ExcelProperty(value = "即时库存")
|
||||
private Double currentStock;
|
||||
/**
|
||||
* 金蝶单据编码
|
||||
*/
|
||||
@ExcelProperty(value = "金蝶单据编码")
|
||||
private String doucCode;
|
||||
|
||||
}
|
||||
|
||||
@ -4,6 +4,7 @@ import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
@ -54,10 +55,53 @@ public class WlStockDataVo {
|
||||
@ExcelProperty(value = "触发时间")
|
||||
private Date triggerTime;
|
||||
|
||||
|
||||
/**
|
||||
* 可用库存
|
||||
*/
|
||||
@ExcelProperty(value = "可用库存")
|
||||
private BigDecimal availableStock;
|
||||
|
||||
/**
|
||||
* 库存量
|
||||
*/
|
||||
@ExcelProperty(value = "库存量")
|
||||
private BigDecimal secAvbqty;
|
||||
|
||||
/**
|
||||
* 生产订单数量
|
||||
*/
|
||||
@ExcelProperty(value = "生产订单数量")
|
||||
private BigDecimal productionQty;
|
||||
|
||||
/**
|
||||
* 采购订单数量
|
||||
*/
|
||||
@ExcelProperty(value = "采购订单数量")
|
||||
private BigDecimal purchaseQty;
|
||||
|
||||
/**
|
||||
* 预留量
|
||||
*/
|
||||
@ExcelProperty(value = "预留量")
|
||||
private BigDecimal secQty;
|
||||
|
||||
/**
|
||||
* 最大安全库存
|
||||
*/
|
||||
@ExcelProperty(value = "最大安全库存")
|
||||
private BigDecimal maxsafetyStock;
|
||||
|
||||
/**
|
||||
* 最低安全库存
|
||||
*/
|
||||
@ExcelProperty(value = "最低安全库存")
|
||||
private BigDecimal minsafetyStock;
|
||||
|
||||
/**
|
||||
* 单据类型 (1: 最高库存单, 0: 最低库存单)
|
||||
*/
|
||||
private Integer documentType;
|
||||
|
||||
@ExcelProperty(value = "金蝶相关数据")
|
||||
private String documentType;
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,15 @@
|
||||
package com.ruoyi.system.mapper;
|
||||
|
||||
import com.ruoyi.system.domain.EleMaterials;
|
||||
import com.ruoyi.system.domain.vo.EleMaterialsVo;
|
||||
import com.ruoyi.common.core.mapper.BaseMapperPlus;
|
||||
|
||||
/**
|
||||
* 电器物料管理Mapper接口
|
||||
*
|
||||
* @author tzy
|
||||
* @date 2024-12-28
|
||||
*/
|
||||
public interface EleMaterialsMapper extends BaseMapperPlus<EleMaterialsMapper, EleMaterials, EleMaterialsVo> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
package com.ruoyi.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.ruoyi.system.domain.NewMaterials;
|
||||
import com.ruoyi.system.domain.vo.NewMaterialsVo;
|
||||
import com.ruoyi.common.core.mapper.BaseMapperPlus;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 金蝶物料管理Mapper接口
|
||||
*
|
||||
* @author 田志阳
|
||||
* @date 2025-01-04
|
||||
*/
|
||||
public interface NewMaterialsMapper extends BaseMapperPlus<NewMaterialsMapper, NewMaterials, NewMaterialsVo> {
|
||||
|
||||
|
||||
}
|
||||
@ -6,15 +6,22 @@ import com.google.gson.Gson;
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.kingdee.bos.webapi.entity.RepoRet;
|
||||
import com.kingdee.bos.webapi.sdk.K3CloudApi;
|
||||
import com.ruoyi.system.domain.dto.PlanPrcessNumDTO;
|
||||
import com.ruoyi.common.utils.JdUtils;
|
||||
import com.ruoyi.system.domain.BomDetails;
|
||||
import com.ruoyi.system.domain.MaterialProperties;
|
||||
import com.ruoyi.system.domain.dto.*;
|
||||
import com.ruoyi.system.domain.vo.ImMaterialVo;
|
||||
import com.ruoyi.system.domain.vo.PlanOrderVo;
|
||||
import com.ruoyi.system.domain.vo.PlannedProcessVo;
|
||||
import com.ruoyi.system.domain.vo.ProductionRouteTwoVo;
|
||||
import com.ruoyi.system.jdmain.rouplan.Model;
|
||||
import com.ruoyi.system.mapper.ImProductionPlanProMapper;
|
||||
import com.ruoyi.system.service.IImProductionPlanProService;
|
||||
import com.ruoyi.system.service.IProcessRouteService;
|
||||
import org.aspectj.bridge.MessageUtil;
|
||||
import org.checkerframework.checker.units.qual.A;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
@ -25,16 +32,18 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.ruoyi.common.core.domain.R.fail;
|
||||
|
||||
public class JdUtil {
|
||||
@Resource
|
||||
private ImProductionPlanProMapper imProductionPlanProMapper;
|
||||
@Resource
|
||||
private IImProductionPlanProService imProductionPlanProService;
|
||||
|
||||
//入库状态
|
||||
// 入库状态
|
||||
public static JsonArray storageProduce(String number, String FMaterialIdCode) {
|
||||
K3CloudApi client = new K3CloudApi();
|
||||
//请求参数,要求为json字符串
|
||||
// 请求参数,要求为json字符串
|
||||
JsonObject json = new JsonObject();
|
||||
json.addProperty("FormId", "STK_InStock");
|
||||
json.addProperty("FieldKeys", "F_UCHN_Text2,FMaterialId.FNumber,FMaterialName,FRealQty,FDocumentStatus");
|
||||
@ -57,10 +66,10 @@ public class JdUtil {
|
||||
filterObject1.addProperty("Logic", 0);
|
||||
filterString.add(filterObject1);
|
||||
json.add("FilterString", filterString);
|
||||
json.addProperty("OrderString", "");//排序字段,字符串类型
|
||||
json.addProperty("TopRowCount", 0);//返回总行数,整型
|
||||
json.addProperty("StartRow", 0);//开始行索引,整型
|
||||
json.addProperty("Limit", 1000);//最大行数,整型,不能超过10000(
|
||||
json.addProperty("OrderString", "");// 排序字段,字符串类型
|
||||
json.addProperty("TopRowCount", 0);// 返回总行数,整型
|
||||
json.addProperty("StartRow", 0);// 开始行索引,整型
|
||||
json.addProperty("Limit", 1000);// 最大行数,整型,不能超过10000(
|
||||
json.addProperty("SubSystemId", "");
|
||||
|
||||
String jsonData = json.toString();
|
||||
@ -78,9 +87,10 @@ public class JdUtil {
|
||||
}
|
||||
return jsonArray;
|
||||
}
|
||||
|
||||
public static JsonArray storageProduce1(String number, String FMaterialIdCode) {
|
||||
K3CloudApi client = new K3CloudApi();
|
||||
//请求参数,要求为json字符串
|
||||
// 请求参数,要求为json字符串
|
||||
JsonObject json = new JsonObject();
|
||||
json.addProperty("FormId", "PRD_INSTOCK");
|
||||
json.addProperty("FieldKeys", "F_UCHN_Text,FMaterialId.FNumber,FMaterialName,FRealQty,FDocumentStatus");
|
||||
@ -103,10 +113,10 @@ public class JdUtil {
|
||||
filterObject1.addProperty("Logic", 0);
|
||||
filterString.add(filterObject1);
|
||||
json.add("FilterString", filterString);
|
||||
json.addProperty("OrderString", "");//排序字段,字符串类型
|
||||
json.addProperty("TopRowCount", 0);//返回总行数,整型
|
||||
json.addProperty("StartRow", 0);//开始行索引,整型
|
||||
json.addProperty("Limit", 1000);//最大行数,整型,不能超过10000(
|
||||
json.addProperty("OrderString", "");// 排序字段,字符串类型
|
||||
json.addProperty("TopRowCount", 0);// 返回总行数,整型
|
||||
json.addProperty("StartRow", 0);// 开始行索引,整型
|
||||
json.addProperty("Limit", 1000);// 最大行数,整型,不能超过10000(
|
||||
json.addProperty("SubSystemId", "");
|
||||
|
||||
String jsonData = json.toString();
|
||||
@ -126,11 +136,11 @@ public class JdUtil {
|
||||
}
|
||||
|
||||
/*
|
||||
查询库存
|
||||
* 查询库存
|
||||
*/
|
||||
public static Map<String, String> selectKuCun(String matrialsCode) {
|
||||
K3CloudApi client = new K3CloudApi();
|
||||
//请求参数,要求为json字符串
|
||||
// 请求参数,要求为json字符串
|
||||
JsonObject json = new JsonObject();
|
||||
json.addProperty("FormId", "STK_Inventory");
|
||||
json.addProperty("FieldKeys", "FMaterialId.FNumber,FMaterialName,FStockName,FStockUnitId.FName,FBaseQty");
|
||||
@ -154,7 +164,7 @@ public class JdUtil {
|
||||
Map<String, String> resultMap = new HashMap<>();
|
||||
|
||||
try {
|
||||
//调用接口
|
||||
// 调用接口
|
||||
String resultJson = String.valueOf(client.executeBillQuery(jsonData));
|
||||
if (resultJson.length() <= 2) {
|
||||
resultMap.put("inventory", "0");
|
||||
@ -190,12 +200,12 @@ public class JdUtil {
|
||||
}
|
||||
|
||||
public static JsonArray selectKuCun1(List<ImMaterialVo> list) {
|
||||
if(list == null || list.isEmpty()) {
|
||||
if (list == null || list.isEmpty()) {
|
||||
return new JsonArray();
|
||||
}
|
||||
|
||||
K3CloudApi client = new K3CloudApi();
|
||||
//请求参数,要求为json字符串
|
||||
// 请求参数,要求为json字符串
|
||||
JsonObject json = new JsonObject();
|
||||
json.addProperty("FormId", "STK_Inventory");
|
||||
json.addProperty("FieldKeys", "FMaterialId.FNumber,FMaterialName,FStockName,FStockUnitId.FName,FBaseQty");
|
||||
@ -222,7 +232,7 @@ public class JdUtil {
|
||||
|
||||
JsonArray jsonArray;
|
||||
try {
|
||||
//调用接口
|
||||
// 调用接口
|
||||
String resultJson = String.valueOf(client.executeBillQuery(jsonData));
|
||||
jsonArray = new Gson().fromJson(resultJson, JsonArray.class);
|
||||
|
||||
@ -231,11 +241,11 @@ public class JdUtil {
|
||||
}
|
||||
return jsonArray;
|
||||
}
|
||||
|
||||
public static BigDecimal selectKuCun2(String matrialsCode) {
|
||||
|
||||
|
||||
K3CloudApi client = new K3CloudApi();
|
||||
//请求参数,要求为json字符串
|
||||
// 请求参数,要求为json字符串
|
||||
JsonObject json = new JsonObject();
|
||||
json.addProperty("FormId", "STK_Inventory");
|
||||
json.addProperty("FieldKeys", "FMaterialId.FNumber,FMaterialName,FStockName,FStockUnitId.FName,FBaseQty");
|
||||
@ -249,7 +259,6 @@ public class JdUtil {
|
||||
filterObject.addProperty("Logic", 0);
|
||||
filterString.add(filterObject);
|
||||
|
||||
|
||||
json.add("FilterString", filterString);
|
||||
json.addProperty("OrderString", "");
|
||||
json.addProperty("TopRowCount", 0);
|
||||
@ -262,16 +271,16 @@ public class JdUtil {
|
||||
BigDecimal fBaseQty = null;
|
||||
|
||||
try {
|
||||
//调用接口
|
||||
// 调用接口
|
||||
String resultJson = String.valueOf(client.billQuery(jsonData));
|
||||
JsonArray jsonArray = new Gson().fromJson(resultJson, JsonArray.class);
|
||||
if (jsonArray != null){
|
||||
if (jsonArray != null) {
|
||||
for (JsonElement jsonElement : jsonArray) {
|
||||
JsonObject asJsonObject = jsonElement.getAsJsonObject();
|
||||
fBaseQty = asJsonObject.get("FBaseQty").getAsBigDecimal();
|
||||
}
|
||||
}else {
|
||||
fBaseQty= BigDecimal.valueOf(0.0);
|
||||
} else {
|
||||
fBaseQty = BigDecimal.valueOf(0.0);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
@ -280,7 +289,6 @@ public class JdUtil {
|
||||
return fBaseQty;
|
||||
}
|
||||
|
||||
|
||||
public static List<Model> getSelecPlan(String rooteProdet) {
|
||||
List<ProductionRouteTwoVo> planOrderList = getSelectProceOrder(rooteProdet);
|
||||
List<PlanPrcessNumDTO> plannedProcesses = new ArrayList<>();
|
||||
@ -288,14 +296,17 @@ public class JdUtil {
|
||||
for (ProductionRouteTwoVo planOrder : planOrderList) {
|
||||
JsonObject json = new JsonObject();
|
||||
json.addProperty("FormId", "SFC_OperationPlanning");
|
||||
json.addProperty("FieldKeys", "FID,FSubEntity_FDetailID,FProductId.FNumber,FOperNumber,FEntity_FEntryID,FProcessId.FName,FSeqNumber,FSeqName,FPlanStartTime,FPlanFinishTime," +
|
||||
"FOperPlanStartTime,FOperPlanFinishTime");
|
||||
json.addProperty("FieldKeys", "F_HBYT_SCLH,FProductId.FNumber,FProductName,FMOQty , FOperNumber,FWorkCenterId.FName ,FProcessId.FName,FOperDescription,FOptCtrlCodeId.FName,FOperQty ,FOperPlanStartTime ,FOperPlanFinishTime,FPlanStartTime,FPlanFinishTime");
|
||||
json.addProperty("FieldKeys",
|
||||
"FID,FSubEntity_FDetailID,FProductId.FNumber,FOperNumber,FEntity_FEntryID,FProcessId.FName,FSeqNumber,FSeqName,FPlanStartTime,FPlanFinishTime,"
|
||||
+
|
||||
"FOperPlanStartTime,FOperPlanFinishTime");
|
||||
json.addProperty("FieldKeys",
|
||||
"F_HBYT_SCLH,FProductId.FNumber,FProductName,FMOQty , FOperNumber,FWorkCenterId.FName ,FProcessId.FName,FOperDescription,FOptCtrlCodeId.FName,FOperQty ,FOperPlanStartTime ,FOperPlanFinishTime,FPlanStartTime,FPlanFinishTime");
|
||||
JsonArray filterString = new JsonArray();
|
||||
JsonObject filterObject = new JsonObject();
|
||||
filterObject.addProperty("FieldName", "FMONumber");
|
||||
filterObject.addProperty("Compare", "="); // 改为等号运算符
|
||||
// filterObject.addProperty("Value", planOrder.getFBillNo());
|
||||
filterObject.addProperty("Compare", "="); // 改为等号运算符
|
||||
// filterObject.addProperty("Value", planOrder.getFBillNo());
|
||||
filterObject.addProperty("Left", "");
|
||||
filterObject.addProperty("Right", "");
|
||||
filterObject.addProperty("Logic", 0);// 从 PlanOrderVo 获取生产令号
|
||||
@ -312,7 +323,7 @@ public class JdUtil {
|
||||
try {
|
||||
String resultJson = String.valueOf(client.billQuery(jsonData));
|
||||
System.out.println(
|
||||
// "生成查询计划订单查询 " + planOrder.getFBillNo() + " 的结果: " + resultJson
|
||||
// "生成查询计划订单查询 " + planOrder.getFBillNo() + " 的结果: " + resultJson
|
||||
);
|
||||
JsonArray jsonArray = new Gson().fromJson(resultJson, JsonArray.class);
|
||||
if (jsonArray == null || jsonArray.size() == 0) {
|
||||
@ -320,8 +331,9 @@ public class JdUtil {
|
||||
}
|
||||
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
List<PlanPrcessNumDTO> plannedProcessList = objectMapper.readValue(jsonArray.toString(), new TypeReference<List<PlanPrcessNumDTO>>() {
|
||||
});
|
||||
List<PlanPrcessNumDTO> plannedProcessList = objectMapper.readValue(jsonArray.toString(),
|
||||
new TypeReference<List<PlanPrcessNumDTO>>() {
|
||||
});
|
||||
if (plannedProcessList != null && !plannedProcessList.isEmpty()) {
|
||||
plannedProcesses.addAll(plannedProcessList);
|
||||
}
|
||||
@ -335,7 +347,7 @@ public class JdUtil {
|
||||
|
||||
public static List<ProductionRouteTwoVo> getSelectProceOrder(String rooteProdet) {
|
||||
K3CloudApi client = new K3CloudApi();
|
||||
//请求参数,要求为json字符串
|
||||
// 请求参数,要求为json字符串
|
||||
JsonObject json = new JsonObject();
|
||||
json.addProperty("FormId", "PRD_MO");
|
||||
json.addProperty("FieldKeys", "F_HBYT_SCLH,FBillNo ,FMaterialId.FNumber,FMaterialName");
|
||||
@ -364,8 +376,9 @@ public class JdUtil {
|
||||
JsonArray jsonArray = new Gson().fromJson(resultJson, JsonArray.class);
|
||||
// 将JsonArray转为PlanOrder列表
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
List<ProductionRouteTwoVo> productionRouteTwoVos = objectMapper.readValue(jsonArray.toString(), new TypeReference<List<ProductionRouteTwoVo>>() {
|
||||
});
|
||||
List<ProductionRouteTwoVo> productionRouteTwoVos = objectMapper.readValue(jsonArray.toString(),
|
||||
new TypeReference<List<ProductionRouteTwoVo>>() {
|
||||
});
|
||||
// 输出或返回结果
|
||||
return productionRouteTwoVos;
|
||||
|
||||
@ -374,17 +387,18 @@ public class JdUtil {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
材料bom
|
||||
{
|
||||
"FMATERIALID.FNumber": "001HD24.01.01.017.0",
|
||||
"FITEMNAME": "行走原点标定",
|
||||
"FMATERIALIDCHILD.FNumber": "001HD24.01.01.016.2",
|
||||
"FCHILDITEMNAME": "不锈钢标尺",
|
||||
"FNUMERATOR": 1,
|
||||
"FDENOMINATOR": 1,
|
||||
"FChildBaseUnitID.FNumber": "jian"
|
||||
},
|
||||
* 材料bom
|
||||
* {
|
||||
* "FMATERIALID.FNumber": "001HD24.01.01.017.0",
|
||||
* "FITEMNAME": "行走原点标定",
|
||||
* "FMATERIALIDCHILD.FNumber": "001HD24.01.01.016.2",
|
||||
* "FCHILDITEMNAME": "不锈钢标尺",
|
||||
* "FNUMERATOR": 1,
|
||||
* "FDENOMINATOR": 1,
|
||||
* "FChildBaseUnitID.FNumber": "jian"
|
||||
* },
|
||||
*/
|
||||
public static List<Model> getPlanOrderVo(String materialCode) {
|
||||
List<ProductionRouteTwoVo> planOrderList = getSelectProceOrder(materialCode);
|
||||
@ -393,12 +407,13 @@ public class JdUtil {
|
||||
for (ProductionRouteTwoVo planOrder : planOrderList) {
|
||||
JsonObject json = new JsonObject();
|
||||
json.addProperty("FormId", "ENG_BOM");
|
||||
json.addProperty("FieldKeys", "F_HBYT_SCLH,FMaterialID.FNumber,FMaterialID.FNumber2,FMaterialName1,FNumerator,FDenominator,FUnitID2.FName");
|
||||
json.addProperty("FieldKeys",
|
||||
"F_HBYT_SCLH,FMaterialID.FNumber,FMaterialID.FNumber2,FMaterialName1,FNumerator,FDenominator,FUnitID2.FName");
|
||||
JsonArray filterString = new JsonArray();
|
||||
JsonObject filterObject = new JsonObject();
|
||||
filterObject.addProperty("FieldName", "FMaterialID.FNumber");
|
||||
filterObject.addProperty("Compare", "="); // 改为等号运算符
|
||||
// filterObject.addProperty("Value", planOrder.getFBillNo());
|
||||
filterObject.addProperty("Compare", "="); // 改为等号运算符
|
||||
// filterObject.addProperty("Value", planOrder.getFBillNo());
|
||||
filterObject.addProperty("Left", "");
|
||||
filterObject.addProperty("Right", "");
|
||||
filterObject.addProperty("Logic", 0);// 从 PlanOrderVo 获取生产令号
|
||||
@ -415,7 +430,7 @@ public class JdUtil {
|
||||
try {
|
||||
String resultJson = String.valueOf(client.billQuery(jsonData));
|
||||
System.out.println(
|
||||
// "生成查询计划订单查询 " + planOrder.getFBillNo() + " 的结果: " + resultJson
|
||||
// "生成查询计划订单查询 " + planOrder.getFBillNo() + " 的结果: " + resultJson
|
||||
);
|
||||
JsonArray jsonArray = new Gson().fromJson(resultJson, JsonArray.class);
|
||||
if (jsonArray == null || jsonArray.size() == 0) {
|
||||
@ -423,8 +438,9 @@ public class JdUtil {
|
||||
}
|
||||
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
List<PlanPrcessNumDTO> plannedProcessList = objectMapper.readValue(jsonArray.toString(), new TypeReference<List<PlanPrcessNumDTO>>() {
|
||||
});
|
||||
List<PlanPrcessNumDTO> plannedProcessList = objectMapper.readValue(jsonArray.toString(),
|
||||
new TypeReference<List<PlanPrcessNumDTO>>() {
|
||||
});
|
||||
if (plannedProcessList != null && !plannedProcessList.isEmpty()) {
|
||||
plannedProcesses.addAll(plannedProcessList);
|
||||
}
|
||||
@ -435,6 +451,293 @@ public class JdUtil {
|
||||
// 转换为 List<Model> 格式
|
||||
return null;
|
||||
}
|
||||
//查询物料是否为按图订制
|
||||
// 查询物料是否为按图订制
|
||||
|
||||
/**
|
||||
* 库存预留信息查询
|
||||
*
|
||||
* @param materialCode
|
||||
* @return
|
||||
*/
|
||||
public static List<InvReserveAnalyzeRptDTO> getInvReserveAnalyzeRpt(String materialCode) {
|
||||
List<InvReserveAnalyzeRptDTO> rptDTOS = new ArrayList<>();
|
||||
K3CloudApi client = new K3CloudApi();
|
||||
JsonObject jsonData = new JsonObject();
|
||||
jsonData.addProperty("FieldKeys", "FMATERIALNUMBER,FMaterialName,FDemandTypeName,FSecQty,FSecAVBQty");
|
||||
jsonData.addProperty("SchemeId", "");
|
||||
jsonData.addProperty("StartRow", 0);
|
||||
jsonData.addProperty("Limit", 2000);
|
||||
jsonData.addProperty("IsVerifyBaseDataField", "true");
|
||||
|
||||
JsonArray filterArray = new JsonArray();
|
||||
JsonObject filterObject = new JsonObject();
|
||||
filterObject.addProperty("Left", "");
|
||||
filterObject.addProperty("FieldName", "FMATERIALNUMBER");
|
||||
filterObject.addProperty("Compare", "67");
|
||||
filterObject.addProperty("Value", materialCode);
|
||||
filterObject.addProperty("Right", "");
|
||||
filterObject.addProperty("Logic", 0);
|
||||
filterArray.add(filterObject);
|
||||
jsonData.add("FilterString", filterArray);
|
||||
|
||||
JsonObject model = new JsonObject();
|
||||
model.addProperty("FStockOrgId", "1");
|
||||
|
||||
JsonObject beginMaterialId = new JsonObject();
|
||||
beginMaterialId.addProperty("FNUMBER", materialCode);
|
||||
model.add("FBeginMaterialId", beginMaterialId);
|
||||
|
||||
model.addProperty("FDemandType", "PLN_FORECAST,PLN_PLANORDER,PRD_PPBOM,SAL_SaleOrder");
|
||||
model.addProperty("FNeedTransOnly", false);
|
||||
|
||||
jsonData.add("Model", model);
|
||||
|
||||
String jsonString = jsonData.toString();
|
||||
String formId = "PLN_InvReserveAnalyzeRpt";
|
||||
String resultJson = null;
|
||||
try {
|
||||
resultJson = client.getSysReportData(formId, jsonString);
|
||||
} catch (Exception e) {
|
||||
System.err.println("Error fetching data for materialCode: " + materialCode);
|
||||
e.printStackTrace();
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
if (resultJson == null) {
|
||||
System.err.println("No data returned for materialCode: " + materialCode);
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
JsonObject resultObject = new Gson().fromJson(resultJson, JsonObject.class);
|
||||
JsonArray rows = resultObject.getAsJsonObject("Result").getAsJsonArray("Rows");
|
||||
if (rows == null){
|
||||
System.err.println("No data returned for materialCode: " + materialCode);
|
||||
return new ArrayList<>();
|
||||
}
|
||||
System.out.println("库存预留单===========>" + rows);
|
||||
|
||||
for (JsonElement rowElement : rows) {
|
||||
JsonArray row = rowElement.getAsJsonArray();
|
||||
InvReserveAnalyzeRptDTO analyzeRptDTO = new InvReserveAnalyzeRptDTO();
|
||||
analyzeRptDTO.setFMATERIALNUMBER(getStringFromJsonArray(row, 0));
|
||||
analyzeRptDTO.setFMaterialName(getStringFromJsonArray(row, 1));
|
||||
analyzeRptDTO.setFDemandTypeName(getStringFromJsonArray(row, 2));
|
||||
analyzeRptDTO.setFSecQty(getDoubleFromJsonArray(row, 3));
|
||||
analyzeRptDTO.setFSecAVBQty(getDoubleFromJsonArray(row, 4));
|
||||
|
||||
rptDTOS.add(analyzeRptDTO);
|
||||
}
|
||||
|
||||
return rptDTOS;
|
||||
}
|
||||
private static String getStringFromJsonArray(JsonArray array, int index) {
|
||||
return array.size() > index && !array.get(index).isJsonNull() ? array.get(index).getAsString() : "";
|
||||
}
|
||||
|
||||
private static double getDoubleFromJsonArray(JsonArray array, int index) {
|
||||
if (array.size() > index && !array.get(index).isJsonNull()) {
|
||||
String value = array.get(index).getAsString();
|
||||
if (!value.isEmpty()) {
|
||||
try {
|
||||
return Double.parseDouble(value);
|
||||
} catch (NumberFormatException e) {
|
||||
System.err.println("NumberFormatException for value: " + value);
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0.0;
|
||||
}
|
||||
/**
|
||||
* 查询生产订单单据体
|
||||
*
|
||||
* @param materialCode
|
||||
* @return
|
||||
*/
|
||||
|
||||
public static List<ProMoDTO> getProMoList(String materialCode) {
|
||||
K3CloudApi client = new K3CloudApi();
|
||||
// 请求参数,要求为json字符串
|
||||
JsonObject json = new JsonObject();
|
||||
json.addProperty("FormId", "PRD_MO");
|
||||
json.addProperty("FieldKeys",
|
||||
"FMaterialId.FNumber,FMaterialName,FQty");
|
||||
// 创建过滤条件
|
||||
JsonArray filterString = new JsonArray();
|
||||
JsonObject filterObject = new JsonObject();
|
||||
filterObject.addProperty("FieldName", "FMaterialId.FNumber");
|
||||
filterObject.addProperty("Compare", "="); // 改为等号运算符
|
||||
filterObject.addProperty("Value", materialCode);
|
||||
filterObject.addProperty("Left", "");
|
||||
filterObject.addProperty("Right", "");
|
||||
filterObject.addProperty("Logic", 0);// 从 PlanOrderVo 获取生产令号
|
||||
filterString.add(filterObject);
|
||||
JsonObject filterObject1 = new JsonObject();
|
||||
filterObject1.addProperty("FieldName", "FStatus");
|
||||
filterObject1.addProperty("Compare", "106"); // 改为等号运算符
|
||||
filterObject1.addProperty("Value", 5);
|
||||
filterObject1.addProperty("Left", "");
|
||||
filterObject1.addProperty("Right", "");
|
||||
filterObject1.addProperty("Logic", 0);// 从 PlanOrderVo 获取生产令号
|
||||
filterString.add(filterObject1);
|
||||
JsonObject filterObject2 = new JsonObject();
|
||||
filterObject2.addProperty("FieldName", "FStatus");
|
||||
filterObject2.addProperty("Compare", "106"); // 改为等号运算符
|
||||
filterObject2.addProperty("Value", 6);
|
||||
filterObject2.addProperty("Left", "");
|
||||
filterObject2.addProperty("Right", "");
|
||||
filterObject2.addProperty("Logic", 0);// 从 PlanOrderVo 获取生产令号
|
||||
filterString.add(filterObject2);
|
||||
JsonObject filterObject3 = new JsonObject();
|
||||
filterObject3.addProperty("FieldName", "FStatus");
|
||||
filterObject3.addProperty("Compare", "106"); // 改为等号运算符
|
||||
filterObject3.addProperty("Value", 7);
|
||||
filterObject3.addProperty("Left", "");
|
||||
filterObject3.addProperty("Right", "");
|
||||
filterObject3.addProperty("Logic", 0);// 从 PlanOrderVo 获取生产令号
|
||||
filterString.add(filterObject3);
|
||||
|
||||
json.add("FilterString", filterString);
|
||||
json.addProperty("OrderString", "");
|
||||
json.addProperty("TopRowCount", 0);
|
||||
json.addProperty("StartRow", 0);
|
||||
json.addProperty("Limit", 2000);
|
||||
json.addProperty("SubSystemId", "");
|
||||
|
||||
String jsonData = json.toString();
|
||||
List<ProMoDTO> promoList = null;
|
||||
try {
|
||||
// 调用接口
|
||||
String resultJson = String.valueOf(client.billQuery(jsonData));
|
||||
JsonArray jsonArray = new Gson().fromJson(resultJson, JsonArray.class);
|
||||
|
||||
// 使用 ObjectMapper 将 JsonArray 转换为 List<PlannedProcessVo>
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
promoList = objectMapper.readValue(jsonArray.toString(),
|
||||
new TypeReference<List<ProMoDTO>>() {
|
||||
|
||||
});
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace(); // 输出异常日志
|
||||
}
|
||||
|
||||
return promoList; // 返回结果
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询采购订单 单据体
|
||||
* @param materialCode
|
||||
* @return
|
||||
*/
|
||||
|
||||
public static List<PurchaseOrderDTO> getPurchaseOrderList(String materialCode) {
|
||||
|
||||
K3CloudApi client = new K3CloudApi();
|
||||
|
||||
// 请求参数,要求为json字符串
|
||||
JsonObject json = new JsonObject();
|
||||
json.addProperty("FormId", "PUR_PurchaseOrder");
|
||||
json.addProperty("FieldKeys",
|
||||
"FMaterialId.FNumber,FMaterialName,FQty");
|
||||
// 创建过滤条件
|
||||
JsonArray filterString = new JsonArray();
|
||||
JsonObject filterObject = new JsonObject();
|
||||
filterObject.addProperty("FieldName", "FMaterialId.FNumber");
|
||||
filterObject.addProperty("Compare", "="); // 改为等号运算符
|
||||
filterObject.addProperty("Value", materialCode);
|
||||
filterObject.addProperty("Left", "");
|
||||
filterObject.addProperty("Right", "");
|
||||
filterObject.addProperty("Logic", 0);// 从 PlanOrderVo 获取生产令号
|
||||
filterString.add(filterObject);
|
||||
JsonObject filterObject1 = new JsonObject();
|
||||
filterObject1.addProperty("FieldName", "FMRPCloseStatus");
|
||||
filterObject1.addProperty("Compare", "="); // 改为等号运算符
|
||||
filterObject1.addProperty("Value", "A");
|
||||
filterObject1.addProperty("Left", "");
|
||||
filterObject1.addProperty("Right", "");
|
||||
filterObject1.addProperty("Logic", 0);// 从 PlanOrderVo 获取生产令号
|
||||
filterString.add(filterObject1);
|
||||
json.add("FilterString", filterString);
|
||||
json.addProperty("OrderString", "");
|
||||
json.addProperty("TopRowCount", 0);
|
||||
json.addProperty("StartRow", 0);
|
||||
json.addProperty("Limit", 2000);
|
||||
json.addProperty("SubSystemId", "");
|
||||
|
||||
String jsonData = json.toString();
|
||||
List<PurchaseOrderDTO> plannedProcessList = null;
|
||||
try {
|
||||
// 调用接口
|
||||
String resultJson = String.valueOf(client.billQuery(jsonData));
|
||||
JsonArray jsonArray = new Gson().fromJson(resultJson, JsonArray.class);
|
||||
|
||||
// 使用 ObjectMapper 将 JsonArray 转换为 List<PlannedProcessVo>
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
plannedProcessList = objectMapper.readValue(jsonArray.toString(),
|
||||
new TypeReference<List<PurchaseOrderDTO>>() {
|
||||
|
||||
});
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace(); // 输出异常日志
|
||||
}
|
||||
|
||||
return plannedProcessList; // 返回结果
|
||||
}
|
||||
|
||||
|
||||
public static Double getKeyong(String materialCode) {
|
||||
List<InvReserveAnalyzeRptDTO> analyzeRpt =getInvReserveAnalyzeRpt(materialCode);
|
||||
if (analyzeRpt == null || analyzeRpt.isEmpty()) {
|
||||
System.err.println("No inventory data found for materialCode: " + materialCode);
|
||||
return 0.0; // 返回 0.0 而不是 null
|
||||
}
|
||||
double fSecAVBQty = 0.0;
|
||||
double fSecQty = 0.0;
|
||||
if (!analyzeRpt.isEmpty()) {
|
||||
fSecAVBQty = analyzeRpt.get(0).getFSecAVBQty();
|
||||
}
|
||||
for (InvReserveAnalyzeRptDTO analyzeRptDTO : analyzeRpt) {
|
||||
if (analyzeRptDTO.getFSecQty() != null) {
|
||||
fSecQty += analyzeRptDTO.getFSecQty();
|
||||
}
|
||||
}
|
||||
double productionQty = 0.0;
|
||||
List<ProMoDTO> proMoList = getProMoList(materialCode);
|
||||
if (proMoList != null) {
|
||||
for (ProMoDTO proMoDTO : proMoList) {
|
||||
productionQty += proMoDTO.getFQty();
|
||||
}
|
||||
}
|
||||
double purchaseQty = 0.0;
|
||||
List<PurchaseOrderDTO> purchaseOrderList = getPurchaseOrderList(materialCode);
|
||||
if (purchaseOrderList != null) {
|
||||
for (PurchaseOrderDTO purchaseOrderDTO : purchaseOrderList) {
|
||||
purchaseQty += purchaseOrderDTO.getFQty();
|
||||
}
|
||||
}
|
||||
return fSecAVBQty + productionQty + purchaseQty - fSecQty;
|
||||
}
|
||||
|
||||
public static int isMaterialVerification(String DrawingNumber, String name) {
|
||||
if (DrawingNumber == null || DrawingNumber.isEmpty() || name == null || name.isEmpty()) {
|
||||
return 0;
|
||||
}
|
||||
JsonArray jsonArray = JdUtils.loadMaterialQuery(DrawingNumber, name);
|
||||
if (jsonArray == null) {
|
||||
return 0;
|
||||
} else {
|
||||
for (JsonElement jsonElement : jsonArray) {
|
||||
String FNumber = jsonElement.getAsJsonObject().get("FNumber").getAsString();
|
||||
String FName = jsonElement.getAsJsonObject().get("FName").getAsString();
|
||||
String Funit = jsonElement.getAsJsonObject().get("FBaseUnitId.FNumber").getAsString();
|
||||
// 检查名称是否一致
|
||||
if (FNumber.equals(DrawingNumber) && !FName.equals(name)) {
|
||||
return 3; // 编码相同但名称不同
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -30,6 +30,8 @@ import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
public class PDFGenerator {
|
||||
|
||||
@ -95,9 +97,9 @@ public class PDFGenerator {
|
||||
}
|
||||
|
||||
public static String writeToPdf(List<CombinedDTO> combinedVoList, String rooteProdet) {
|
||||
String fontPath = "C:\\Users\\Administrator\\AppData\\Local\\Microsoft\\Windows\\Fonts\\arial unicode ms.ttf";
|
||||
String fontPath = "C:\\Windows\\Fonts\\arial unicode ms.ttf";
|
||||
List<String> pdfPaths = new ArrayList<>();
|
||||
String directoryPath = "C:\\Users\\Administrator\\Desktop\\上传BOM\\" + rooteProdet;
|
||||
String directoryPath = "D:\\上传BOM\\" + rooteProdet;
|
||||
// 检查目录是否存在,如果不存在则创建
|
||||
File directory = new File(directoryPath);
|
||||
if (!directory.exists()) {
|
||||
@ -344,6 +346,8 @@ public class PDFGenerator {
|
||||
zipFile.getParentFile().mkdirs();
|
||||
}
|
||||
|
||||
Set<String> fileNamesInZip = new HashSet<>();
|
||||
|
||||
try (ZipOutputStream zipOut = new ZipOutputStream(new FileOutputStream(zipFilePath))) {
|
||||
// 设置压缩级别
|
||||
zipOut.setLevel(ZipOutputStream.DEFLATED);
|
||||
@ -351,9 +355,16 @@ public class PDFGenerator {
|
||||
for (String filePath : sourceFilePaths) {
|
||||
File fileToZip = new File(filePath);
|
||||
if (fileToZip.exists()) {
|
||||
String fileName = fileToZip.getName();
|
||||
if (fileNamesInZip.contains(fileName)) {
|
||||
System.out.println("跳过重复文件: " + fileName);
|
||||
continue; // 跳过重复文件
|
||||
}
|
||||
fileNamesInZip.add(fileName);
|
||||
|
||||
try (FileInputStream fis = new FileInputStream(fileToZip)) {
|
||||
// 创建ZIP条目
|
||||
ZipEntry zipEntry = new ZipEntry(fileToZip.getName());
|
||||
ZipEntry zipEntry = new ZipEntry(fileName);
|
||||
zipOut.putNextEntry(zipEntry);
|
||||
|
||||
// 写入文件内容
|
||||
@ -454,7 +465,7 @@ public class PDFGenerator {
|
||||
File sourceFile = new File(sourcePath);
|
||||
File targetFile = new File(departmentFolder, targetPath);
|
||||
|
||||
// 检查目<EFBFBD><EFBFBD><EFBFBD>文件夹是否存在,不存在则创建
|
||||
// 检查目标文件夹是否存在,不存在则创建
|
||||
if (!departmentFolder.exists()) {
|
||||
departmentFolder.mkdirs(); // 创建车间文件夹
|
||||
}
|
||||
|
||||
@ -0,0 +1,49 @@
|
||||
package com.ruoyi.system.service;
|
||||
|
||||
import com.ruoyi.system.domain.EleMaterials;
|
||||
import com.ruoyi.system.domain.vo.EleMaterialsVo;
|
||||
import com.ruoyi.system.domain.bo.EleMaterialsBo;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 电器物料管理Service接口
|
||||
*
|
||||
* @author tzy
|
||||
* @date 2024-12-28
|
||||
*/
|
||||
public interface IEleMaterialsService {
|
||||
|
||||
/**
|
||||
* 查询电器物料管理
|
||||
*/
|
||||
EleMaterialsVo queryById(Long id);
|
||||
|
||||
/**
|
||||
* 查询电器物料管理列表
|
||||
*/
|
||||
TableDataInfo<EleMaterialsVo> queryPageList(EleMaterialsBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询电器物料管理列表
|
||||
*/
|
||||
List<EleMaterialsVo> queryList(EleMaterialsBo bo);
|
||||
|
||||
/**
|
||||
* 新增电器物料管理
|
||||
*/
|
||||
Boolean insertByBo(EleMaterialsBo bo);
|
||||
|
||||
/**
|
||||
* 修改电器物料管理
|
||||
*/
|
||||
Boolean updateByBo(EleMaterialsBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除电器物料管理信息
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
}
|
||||
@ -0,0 +1,54 @@
|
||||
package com.ruoyi.system.service;
|
||||
|
||||
import com.ruoyi.system.domain.NewMaterials;
|
||||
import com.ruoyi.system.domain.vo.NewMaterialsVo;
|
||||
import com.ruoyi.system.domain.bo.NewMaterialsBo;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
import com.ruoyi.system.domain.vo.ProcessRouteVo;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 金蝶物料管理Service接口
|
||||
*
|
||||
* @author 田志阳
|
||||
* @date 2025-01-04
|
||||
*/
|
||||
public interface INewMaterialsService {
|
||||
|
||||
/**
|
||||
* 查询金蝶物料管理
|
||||
*/
|
||||
NewMaterialsVo queryById(Long id);
|
||||
|
||||
/**
|
||||
* 查询金蝶物料管理列表
|
||||
*/
|
||||
TableDataInfo<NewMaterialsVo> queryPageList(NewMaterialsBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询金蝶物料管理列表
|
||||
*/
|
||||
List<NewMaterialsVo> queryList(NewMaterialsBo bo);
|
||||
|
||||
/**
|
||||
* 新增金蝶物料管理
|
||||
*/
|
||||
Boolean insertByBo(NewMaterialsBo bo);
|
||||
|
||||
/**
|
||||
* 修改金蝶物料管理
|
||||
*/
|
||||
Boolean updateByBo(NewMaterialsBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除金蝶物料管理信息
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
|
||||
boolean saveData(List<NewMaterialsVo> list);
|
||||
|
||||
List<NewMaterialsVo> addToJindie();
|
||||
}
|
||||
@ -34,6 +34,7 @@ public interface IProcessRouteService {
|
||||
* 查询工艺路线列表
|
||||
*/
|
||||
TableDataInfo<ProcessRouteVo> queryPageList(ProcessRouteBo bo, PageQuery pageQuery);
|
||||
TableDataInfo<ProcessRouteVo> queryPageList2(ProcessRouteBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询工艺路线列表
|
||||
|
||||
@ -0,0 +1,119 @@
|
||||
package com.ruoyi.system.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.system.domain.bo.EleMaterialsBo;
|
||||
import com.ruoyi.system.domain.vo.EleMaterialsVo;
|
||||
import com.ruoyi.system.domain.EleMaterials;
|
||||
import com.ruoyi.system.mapper.EleMaterialsMapper;
|
||||
import com.ruoyi.system.service.IEleMaterialsService;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 电器物料管理Service业务层处理
|
||||
*
|
||||
* @author tzy
|
||||
* @date 2024-12-28
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class EleMaterialsServiceImpl implements IEleMaterialsService {
|
||||
|
||||
private final EleMaterialsMapper baseMapper;
|
||||
|
||||
/**
|
||||
* 查询电器物料管理
|
||||
*/
|
||||
@Override
|
||||
public EleMaterialsVo queryById(Long id){
|
||||
return baseMapper.selectVoById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询电器物料管理列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<EleMaterialsVo> queryPageList(EleMaterialsBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<EleMaterials> lqw = buildQueryWrapper(bo);
|
||||
Page<EleMaterialsVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询电器物料管理列表
|
||||
*/
|
||||
@Override
|
||||
public List<EleMaterialsVo> queryList(EleMaterialsBo bo) {
|
||||
LambdaQueryWrapper<EleMaterials> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<EleMaterials> buildQueryWrapper(EleMaterialsBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<EleMaterials> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(bo.getSerialNumber() != null, EleMaterials::getSerialNumber, bo.getSerialNumber());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getMaterialCode()), EleMaterials::getMaterialCode, bo.getMaterialCode());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getMaterialName()), EleMaterials::getMaterialName, bo.getMaterialName());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getModel()), EleMaterials::getModel, bo.getModel());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getMaterialType()), EleMaterials::getMaterialType, bo.getMaterialType());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getUnit()), EleMaterials::getUnit, bo.getUnit());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getBrand()), EleMaterials::getBrand, bo.getBrand());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getRemarks()), EleMaterials::getRemarks, bo.getRemarks());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增电器物料管理
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(EleMaterialsBo bo) {
|
||||
EleMaterials add = BeanUtil.toBean(bo, EleMaterials.class);
|
||||
//物料编码自动新增
|
||||
|
||||
//查询 是否有相同的物料编码 规格 品牌
|
||||
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setId(add.getId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改电器物料管理
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(EleMaterialsBo bo) {
|
||||
EleMaterials update = BeanUtil.toBean(bo, EleMaterials.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(EleMaterials entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除电器物料管理
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteBatchIds(ids) > 0;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,605 @@
|
||||
package com.ruoyi.system.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.kingdee.bos.webapi.entity.RepoRet;
|
||||
import com.kingdee.bos.webapi.sdk.K3CloudApi;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.ruoyi.system.controller.ProcessRouteController;
|
||||
import com.ruoyi.system.domain.BomDetails;
|
||||
import com.ruoyi.system.domain.MaterialProperties;
|
||||
import com.ruoyi.system.domain.vo.ProcessRouteVo;
|
||||
import com.ruoyi.system.runner.JdUtil;
|
||||
import com.ruoyi.system.service.IMaterialPropertiesService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.aspectj.bridge.MessageUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.system.domain.bo.NewMaterialsBo;
|
||||
import com.ruoyi.system.domain.vo.NewMaterialsVo;
|
||||
import com.ruoyi.system.domain.NewMaterials;
|
||||
import com.ruoyi.system.mapper.NewMaterialsMapper;
|
||||
import com.ruoyi.system.service.INewMaterialsService;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 金蝶物料管理Service业务层处理
|
||||
*
|
||||
* @author 田志阳
|
||||
* @date 2025-01-04
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class NewMaterialsServiceImpl implements INewMaterialsService {
|
||||
|
||||
private final IMaterialPropertiesService iMaterialPropertiesService;
|
||||
|
||||
private final NewMaterialsMapper baseMapper;
|
||||
private static final Logger log = LoggerFactory.getLogger(INewMaterialsService.class);
|
||||
/**
|
||||
* 查询金蝶物料管理
|
||||
*/
|
||||
@Override
|
||||
public NewMaterialsVo queryById(Long id){
|
||||
return baseMapper.selectVoById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询金蝶物料管理列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<NewMaterialsVo> queryPageList(NewMaterialsBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<NewMaterials> lqw = buildQueryWrapper(bo);
|
||||
Page<NewMaterialsVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询金蝶物料管理列表
|
||||
*/
|
||||
@Override
|
||||
public List<NewMaterialsVo> queryList(NewMaterialsBo bo) {
|
||||
LambdaQueryWrapper<NewMaterials> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<NewMaterials> buildQueryWrapper(NewMaterialsBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<NewMaterials> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(bo.getSerialNumber() != null, NewMaterials::getSerialNumber, bo.getSerialNumber());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getMaterialCode()), NewMaterials::getMaterialCode, bo.getMaterialCode());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getMaterialName()), NewMaterials::getMaterialName, bo.getMaterialName());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getMaterialModel()), NewMaterials::getMaterialModel, bo.getMaterialModel());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getMaterialType()), NewMaterials::getMaterialType, bo.getMaterialType());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getMaterialUnit()), NewMaterials::getMaterialUnit, bo.getMaterialUnit());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getMaterialBrand()), NewMaterials::getMaterialBrand, bo.getMaterialBrand());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getRemarks()), NewMaterials::getRemarks, bo.getRemarks());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getMaterialAttribute()), NewMaterials::getMaterialAttribute, bo.getMaterialAttribute());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getExistsStatus()), NewMaterials::getExistsStatus, bo.getExistsStatus());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getMaterialClassify()), NewMaterials::getMaterialClassify, bo.getMaterialClassify());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增金蝶物料管理
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(NewMaterialsBo bo) {
|
||||
NewMaterials add = BeanUtil.toBean(bo, NewMaterials.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setId(add.getId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改金蝶物料管理
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(NewMaterialsBo bo) {
|
||||
NewMaterials update = BeanUtil.toBean(bo, NewMaterials.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(NewMaterials entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除金蝶物料管理
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteBatchIds(ids) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param list
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean saveData(List<NewMaterialsVo> list) {
|
||||
ArrayList<NewMaterials> newMaterials1 = new ArrayList<>();
|
||||
if (!list.isEmpty()) {
|
||||
for (NewMaterialsVo newMaterialsVo : list) {
|
||||
NewMaterials newMaterials = BeanUtil.copyProperties(newMaterialsVo, NewMaterials.class);
|
||||
newMaterials1.add(newMaterials);
|
||||
//查询物料是否存在
|
||||
int verification = JdUtil.isMaterialVerification(newMaterials.getMaterialCode(), newMaterials.getMaterialName());
|
||||
if (verification==1){
|
||||
newMaterials.setRemarks("物料存在");
|
||||
}
|
||||
if (verification==2){
|
||||
newMaterials.setRemarks("物料存在");
|
||||
}
|
||||
if (verification==3){
|
||||
newMaterials.setRemarks("物料不存在");
|
||||
}
|
||||
}
|
||||
}
|
||||
return baseMapper.insertBatch(newMaterials1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<NewMaterialsVo> addToJindie() {
|
||||
List<NewMaterials> newMaterials = baseMapper.selectList();
|
||||
ArrayList<NewMaterialsVo> newMaterialsVos = new ArrayList<>();
|
||||
if (!newMaterials.isEmpty()) {
|
||||
for (NewMaterials newMaterial : newMaterials) {
|
||||
if (newMaterial.getRemarks().equals("物料不存在")) {
|
||||
//属性判断
|
||||
String states = null;
|
||||
if (newMaterial.getMaterialBrand().equals("伊特")) {
|
||||
states = "2";
|
||||
}else{
|
||||
states = "1";
|
||||
}
|
||||
int i = loadMaterialToDQ(newMaterial, states);
|
||||
if (i == 1) {
|
||||
newMaterial.setExistsStatus("已推送");
|
||||
newMaterialsVos.add(BeanUtil.copyProperties(newMaterial, NewMaterialsVo.class));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return newMaterialsVos;
|
||||
}
|
||||
public int loadMaterialToDQ(NewMaterials newMaterial, String states) {
|
||||
K3CloudApi client = new K3CloudApi();
|
||||
// 创建一个空的JsonObject
|
||||
JsonObject json = new JsonObject();
|
||||
// 添加IsAutoSubmitAndAudit字段
|
||||
json.addProperty("IsAutoSubmitAndAudit", "true");
|
||||
|
||||
// 创建Model对象,并加入JsonObject
|
||||
JsonObject model = new JsonObject();
|
||||
json.add("Model", model);
|
||||
|
||||
// 添加Model字段
|
||||
model.addProperty("FMATERIALID", 0);
|
||||
model.addProperty("FSpecification", newMaterial.getRemarks());// 备注仓库
|
||||
model.addProperty("FNumber", newMaterial.getMaterialCode());
|
||||
model.addProperty("FName", newMaterial.getMaterialName());
|
||||
MaterialProperties materialProperties = iMaterialPropertiesService.selectByAttribute(newMaterial.getMaterialType());
|
||||
if (materialProperties != null) {
|
||||
JsonObject FSVRIAssistant = new JsonObject();
|
||||
FSVRIAssistant.addProperty("FNumber", materialProperties.getMaterialAttributeId());
|
||||
model.add("F_SVRI_Assistant", FSVRIAssistant);
|
||||
} else {
|
||||
// 没写材料为默认为空
|
||||
JsonObject FSVRIAssistant = new JsonObject();
|
||||
FSVRIAssistant.addProperty("FNumber", "17");
|
||||
model.add("F_SVRI_Assistant", FSVRIAssistant);
|
||||
}
|
||||
// 创建FMaterialGroup对象,并加入Model
|
||||
JsonObject fMaterialGroup = new JsonObject();
|
||||
fMaterialGroup.addProperty("FNumber", "YT100.01");
|
||||
model.add("FMaterialGroup", fMaterialGroup);
|
||||
|
||||
model.addProperty("FIsHandleReserve", true);
|
||||
|
||||
// 创建SubHeadEntity对象,并加入Model
|
||||
JsonObject subHeadEntity = new JsonObject();
|
||||
model.add("SubHeadEntity", subHeadEntity);
|
||||
|
||||
subHeadEntity.addProperty("FErpClsID", states);
|
||||
subHeadEntity.addProperty("FFeatureItem", "1");
|
||||
|
||||
// 创建FCategoryID对象,并加入SubHeadEntity
|
||||
JsonObject fCategoryID = new JsonObject();
|
||||
if (states.equals("2") || states.equals("3")) {
|
||||
fCategoryID.addProperty("FNumber", "007");
|
||||
} else {
|
||||
fCategoryID.addProperty("FNumber", "006");
|
||||
}
|
||||
|
||||
subHeadEntity.add("FCategoryID", fCategoryID);
|
||||
|
||||
// 创建FTaxRateId对象,并加入SubHeadEntity
|
||||
JsonObject fTaxRateId = new JsonObject();
|
||||
fTaxRateId.addProperty("FNUMBER", "SL02_SYS");
|
||||
subHeadEntity.add("FTaxRateId", fTaxRateId);
|
||||
|
||||
// 创建FBaseUnitId对象,并加入SubHeadEntity
|
||||
JsonObject fBaseUnitId = new JsonObject();
|
||||
switch (newMaterial.getMaterialUnit()) {// 单位
|
||||
case "把":
|
||||
fBaseUnitId.addProperty("FNumber", "002");
|
||||
break;
|
||||
case "包":
|
||||
fBaseUnitId.addProperty("FNumber", "012");
|
||||
break;
|
||||
case "个":
|
||||
fBaseUnitId.addProperty("FNumber", "001");
|
||||
break;
|
||||
case "根":
|
||||
fBaseUnitId.addProperty("FNumber", "003");
|
||||
break;
|
||||
case "米":
|
||||
fBaseUnitId.addProperty("FNumber", "005");
|
||||
break;
|
||||
case "卷":
|
||||
fBaseUnitId.addProperty("FNumber", "020");
|
||||
break;
|
||||
case "盒":
|
||||
fBaseUnitId.addProperty("FNumber", "014");
|
||||
break;
|
||||
case "件":
|
||||
fBaseUnitId.addProperty("FNumber", "jian");
|
||||
break;
|
||||
case "盘":
|
||||
fBaseUnitId.addProperty("FNumber", "011");
|
||||
break;
|
||||
case "瓶":
|
||||
fBaseUnitId.addProperty("FNumber", "016");
|
||||
break;
|
||||
case "条":
|
||||
fBaseUnitId.addProperty("FNumber", "017");
|
||||
break;
|
||||
case "套":
|
||||
fBaseUnitId.addProperty("FNumber", "007");
|
||||
break;
|
||||
}
|
||||
subHeadEntity.add("FBaseUnitId", fBaseUnitId);
|
||||
if (states.equals("1")) {
|
||||
subHeadEntity.addProperty("FIsPurchase", true);
|
||||
subHeadEntity.addProperty("FIsSale", true);
|
||||
subHeadEntity.addProperty("FIsInventory", true);
|
||||
} else {
|
||||
subHeadEntity.addProperty("FIsPurchase", true);
|
||||
subHeadEntity.addProperty("FIsInventory", true);
|
||||
subHeadEntity.addProperty("FIsSubContract", true);
|
||||
subHeadEntity.addProperty("FIsSale", true);
|
||||
subHeadEntity.addProperty("FIsProduce", true);
|
||||
|
||||
}
|
||||
|
||||
// 创建SubHeadEntity1对象,并加入Model
|
||||
JsonObject subHeadEntity1 = new JsonObject();
|
||||
model.add("SubHeadEntity1", subHeadEntity1);
|
||||
JsonObject fStoreUnitId = new JsonObject();
|
||||
switch (newMaterial.getMaterialUnit()) {
|
||||
case "把":
|
||||
fBaseUnitId.addProperty("FNumber", "002");
|
||||
break;
|
||||
case "包":
|
||||
fBaseUnitId.addProperty("FNumber", "012");
|
||||
break;
|
||||
case "个":
|
||||
fBaseUnitId.addProperty("FNumber", "001");
|
||||
break;
|
||||
case "根":
|
||||
fBaseUnitId.addProperty("FNumber", "003");
|
||||
break;
|
||||
case "米":
|
||||
fBaseUnitId.addProperty("FNumber", "005");
|
||||
break;
|
||||
case "卷":
|
||||
fBaseUnitId.addProperty("FNumber", "020");
|
||||
break;
|
||||
case "盒":
|
||||
fBaseUnitId.addProperty("FNumber", "014");
|
||||
break;
|
||||
case "件":
|
||||
fBaseUnitId.addProperty("FNumber", "jian");
|
||||
break;
|
||||
case "盘":
|
||||
fBaseUnitId.addProperty("FNumber", "011");
|
||||
break;
|
||||
case "瓶":
|
||||
fBaseUnitId.addProperty("FNumber", "016");
|
||||
break;
|
||||
case "条":
|
||||
fBaseUnitId.addProperty("FNumber", "017");
|
||||
break;
|
||||
case "套":
|
||||
fBaseUnitId.addProperty("FNumber", "007");
|
||||
break;
|
||||
}
|
||||
subHeadEntity1.add("FStoreUnitID", fStoreUnitId);
|
||||
subHeadEntity1.addProperty("FUnitConvertDir", "1");
|
||||
|
||||
// 创建FStockId对象,并加入SubHeadEntity1
|
||||
// 仓库代码为 半成品库007
|
||||
JsonObject fStockId = new JsonObject();
|
||||
fStockId.addProperty("FNumber", "007");
|
||||
subHeadEntity1.add("FStockId", fStockId);
|
||||
|
||||
// 创建FCurrencyId对象,并加入SubHeadEntity1
|
||||
JsonObject fCurrencyId = new JsonObject();
|
||||
fCurrencyId.addProperty("FNumber", "PRE001");
|
||||
subHeadEntity1.add("FCurrencyId", fCurrencyId);
|
||||
|
||||
subHeadEntity1.addProperty("FIsSNPRDTracy", false);
|
||||
subHeadEntity1.addProperty("FSNManageType", "1");
|
||||
subHeadEntity1.addProperty("FSNGenerateTime", "1");
|
||||
subHeadEntity1.addProperty("FBoxStandardQty", 0.0);
|
||||
// 创建FPurchaseUnitId对象,并加入SubHeadEntity1
|
||||
JsonObject fPurchaseUnitId = new JsonObject();
|
||||
switch (newMaterial.getMaterialUnit()) {
|
||||
case "把":
|
||||
fBaseUnitId.addProperty("FNumber", "002");
|
||||
break;
|
||||
case "包":
|
||||
fBaseUnitId.addProperty("FNumber", "012");
|
||||
break;
|
||||
case "个":
|
||||
fBaseUnitId.addProperty("FNumber", "001");
|
||||
break;
|
||||
case "根":
|
||||
fBaseUnitId.addProperty("FNumber", "003");
|
||||
break;
|
||||
case "米":
|
||||
fBaseUnitId.addProperty("FNumber", "005");
|
||||
break;
|
||||
case "卷":
|
||||
fBaseUnitId.addProperty("FNumber", "020");
|
||||
break;
|
||||
case "盒":
|
||||
fBaseUnitId.addProperty("FNumber", "014");
|
||||
break;
|
||||
case "件":
|
||||
fBaseUnitId.addProperty("FNumber", "jian");
|
||||
break;
|
||||
case "盘":
|
||||
fBaseUnitId.addProperty("FNumber", "011");
|
||||
break;
|
||||
case "瓶":
|
||||
fBaseUnitId.addProperty("FNumber", "016");
|
||||
break;
|
||||
case "条":
|
||||
fBaseUnitId.addProperty("FNumber", "017");
|
||||
break;
|
||||
case "套":
|
||||
fBaseUnitId.addProperty("FNumber", "007");
|
||||
break;
|
||||
}
|
||||
subHeadEntity1.add("FPurchaseUnitId", fPurchaseUnitId);
|
||||
|
||||
// 创建SubHeadEntity3对象,并加入Model
|
||||
JsonObject subHeadEntity3 = new JsonObject();
|
||||
model.add("SubHeadEntity3", subHeadEntity3);
|
||||
|
||||
// 创建FPurchasePriceUnitId对象,并加入SubHeadEntity3
|
||||
JsonObject fPurchasePriceUnitId = new JsonObject();
|
||||
switch (newMaterial.getMaterialUnit()) {
|
||||
case "把":
|
||||
fBaseUnitId.addProperty("FNumber", "002");
|
||||
break;
|
||||
case "包":
|
||||
fBaseUnitId.addProperty("FNumber", "012");
|
||||
break;
|
||||
case "个":
|
||||
fBaseUnitId.addProperty("FNumber", "001");
|
||||
break;
|
||||
case "根":
|
||||
fBaseUnitId.addProperty("FNumber", "003");
|
||||
break;
|
||||
case "米":
|
||||
fBaseUnitId.addProperty("FNumber", "005");
|
||||
break;
|
||||
case "卷":
|
||||
fBaseUnitId.addProperty("FNumber", "020");
|
||||
break;
|
||||
case "盒":
|
||||
fBaseUnitId.addProperty("FNumber", "014");
|
||||
break;
|
||||
case "件":
|
||||
fBaseUnitId.addProperty("FNumber", "jian");
|
||||
break;
|
||||
case "盘":
|
||||
fBaseUnitId.addProperty("FNumber", "011");
|
||||
break;
|
||||
case "瓶":
|
||||
fBaseUnitId.addProperty("FNumber", "016");
|
||||
break;
|
||||
case "条":
|
||||
fBaseUnitId.addProperty("FNumber", "017");
|
||||
break;
|
||||
case "套":
|
||||
fBaseUnitId.addProperty("FNumber", "007");
|
||||
break;
|
||||
}
|
||||
subHeadEntity3.add("FPurchasePriceUnitId", fPurchasePriceUnitId);
|
||||
|
||||
subHeadEntity3.addProperty("FIsQuota", false);
|
||||
subHeadEntity3.addProperty("FQuotaType", "1");
|
||||
|
||||
JsonObject subHeadEntity6 = new JsonObject();
|
||||
model.add("SubHeadEntity6", subHeadEntity6);
|
||||
// 不同的属性不同的检验方案
|
||||
if (states.equals("1")) {
|
||||
// 外购
|
||||
subHeadEntity6.addProperty("FCheckIncoming", true);
|
||||
}
|
||||
if (states.equals("2")) {
|
||||
// 自制
|
||||
subHeadEntity6.addProperty("FCheckProduct", true);
|
||||
subHeadEntity6.addProperty("FCheckReturnMtrl", true);
|
||||
}
|
||||
if (states.equals("3")) {
|
||||
// 委外
|
||||
subHeadEntity6.addProperty("FCheckIncoming", true);
|
||||
subHeadEntity6.addProperty("FCheckProduct", true);
|
||||
subHeadEntity6.addProperty("FCheckReturnMtrl", true);
|
||||
}
|
||||
|
||||
// 创建SubHeadEntity5对象,并加入Model
|
||||
JsonObject subHeadEntity5 = new JsonObject();
|
||||
model.add("SubHeadEntity5", subHeadEntity5);
|
||||
|
||||
// 创建FProduceUnitId对象,并加入SubHeadEntity5
|
||||
JsonObject fProduceUnitId = new JsonObject();
|
||||
switch (newMaterial.getMaterialUnit()) {
|
||||
case "把":
|
||||
fBaseUnitId.addProperty("FNumber", "002");
|
||||
break;
|
||||
case "包":
|
||||
fBaseUnitId.addProperty("FNumber", "012");
|
||||
break;
|
||||
case "个":
|
||||
fBaseUnitId.addProperty("FNumber", "001");
|
||||
break;
|
||||
case "根":
|
||||
fBaseUnitId.addProperty("FNumber", "003");
|
||||
break;
|
||||
case "米":
|
||||
fBaseUnitId.addProperty("FNumber", "005");
|
||||
break;
|
||||
case "卷":
|
||||
fBaseUnitId.addProperty("FNumber", "020");
|
||||
break;
|
||||
case "盒":
|
||||
fBaseUnitId.addProperty("FNumber", "014");
|
||||
break;
|
||||
case "件":
|
||||
fBaseUnitId.addProperty("FNumber", "jian");
|
||||
break;
|
||||
case "盘":
|
||||
fBaseUnitId.addProperty("FNumber", "011");
|
||||
break;
|
||||
case "瓶":
|
||||
fBaseUnitId.addProperty("FNumber", "016");
|
||||
break;
|
||||
case "条":
|
||||
fBaseUnitId.addProperty("FNumber", "017");
|
||||
break;
|
||||
case "套":
|
||||
fBaseUnitId.addProperty("FNumber", "007");
|
||||
break;
|
||||
}
|
||||
subHeadEntity5.add("FProduceUnitId", fProduceUnitId);
|
||||
|
||||
// 创建FProduceBillType对象,并加入SubHeadEntity5
|
||||
JsonObject fProduceBillType = new JsonObject();
|
||||
fProduceBillType.addProperty("FNUMBER", "SCDD05_SYS");
|
||||
subHeadEntity5.add("FProduceBillType", fProduceBillType);
|
||||
|
||||
// 创建FBOMUnitId对象,并加入SubHeadEntity5
|
||||
JsonObject fBOMUnitId = new JsonObject();
|
||||
switch (newMaterial.getMaterialUnit()) {
|
||||
case "把":
|
||||
fBaseUnitId.addProperty("FNumber", "002");
|
||||
break;
|
||||
case "包":
|
||||
fBaseUnitId.addProperty("FNumber", "012");
|
||||
break;
|
||||
case "个":
|
||||
fBaseUnitId.addProperty("FNumber", "001");
|
||||
break;
|
||||
case "根":
|
||||
fBaseUnitId.addProperty("FNumber", "003");
|
||||
break;
|
||||
case "米":
|
||||
fBaseUnitId.addProperty("FNumber", "005");
|
||||
break;
|
||||
case "卷":
|
||||
fBaseUnitId.addProperty("FNumber", "020");
|
||||
break;
|
||||
case "盒":
|
||||
fBaseUnitId.addProperty("FNumber", "014");
|
||||
break;
|
||||
case "件":
|
||||
fBaseUnitId.addProperty("FNumber", "jian");
|
||||
break;
|
||||
case "盘":
|
||||
fBaseUnitId.addProperty("FNumber", "011");
|
||||
break;
|
||||
case "瓶":
|
||||
fBaseUnitId.addProperty("FNumber", "016");
|
||||
break;
|
||||
case "条":
|
||||
fBaseUnitId.addProperty("FNumber", "017");
|
||||
break;
|
||||
case "套":
|
||||
fBaseUnitId.addProperty("FNumber", "007");
|
||||
break;
|
||||
}
|
||||
subHeadEntity5.add("FBOMUnitId", fBOMUnitId);
|
||||
if (states.equals("1")) {
|
||||
subHeadEntity5.addProperty("FIsMainPrd", false);
|
||||
} else {
|
||||
subHeadEntity5.addProperty("FIsMainPrd", true);
|
||||
}
|
||||
subHeadEntity5.addProperty("FIssueType", "1");
|
||||
|
||||
// 创建FPickStockId对象,并加入SubHeadEntity5
|
||||
JsonObject fPickStockId = new JsonObject();
|
||||
fPickStockId.addProperty("FNumber", "CK010");
|
||||
subHeadEntity1.add("FPickStockId", fPickStockId);
|
||||
|
||||
subHeadEntity5.addProperty("FOverControlMode", "1");
|
||||
subHeadEntity5.addProperty("FStandHourUnitId", "3600");
|
||||
subHeadEntity5.addProperty("FBackFlushType", "1");
|
||||
String jsonData = json.toString();
|
||||
System.out.println(jsonData);
|
||||
try {
|
||||
// 业务对象标识
|
||||
String formId = "BD_MATERIAL";
|
||||
// 调用接口
|
||||
String resultJson = client.save(formId, jsonData);
|
||||
// 用于记录结果
|
||||
Gson gson = new Gson();
|
||||
// 对返回结果进行解析和校验
|
||||
RepoRet repoRet = gson.fromJson(resultJson, RepoRet.class);
|
||||
if (repoRet.getResult().getResponseStatus().isIsSuccess()) {
|
||||
System.out.printf("接口返回结果: %s%n", gson.toJson(repoRet.getResult()));
|
||||
log.info("接口返回结果: %s%n" + gson.toJson(repoRet.getResult()));
|
||||
return 1;
|
||||
} else {
|
||||
MessageUtil.fail("接口返回结果: " + gson.toJson(repoRet.getResult().getResponseStatus()));
|
||||
log.error("接口返回结果: 失败 " + gson.toJson(repoRet.getResult().getResponseStatus()));
|
||||
return 0;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
MessageUtil.fail(e.getMessage());
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
@ -20,6 +20,7 @@ import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.redis.RedisUtils;
|
||||
import com.ruoyi.system.controller.ProcessRouteController;
|
||||
import com.ruoyi.system.domain.*;
|
||||
import com.ruoyi.system.domain.bo.BomDetailsBo;
|
||||
@ -33,6 +34,7 @@ import com.ruoyi.system.jdmain.rouplan.Model;
|
||||
import com.ruoyi.system.jdmain.route.ProcessModel;
|
||||
import com.ruoyi.system.listener.LoadBomResult;
|
||||
import com.ruoyi.system.mapper.*;
|
||||
import com.ruoyi.system.runner.JdUtil;
|
||||
import com.ruoyi.system.runner.PDFGenerator;
|
||||
import com.ruoyi.system.service.IBomDetailsService;
|
||||
import com.ruoyi.system.service.IMaterialPropertiesService;
|
||||
@ -100,7 +102,22 @@ public class ProcessRouteServiceImpl implements IProcessRouteService {
|
||||
Page<ProcessRouteVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
@Override
|
||||
public TableDataInfo<ProcessRouteVo> queryPageList2(ProcessRouteBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<ProcessRoute> lqw = buildQueryWrapper(bo);
|
||||
Page<ProcessRouteVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
List<ProcessRouteVo> records = result.getRecords();
|
||||
log.info("开始更新可用库存");
|
||||
for (ProcessRouteVo record : records) {
|
||||
String materialCode = record.getMaterialCode();
|
||||
if (materialCode != null) {
|
||||
Double keyong = JdUtil.getKeyong(materialCode);
|
||||
record.setFirstBatchQuantity(keyong);
|
||||
|
||||
}
|
||||
}
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
/**
|
||||
* 查询工艺路线列表
|
||||
*/
|
||||
@ -350,15 +367,12 @@ public class ProcessRouteServiceImpl implements IProcessRouteService {
|
||||
public boolean saveData(List<ProcessRouteVo> routeVoList, List<ProductionOrderVo> productionOrderVos) {
|
||||
// 将 ProcessRouteVo 转换为 ProcessRoute
|
||||
List<ProcessRoute> processRoutes = BeanUtil.copyToList(routeVoList, ProcessRoute.class);
|
||||
// firstBatchQuantity
|
||||
|
||||
// 1. 处理材料 BOM
|
||||
processMaterialBom(processRoutes);
|
||||
|
||||
// 2. 处理 BOM 详情
|
||||
List<BomDetailsVo> bomDetailsVos = processBomDetails(processRoutes, productionOrderVos);
|
||||
|
||||
// 3. 保存 BOM 详情
|
||||
Map<String, Double> inventoryCache = new HashMap<>(); // 缓存可用库存
|
||||
saveBomDetails(bomDetailsVos);
|
||||
List<ProcessRoute> routeArrayList = new ArrayList<>();
|
||||
boolean allEmpty = processRoutes.stream()
|
||||
@ -380,6 +394,17 @@ public class ProcessRouteServiceImpl implements IProcessRouteService {
|
||||
|
||||
for (ProcessRoute processRoute : processRoutes) {
|
||||
// 判断是否是重复的组焊件
|
||||
String materialCode = processRoute.getMaterialCode();
|
||||
Double kucun = inventoryCache.get(materialCode); // 从缓存中获取库存
|
||||
|
||||
if (kucun == null) { // 如果缓存中没有,则查询
|
||||
log.info("开始查询可用库存:" + materialCode);
|
||||
kucun = JdUtil.getKeyong(materialCode);
|
||||
if (kucun == null) {
|
||||
kucun = 0.0;
|
||||
}
|
||||
inventoryCache.put(materialCode, kucun); // 将查询结果存入缓存
|
||||
}
|
||||
boolean isDuplicateWelding = "组焊件".equals(processRoute.getMaterial())
|
||||
&& duplicateWeldingMaterials.contains(processRoute.getMaterialCode());
|
||||
|
||||
@ -398,7 +423,6 @@ public class ProcessRouteServiceImpl implements IProcessRouteService {
|
||||
processRoute1.setRouteDescription(processRoute.getRouteDescription());
|
||||
processRoute1.setMaterial(processRoute.getMaterial());
|
||||
processRoute1.setDiscWeight(processRoute.getDiscWeight());
|
||||
|
||||
// 复制工艺信息
|
||||
processRoute1.setProcessNo(processRouteSelectDTO.getProcessNo());
|
||||
processRoute1.setProcessName(processRouteSelectDTO.getProcessName());
|
||||
@ -407,7 +431,8 @@ public class ProcessRouteServiceImpl implements IProcessRouteService {
|
||||
processRoute1.setProcessControl(processRouteSelectDTO.getProcessControl());
|
||||
processRoute1.setActivityDuration(processRouteSelectDTO.getActivityDuration());
|
||||
processRoute1.setActivityUnit("分");
|
||||
|
||||
log.info("开始查询可用库存:" + processRoute.getMaterialCode());
|
||||
processRoute1.setFirstBatchQuantity(kucun);
|
||||
// 设置时间
|
||||
processRoute1.setCreateTime(new Date());
|
||||
processRoute1.setUpdateTime(new Date());
|
||||
@ -428,7 +453,10 @@ public class ProcessRouteServiceImpl implements IProcessRouteService {
|
||||
defaultRoute.setProcessControl(null);
|
||||
defaultRoute.setActivityDuration(null);
|
||||
defaultRoute.setActivityUnit("分");
|
||||
|
||||
|
||||
|
||||
defaultRoute.setFirstBatchQuantity(kucun);
|
||||
|
||||
// 设置创建时间和更新时间
|
||||
defaultRoute.setCreateTime(new Date());
|
||||
defaultRoute.setUpdateTime(new Date());
|
||||
@ -452,7 +480,10 @@ public class ProcessRouteServiceImpl implements IProcessRouteService {
|
||||
if (processRoute.getProcessNo() != null || processRoute.getProcessName() != null) {
|
||||
processRoute.setCreateTime(new Date());
|
||||
processRoute.setUpdateTime(new Date());
|
||||
routeArrayList.add(processRoute);
|
||||
Double kucun = JdUtil.getKeyong(processRoute.getMaterialCode());
|
||||
processRoute.setFirstBatchQuantity(kucun);
|
||||
|
||||
routeArrayList.add(processRoute);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -972,43 +1003,44 @@ public class ProcessRouteServiceImpl implements IProcessRouteService {
|
||||
List<ProcessRouteXuDTO> successfulRoutes = new ArrayList<>();
|
||||
List<ProcessRouteXuDTO> failedRoutes = new ArrayList<>();
|
||||
List<String> duplicateRoutes = new ArrayList<>();
|
||||
for (ProcessRouteXuDTO processRouteXuDTO : rawBomList) {
|
||||
// 获取金蝶中的此物料工艺路线,在金蝶查询可能有多条工艺路线
|
||||
for (ProcessRouteXuDTO processRouteXuDTO : rawBomList) {
|
||||
// 获取金蝶中的此物料工艺路线,在金蝶查询可能有多条工艺路线
|
||||
List<ProcessRouteSelectDTO> jdProcessRoute = getSelectProcessRoute(processRouteXuDTO.getMaterialCode());
|
||||
Map<String, List<ProcessRouteSelectDTO>> groupedByFNumber = jdProcessRoute.stream()
|
||||
.collect(Collectors.groupingBy(ProcessRouteSelectDTO::getFNumber));
|
||||
// 当前物料的工艺路线
|
||||
// 当前物料的工艺路线
|
||||
List<ProcessRouteDTO> processRouteDT = processRouteXuDTO.getProcessRouteDT();
|
||||
// 比较工艺路线
|
||||
// 比较工艺路线
|
||||
boolean isDifferent = compareProcessRoutes(processRouteDT, groupedByFNumber);
|
||||
if (isDifferent) {
|
||||
if (isDifferent) {
|
||||
log.info("工艺路线不同,进行更新: " + processRouteXuDTO.getMaterialCode());
|
||||
|
||||
// 保存工艺路线
|
||||
LoadBomResult result = loadBillOfMaterialsPreservation(processRouteXuDTO);
|
||||
// 处理返回结果
|
||||
if (result.isSuccess()) {
|
||||
log.info("工艺路线保存成功: " + processRouteXuDTO.getMaterialCode() + result.getResultData());
|
||||
successfulRoutes.add(processRouteXuDTO);
|
||||
} else {
|
||||
log.info("工艺路线保存失败: " + processRouteXuDTO.getMaterialCode() + result.getMessage());
|
||||
failedRoutes.add(processRouteXuDTO);
|
||||
}
|
||||
// 保存工艺路线
|
||||
LoadBomResult result = loadBillOfMaterialsPreservation(processRouteXuDTO);
|
||||
// 处理返回结果
|
||||
if (result.isSuccess()) {
|
||||
log.info("工艺路线保存成功: " + processRouteXuDTO.getMaterialCode() + result.getResultData());
|
||||
successfulRoutes.add(processRouteXuDTO);
|
||||
} else {
|
||||
log.info("工艺路线保存失败: " + processRouteXuDTO.getMaterialCode() + result.getMessage());
|
||||
failedRoutes.add(processRouteXuDTO);
|
||||
}
|
||||
} else {
|
||||
log.info("工艺路线相同,无需更新: " + processRouteXuDTO.getMaterialCode());
|
||||
log.info("工艺路线相同,无需更新: " + processRouteXuDTO.getMaterialCode());
|
||||
duplicateRoutes.add(processRouteXuDTO.getMaterialCode());
|
||||
}
|
||||
|
||||
}
|
||||
// 封装结果
|
||||
// 封装结果
|
||||
ProcessRoutePushResultDTO resultDTO = new ProcessRoutePushResultDTO();
|
||||
resultDTO.setSuccessfulRoutes(successfulRoutes);
|
||||
resultDTO.setFailedRoutes(failedRoutes);
|
||||
resultDTO.setDuplicateRoutes(duplicateRoutes);
|
||||
return resultDTO;
|
||||
return resultDTO;
|
||||
}
|
||||
|
||||
private boolean compareProcessRoutes(List<ProcessRouteDTO> processRouteDT, Map<String, List<ProcessRouteSelectDTO>> groupedByFNumber) {
|
||||
private boolean compareProcessRoutes(List<ProcessRouteDTO> processRouteDT,
|
||||
Map<String, List<ProcessRouteSelectDTO>> groupedByFNumber) {
|
||||
// 对当前物料的工艺路线进行排序
|
||||
processRouteDT.sort(Comparator.comparing(ProcessRouteDTO::getProcessNo));
|
||||
for (List<ProcessRouteSelectDTO> jdRoutes : groupedByFNumber.values()) {
|
||||
@ -1021,23 +1053,25 @@ public class ProcessRouteServiceImpl implements IProcessRouteService {
|
||||
}
|
||||
return true; // 没有找到相同的工艺路线,需要更新
|
||||
}
|
||||
private boolean areRoutesEqual (List<ProcessRouteDTO> processRouteDT, List<ProcessRouteSelectDTO> jdRoutes ) {
|
||||
|
||||
private boolean areRoutesEqual(List<ProcessRouteDTO> processRouteDT, List<ProcessRouteSelectDTO> jdRoutes) {
|
||||
if (processRouteDT.size() != jdRoutes.size()) {
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < processRouteDT.size(); i++) {
|
||||
for (int i = 0; i < processRouteDT.size(); i++) {
|
||||
ProcessRouteDTO localRoute = processRouteDT.get(i);
|
||||
ProcessRouteSelectDTO jdRoute = jdRoutes.get(i);
|
||||
if (!Objects.equals(localRoute.getProcessNo(), jdRoute.getProcessNo()) ||
|
||||
!Objects.equals(localRoute.getProcessName(), jdRoute.getProcessName()) ||
|
||||
!Objects.equals(localRoute.getWorkCenter(), jdRoute.getWorkCenter()) ||
|
||||
!Objects.equals(localRoute.getProcessControl(), jdRoute.getProcessControl()) ||
|
||||
!Objects.equals(localRoute.getActivityDuration(), jdRoute.getActivityDuration())) {
|
||||
if (!Objects.equals(localRoute.getProcessNo(), jdRoute.getProcessNo()) ||
|
||||
!Objects.equals(localRoute.getProcessName(), jdRoute.getProcessName()) ||
|
||||
!Objects.equals(localRoute.getWorkCenter(), jdRoute.getWorkCenter()) ||
|
||||
!Objects.equals(localRoute.getProcessControl(), jdRoute.getProcessControl()) ||
|
||||
!Objects.equals(localRoute.getActivityDuration(), jdRoute.getActivityDuration())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询工艺路线单据体
|
||||
*
|
||||
|
||||
@ -2,6 +2,7 @@ package com.ruoyi.system.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.google.gson.Gson;
|
||||
@ -14,17 +15,23 @@ import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.system.domain.SafetyStock;
|
||||
import com.ruoyi.system.domain.WlStockData;
|
||||
import com.ruoyi.system.domain.bo.WlStockDataBo;
|
||||
import com.ruoyi.system.domain.dto.InvReserveAnalyzeRptDTO;
|
||||
import com.ruoyi.system.domain.dto.ProMoDTO;
|
||||
import com.ruoyi.system.domain.dto.PurchaseOrderDTO;
|
||||
import com.ruoyi.system.domain.vo.WlStockDataVo;
|
||||
import com.ruoyi.system.mapper.SafetyStockMapper;
|
||||
import com.ruoyi.system.mapper.StandardPartsMapper;
|
||||
import com.ruoyi.system.mapper.WlStockDataMapper;
|
||||
import com.ruoyi.system.runner.JdUtil;
|
||||
import com.ruoyi.system.service.IWlStockDataService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@ -76,10 +83,16 @@ public class WlStockDataServiceImpl implements IWlStockDataService {
|
||||
lqw.eq(bo.getRequiredStock() != null, WlStockData::getRequiredStock, bo.getRequiredStock());
|
||||
lqw.eq(bo.getCurrentStock() != null, WlStockData::getCurrentStock, bo.getCurrentStock());
|
||||
lqw.eq(bo.getTriggerTime() != null, WlStockData::getTriggerTime, bo.getTriggerTime());
|
||||
lqw.eq(bo.getDocumentType() != null, WlStockData::getDocumentType, bo.getDocumentType());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getDocumentType()), WlStockData::getDocumentType, bo.getDocumentType());
|
||||
lqw.eq(bo.getAvailableStock() != null, WlStockData::getAvailableStock, bo.getAvailableStock());
|
||||
lqw.eq(bo.getSecAvbqty() != null, WlStockData::getSecAvbqty, bo.getSecAvbqty());
|
||||
lqw.eq(bo.getProductionQty() != null, WlStockData::getProductionQty, bo.getProductionQty());
|
||||
lqw.eq(bo.getPurchaseQty() != null, WlStockData::getPurchaseQty, bo.getPurchaseQty());
|
||||
lqw.eq(bo.getSecQty() != null, WlStockData::getSecQty, bo.getSecQty());
|
||||
lqw.eq(bo.getMaxsafetyStock() != null, WlStockData::getMaxsafetyStock, bo.getMaxsafetyStock());
|
||||
lqw.eq(bo.getMinsafetyStock() != null, WlStockData::getMinsafetyStock, bo.getMinsafetyStock());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增安全库存单据
|
||||
*/
|
||||
@ -108,7 +121,7 @@ public class WlStockDataServiceImpl implements IWlStockDataService {
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(WlStockData entity) {
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
// TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
@ -117,7 +130,7 @@ public class WlStockDataServiceImpl implements IWlStockDataService {
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if (isValid) {
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
// TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteBatchIds(ids) > 0;
|
||||
}
|
||||
@ -127,13 +140,13 @@ public class WlStockDataServiceImpl implements IWlStockDataService {
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<WlStockData> generateDoc() {
|
||||
|
||||
public List<WlStockData> generateDoc2() {
|
||||
// 查询到安全库存单据已有的数据
|
||||
List<WlStockData> existingStockData = baseMapper.selectList();
|
||||
Set<String> existingMaterialCodes = existingStockData.stream()
|
||||
.map(WlStockData::getMaterialCode)
|
||||
.collect(Collectors.toSet());
|
||||
.map(WlStockData::getMaterialCode)
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
// 获取安全库存阈值,并存储在映射中
|
||||
List<SafetyStock> safetyStocks = safetyStockMapper.selectList();
|
||||
@ -153,7 +166,9 @@ public class WlStockDataServiceImpl implements IWlStockDataService {
|
||||
if (jsonArray != null && jsonArray.size() > 0) {
|
||||
for (int i = 0; i < jsonArray.size(); i++) {
|
||||
JsonObject jsonObject = jsonArray.get(i).getAsJsonObject();
|
||||
String materialCode = jsonObject.has("FMaterialId.FNumber") ? jsonObject.get("FMaterialId.FNumber").getAsString() : "";
|
||||
String materialCode = jsonObject.has("FMaterialId.FNumber")
|
||||
? jsonObject.get("FMaterialId.FNumber").getAsString()
|
||||
: "";
|
||||
double currentStock = jsonObject.has("FBaseQty") ? jsonObject.get("FBaseQty").getAsDouble() : 0.0;
|
||||
logger.info("MaterialCode: {}, CurrentStock: {}", materialCode, currentStock);
|
||||
currentStockMap.put(materialCode, currentStock);
|
||||
@ -181,7 +196,7 @@ public class WlStockDataServiceImpl implements IWlStockDataService {
|
||||
WlStockData wlStockData = new WlStockData();
|
||||
wlStockData.setMaterialCode(safetyStock.getMaterialCode());
|
||||
wlStockData.setMaterialName(safetyStock.getMaterialName());
|
||||
wlStockData.setRequiredStock(safetyStock.getMaxSafetyStock()); // 使用 maxSafetyStock
|
||||
wlStockData.setRequiredStock(safetyStock.getMaxSafetyStock()); // 使用 maxSafetyStock
|
||||
wlStockData.setCurrentStock(currentStock);
|
||||
wlStockData.setTriggerTime(new Date());
|
||||
wlStockData.setCreateTime(new Date());
|
||||
@ -193,12 +208,13 @@ public class WlStockDataServiceImpl implements IWlStockDataService {
|
||||
baseMapper.insertBatch(wlStockDataList);
|
||||
return wlStockDataList;
|
||||
}
|
||||
|
||||
public List<WlStockData> generateDoc1() {
|
||||
// 查询到安全库存单据已有的数据
|
||||
List<WlStockData> existingStockData = baseMapper.selectList();
|
||||
Set<String> existingMaterialCodes = existingStockData.stream()
|
||||
.map(WlStockData::getMaterialCode)
|
||||
.collect(Collectors.toSet());
|
||||
.map(WlStockData::getMaterialCode)
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
// 获取安全库存阈值,并存储在映射中
|
||||
List<SafetyStock> safetyStocks = safetyStockMapper.selectList();
|
||||
@ -218,7 +234,9 @@ public class WlStockDataServiceImpl implements IWlStockDataService {
|
||||
if (jsonArray != null && jsonArray.size() > 0) {
|
||||
for (int i = 0; i < jsonArray.size(); i++) {
|
||||
JsonObject jsonObject = jsonArray.get(i).getAsJsonObject();
|
||||
String materialCode = jsonObject.has("FMaterialId.FNumber") ? jsonObject.get("FMaterialId.FNumber").getAsString() : "";
|
||||
String materialCode = jsonObject.has("FMaterialId.FNumber")
|
||||
? jsonObject.get("FMaterialId.FNumber").getAsString()
|
||||
: "";
|
||||
double currentStock = jsonObject.has("FBaseQty") ? jsonObject.get("FBaseQty").getAsDouble() : 0.0;
|
||||
logger.info("MaterialCode: {}, CurrentStock: {}", materialCode, currentStock);
|
||||
currentStockMap.put(materialCode, currentStock);
|
||||
@ -246,7 +264,7 @@ public class WlStockDataServiceImpl implements IWlStockDataService {
|
||||
WlStockData wlStockData = new WlStockData();
|
||||
wlStockData.setMaterialCode(safetyStock.getMaterialCode());
|
||||
wlStockData.setMaterialName(safetyStock.getMaterialName());
|
||||
wlStockData.setRequiredStock(safetyStock.getMaxSafetyStock()); // 使用 maxSafetyStock
|
||||
wlStockData.setRequiredStock(safetyStock.getMaxSafetyStock()); // 使用 maxSafetyStock
|
||||
wlStockData.setCurrentStock(currentStock);
|
||||
wlStockData.setTriggerTime(new Date());
|
||||
wlStockDataList.add(wlStockData);
|
||||
@ -259,12 +277,115 @@ public class WlStockDataServiceImpl implements IWlStockDataService {
|
||||
return wlStockDataList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<WlStockData> generateDoc() {
|
||||
List<SafetyStock> safetyStocks = safetyStockMapper.selectList();
|
||||
List<WlStockData> wlStockDataList = new ArrayList<>();
|
||||
|
||||
// 使用 CachedThreadPool
|
||||
ExecutorService executor = Executors.newCachedThreadPool();
|
||||
List<CompletableFuture<WlStockData>> futures = new ArrayList<>();
|
||||
|
||||
for (SafetyStock safetyStock : safetyStocks) {
|
||||
// 提交任务到线程池
|
||||
CompletableFuture<WlStockData> future = CompletableFuture.supplyAsync(() -> processMaterialCode(safetyStock), executor);
|
||||
futures.add(future);
|
||||
}
|
||||
|
||||
// 收集结果
|
||||
for (CompletableFuture<WlStockData> future : futures) {
|
||||
future.thenAccept(wlStockData -> {
|
||||
if (wlStockData != null) {
|
||||
wlStockDataList.add(wlStockData);
|
||||
}
|
||||
}).exceptionally(e -> {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
});
|
||||
}
|
||||
|
||||
// 等待所有任务完成
|
||||
CompletableFuture.allOf(futures.toArray(new CompletableFuture[0])).join();
|
||||
|
||||
executor.shutdown();
|
||||
baseMapper.insertBatch(wlStockDataList);
|
||||
|
||||
return wlStockDataList;
|
||||
}
|
||||
|
||||
private WlStockData processMaterialCode(SafetyStock safetyStock) {
|
||||
if (safetyStock == null) {
|
||||
logger.error("SafetyStock is null");
|
||||
return null; // 或者抛出异常
|
||||
}
|
||||
|
||||
String materialCode = safetyStock.getMaterialCode();
|
||||
if (materialCode == null) {
|
||||
logger.error("Material code is null for SafetyStock: {}", safetyStock);
|
||||
return null; // 或者抛出异常
|
||||
}
|
||||
|
||||
List<InvReserveAnalyzeRptDTO> analyzeRpt = JdUtil.getInvReserveAnalyzeRpt(materialCode);
|
||||
double fSecAVBQty = 0.0; // 默认值
|
||||
double fSecQty = 0.0; // 默认值
|
||||
|
||||
// 检查 analyzeRpt 是否为 null 或空
|
||||
if (analyzeRpt != null && !analyzeRpt.isEmpty()) {
|
||||
fSecAVBQty = analyzeRpt.get(0).getFSecAVBQty();
|
||||
fSecQty = analyzeRpt.stream().mapToDouble(dto -> dto.getFSecQty() != null ? dto.getFSecQty() : 0.0).sum();
|
||||
} else {
|
||||
logger.warn("No inventory report found for material code: {}", materialCode);
|
||||
// 如果没有库存数据,fSecAVBQty 和 fSecQty 保持为 0
|
||||
}
|
||||
|
||||
double productionQty = 0.0;
|
||||
double purchaseQty = 0.0;
|
||||
productionQty = JdUtil.getProMoList(materialCode).stream().mapToDouble(ProMoDTO::getFQty).sum();
|
||||
purchaseQty = JdUtil.getPurchaseOrderList(materialCode).stream().mapToDouble(PurchaseOrderDTO::getFQty).sum();
|
||||
//可用库存
|
||||
double availableStock = fSecAVBQty + productionQty + purchaseQty - fSecQty;
|
||||
//最小安全库存
|
||||
double minSafetyStock = safetyStock.getMinSafetyStock();
|
||||
//最大安全库存
|
||||
double maxSafetyStock = safetyStock.getMaxSafetyStock();
|
||||
|
||||
if (availableStock < minSafetyStock) {
|
||||
WlStockData wlStockData = new WlStockData();
|
||||
wlStockData.setMaterialCode(safetyStock.getMaterialCode());
|
||||
wlStockData.setMaterialName(safetyStock.getMaterialName());
|
||||
wlStockData.setRequiredStock(maxSafetyStock);
|
||||
wlStockData.setCurrentStock(availableStock);
|
||||
wlStockData.setTriggerTime(new Date());
|
||||
wlStockData.setAvailableStock(BigDecimal.valueOf(availableStock));
|
||||
wlStockData.setProductionQty(BigDecimal.valueOf(productionQty));
|
||||
wlStockData.setPurchaseQty(BigDecimal.valueOf(purchaseQty));
|
||||
wlStockData.setSecQty(BigDecimal.valueOf(fSecQty));
|
||||
wlStockData.setMinsafetyStock(BigDecimal.valueOf(minSafetyStock));
|
||||
wlStockData.setMaxsafetyStock(BigDecimal.valueOf(maxSafetyStock));
|
||||
wlStockData.setSecAvbqty(BigDecimal.valueOf(fSecAVBQty));
|
||||
|
||||
wlStockData.setDocumentType("物料编码:" + materialCode + "||" + "可用库存:" + availableStock + "||" + "库存量:"
|
||||
+ fSecAVBQty + "||" + "生产订单:" + productionQty + "||" + "采购订单:" + purchaseQty + "||" + "预留量:"
|
||||
+ fSecQty + "||" + "最大库存:" + maxSafetyStock + "||" + "最低库存:" + minSafetyStock);
|
||||
|
||||
//创建生产订单
|
||||
|
||||
return wlStockData;
|
||||
}else {
|
||||
System.err.println("未找到物料编码的库相关信息: " + materialCode+ "可用库存:" + availableStock + "||" + "库存量:"
|
||||
+ fSecAVBQty + "||" + "生产订单:" + productionQty + "||" + "采购订单:" + purchaseQty + "||" + "预留量:"
|
||||
+ fSecQty + "||" + "最大库存:" + maxSafetyStock + "||" + "最低库存:" + minSafetyStock);
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 物料批量查询
|
||||
*/
|
||||
public static JsonArray selectKuCun1( List<SafetyStock> safetyStocks) {
|
||||
public static JsonArray selectKuCun1(List<SafetyStock> safetyStocks) {
|
||||
K3CloudApi client = new K3CloudApi();
|
||||
//请求参数,要求为json字符串
|
||||
// 请求参数,要求为json字符串
|
||||
JsonObject json = new JsonObject();
|
||||
json.addProperty("FormId", "STK_Inventory");
|
||||
json.addProperty("FieldKeys", "FMaterialId.FNumber,FMaterialName,FStockName,FStockUnitId.FName,FBaseQty");
|
||||
@ -288,7 +409,7 @@ public class WlStockDataServiceImpl implements IWlStockDataService {
|
||||
excludeStockFilter1.addProperty("Logic", 0); // 设置逻辑关系为 OR (假设 0 代表 OR)
|
||||
filterString.add(excludeStockFilter1);
|
||||
|
||||
for (int i= 0; i<safetyStocks.size(); i++) {
|
||||
for (int i = 0; i < safetyStocks.size(); i++) {
|
||||
SafetyStock safetyStock = safetyStocks.get(i);
|
||||
JsonObject filterObject = new JsonObject();
|
||||
filterObject.addProperty("FieldName", "FMaterialId.FNumber");
|
||||
@ -320,7 +441,7 @@ public class WlStockDataServiceImpl implements IWlStockDataService {
|
||||
String jsonData = json.toString();
|
||||
JsonArray jsonArray;
|
||||
try {
|
||||
//调用接口
|
||||
// 调用接口
|
||||
String resultJson = String.valueOf(client.billQuery(jsonData));
|
||||
jsonArray = new Gson().fromJson(resultJson, JsonArray.class);
|
||||
logger.info("查询库存信息:{}", jsonArray);
|
||||
@ -331,7 +452,9 @@ public class WlStockDataServiceImpl implements IWlStockDataService {
|
||||
Map<String, Double> materialStockMap = new HashMap<>();
|
||||
for (int i = 0; i < jsonArray.size(); i++) {
|
||||
JsonObject stockData = jsonArray.get(i).getAsJsonObject();
|
||||
String materialCode = stockData.has("FMaterialId.FNumber") ? stockData.get("FMaterialId.FNumber").getAsString() : "";
|
||||
String materialCode = stockData.has("FMaterialId.FNumber")
|
||||
? stockData.get("FMaterialId.FNumber").getAsString()
|
||||
: "";
|
||||
double baseQty = stockData.has("FBaseQty") ? stockData.get("FBaseQty").getAsDouble() : 0;
|
||||
|
||||
// 聚合相同物料的库存数量
|
||||
|
||||
@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.system.mapper.EleMaterialsMapper">
|
||||
|
||||
<resultMap type="com.ruoyi.system.domain.EleMaterials" id="EleMaterialsResult">
|
||||
<result property="id" column="id"/>
|
||||
<result property="serialNumber" column="serial_number"/>
|
||||
<result property="materialCode" column="material_code"/>
|
||||
<result property="materialName" column="material_name"/>
|
||||
<result property="model" column="model"/>
|
||||
<result property="materialType" column="material_type"/>
|
||||
<result property="unit" column="unit"/>
|
||||
<result property="brand" column="brand"/>
|
||||
<result property="remarks" column="remarks"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
</mapper>
|
||||
@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.system.mapper.NewMaterialsMapper">
|
||||
|
||||
<resultMap type="com.ruoyi.system.domain.NewMaterials" id="NewMaterialsResult">
|
||||
<result property="id" column="id"/>
|
||||
<result property="serialNumber" column="serial_number"/>
|
||||
<result property="materialCode" column="material_code"/>
|
||||
<result property="materialName" column="material_name"/>
|
||||
<result property="materialModel" column="material_model"/>
|
||||
<result property="materialType" column="material_type"/>
|
||||
<result property="materialUnit" column="material_unit"/>
|
||||
<result property="materialBrand" column="material_brand"/>
|
||||
<result property="remarks" column="remarks"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="materialAttribute" column="material_attribute"/>
|
||||
<result property="existsStatus" column="exists_status"/>
|
||||
<result property="materialClassify" column="material_classify"/>
|
||||
</resultMap>
|
||||
</mapper>
|
||||
@ -16,6 +16,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="availableStock" column="available_stock"/>
|
||||
<result property="secAvbqty" column="sec_avbqty"/>
|
||||
<result property="productionQty" column="production_qty"/>
|
||||
<result property="purchaseQty" column="purchase_qty"/>
|
||||
<result property="secQty" column="sec_qty"/>
|
||||
<result property="maxsafetyStock" column="maxsafety_stock"/>
|
||||
<result property="minsafetyStock" column="minsafety_stock"/>
|
||||
<result property="doucCode" column="douc_code"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user