|
|
|
@ -44,8 +44,9 @@ public class KingdeeErpSyncServiceImpl implements IKingdeeErpSyncService {
|
|
|
|
|
* @Description:从金蝶ERP同步供应商信息
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public int syncSupplierInfoFromErp(int startRow) throws Exception {
|
|
|
|
|
String maxErpModifyDate = mesBaseSupplierInfoMapper.selectMaxErpModifyDate();
|
|
|
|
|
public int syncSupplierInfoFromErp(int startRow, ErpSyncInfoVo erpSyncInfoVo) throws Exception {
|
|
|
|
|
String maxErpModifyDate = StringUtils.isEmpty(erpSyncInfoVo.getMaxErpModifyDate()) ?
|
|
|
|
|
mesBaseSupplierInfoMapper.selectMaxErpModifyDate() : erpSyncInfoVo.getMaxErpModifyDate();
|
|
|
|
|
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) {
|
|
|
|
|
// System.out.println(startRow);
|
|
|
|
@ -184,7 +185,7 @@ public class KingdeeErpSyncServiceImpl implements IKingdeeErpSyncService {
|
|
|
|
|
@Override
|
|
|
|
|
public int syncMaterialInfoFromErp(int startRow, ErpSyncInfoVo erpSyncInfoVo) throws Exception {
|
|
|
|
|
String maxErpModifyDate = StringUtils.isEmpty(erpSyncInfoVo.getMaxErpModifyDate())
|
|
|
|
|
?mesBaseMaterialInfoMapper.selectMaxErpModifyDate():erpSyncInfoVo.getMaxErpModifyDate();
|
|
|
|
|
? mesBaseMaterialInfoMapper.selectMaxErpModifyDate() : erpSyncInfoVo.getMaxErpModifyDate();
|
|
|
|
|
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) {
|
|
|
|
|
// System.out.println(startRow);
|
|
|
|
@ -326,8 +327,9 @@ public class KingdeeErpSyncServiceImpl implements IKingdeeErpSyncService {
|
|
|
|
|
* @Descrption:从金蝶ERP同步销售订单
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public int syncSaleOrderFromErp(int startRow) throws Exception {
|
|
|
|
|
String maxErpModifyDate = mesSaleOrderMapper.selectMaxErpModifyDate();
|
|
|
|
|
public int syncSaleOrderFromErp(int startRow, ErpSyncInfoVo erpSyncInfoVo) throws Exception {
|
|
|
|
|
String maxErpModifyDate = StringUtils.isEmpty(erpSyncInfoVo.getMaxErpModifyDate())?
|
|
|
|
|
mesSaleOrderMapper.selectMaxErpModifyDate():erpSyncInfoVo.getMaxErpModifyDate();
|
|
|
|
|
return syncSaleOrderFromErp(startRow, maxErpModifyDate);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -335,7 +337,7 @@ public class KingdeeErpSyncServiceImpl implements IKingdeeErpSyncService {
|
|
|
|
|
* @throws Exception
|
|
|
|
|
* @Descrption:从金蝶ERP同步销售订单
|
|
|
|
|
*/
|
|
|
|
|
public int syncSaleOrderFromErp(int startRow,String maxErpModifyDate) throws Exception {
|
|
|
|
|
public int syncSaleOrderFromErp(int startRow, String maxErpModifyDate) throws Exception {
|
|
|
|
|
K3CloudApi api = new K3CloudApi();
|
|
|
|
|
// String FDocumentStatus = "C";
|
|
|
|
|
// String json = "{\n" +
|
|
|
|
@ -351,7 +353,7 @@ public class KingdeeErpSyncServiceImpl implements IKingdeeErpSyncService {
|
|
|
|
|
|
|
|
|
|
JSONObject queryJson = new JSONObject();
|
|
|
|
|
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";
|
|
|
|
|
//
|
|
|
|
|
// String filterString = "FNumber='98010102'";
|
|
|
|
@ -391,13 +393,15 @@ public class KingdeeErpSyncServiceImpl implements IKingdeeErpSyncService {
|
|
|
|
|
JSONObject resultObject = (JSONObject) resultArray.get(i);
|
|
|
|
|
MesSaleOrder mesSaleOrder = new MesSaleOrder();
|
|
|
|
|
//erp主键
|
|
|
|
|
Long erpId = resultObject.getLong("FID");
|
|
|
|
|
Long erpId = resultObject.getLong("FID");
|
|
|
|
|
//销售订单编号id
|
|
|
|
|
String saleOrderCode = resultObject.getString("FBillNo");
|
|
|
|
|
//审核日期
|
|
|
|
|
String approveDate = resultObject.getString("FApproveDate");
|
|
|
|
|
//订单明细id
|
|
|
|
|
Long fentyrId = resultObject.getLong("FSaleOrderEntry.FEntryID");
|
|
|
|
|
//订单明细规格
|
|
|
|
|
String materialModel = resultObject.getString("FSaleOrderEntry.FMaterialModel");
|
|
|
|
|
//ERP物料id
|
|
|
|
|
Long fmaterialId = resultObject.getLong("FMaterialId");
|
|
|
|
|
//物料编码
|
|
|
|
@ -430,6 +434,7 @@ public class KingdeeErpSyncServiceImpl implements IKingdeeErpSyncService {
|
|
|
|
|
mesSaleOrder.setErpId(erpId);
|
|
|
|
|
mesSaleOrder.setSaleorderCode(saleOrderCode);
|
|
|
|
|
mesSaleOrder.setFentryId(fentyrId);
|
|
|
|
|
mesSaleOrder.setMaterialModel(materialModel);
|
|
|
|
|
mesSaleOrder.setDocumentStatus(documentStatus);
|
|
|
|
|
//erp物料id
|
|
|
|
|
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) {
|
|
|
|
|
// System.out.println(startRow);
|
|
|
|
|
//通过递归同步所有物料信息,测试先不用
|
|
|
|
|
int i = syncSaleOrderFromErp(startRow + resultArray.size(),maxErpModifyDate);
|
|
|
|
|
int i = syncSaleOrderFromErp(startRow + resultArray.size(), maxErpModifyDate);
|
|
|
|
|
// return i;
|
|
|
|
|
return 1;
|
|
|
|
|
} else {
|
|
|
|
@ -501,16 +506,17 @@ public class KingdeeErpSyncServiceImpl implements IKingdeeErpSyncService {
|
|
|
|
|
* @Descrption:从金蝶ERP同步项目信息
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public int syncProjectInfoFromErp(int startRow) throws Exception {
|
|
|
|
|
String maxErpModifyDate = mesProjectInfoMapper.selectMaxErpModifyDate();
|
|
|
|
|
return syncProjectInfoFromErp(startRow,maxErpModifyDate);
|
|
|
|
|
public int syncProjectInfoFromErp(int startRow, ErpSyncInfoVo erpSyncInfoVo) throws Exception {
|
|
|
|
|
String maxErpModifyDate = StringUtils.isEmpty(erpSyncInfoVo.getMaxErpModifyDate())?
|
|
|
|
|
mesProjectInfoMapper.selectMaxErpModifyDate(): erpSyncInfoVo.getMaxErpModifyDate();
|
|
|
|
|
return syncProjectInfoFromErp(startRow, maxErpModifyDate);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @throws Exception
|
|
|
|
|
* @Descrption:从金蝶ERP同步项目信息
|
|
|
|
|
*/
|
|
|
|
|
public int syncProjectInfoFromErp(int startRow,String maxErpModifyDate) throws Exception {
|
|
|
|
|
public int syncProjectInfoFromErp(int startRow, String maxErpModifyDate) throws Exception {
|
|
|
|
|
K3CloudApi api = new K3CloudApi();
|
|
|
|
|
// 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) {
|
|
|
|
|
// System.out.println(startRow);
|
|
|
|
|
//通过递归同步所有物料信息,测试先不用
|
|
|
|
|
int i = syncProjectInfoFromErp(startRow + resultArray.size(),maxErpModifyDate);
|
|
|
|
|
int i = syncProjectInfoFromErp(startRow + resultArray.size(), maxErpModifyDate);
|
|
|
|
|
// return i;
|
|
|
|
|
return 1;
|
|
|
|
|
} else {
|
|
|
|
@ -619,16 +625,17 @@ public class KingdeeErpSyncServiceImpl implements IKingdeeErpSyncService {
|
|
|
|
|
* @Descrption:从金蝶ERP同步采购订单
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public int syncPurchaseOrderFromErp(int startRow) throws Exception {
|
|
|
|
|
String maxErpModifyDate = mesPurchaseOrderMapper.selectMaxErpModifyDate();
|
|
|
|
|
return syncPurchaseOrderFromErp(startRow,maxErpModifyDate);
|
|
|
|
|
public int syncPurchaseOrderFromErp(int startRow, ErpSyncInfoVo erpSyncInfoVo) throws Exception {
|
|
|
|
|
String maxErpModifyDate = StringUtils.isEmpty(erpSyncInfoVo.getMaxErpModifyDate())?
|
|
|
|
|
mesPurchaseOrderMapper.selectMaxErpModifyDate():erpSyncInfoVo.getMaxErpModifyDate();
|
|
|
|
|
return syncPurchaseOrderFromErp(startRow, maxErpModifyDate);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @throws Exception
|
|
|
|
|
* @Descrption:从金蝶ERP同步采购订单
|
|
|
|
|
*/
|
|
|
|
|
public int syncPurchaseOrderFromErp(int startRow,String maxErpModifyDate) throws Exception {
|
|
|
|
|
public int syncPurchaseOrderFromErp(int startRow, String maxErpModifyDate) throws Exception {
|
|
|
|
|
K3CloudApi api = new K3CloudApi();
|
|
|
|
|
// String FDocumentStatus = "C";
|
|
|
|
|
JSONObject queryJson = new JSONObject();
|
|
|
|
@ -681,7 +688,7 @@ public class KingdeeErpSyncServiceImpl implements IKingdeeErpSyncService {
|
|
|
|
|
//订单明细id
|
|
|
|
|
Long fentryId = resultObject.getLong("FPOOrderEntry.FEntryID");
|
|
|
|
|
//erp物料ID
|
|
|
|
|
Long fmaterialId = resultObject.getLong("FMaterialId");
|
|
|
|
|
Long fmaterialId = resultObject.getLong("FMaterialId");
|
|
|
|
|
//物料编码
|
|
|
|
|
String materialCode = resultObject.getString("FMaterialId.FNumber");
|
|
|
|
|
//物料名称
|
|
|
|
@ -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) {
|
|
|
|
|
// System.out.println(startRow);
|
|
|
|
|
//通过递归同步所有物料信息,测试先不用
|
|
|
|
|
int i = syncPurchaseOrderFromErp(startRow + resultArray.size(),maxErpModifyDate);
|
|
|
|
|
int i = syncPurchaseOrderFromErp(startRow + resultArray.size(), maxErpModifyDate);
|
|
|
|
|
// return i;
|
|
|
|
|
return 1;
|
|
|
|
|
} else {
|
|
|
|
@ -788,7 +795,7 @@ public class KingdeeErpSyncServiceImpl implements IKingdeeErpSyncService {
|
|
|
|
|
|
|
|
|
|
public static void main(String[] args) throws Exception {
|
|
|
|
|
KingdeeErpSyncServiceImpl k = new KingdeeErpSyncServiceImpl();
|
|
|
|
|
k.syncProjectInfoFromErp(0,"");
|
|
|
|
|
k.syncProjectInfoFromErp(0, "");
|
|
|
|
|
// int i = syncSupplierInfoFromErp(0);
|
|
|
|
|
// syncMaterialInfoFromErpTest(0);
|
|
|
|
|
// syncSaleOrderFromErp();
|
|
|
|
@ -804,9 +811,6 @@ public class KingdeeErpSyncServiceImpl implements IKingdeeErpSyncService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static int syncMaterialInfoFromErpTest(int startRow) throws Exception {
|
|
|
|
|
K3CloudApi api = new K3CloudApi();
|
|
|
|
|
String FDocumentStatus = "C";
|
|
|
|
@ -829,8 +833,8 @@ public class KingdeeErpSyncServiceImpl implements IKingdeeErpSyncService {
|
|
|
|
|
queryJson.put("SubSystemId", "");
|
|
|
|
|
|
|
|
|
|
//条件查询
|
|
|
|
|
String filterString = "FNumber ='01010001'";
|
|
|
|
|
queryJson.put("FilterString", filterString);
|
|
|
|
|
String filterString = "FNumber ='01010001'";
|
|
|
|
|
queryJson.put("FilterString", filterString);
|
|
|
|
|
|
|
|
|
|
System.out.println(queryJson.toString());
|
|
|
|
|
|
|
|
|
@ -846,7 +850,7 @@ public class KingdeeErpSyncServiceImpl implements IKingdeeErpSyncService {
|
|
|
|
|
System.out.println("物料单据查询接口: " + result);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|