ERP同步收料通知单发送邮件提示信息完善
MES同步到ERP入库和出库信息增加操作日志信息的保存
master
xs 6 months ago
parent 898f660d32
commit aa36a11b15

@ -54,4 +54,6 @@ public class SystemConstants {
public static final Long PROCESS_ACTIVITY_ID_STOCK_NOTENOUGH = 5011L;//物料库存告警 public static final Long PROCESS_ACTIVITY_ID_STOCK_NOTENOUGH = 5011L;//物料库存告警
public static final Long PROCESS_ACTIVITY_ID_PRODUCE_PAUSE = 7011L;//车间暂停通知 public static final Long PROCESS_ACTIVITY_ID_PRODUCE_PAUSE = 7011L;//车间暂停通知
public static final Long PROCESS_ACTIVITY_ID_RECEIVE_BILL = 8011L;//收料通知单通知
} }

@ -88,7 +88,7 @@ public enum BusinessType
ALLOCATE, ALLOCATE,
/** /**
* * (16)
*/ */
UNALLOCATE, UNALLOCATE,
@ -110,7 +110,7 @@ public enum BusinessType
/** /**
* * (20)
*/ */
OUTSTOCK, OUTSTOCK,
@ -135,7 +135,7 @@ public enum BusinessType
PRINT, PRINT,
/** /**
* * (25)
*/ */
REGENERATE, REGENERATE,
@ -160,7 +160,7 @@ public enum BusinessType
RECALL, RECALL,
/** /**
* * (30)
*/ */
PAUSE, PAUSE,

@ -144,8 +144,8 @@ public class KingdeeErpSyncController {
* ERPMES * ERPMES
*/ */
@PostMapping("/syncPurchaseReceiveBillFromErp") @PostMapping("/syncPurchaseReceiveBillFromErp")
@Log(title = "ERP采购收料单", businessType = BusinessType.INSERT) // @Log(title = "ERP采购收料单", businessType = BusinessType.INSERT)
@InnerAuth // @InnerAuth
public AjaxResult syncPurchaseReceiveBillFromErp(@RequestBody ErpSyncInfoVo erpSyncInfoVo) { public AjaxResult syncPurchaseReceiveBillFromErp(@RequestBody ErpSyncInfoVo erpSyncInfoVo) {
try { try {
return AjaxResult.success(kingdeeErpSyncService.syncPurchaseReceiveBillFromErp(0, erpSyncInfoVo)); return AjaxResult.success(kingdeeErpSyncService.syncPurchaseReceiveBillFromErp(0, erpSyncInfoVo));

@ -87,6 +87,8 @@ public class MesPurchaseReceiveBill extends BaseEntity
@Excel(name = "京源项目;F_TOND_Base") @Excel(name = "京源项目;F_TOND_Base")
private String tondBase; private String tondBase;
private Date preDeliveryDate;
/** 单价;FPRICE */ /** 单价;FPRICE */
@Excel(name = "单价;FPRICE") @Excel(name = "单价;FPRICE")
private BigDecimal price; private BigDecimal price;
@ -251,6 +253,15 @@ public class MesPurchaseReceiveBill extends BaseEntity
{ {
return tondBase; return tondBase;
} }
public Date getPreDeliveryDate() {
return preDeliveryDate;
}
public void setPreDeliveryDate(Date preDeliveryDate) {
this.preDeliveryDate = preDeliveryDate;
}
public void setPrice(BigDecimal price) public void setPrice(BigDecimal price)
{ {
this.price = price; this.price = price;

@ -4,8 +4,11 @@ package com.hw.jindie.service.impl;
import com.alibaba.fastjson2.JSONArray; import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.JSONObject;
import com.alibaba.nacos.shaded.com.google.gson.Gson; import com.alibaba.nacos.shaded.com.google.gson.Gson;
import com.hw.common.core.constant.SecurityConstants;
import com.hw.common.core.utils.StringUtils; import com.hw.common.core.utils.StringUtils;
import com.hw.jindie.config.KingdeeConfig; import com.hw.jindie.config.KingdeeConfig;
import com.hw.system.api.RemoteLogService;
import com.hw.system.api.domain.SysOperLog;
import com.kingdee.bos.webapi.entity.RepoRet; import com.kingdee.bos.webapi.entity.RepoRet;
import com.kingdee.bos.webapi.entity.RepoStatus; import com.kingdee.bos.webapi.entity.RepoStatus;
import com.kingdee.bos.webapi.sdk.K3CloudApi; import com.kingdee.bos.webapi.sdk.K3CloudApi;
@ -13,8 +16,11 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/** /**
@ -24,6 +30,8 @@ import java.util.ArrayList;
*/ */
@Service @Service
public class KingdeeErpService { public class KingdeeErpService {
@Resource
private RemoteLogService remoteLogService;
private static final Logger logger = LoggerFactory.getLogger(KingdeeErpService.class); private static final Logger logger = LoggerFactory.getLogger(KingdeeErpService.class);
@ -115,6 +123,8 @@ public class KingdeeErpService {
RepoRet repoRet = gson.fromJson(resultJson, RepoRet.class); RepoRet repoRet = gson.fromJson(resultJson, RepoRet.class);
logger.info("singleSavePurchaseRequisition接口调用成功|请求参数:" + saveParams + "|返回结果:" + resultJson); logger.info("singleSavePurchaseRequisition接口调用成功|请求参数:" + saveParams + "|返回结果:" + resultJson);
RepoStatus responseStatus = repoRet.getResult().getResponseStatus(); RepoStatus responseStatus = repoRet.getResult().getResponseStatus();
List<SysOperLog> sysOperLogList = new ArrayList<>();
Date currentDate = new Date();
if (responseStatus.isIsSuccess()) { if (responseStatus.isIsSuccess()) {
JSONObject json = new JSONObject(); JSONObject json = new JSONObject();
json.put("formId", KingdeeConfig.PUR_Requisition); json.put("formId", KingdeeConfig.PUR_Requisition);
@ -125,12 +135,28 @@ public class KingdeeErpService {
if (!commitRepoRet.getResult().getResponseStatus().isIsSuccess()) { if (!commitRepoRet.getResult().getResponseStatus().isIsSuccess()) {
logger.error("singleSavePurchaseRequisitionCommitException|请求参数:" + json.toJSONString() + "|返回结果:" + commitRepoRet); logger.error("singleSavePurchaseRequisitionCommitException|请求参数:" + json.toJSONString() + "|返回结果:" + commitRepoRet);
} }
SysOperLog sysOperLogCommit = this.getSysOperLog("原材料入库申请单提交", 1, "com.hw.jindie.controller.KingdeeErpSyncController.syncPurchaseReceiveBillFromErp",
"POST", "syncPurchaseReceiveBillFromErp", "PUR_ReceiveBill(" + json.toString() + ")", commitRepoRet.toString(), currentDate, 1L);
sysOperLogList.add(sysOperLogCommit);
//采购申请单审核 //采购申请单审核
String auditResult = this.genericAuditInterface(json); String auditResult = this.genericAuditInterface(json);
RepoRet auditRepoRet = gson.fromJson(auditResult, RepoRet.class); RepoRet auditRepoRet = gson.fromJson(auditResult, RepoRet.class);
if (!auditRepoRet.getResult().getResponseStatus().isIsSuccess()) { if (!auditRepoRet.getResult().getResponseStatus().isIsSuccess()) {
logger.error("singleSavePurchaseRequisitionAuditException|请求参数:" + json.toJSONString() + "|返回结果:" + commitRepoRet); logger.error("singleSavePurchaseRequisitionAuditException|请求参数:" + json.toJSONString() + "|返回结果:" + auditRepoRet);
} }
SysOperLog sysOperLogAudit = this.getSysOperLog("原材料入库申请单审核", 1, "com.hw.jindie.controller.KingdeeErpSyncController.syncPurchaseReceiveBillFromErp",
"POST", "syncPurchaseReceiveBillFromErp", "PUR_ReceiveBill(" + json.toString() + ")", commitRepoRet.toString(), currentDate, 1L);
sysOperLogList.add(sysOperLogAudit);
if (!sysOperLogList.isEmpty()) {
for (SysOperLog sysOperLog : sysOperLogList) {
remoteLogService.saveLog(sysOperLog, SecurityConstants.INNER);
}
}
} }
return gson.toJson(responseStatus); return gson.toJson(responseStatus);
} catch (Exception e) { } catch (Exception e) {
@ -265,27 +291,51 @@ public class KingdeeErpService {
String saveParams = data.toJSONString(); String saveParams = data.toJSONString();
String resultJson = client.save(formId, saveParams); String resultJson = client.save(formId, saveParams);
List<SysOperLog> sysOperLogList = new ArrayList<>();
Date currentDate = new Date();
//用于记录结果 //用于记录结果
Gson gson = new Gson(); Gson gson = new Gson();
//对返回结果进行解析和校验 //对返回结果进行解析和校验
RepoRet repoRet = gson.fromJson(resultJson, RepoRet.class); RepoRet repoRet = gson.fromJson(resultJson, RepoRet.class);
logger.info("savePurchaseStorage接口调用成功|请求参数:" + saveParams + "|返回结果:" + resultJson); logger.info("savePurchaseStorage接口调用成功|请求参数:" + saveParams + "|返回结果:" + resultJson);
RepoStatus responseStatus = repoRet.getResult().getResponseStatus(); RepoStatus responseStatus = repoRet.getResult().getResponseStatus();
if (responseStatus.isIsSuccess()) { if (responseStatus.isIsSuccess()) {
Long beginTimeL = System.currentTimeMillis();
JSONObject json = new JSONObject(); JSONObject json = new JSONObject();
json.put("formId", KingdeeConfig.STK_InStock); json.put("formId", KingdeeConfig.STK_InStock);
json.put("Ids", repoRet.getResult().getId()); json.put("Ids", repoRet.getResult().getId());
//采购入库单提交 //采购入库单提交
String commitResult = this.genericCommitInterface(json); String commitResult = this.genericCommitInterface(json);
RepoRet commitRepoRet = gson.fromJson(commitResult, RepoRet.class); RepoRet commitRepoRet = gson.fromJson(commitResult, RepoRet.class);
String commitResultStr = "成功";
if (!commitRepoRet.getResult().getResponseStatus().isIsSuccess()) { if (!commitRepoRet.getResult().getResponseStatus().isIsSuccess()) {
commitResultStr = "失败";
logger.error("savePurchaseStorage|请求参数:" + json.toJSONString() + "|返回结果:" + commitRepoRet); logger.error("savePurchaseStorage|请求参数:" + json.toJSONString() + "|返回结果:" + commitRepoRet);
} }
SysOperLog sysOperLogCommit = this.getSysOperLog("原材料入库申请单提交", 1, "com.hw.jindie.controller.KingdeeErpSyncController.savePurchaseStorage",
"POST", "syncPurchaseReceiveBillFromErp", formId+"(" + json.toString() + ")", commitResultStr, currentDate, System.currentTimeMillis()-beginTimeL);
sysOperLogList.add(sysOperLogCommit);
beginTimeL = System.currentTimeMillis();
//采购入库单审核 //采购入库单审核
String auditResult = this.genericAuditInterface(json); String auditResult = this.genericAuditInterface(json);
RepoRet auditRepoRet = gson.fromJson(auditResult, RepoRet.class); RepoRet auditRepoRet = gson.fromJson(auditResult, RepoRet.class);
String auditResultStr = "成功";
if (!auditRepoRet.getResult().getResponseStatus().isIsSuccess()) { if (!auditRepoRet.getResult().getResponseStatus().isIsSuccess()) {
logger.error("savePurchaseStorage|请求参数:" + json.toJSONString() + "|返回结果:" + commitRepoRet); auditResultStr = "失败";
logger.error("savePurchaseStorage|请求参数:" + json.toJSONString() + "|返回结果:" + auditRepoRet);
}
SysOperLog sysOperLogAudit = this.getSysOperLog("原材料入库申请单审核", 1, "com.hw.jindie.controller.KingdeeErpSyncController.savePurchaseStorage",
"POST", "syncPurchaseReceiveBillFromErp", formId+"(" + json.toString() + ")", auditResultStr, currentDate, System.currentTimeMillis()-beginTimeL);
sysOperLogList.add(sysOperLogAudit);
if (!sysOperLogList.isEmpty()) {
for (SysOperLog sysOperLog : sysOperLogList) {
remoteLogService.saveLog(sysOperLog, SecurityConstants.INNER);
}
} }
} }
return gson.toJson(responseStatus); return gson.toJson(responseStatus);
@ -459,6 +509,9 @@ public class KingdeeErpService {
String saveParams = data.toJSONString(); String saveParams = data.toJSONString();
String resultJson = client.save(formId, saveParams); String resultJson = client.save(formId, saveParams);
List<SysOperLog> sysOperLogList = new ArrayList<>();
Date currentDate = new Date();
//用于记录结果 //用于记录结果
Gson gson = new Gson(); Gson gson = new Gson();
//对返回结果进行解析和校验 //对返回结果进行解析和校验
@ -466,21 +519,44 @@ public class KingdeeErpService {
logger.info("saveOtherOutStorage接口调用成功|请求参数:" + saveParams + "|返回结果:" + resultJson); logger.info("saveOtherOutStorage接口调用成功|请求参数:" + saveParams + "|返回结果:" + resultJson);
RepoStatus responseStatus = repoRet.getResult().getResponseStatus(); RepoStatus responseStatus = repoRet.getResult().getResponseStatus();
if (responseStatus.isIsSuccess()) { if (responseStatus.isIsSuccess()) {
Long beginTimeL = System.currentTimeMillis();
JSONObject json = new JSONObject(); JSONObject json = new JSONObject();
json.put("formId", KingdeeConfig.STK_MisDelivery); json.put("formId", KingdeeConfig.STK_MisDelivery);
json.put("Ids", repoRet.getResult().getId()); json.put("Ids", repoRet.getResult().getId());
//其他出库单提交 //其他出库单提交
String commitResult = this.genericCommitInterface(json); String commitResult = this.genericCommitInterface(json);
RepoRet commitRepoRet = gson.fromJson(commitResult, RepoRet.class); RepoRet commitRepoRet = gson.fromJson(commitResult, RepoRet.class);
String commitResultStr = "成功";
if (!commitRepoRet.getResult().getResponseStatus().isIsSuccess()) { if (!commitRepoRet.getResult().getResponseStatus().isIsSuccess()) {
commitResultStr = "失败";
logger.error("saveOtherOutStorage|请求参数:" + json.toJSONString() + "|返回结果:" + commitRepoRet); logger.error("saveOtherOutStorage|请求参数:" + json.toJSONString() + "|返回结果:" + commitRepoRet);
} }
SysOperLog sysOperLogCommit = this.getSysOperLog("其他出库单提交", 1, "com.hw.jindie.controller.KingdeeErpSyncController.saveOtherOutStorage",
"POST", "saveOtherOutStorage", formId+"(" + json.toString() + ")", commitResultStr, currentDate, System.currentTimeMillis()-beginTimeL);
sysOperLogList.add(sysOperLogCommit);
beginTimeL = System.currentTimeMillis();
//其他出库单审核 //其他出库单审核
String auditResult = this.genericAuditInterface(json); String auditResult = this.genericAuditInterface(json);
RepoRet auditRepoRet = gson.fromJson(auditResult, RepoRet.class); RepoRet auditRepoRet = gson.fromJson(auditResult, RepoRet.class);
String auditResultStr = "成功";
if (!auditRepoRet.getResult().getResponseStatus().isIsSuccess()) { if (!auditRepoRet.getResult().getResponseStatus().isIsSuccess()) {
auditResultStr = "失败";
logger.error("saveOtherOutStorage|请求参数:" + json.toJSONString() + "|返回结果:" + commitRepoRet); logger.error("saveOtherOutStorage|请求参数:" + json.toJSONString() + "|返回结果:" + commitRepoRet);
} }
SysOperLog sysOperLogAudit = this.getSysOperLog("其他出库单审核", 1, "com.hw.jindie.controller.KingdeeErpSyncController.saveOtherOutStorage",
"POST", "saveOtherOutStorage", formId+"(" + json.toString() + ")", auditResultStr, currentDate, System.currentTimeMillis()-beginTimeL);
sysOperLogList.add(sysOperLogAudit);
if (!sysOperLogList.isEmpty()) {
for (SysOperLog sysOperLog : sysOperLogList) {
remoteLogService.saveLog(sysOperLog, SecurityConstants.INNER);
}
}
} }
return gson.toJson(responseStatus); return gson.toJson(responseStatus);
} catch (Exception e) { } catch (Exception e) {
@ -552,6 +628,9 @@ public class KingdeeErpService {
String saveParams = data.toJSONString(); String saveParams = data.toJSONString();
String resultJson = client.save(formId, saveParams); String resultJson = client.save(formId, saveParams);
List<SysOperLog> sysOperLogList = new ArrayList<>();
Date currentDate = new Date();
//用于记录结果 //用于记录结果
Gson gson = new Gson(); Gson gson = new Gson();
//对返回结果进行解析和校验 //对返回结果进行解析和校验
@ -559,21 +638,43 @@ public class KingdeeErpService {
logger.info("saveOtherInStorage接口调用成功|请求参数:" + saveParams + "|返回结果:" + resultJson); logger.info("saveOtherInStorage接口调用成功|请求参数:" + saveParams + "|返回结果:" + resultJson);
RepoStatus responseStatus = repoRet.getResult().getResponseStatus(); RepoStatus responseStatus = repoRet.getResult().getResponseStatus();
if (responseStatus.isIsSuccess()) { if (responseStatus.isIsSuccess()) {
Long beginTimeL = System.currentTimeMillis();
JSONObject json = new JSONObject(); JSONObject json = new JSONObject();
json.put("formId", KingdeeConfig.STK_MISCELLANEOUS); json.put("formId", KingdeeConfig.STK_MISCELLANEOUS);
json.put("Ids", repoRet.getResult().getId()); json.put("Ids", repoRet.getResult().getId());
//其他入库单提交 //其他入库单提交
String commitResult = this.genericCommitInterface(json); String commitResult = this.genericCommitInterface(json);
RepoRet commitRepoRet = gson.fromJson(commitResult, RepoRet.class); RepoRet commitRepoRet = gson.fromJson(commitResult, RepoRet.class);
String commitResultStr = "成功";
if (!commitRepoRet.getResult().getResponseStatus().isIsSuccess()){ if (!commitRepoRet.getResult().getResponseStatus().isIsSuccess()){
commitResultStr = "失败";
logger.error("saveOtherInStorage|请求参数:" + json.toJSONString() + "|返回结果:" + commitRepoRet); logger.error("saveOtherInStorage|请求参数:" + json.toJSONString() + "|返回结果:" + commitRepoRet);
} }
SysOperLog sysOperLogCommit = this.getSysOperLog("其他入库单提交", 1, "com.hw.jindie.controller.KingdeeErpSyncController.saveOtherInStorage",
"POST", "saveOtherInStorage", formId+"(" + json.toString() + ")", commitResultStr, currentDate, System.currentTimeMillis()-beginTimeL);
sysOperLogList.add(sysOperLogCommit);
beginTimeL = System.currentTimeMillis();
//其他入库单审核 //其他入库单审核
String auditResult = this.genericAuditInterface(json); String auditResult = this.genericAuditInterface(json);
RepoRet auditRepoRet = gson.fromJson(auditResult, RepoRet.class); RepoRet auditRepoRet = gson.fromJson(auditResult, RepoRet.class);
String auditResultStr = "成功";
if (!auditRepoRet.getResult().getResponseStatus().isIsSuccess()){ if (!auditRepoRet.getResult().getResponseStatus().isIsSuccess()){
auditResultStr = "失败";
logger.error("saveOtherInStorage|请求参数:" + json.toJSONString() + "|返回结果:" + commitRepoRet); logger.error("saveOtherInStorage|请求参数:" + json.toJSONString() + "|返回结果:" + commitRepoRet);
} }
SysOperLog sysOperLogAudit = this.getSysOperLog("其他入库单审核", 1, "com.hw.jindie.controller.KingdeeErpSyncController.saveOtherInStorage",
"POST", "saveOtherInStorage", formId+"(" + json.toString() + ")", auditResultStr, currentDate, System.currentTimeMillis()-beginTimeL);
sysOperLogList.add(sysOperLogAudit);
if (!sysOperLogList.isEmpty()) {
for (SysOperLog sysOperLog : sysOperLogList) {
remoteLogService.saveLog(sysOperLog, SecurityConstants.INNER);
}
}
} }
return gson.toJson(responseStatus); return gson.toJson(responseStatus);
} catch (Exception e) { } catch (Exception e) {
@ -583,4 +684,24 @@ public class KingdeeErpService {
} }
private SysOperLog getSysOperLog(String logTitle, Integer businessType, String method, String requestMethod, String operUrl,
String operParam, String jsonResult, Date operTime, Long costTime) throws Exception {
SysOperLog sysOperLog = new SysOperLog();
sysOperLog.setTitle(logTitle);
sysOperLog.setBusinessType(businessType);
sysOperLog.setMethod(method);
sysOperLog.setRequestMethod(requestMethod);
sysOperLog.setOperatorType(0);
sysOperLog.setOperIp("127.0.0.1");
sysOperLog.setOperName("定时任务");
sysOperLog.setOperUrl(operUrl);
sysOperLog.setOperParam(operParam);
sysOperLog.setJsonResult(jsonResult);
sysOperLog.setStatus(0);
sysOperLog.setOperTime(operTime);
sysOperLog.setCostTime(costTime);
return sysOperLog;
}
} }

@ -1219,7 +1219,7 @@ public class KingdeeErpSyncServiceImpl implements IKingdeeErpSyncService {
// String FDocumentStatus = "C"; // String FDocumentStatus = "C";
JSONObject queryJson = new JSONObject(); JSONObject queryJson = new JSONObject();
String formId = "PUR_ReceiveBill"; String formId = "PUR_ReceiveBill";
String fieldKeys = "FID,FBillNo,FDocumentStatus,FSupplierId,FModifyDate,FCreateDate,FStockOrgId,FActlandQty,FActReceiveQty,FDetailEntity_FEntryID,FDetailEntity_Link_FSBillId,FDetailEntity_Link_FSId,FOrderBillNo,FMaterialId,FMaterialId.FNumber,FMaterialId.Fname"; String fieldKeys = "FID,FBillNo,FDocumentStatus,FSupplierId,FModifyDate,FCreateDate,FStockOrgId,FActlandQty,FActReceiveQty,FDetailEntity_FEntryID,FDetailEntity_Link_FSBillId,FDetailEntity_Link_FSId,FPreDeliveryDate,FOrderBillNo,FMaterialId,FMaterialId.FNumber,FMaterialId.Fname,FMateriaModel,F_TOND_Base";
// String filterString = ""; // String filterString = "";
String orderString = ""; String orderString = "";
int topRowCount = 0; int topRowCount = 0;
@ -1265,6 +1265,8 @@ public class KingdeeErpSyncServiceImpl implements IKingdeeErpSyncService {
List<SysOperLog> sysOperLogList = new ArrayList<>(); List<SysOperLog> sysOperLogList = new ArrayList<>();
Date currentDate = new Date(); Date currentDate = new Date();
StringBuilder notifyInfoBuilder = new StringBuilder("收料通知:"); StringBuilder notifyInfoBuilder = new StringBuilder("收料通知:");
Long projectErpId = null;
String projectName = "";
try { try {
for (int i = 0; i < resultArray.size(); i++) { for (int i = 0; i < resultArray.size(); i++) {
Long beginTimeL = System.currentTimeMillis(); Long beginTimeL = System.currentTimeMillis();
@ -1296,8 +1298,7 @@ public class KingdeeErpSyncServiceImpl implements IKingdeeErpSyncService {
String fsId = resultObject.getString("FDetailEntity.Link.FSId"); String fsId = resultObject.getString("FDetailEntity.Link.FSId");
Long fStockOrgId = resultObject.getLong("FStockOrgId"); Long fStockOrgId = resultObject.getLong("FStockOrgId");
//京源项目
// String tondBase = resultObject.getString("F.TOND.Base");
//供应商id //供应商id
Long supplierId = resultObject.getLong("FSupplierId"); Long supplierId = resultObject.getLong("FSupplierId");
@ -1313,6 +1314,11 @@ public class KingdeeErpSyncServiceImpl implements IKingdeeErpSyncService {
//更新时间 //更新时间
String FModifyDate = resultObject.getString("FModifyDate"); String FModifyDate = resultObject.getString("FModifyDate");
String tondBase = resultObject.getString("F.TOND.Base");
String materialSpec = resultObject.getString("FMateriaModel");
//计划交货日期
String preDeliveryDate = resultObject.getString("FPreDeliveryDate");
mesPurchaseReceiveBill.setErpId(erpId); mesPurchaseReceiveBill.setErpId(erpId);
mesPurchaseReceiveBill.setBillNo(billNo); mesPurchaseReceiveBill.setBillNo(billNo);
mesPurchaseReceiveBill.setPoNo(poNo); mesPurchaseReceiveBill.setPoNo(poNo);
@ -1326,10 +1332,13 @@ public class KingdeeErpSyncServiceImpl implements IKingdeeErpSyncService {
mesPurchaseReceiveBill.setPurchaseOrgId(fStockOrgId); mesPurchaseReceiveBill.setPurchaseOrgId(fStockOrgId);
mesPurchaseReceiveBill.setActReceiveAmount(actReceiveAmount); mesPurchaseReceiveBill.setActReceiveAmount(actReceiveAmount);
mesPurchaseReceiveBill.setActLandAmount(actlandAmount); mesPurchaseReceiveBill.setActLandAmount(actlandAmount);
// mesPurchaseReceiveBill.setTondBase(tondBase); mesPurchaseReceiveBill.setTondBase(tondBase);
mesPurchaseReceiveBill.setSupplierId(supplierId); mesPurchaseReceiveBill.setSupplierId(supplierId);
mesPurchaseReceiveBill.setUpdateTime(currentDate); mesPurchaseReceiveBill.setUpdateTime(currentDate);
if (preDeliveryDate != null) {
mesPurchaseReceiveBill.setPreDeliveryDate(conversionERPTime(preDeliveryDate));
}
if (approveDate != null) { if (approveDate != null) {
mesPurchaseReceiveBill.setApproveDate(conversionERPTime(approveDate)); mesPurchaseReceiveBill.setApproveDate(conversionERPTime(approveDate));
@ -1349,12 +1358,32 @@ public class KingdeeErpSyncServiceImpl implements IKingdeeErpSyncService {
MesPurchaseReceiveBill existedPurchaseReceiveBill = mesPurchaseReceiveBillMapper.selectMesPurchaseReceiveBillByUI(erpId, fentryId); MesPurchaseReceiveBill existedPurchaseReceiveBill = mesPurchaseReceiveBillMapper.selectMesPurchaseReceiveBillByUI(erpId, fentryId);
if (StringUtils.isNotEmpty(tondBase)) {
Long tondBaseL = Long.valueOf(tondBase);
if (StringUtils.isEmpty(projectName)) {
projectErpId = tondBaseL;
MesProjectInfo mesProjectInfo = mesProjectInfoMapper.selectMesProjectInfoByErpId(tondBaseL);
projectName = mesProjectInfo == null ? "" : mesProjectInfo.getProjectName();
}else{
if(!tondBaseL.equals(projectErpId)){
projectErpId = tondBaseL;
MesProjectInfo mesProjectInfo = mesProjectInfoMapper.selectMesProjectInfoByErpId(tondBaseL);
projectName = mesProjectInfo == null ? "" : mesProjectInfo.getProjectName();
}
}
}
if (existedPurchaseReceiveBill != null) { if (existedPurchaseReceiveBill != null) {
mesPurchaseReceiveBill.setReceiveBillId(existedPurchaseReceiveBill.getReceiveBillId()); mesPurchaseReceiveBill.setReceiveBillId(existedPurchaseReceiveBill.getReceiveBillId());
toUpdatePurchaseReceiveBillList.add(mesPurchaseReceiveBill); toUpdatePurchaseReceiveBillList.add(mesPurchaseReceiveBill);
} else { } else {
toInsertPurchaseReceiveBillList.add(mesPurchaseReceiveBill); toInsertPurchaseReceiveBillList.add(mesPurchaseReceiveBill);
notifyInfoBuilder.append(materialName).append(";"); notifyInfoBuilder.append(materialName).append("|").append(materialSpec).append("|").append(actlandAmount).append("|")
.append(preDeliveryDate).append("|").append(projectName)
.append(";");
} }
// System.out.println("l:"+resultArray.get(i).toString().length()); // System.out.println("l:"+resultArray.get(i).toString().length());
@ -1413,7 +1442,7 @@ public class KingdeeErpSyncServiceImpl implements IKingdeeErpSyncService {
sysPointRouter.setProcessActivityId(SystemConstants.PROCESS_ACTIVITY_ID_STOCK_NOTENOUGH); sysPointRouter.setProcessActivityId(SystemConstants.PROCESS_ACTIVITY_ID_STOCK_NOTENOUGH);
sysPointRouter.setCreateBy("定时任务"); sysPointRouter.setCreateBy("定时任务");
sysPointRouter.setCreateTime(new Date()); sysPointRouter.setCreateTime(new Date());
sysPointRouter.setProcessActivityId(7011L); sysPointRouter.setProcessActivityId(SystemConstants.PROCESS_ACTIVITY_ID_RECEIVE_BILL);
sysPointRouter.setEmailFlag("1"); sysPointRouter.setEmailFlag("1");
sysPointRouter.setSentEmailFlag("0"); sysPointRouter.setSentEmailFlag("0");

@ -22,6 +22,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="erpModifyDate" column="erp_modify_date" /> <result property="erpModifyDate" column="erp_modify_date" />
<result property="purchaseOrgId" column="purchase_org_id" /> <result property="purchaseOrgId" column="purchase_org_id" />
<result property="tondBase" column="tond_base" /> <result property="tondBase" column="tond_base" />
<result property="preDeliveryDate" column="pre_delivery_date" />
<result property="price" column="price" /> <result property="price" column="price" />
<result property="supplierId" column="supplier_id" /> <result property="supplierId" column="supplier_id" />
<result property="remark" column="remark" /> <result property="remark" column="remark" />
@ -83,6 +84,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="erpModifyDate != null">erp_modify_date,</if> <if test="erpModifyDate != null">erp_modify_date,</if>
<if test="purchaseOrgId != null">purchase_org_id,</if> <if test="purchaseOrgId != null">purchase_org_id,</if>
<if test="tondBase != null">tond_base,</if> <if test="tondBase != null">tond_base,</if>
<if test="preDeliveryDate != null">pre_delivery_date,</if>
<if test="price != null">price,</if> <if test="price != null">price,</if>
<if test="supplierId != null">supplier_id,</if> <if test="supplierId != null">supplier_id,</if>
<if test="remark != null">remark,</if> <if test="remark != null">remark,</if>
@ -108,6 +110,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="erpModifyDate != null">#{erpModifyDate},</if> <if test="erpModifyDate != null">#{erpModifyDate},</if>
<if test="purchaseOrgId != null">#{purchaseOrgId},</if> <if test="purchaseOrgId != null">#{purchaseOrgId},</if>
<if test="tondBase != null">#{tondBase},</if> <if test="tondBase != null">#{tondBase},</if>
<if test="preDeliveryDate != null">#{preDeliveryDate},</if>
<if test="price != null">#{price},</if> <if test="price != null">#{price},</if>
<if test="supplierId != null">#{supplierId},</if> <if test="supplierId != null">#{supplierId},</if>
<if test="remark != null">#{remark},</if> <if test="remark != null">#{remark},</if>
@ -137,6 +140,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="erpModifyDate != null">erp_modify_date = #{erpModifyDate},</if> <if test="erpModifyDate != null">erp_modify_date = #{erpModifyDate},</if>
<if test="purchaseOrgId != null">purchase_org_id = #{purchaseOrgId},</if> <if test="purchaseOrgId != null">purchase_org_id = #{purchaseOrgId},</if>
<if test="tondBase != null">tond_base = #{tondBase},</if> <if test="tondBase != null">tond_base = #{tondBase},</if>
<if test="preDeliveryDate != null">pre_delivery_date = #{preDeliveryDate},</if>
<if test="price != null">price = #{price},</if> <if test="price != null">price = #{price},</if>
<if test="supplierId != null">supplier_id = #{supplierId},</if> <if test="supplierId != null">supplier_id = #{supplierId},</if>
<if test="remark != null">remark = #{remark},</if> <if test="remark != null">remark = #{remark},</if>

Loading…
Cancel
Save