|
|
@@ -3146,6 +3146,65 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
|
|
|
return "推送成功";
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ @DS("multi-one")
|
|
|
+ public String pushInvoiceFor(List<SyPackingListFabric> listFabrics) {
|
|
|
+ List<String> ids=new ArrayList<>();//获取出库单号
|
|
|
+ JSONArray jsonArrays2=new JSONArray();
|
|
|
+ Map<String,List<SyPackingListFabric>> codeMaps=new HashMap<>();//key:传入销售发票单id,value:主表数据
|
|
|
+ for (SyPackingListFabric syPackingListFabric : listFabrics){
|
|
|
+ String recordingCode=syPackingListFabric.getRecordingCode();
|
|
|
+ String code=syPackingListFabric.getSaleInvoiceCode();
|
|
|
+ System.out.println("recordingCode\t"+recordingCode);
|
|
|
+ System.out.println("code\t"+code);
|
|
|
+ if(recordingCode!=null&&code!=null&&recordingCode.indexOf("101账套采购发票单")>-1&&code.indexOf("101结算单")==-1 ){
|
|
|
+ String documentNo=recordingCode.substring(recordingCode.indexOf("101账套采购发票单")+11,recordingCode.indexOf("101账套采购发票单")+22);
|
|
|
+ System.out.println("101账套采购发票单号\t"+documentNo);
|
|
|
+ if (!ids.contains(documentNo)){
|
|
|
+ List<SyPackingListFabric> fabricList=new ArrayList<>();
|
|
|
+ fabricList.add(syPackingListFabric);
|
|
|
+ codeMaps.put(documentNo,fabricList);
|
|
|
+ ids.add(documentNo);
|
|
|
+ JSONObject jsonObject1=new JSONObject();
|
|
|
+ jsonObject1.put("CACCID","101");
|
|
|
+ jsonObject1.put("CMAKER","进出口平台管理员");
|
|
|
+ jsonObject1.put("CVOUCHCODE_U8",documentNo);
|
|
|
+ jsonObject1.put("DDATE",syPackingListFabric.getTheFinalShippingDate().substring(0,10));
|
|
|
+ jsonArrays2.add(jsonObject1);
|
|
|
+ }else{
|
|
|
+ List<SyPackingListFabric> fabricList=codeMaps.get(documentNo);
|
|
|
+ fabricList.add(syPackingListFabric);
|
|
|
+ codeMaps.put(documentNo,fabricList);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ System.out.println("结算单codeMaps\t"+codeMaps);
|
|
|
+ System.out.println("结算单jsonArrays2\t"+jsonArrays2);
|
|
|
+ if (jsonArrays2.size()>0){
|
|
|
+ JSONArray resturnJsonArrays2 = InterfaceConnUtils.doPost(jsonArrays2,"purchasesettle_import");//结算单
|
|
|
+ Map<String,String> codeMaps3 = result(resturnJsonArrays2,"结算单","101");
|
|
|
+
|
|
|
+ for (String code1 : codeMaps.keySet()){
|
|
|
+ List<SyPackingListFabric> listFabricList=codeMaps.get(code1);
|
|
|
+ for (SyPackingListFabric fabric : listFabricList){
|
|
|
+ if (codeMaps3.get(code1).indexOf("失败")>-1|| codeMaps3.get(code1).indexOf("未结账")>-1){
|
|
|
+ if(fabric.getSaleInvoiceError()==null){
|
|
|
+ fabric.setSaleInvoiceError(codeMaps3.get(code1));
|
|
|
+ }else{
|
|
|
+ fabric.setSaleInvoiceError(fabric.getSaleInvoiceError()+";"+codeMaps3.get(code1));
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ if(fabric.getSaleInvoiceCode()==null){
|
|
|
+ fabric.setSaleInvoiceCode(codeMaps3.get(code1));
|
|
|
+ }else{
|
|
|
+ fabric.setSaleInvoiceCode(fabric.getSaleInvoiceCode()+";"+codeMaps3.get(code1));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return "推送成功";
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 合并批量推送采购发票单
|