|
|
@ -44,8 +44,9 @@ public class KingdeeErpSyncServiceImpl implements IKingdeeErpSyncService {
|
|
|
|
* @Description:从金蝶ERP同步供应商信息
|
|
|
|
* @Description:从金蝶ERP同步供应商信息
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public int syncSupplierInfoFromErp(int startRow) throws Exception {
|
|
|
|
public int syncSupplierInfoFromErp(int startRow, ErpSyncInfoVo erpSyncInfoVo) throws Exception {
|
|
|
|
String maxErpModifyDate = mesBaseSupplierInfoMapper.selectMaxErpModifyDate();
|
|
|
|
String maxErpModifyDate = StringUtils.isEmpty(erpSyncInfoVo.getMaxErpModifyDate()) ?
|
|
|
|
|
|
|
|
mesBaseSupplierInfoMapper.selectMaxErpModifyDate() : erpSyncInfoVo.getMaxErpModifyDate();
|
|
|
|
return syncSupplierInfoFromErp(startRow, maxErpModifyDate);
|
|
|
|
return syncSupplierInfoFromErp(startRow, maxErpModifyDate);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -162,7 +163,7 @@ public class KingdeeErpSyncServiceImpl implements IKingdeeErpSyncService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
System.out.println("size:"+resultArray.size());
|
|
|
|
System.out.println("size:" + resultArray.size());
|
|
|
|
//如果返回的数组的数量等于分页数量,则继续获取下一页数据
|
|
|
|
//如果返回的数组的数量等于分页数量,则继续获取下一页数据
|
|
|
|
if (resultArray.size() == limit) {
|
|
|
|
if (resultArray.size() == limit) {
|
|
|
|
// System.out.println(startRow);
|
|
|
|
// System.out.println(startRow);
|
|
|
@ -184,7 +185,7 @@ public class KingdeeErpSyncServiceImpl implements IKingdeeErpSyncService {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public int syncMaterialInfoFromErp(int startRow, ErpSyncInfoVo erpSyncInfoVo) throws Exception {
|
|
|
|
public int syncMaterialInfoFromErp(int startRow, ErpSyncInfoVo erpSyncInfoVo) throws Exception {
|
|
|
|
String maxErpModifyDate = StringUtils.isEmpty(erpSyncInfoVo.getMaxErpModifyDate())
|
|
|
|
String maxErpModifyDate = StringUtils.isEmpty(erpSyncInfoVo.getMaxErpModifyDate())
|
|
|
|
?mesBaseMaterialInfoMapper.selectMaxErpModifyDate():erpSyncInfoVo.getMaxErpModifyDate();
|
|
|
|
? mesBaseMaterialInfoMapper.selectMaxErpModifyDate() : erpSyncInfoVo.getMaxErpModifyDate();
|
|
|
|
return syncMaterialInfoFromErp(startRow, maxErpModifyDate);
|
|
|
|
return syncMaterialInfoFromErp(startRow, maxErpModifyDate);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -306,7 +307,7 @@ public class KingdeeErpSyncServiceImpl implements IKingdeeErpSyncService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
System.out.println("size:"+resultArray.size());
|
|
|
|
System.out.println("size:" + resultArray.size());
|
|
|
|
/**分页递归获取所有物料信息*/
|
|
|
|
/**分页递归获取所有物料信息*/
|
|
|
|
if (resultArray.size() == limit) {
|
|
|
|
if (resultArray.size() == limit) {
|
|
|
|
// System.out.println(startRow);
|
|
|
|
// System.out.println(startRow);
|
|
|
@ -326,8 +327,9 @@ public class KingdeeErpSyncServiceImpl implements IKingdeeErpSyncService {
|
|
|
|
* @Descrption:从金蝶ERP同步销售订单
|
|
|
|
* @Descrption:从金蝶ERP同步销售订单
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public int syncSaleOrderFromErp(int startRow) throws Exception {
|
|
|
|
public int syncSaleOrderFromErp(int startRow, ErpSyncInfoVo erpSyncInfoVo) throws Exception {
|
|
|
|
String maxErpModifyDate = mesSaleOrderMapper.selectMaxErpModifyDate();
|
|
|
|
String maxErpModifyDate = StringUtils.isEmpty(erpSyncInfoVo.getMaxErpModifyDate())?
|
|
|
|
|
|
|
|
mesSaleOrderMapper.selectMaxErpModifyDate():erpSyncInfoVo.getMaxErpModifyDate();
|
|
|
|
return syncSaleOrderFromErp(startRow, maxErpModifyDate);
|
|
|
|
return syncSaleOrderFromErp(startRow, maxErpModifyDate);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -335,7 +337,7 @@ public class KingdeeErpSyncServiceImpl implements IKingdeeErpSyncService {
|
|
|
|
* @throws Exception
|
|
|
|
* @throws Exception
|
|
|
|
* @Descrption:从金蝶ERP同步销售订单
|
|
|
|
* @Descrption:从金蝶ERP同步销售订单
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public int syncSaleOrderFromErp(int startRow,String maxErpModifyDate) throws Exception {
|
|
|
|
public int syncSaleOrderFromErp(int startRow, String maxErpModifyDate) throws Exception {
|
|
|
|
K3CloudApi api = new K3CloudApi();
|
|
|
|
K3CloudApi api = new K3CloudApi();
|
|
|
|
// String FDocumentStatus = "C";
|
|
|
|
// String FDocumentStatus = "C";
|
|
|
|
// String json = "{\n" +
|
|
|
|
// String json = "{\n" +
|
|
|
@ -351,7 +353,7 @@ public class KingdeeErpSyncServiceImpl implements IKingdeeErpSyncService {
|
|
|
|
|
|
|
|
|
|
|
|
JSONObject queryJson = new JSONObject();
|
|
|
|
JSONObject queryJson = new JSONObject();
|
|
|
|
String formId = "SAL_SaleOrder";
|
|
|
|
String formId = "SAL_SaleOrder";
|
|
|
|
String fieldKeys = "FID,FBillNo,FApproveDate,FSaleOrderEntry_FEntryID,FMaterialId,FMaterialId.FNumber,FMaterialName,FDocumentStatus," +
|
|
|
|
String fieldKeys = "FID,FBillNo,FApproveDate,FSaleOrderEntry_FEntryID,FSaleOrderEntry_FMaterialModel,FMaterialId,FMaterialId.FNumber,FMaterialName,FDocumentStatus," +
|
|
|
|
"FQty,FCreateDate,FModifyDate,FMinPlanDeliveryDate,FAuxPropId,FStockId,FOwnerId,FSaleDeptId,FPrice,FStockOrgId,F_TOND_Base";
|
|
|
|
"FQty,FCreateDate,FModifyDate,FMinPlanDeliveryDate,FAuxPropId,FStockId,FOwnerId,FSaleDeptId,FPrice,FStockOrgId,F_TOND_Base";
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// String filterString = "FNumber='98010102'";
|
|
|
|
// String filterString = "FNumber='98010102'";
|
|
|
@ -398,6 +400,8 @@ public class KingdeeErpSyncServiceImpl implements IKingdeeErpSyncService {
|
|
|
|
String approveDate = resultObject.getString("FApproveDate");
|
|
|
|
String approveDate = resultObject.getString("FApproveDate");
|
|
|
|
//订单明细id
|
|
|
|
//订单明细id
|
|
|
|
Long fentyrId = resultObject.getLong("FSaleOrderEntry.FEntryID");
|
|
|
|
Long fentyrId = resultObject.getLong("FSaleOrderEntry.FEntryID");
|
|
|
|
|
|
|
|
//订单明细规格
|
|
|
|
|
|
|
|
String materialModel = resultObject.getString("FSaleOrderEntry.FMaterialModel");
|
|
|
|
//ERP物料id
|
|
|
|
//ERP物料id
|
|
|
|
Long fmaterialId = resultObject.getLong("FMaterialId");
|
|
|
|
Long fmaterialId = resultObject.getLong("FMaterialId");
|
|
|
|
//物料编码
|
|
|
|
//物料编码
|
|
|
@ -430,6 +434,7 @@ public class KingdeeErpSyncServiceImpl implements IKingdeeErpSyncService {
|
|
|
|
mesSaleOrder.setErpId(erpId);
|
|
|
|
mesSaleOrder.setErpId(erpId);
|
|
|
|
mesSaleOrder.setSaleorderCode(saleOrderCode);
|
|
|
|
mesSaleOrder.setSaleorderCode(saleOrderCode);
|
|
|
|
mesSaleOrder.setFentryId(fentyrId);
|
|
|
|
mesSaleOrder.setFentryId(fentyrId);
|
|
|
|
|
|
|
|
mesSaleOrder.setMaterialModel(materialModel);
|
|
|
|
mesSaleOrder.setDocumentStatus(documentStatus);
|
|
|
|
mesSaleOrder.setDocumentStatus(documentStatus);
|
|
|
|
//erp物料id
|
|
|
|
//erp物料id
|
|
|
|
mesSaleOrder.setMaterialId(fmaterialId);
|
|
|
|
mesSaleOrder.setMaterialId(fmaterialId);
|
|
|
@ -480,13 +485,13 @@ public class KingdeeErpSyncServiceImpl implements IKingdeeErpSyncService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
System.out.println("size:"+resultArray.size());
|
|
|
|
System.out.println("size:" + resultArray.size());
|
|
|
|
|
|
|
|
|
|
|
|
/**分页递归获取所有物料信息*/
|
|
|
|
/**分页递归获取所有物料信息*/
|
|
|
|
if (resultArray.size() == limit) {
|
|
|
|
if (resultArray.size() == limit) {
|
|
|
|
// System.out.println(startRow);
|
|
|
|
// System.out.println(startRow);
|
|
|
|
//通过递归同步所有物料信息,测试先不用
|
|
|
|
//通过递归同步所有物料信息,测试先不用
|
|
|
|
int i = syncSaleOrderFromErp(startRow + resultArray.size(),maxErpModifyDate);
|
|
|
|
int i = syncSaleOrderFromErp(startRow + resultArray.size(), maxErpModifyDate);
|
|
|
|
// return i;
|
|
|
|
// return i;
|
|
|
|
return 1;
|
|
|
|
return 1;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
@ -501,16 +506,17 @@ public class KingdeeErpSyncServiceImpl implements IKingdeeErpSyncService {
|
|
|
|
* @Descrption:从金蝶ERP同步项目信息
|
|
|
|
* @Descrption:从金蝶ERP同步项目信息
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public int syncProjectInfoFromErp(int startRow) throws Exception {
|
|
|
|
public int syncProjectInfoFromErp(int startRow, ErpSyncInfoVo erpSyncInfoVo) throws Exception {
|
|
|
|
String maxErpModifyDate = mesProjectInfoMapper.selectMaxErpModifyDate();
|
|
|
|
String maxErpModifyDate = StringUtils.isEmpty(erpSyncInfoVo.getMaxErpModifyDate())?
|
|
|
|
return syncProjectInfoFromErp(startRow,maxErpModifyDate);
|
|
|
|
mesProjectInfoMapper.selectMaxErpModifyDate(): erpSyncInfoVo.getMaxErpModifyDate();
|
|
|
|
|
|
|
|
return syncProjectInfoFromErp(startRow, maxErpModifyDate);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* @throws Exception
|
|
|
|
* @throws Exception
|
|
|
|
* @Descrption:从金蝶ERP同步项目信息
|
|
|
|
* @Descrption:从金蝶ERP同步项目信息
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public int syncProjectInfoFromErp(int startRow,String maxErpModifyDate) throws Exception {
|
|
|
|
public int syncProjectInfoFromErp(int startRow, String maxErpModifyDate) throws Exception {
|
|
|
|
K3CloudApi api = new K3CloudApi();
|
|
|
|
K3CloudApi api = new K3CloudApi();
|
|
|
|
// String FDocumentStatus = "C";
|
|
|
|
// String FDocumentStatus = "C";
|
|
|
|
|
|
|
|
|
|
|
@ -600,12 +606,12 @@ public class KingdeeErpSyncServiceImpl implements IKingdeeErpSyncService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
System.out.println("size:"+resultArray.size());
|
|
|
|
System.out.println("size:" + resultArray.size());
|
|
|
|
/**分页递归获取所有物料信息*/
|
|
|
|
/**分页递归获取所有物料信息*/
|
|
|
|
if (resultArray.size() == limit) {
|
|
|
|
if (resultArray.size() == limit) {
|
|
|
|
// System.out.println(startRow);
|
|
|
|
// System.out.println(startRow);
|
|
|
|
//通过递归同步所有物料信息,测试先不用
|
|
|
|
//通过递归同步所有物料信息,测试先不用
|
|
|
|
int i = syncProjectInfoFromErp(startRow + resultArray.size(),maxErpModifyDate);
|
|
|
|
int i = syncProjectInfoFromErp(startRow + resultArray.size(), maxErpModifyDate);
|
|
|
|
// return i;
|
|
|
|
// return i;
|
|
|
|
return 1;
|
|
|
|
return 1;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
@ -619,16 +625,17 @@ public class KingdeeErpSyncServiceImpl implements IKingdeeErpSyncService {
|
|
|
|
* @Descrption:从金蝶ERP同步采购订单
|
|
|
|
* @Descrption:从金蝶ERP同步采购订单
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public int syncPurchaseOrderFromErp(int startRow) throws Exception {
|
|
|
|
public int syncPurchaseOrderFromErp(int startRow, ErpSyncInfoVo erpSyncInfoVo) throws Exception {
|
|
|
|
String maxErpModifyDate = mesPurchaseOrderMapper.selectMaxErpModifyDate();
|
|
|
|
String maxErpModifyDate = StringUtils.isEmpty(erpSyncInfoVo.getMaxErpModifyDate())?
|
|
|
|
return syncPurchaseOrderFromErp(startRow,maxErpModifyDate);
|
|
|
|
mesPurchaseOrderMapper.selectMaxErpModifyDate():erpSyncInfoVo.getMaxErpModifyDate();
|
|
|
|
|
|
|
|
return syncPurchaseOrderFromErp(startRow, maxErpModifyDate);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* @throws Exception
|
|
|
|
* @throws Exception
|
|
|
|
* @Descrption:从金蝶ERP同步采购订单
|
|
|
|
* @Descrption:从金蝶ERP同步采购订单
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public int syncPurchaseOrderFromErp(int startRow,String maxErpModifyDate) throws Exception {
|
|
|
|
public int syncPurchaseOrderFromErp(int startRow, String maxErpModifyDate) throws Exception {
|
|
|
|
K3CloudApi api = new K3CloudApi();
|
|
|
|
K3CloudApi api = new K3CloudApi();
|
|
|
|
// String FDocumentStatus = "C";
|
|
|
|
// String FDocumentStatus = "C";
|
|
|
|
JSONObject queryJson = new JSONObject();
|
|
|
|
JSONObject queryJson = new JSONObject();
|
|
|
@ -772,12 +779,12 @@ public class KingdeeErpSyncServiceImpl implements IKingdeeErpSyncService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
System.out.println("size:"+resultArray.size());
|
|
|
|
System.out.println("size:" + resultArray.size());
|
|
|
|
/**分页递归获取所有物料信息*/
|
|
|
|
/**分页递归获取所有物料信息*/
|
|
|
|
if (resultArray.size() == limit) {
|
|
|
|
if (resultArray.size() == limit) {
|
|
|
|
// System.out.println(startRow);
|
|
|
|
// System.out.println(startRow);
|
|
|
|
//通过递归同步所有物料信息,测试先不用
|
|
|
|
//通过递归同步所有物料信息,测试先不用
|
|
|
|
int i = syncPurchaseOrderFromErp(startRow + resultArray.size(),maxErpModifyDate);
|
|
|
|
int i = syncPurchaseOrderFromErp(startRow + resultArray.size(), maxErpModifyDate);
|
|
|
|
// return i;
|
|
|
|
// return i;
|
|
|
|
return 1;
|
|
|
|
return 1;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
@ -788,7 +795,7 @@ public class KingdeeErpSyncServiceImpl implements IKingdeeErpSyncService {
|
|
|
|
|
|
|
|
|
|
|
|
public static void main(String[] args) throws Exception {
|
|
|
|
public static void main(String[] args) throws Exception {
|
|
|
|
KingdeeErpSyncServiceImpl k = new KingdeeErpSyncServiceImpl();
|
|
|
|
KingdeeErpSyncServiceImpl k = new KingdeeErpSyncServiceImpl();
|
|
|
|
k.syncProjectInfoFromErp(0,"");
|
|
|
|
k.syncProjectInfoFromErp(0, "");
|
|
|
|
// int i = syncSupplierInfoFromErp(0);
|
|
|
|
// int i = syncSupplierInfoFromErp(0);
|
|
|
|
// syncMaterialInfoFromErpTest(0);
|
|
|
|
// syncMaterialInfoFromErpTest(0);
|
|
|
|
// syncSaleOrderFromErp();
|
|
|
|
// syncSaleOrderFromErp();
|
|
|
@ -804,9 +811,6 @@ public class KingdeeErpSyncServiceImpl implements IKingdeeErpSyncService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static int syncMaterialInfoFromErpTest(int startRow) throws Exception {
|
|
|
|
public static int syncMaterialInfoFromErpTest(int startRow) throws Exception {
|
|
|
|
K3CloudApi api = new K3CloudApi();
|
|
|
|
K3CloudApi api = new K3CloudApi();
|
|
|
|
String FDocumentStatus = "C";
|
|
|
|
String FDocumentStatus = "C";
|
|
|
@ -846,7 +850,7 @@ public class KingdeeErpSyncServiceImpl implements IKingdeeErpSyncService {
|
|
|
|
System.out.println("物料单据查询接口: " + result);
|
|
|
|
System.out.println("物料单据查询接口: " + result);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|