更新采购申请单 生产订单仓库
This commit is contained in:
parent
3c0a849df7
commit
a83e250c37
@ -905,7 +905,7 @@ public class ProcessRouteController extends BaseController {
|
||||
@SaCheckPermission("system:route:updateProductionOrders")
|
||||
@Log(title = "获取全部工艺路线和物料清单", businessType = BusinessType.OTHER)
|
||||
@PostMapping("/updateCgOrders")
|
||||
public R updateCgOrders(@RequestParam("rooteProdet") String rooteProdet,@RequestParam("cangKuNum")String cangKuNum) {
|
||||
public R updateCgOrders(@RequestParam("rooteProdet") String rooteProdet,@RequestParam("cangKuNum")String cangKuNum) throws Exception {
|
||||
//判断此项目是否有
|
||||
List<String> list = iProcessRouteService.updateCgOrders(rooteProdet,cangKuNum);
|
||||
return R.ok(list);
|
||||
|
||||
@ -0,0 +1,12 @@
|
||||
package com.ruoyi.system.domain.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class CgDTO {
|
||||
@JsonProperty("FBillNo")
|
||||
private String orderBillNo;
|
||||
@JsonProperty("FMaterialId.FNumber")
|
||||
private String materialCode;
|
||||
}
|
||||
@ -1,27 +1,15 @@
|
||||
package com.ruoyi.system.jdmain.rouplan;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class FidEntryIdDTO {
|
||||
@JsonProperty("FID")
|
||||
private Long fid;
|
||||
@JsonProperty("FEntity_FEntryID")
|
||||
private Long fEntryId;
|
||||
private String warehouseNumber;
|
||||
public FidEntryIdDTO(Long fid, Long fEntryId, String warehouseNumber) {
|
||||
this.fid = fid;
|
||||
this.fEntryId = fEntryId;
|
||||
this.warehouseNumber = warehouseNumber;
|
||||
}
|
||||
@JsonProperty("FBillNo")
|
||||
private String FBillNo;
|
||||
|
||||
public Long getFid() {
|
||||
return fid;
|
||||
}
|
||||
|
||||
public Long getFEntryId() {
|
||||
return fEntryId;
|
||||
}
|
||||
|
||||
public String getWarehouseNumber() {
|
||||
return warehouseNumber;
|
||||
}
|
||||
}
|
||||
|
||||
@ -3421,96 +3421,18 @@ public class JdUtil {
|
||||
}
|
||||
return Collections.emptyList();
|
||||
}
|
||||
public static String updateOrder2(JdHuoZhu jdHuoZhu, String cangKuNum) throws Exception {
|
||||
|
||||
K3CloudApi api = new K3CloudApi(false);
|
||||
JsonObject json = new JsonObject();
|
||||
|
||||
JsonArray needUpDateFields = new JsonArray();
|
||||
needUpDateFields.add("FID");
|
||||
needUpDateFields.add("F_HBYT_RKCK.FName");
|
||||
needUpDateFields.add("FTreeEntity_FENTRYID");
|
||||
json.add("NeedUpDateFields", needUpDateFields);
|
||||
|
||||
json.addProperty("IsDeleteEntry", "false");
|
||||
|
||||
JsonObject model = new JsonObject();
|
||||
model.addProperty("FID", jdHuoZhu.getFID());
|
||||
|
||||
JsonArray fTreeEntity = new JsonArray();
|
||||
JsonObject fTreeEntityItem = new JsonObject();
|
||||
fTreeEntityItem.addProperty("F_HBYT_RKCK.FName", cangKuNum);
|
||||
fTreeEntityItem.addProperty("FENTRYID", jdHuoZhu.getFTreeEntityFENTRYID());
|
||||
fTreeEntity.add(fTreeEntityItem);
|
||||
model.add("FTreeEntity", fTreeEntity);
|
||||
|
||||
json.add("Model", model);
|
||||
|
||||
// Gson 自己序列化自己
|
||||
String data = json.toString();
|
||||
System.out.println(data);
|
||||
|
||||
String result = api.save("PRD_MO", data);
|
||||
|
||||
Gson gson = new Gson();
|
||||
RepoRet sRet = gson.fromJson(result, RepoRet.class);
|
||||
|
||||
if (sRet.isSuccessfully()) {
|
||||
return "生产订单保存成功";
|
||||
} else {
|
||||
return "生产订单保存失败:" + gson.toJson(sRet.getResult());
|
||||
}
|
||||
}
|
||||
|
||||
public static String updateCgOrder1(List<FidEntryIdDTO> list, String cangKuNum) throws Exception {
|
||||
|
||||
K3CloudApi api = new K3CloudApi(false);
|
||||
JsonObject json = new JsonObject();
|
||||
|
||||
JsonArray needUpDateFields = new JsonArray();
|
||||
needUpDateFields.add("FID");
|
||||
needUpDateFields.add("F_HBYT_RKCK.FName");
|
||||
needUpDateFields.add("FTreeEntity_FENTRYID");
|
||||
json.add("NeedUpDateFields", needUpDateFields);
|
||||
|
||||
json.addProperty("IsDeleteEntry", "false");
|
||||
|
||||
JsonObject model = new JsonObject();
|
||||
model.addProperty("FID", jdHuoZhu.getFID());
|
||||
|
||||
JsonArray fTreeEntity = new JsonArray();
|
||||
JsonObject fTreeEntityItem = new JsonObject();
|
||||
fTreeEntityItem.addProperty("F_HBYT_RKCK.FName", cangKuNum);
|
||||
fTreeEntityItem.addProperty("FENTRYID", jdHuoZhu.getFTreeEntityFENTRYID());
|
||||
fTreeEntity.add(fTreeEntityItem);
|
||||
model.add("FTreeEntity", fTreeEntity);
|
||||
|
||||
json.add("Model", model);
|
||||
|
||||
// Gson 自己序列化自己
|
||||
String data = json.toString();
|
||||
System.out.println(data);
|
||||
|
||||
String result = api.save("PRD_MO", data);
|
||||
|
||||
Gson gson = new Gson();
|
||||
RepoRet sRet = gson.fromJson(result, RepoRet.class);
|
||||
|
||||
if (sRet.isSuccessfully()) {
|
||||
return "生产订单保存成功";
|
||||
} else {
|
||||
return "生产订单保存失败:" + gson.toJson(sRet.getResult());
|
||||
}
|
||||
}
|
||||
/*
|
||||
|
||||
/**
|
||||
* 获取此令号下的采购申请单对应的所有物料编码
|
||||
* @param productionOrderNo
|
||||
* @return
|
||||
*/
|
||||
public static List<String> getCaiGouOrderNumberList(String productionOrderNo) {
|
||||
public static List<CgDTO> getCGOrderFBillNoList2(String productionOrderNo) {
|
||||
K3CloudApi client = new K3CloudApi();
|
||||
// 请求参数,要求为json字符串
|
||||
JsonObject json = new JsonObject();
|
||||
json.addProperty("FormId", "PUR_Requisition");
|
||||
json.addProperty("FieldKeys", "FMaterialId.FNumber");
|
||||
json.addProperty("FieldKeys", "FBillNo,FMaterialId.FNumber");
|
||||
JsonArray filterString = new JsonArray();
|
||||
JsonObject filterObject = new JsonObject();
|
||||
filterObject.addProperty("FieldName", "F_UCHN_Text");
|
||||
@ -3531,18 +3453,139 @@ public class JdUtil {
|
||||
try {
|
||||
String resultJson = String.valueOf(client.billQuery(jsonData));
|
||||
JsonArray jsonArray = new Gson().fromJson(resultJson, JsonArray.class);
|
||||
List<String> list = new ArrayList<>();
|
||||
for (int i = 0; i < jsonArray.size(); i++) {
|
||||
JsonObject jsonObject = jsonArray.get(i).getAsJsonObject();
|
||||
if (jsonObject.has("FMaterialId.FNumber")) {
|
||||
list.add(jsonObject.get("FMaterialId.FNumber").getAsString());
|
||||
}
|
||||
if (jsonArray != null && jsonArray.size() > 0) {
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
return objectMapper.readValue(jsonArray.toString(), new TypeReference<List<CgDTO>>() {
|
||||
});
|
||||
} else {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return list;
|
||||
} catch (Exception e) {
|
||||
log.error("调用接口时发生异常: " + e.getMessage(), e);
|
||||
}
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
public static String updateOrder2(JdHuoZhu jdHuoZhu, String cangKuNum) throws Exception {
|
||||
|
||||
K3CloudApi api = new K3CloudApi(false);
|
||||
JsonObject json = new JsonObject();
|
||||
|
||||
JsonArray needUpDateFields = new JsonArray();
|
||||
needUpDateFields.add("FID");
|
||||
needUpDateFields.add("F_HBYT_RKCK.FName");
|
||||
needUpDateFields.add("FTreeEntity");
|
||||
json.add("NeedUpDateFields", needUpDateFields);
|
||||
|
||||
json.addProperty("IsDeleteEntry", "false");
|
||||
|
||||
JsonObject model = new JsonObject();
|
||||
model.addProperty("FID", jdHuoZhu.getFID());
|
||||
|
||||
JsonArray fTreeEntity = new JsonArray();
|
||||
JsonObject fTreeEntityItem = new JsonObject();
|
||||
fTreeEntityItem.addProperty("F_HBYT_RKCK.FName", cangKuNum);
|
||||
fTreeEntityItem.addProperty("FENTRYID", jdHuoZhu.getFTreeEntityFENTRYID());
|
||||
fTreeEntity.add(fTreeEntityItem);
|
||||
model.add("FTreeEntity", fTreeEntity);
|
||||
|
||||
json.add("Model", model);
|
||||
|
||||
// Gson 自己序列化自己
|
||||
String data = json.toString();
|
||||
System.out.println(data);
|
||||
|
||||
String result = api.save("PRD_MO", data);
|
||||
|
||||
Gson gson = new Gson();
|
||||
RepoRet sRet = gson.fromJson(result, RepoRet.class);
|
||||
|
||||
if (sRet.isSuccessfully()) {
|
||||
return "生产订单保存成功";
|
||||
} else {
|
||||
return "生产订单保存失败:" + gson.toJson(sRet.getResult());
|
||||
}
|
||||
}
|
||||
|
||||
public static String updateCgOrder1(FidEntryIdDTO fidEntryIdDTO, String cangKuNum) throws Exception {
|
||||
|
||||
K3CloudApi api = new K3CloudApi(false);
|
||||
JsonObject json = new JsonObject();
|
||||
JsonArray needUpDateFields = new JsonArray();
|
||||
needUpDateFields.add("F_HBYT_RKCK");
|
||||
needUpDateFields.add("FEntity");
|
||||
json.add("NeedUpDateFields", needUpDateFields);
|
||||
|
||||
json.addProperty("IsDeleteEntry", "false");
|
||||
|
||||
JsonObject model = new JsonObject();
|
||||
model.addProperty("FID", fidEntryIdDTO.getFid());
|
||||
|
||||
JsonArray fTreeEntity = new JsonArray();
|
||||
JsonObject fTreeEntityItem = new JsonObject();
|
||||
fTreeEntityItem.addProperty("F_HBYT_RKCK.FName", cangKuNum);
|
||||
fTreeEntityItem.addProperty("FEntity_FEntryID", fidEntryIdDTO.getFEntryId());
|
||||
fTreeEntity.add(fTreeEntityItem);
|
||||
model.add("FEntity", fTreeEntity);
|
||||
json.add("Model", model);
|
||||
|
||||
// Gson 自己序列化自己
|
||||
String data = json.toString();
|
||||
System.out.println(data);
|
||||
|
||||
String result = api.save("PUR_Requisition", data);
|
||||
|
||||
Gson gson = new Gson();
|
||||
RepoRet sRet = gson.fromJson(result, RepoRet.class);
|
||||
|
||||
if (sRet.isSuccessfully()) {
|
||||
return "采购申请单保存成功";
|
||||
} else {
|
||||
return "采购申请单成功失败:" + gson.toJson(sRet.getResult());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询采购申请的FID 和entryid
|
||||
* @param fBillNo
|
||||
* @return
|
||||
*/
|
||||
public static List<FidEntryIdDTO> queryFidAndEntryId(String fBillNo) {
|
||||
K3CloudApi client = new K3CloudApi();
|
||||
// 请求参数,要求为json字符串
|
||||
JsonObject json = new JsonObject();
|
||||
json.addProperty("FormId", "PUR_Requisition");
|
||||
json.addProperty("FieldKeys", "FBillNo,FID,FEntity_FEntryID");
|
||||
JsonArray filterString = new JsonArray();
|
||||
JsonObject filterObject = new JsonObject();
|
||||
filterObject.addProperty("FieldName", "FBillNo");
|
||||
filterObject.addProperty("Compare", "67");
|
||||
filterObject.addProperty("Value", fBillNo);
|
||||
filterObject.addProperty("Left", "");
|
||||
filterObject.addProperty("Right", "");
|
||||
filterObject.addProperty("Logic", 0);
|
||||
filterString.add(filterObject);
|
||||
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();
|
||||
try {
|
||||
String resultJson = String.valueOf(client.billQuery(jsonData));
|
||||
JsonArray jsonArray = new Gson().fromJson(resultJson, JsonArray.class);
|
||||
if (jsonArray != null && jsonArray.size() > 0) {
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
return objectMapper.readValue(jsonArray.toString(), new TypeReference<List<FidEntryIdDTO>>() {
|
||||
});
|
||||
} else {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("调用接口时发生异常: " + e.getMessage(), e);
|
||||
}
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
|
||||
@ -55,6 +55,7 @@ import java.util.concurrent.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.ruoyi.system.controller.BomDetailsController.*;
|
||||
import static com.ruoyi.system.runner.JdUtil.getCaiGouOrderNumberList;
|
||||
import static com.ruoyi.system.runner.JdUtil.updateCgOrder1;
|
||||
import static com.ruoyi.system.runner.JsonConverter.createProcessModel;
|
||||
import static com.ruoyi.system.runner.updatePcessPlanConver.updatePcessPlan1;
|
||||
@ -2635,16 +2636,19 @@ public class ProcessRouteServiceImpl implements IProcessRouteService {
|
||||
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新采购申请仓库字段
|
||||
*/
|
||||
public List<String> updateCgOrders(String rooteProdet, String cangKuNum) throws Exception {
|
||||
List<PlanOrderVo> planOrderList = getSelectProceOrder1(rooteProdet);
|
||||
for (PlanOrderVo planOrderVo : planOrderList) {
|
||||
List<FidEntryIdDTO> fidEntryIdDTOS = JdUtil.queryFidAndEntryId(planOrderVo.getFBillNo());
|
||||
List<CgDTO> list = JdUtil.getCGOrderFBillNoList2(rooteProdet);
|
||||
for (CgDTO orderBillNo : list) {
|
||||
List<FidEntryIdDTO> fidEntryIdDTOS = JdUtil.queryFidAndEntryId(orderBillNo.getOrderBillNo());
|
||||
for (FidEntryIdDTO fidEntryIdDTO : fidEntryIdDTOS) {
|
||||
|
||||
String s = updateCgOrder1(fidEntryIdDTO, cangKuNum);
|
||||
}
|
||||
String s = updateCgOrder1(fidEntryIdDTOS, cangKuNum);
|
||||
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user