|
@@ -643,7 +643,29 @@ public class KabeiyiServiceImpl implements KabeiyiService {
|
|
|
param2.put("id", id);
|
|
|
param2.put("ds_sequence", dsSequence);
|
|
|
|
|
|
- Map<String, Object> map2 = get("https://api.yonyouup.com/api/consignment/get", param2, null);
|
|
|
+ Map<String, Object> map2 = new HashMap<>();
|
|
|
+
|
|
|
+ int i1 =1 ;
|
|
|
+ boolean flag1 = false;
|
|
|
+ while (i1<=5 && !flag1) {
|
|
|
+ try {
|
|
|
+ map2 = get("https://api.yonyouup.com/api/consignment/get", param2, null);
|
|
|
+ flag1 = true;
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("获取发货单详情失败:{}, 重试次数:{}",e.getMessage(),i1);
|
|
|
+ try {
|
|
|
+ Thread.sleep(3000);
|
|
|
+ } catch (InterruptedException ex) {
|
|
|
+ throw new RuntimeException(ex);
|
|
|
+ }
|
|
|
+ i1++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (i1 > 5){
|
|
|
+ log.error("获取发货单详情失败");
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
Map consignment2 = (Map) map2.get("consignment");
|
|
|
|
|
@@ -658,7 +680,7 @@ public class KabeiyiServiceImpl implements KabeiyiService {
|
|
|
formData.put("textField_m18qfuiz",getString(consignment2.get("operation_type")));//操作类型
|
|
|
formData.put("textField_m18qfuj0",getString(consignment2.get("saletypename")));//销售类型
|
|
|
formData.put("textField_m18nvp87",getString(consignment2.get("code")));//发货单code
|
|
|
- formData.put("dateField_m18nvp7x",DateUtil.parseDate(yesterday).getTime());//发货日期
|
|
|
+ formData.put("dateField_m18nvp7x",DateUtil.parseDate(getString(consignment.get("date"))).getTime());//发货日期
|
|
|
formData.put("textField_m18nvp7z",getString(consignment2.get("deptname")));//部门
|
|
|
formData.put("textField_m18nvp81",getString(consignment2.get("maker")));//生产员
|
|
|
formData.put("textField_m18nvp80",getString(consignment2.get("verifier")));//质检员
|
|
@@ -679,8 +701,9 @@ public class KabeiyiServiceImpl implements KabeiyiService {
|
|
|
detail.put("numberField_m18nvp8m", getString(item.get("sum")));//含税总价
|
|
|
detail.put("numberField_m18nvp8n", getString(item.get("taxrate")));//税率
|
|
|
detail.put("numberField_m18nvp8o", getString(item.get("tax")));//总税价
|
|
|
- detail.put("dateField_m18yzlob", DateUtil.parseDate(yesterday).getTime());//发货日期
|
|
|
+ detail.put("dateField_m18yzlob", DateUtil.parseDate(getString(consignment.get("date"))).getTime());//发货日期
|
|
|
detail.put("textField_m18z3yn8", getString(consignment2.get("cusname")));//客户名称
|
|
|
+ detail.put("textField_m1odluob", factory.get(dsSequence));//工厂名称
|
|
|
|
|
|
return detail;
|
|
|
}).collect(Collectors.toList());
|
|
@@ -698,13 +721,16 @@ public class KabeiyiServiceImpl implements KabeiyiService {
|
|
|
flag = true;
|
|
|
}catch (McException e){
|
|
|
if (e.getMessage().contains("The request has failed due to a temporary failure of the server.")){
|
|
|
- log.info("请求失败,尝试次数:{}",i);
|
|
|
+ log.error("请求失败,尝试次数:{}",i);
|
|
|
i++;
|
|
|
try {
|
|
|
Thread.sleep(3000);
|
|
|
} catch (InterruptedException ex) {
|
|
|
throw new RuntimeException(ex);
|
|
|
}
|
|
|
+ }else {
|
|
|
+ log.error("删除失败 失败原因:{}" , e.getMessage());
|
|
|
+ flag = true;
|
|
|
}
|
|
|
}catch (Exception e){
|
|
|
log.error("发货单:{} 同步失败 失败原因:{}",getString(consignment2.get("code")) , e.getMessage());
|