Browse Source

u8推送接口

huxy 2 years ago
parent
commit
b40e97d04f

+ 0 - 3
jeecg-boot-module-system/src/main/java/org/jeecg/modules/splfi/service/impl/SyPackingListFabricServiceImpl.java

@@ -1068,9 +1068,6 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 	public void result(JSONArray jsonArray,String tableName ,String account,String id){
 		JSONObject jsonObject=jsonArray.getJSONObject(0);
 		if(jsonObject.get("Result").equals("F")){//获取发货单是否成功添加
-			/*SyPackingListTailoring syPackingListTailoring=syPackingListTailoringMapper.selectById(id);
-			syPackingListTailoring.setRecording(account+"-"+tableName);
-			syPackingListTailoringMapper.updateById(syPackingListTailoring);*/
 			throw new JeecgBootException("账套"+account+"接口"+tableName+",原因\t"+ jsonObject.get("Description"));
 		}
 	}

+ 40 - 27
jeecg-boot-module-system/src/main/java/org/jeecg/modules/splt/controller/SyPackingListTailoringController.java

@@ -1221,6 +1221,7 @@ public class SyPackingListTailoringController {
 			queryWrapper.eq("sy_packing_list_tailoring_id",main.getId());
 			queryWrapper.eq("del_flag","0");
 			List<SyPackingListTailoringItem> syPackingListTailoringItems=syPackingListTailoringItemService.list(queryWrapper);
+			String message="";//获取报错消息
 			if(syPackingListTailoringItems!=null){
 				main.setSyPackingListTailoringItemList(syPackingListTailoringItems);
 				map.put("account",main.getSyPackingListTailoringItemList().get(0).getOmpoAccount());//委外采购账套号
@@ -1234,28 +1235,41 @@ public class SyPackingListTailoringController {
 				map.put("CVENCODE","one");//供应商编码
 				map.put("orderNumber","one");//销售订单号
 				map.put("poid","one");//销售订单id
-				System.out.println("循环前\n"+map);
 				for (int x=0;x<3;x++){//最多循环3次
-					if (map.get("account").equals("903")){
-						syPackingListTailoringService.three(main,map);
-					}else if(map.get("account").equals("902")){
-						syPackingListTailoringService.two(main,map);
-					}else if(map.get("account").equals("901")){
-						syPackingListTailoringService.one(main,map);
+					try {
+						if (map.get("account").equals("903")){
+							syPackingListTailoringService.three(main,map);
+						}else if(map.get("account").equals("902")){
+							syPackingListTailoringService.two(main,map);
+						}else if(map.get("account").equals("901")){
+							syPackingListTailoringService.one(main,map);
+						}else{
+							break;
+						}
+					}catch (Exception e){
+						message+=e.getMessage();
 					}
 				}
-				System.out.println("循环后\n"+map);
 			}
-			main.setPushState("1");//推送成功!
-			System.out.println("main\n"+main);
+			if(message!=null&&message.length()>0){
+				main.setPushState("2");//推送失败!
+				result.setSuccess(false);
+				result.setMessage(message);
+			}else{
+				main.setPushState("1");//推送成功!
+				result.setSuccess(true);
+				result.setMessage("u8已成功生成单据");
+			}
 			result.setResult(main);
-		//	syPackingListTailoringService.updateById(main);//修改成衣
-			result.setSuccess(true);
-			result.setMessage("u8已成功生成单据");
-		}catch (Exception e){
+			syPackingListTailoringService.updateById(main);//修改成衣
+		}catch (Exception e){/*
 			SyPackingListTailoring main=syPackingListTailoringService.getById(ids);
 			main.setPushState("2");//推送失败!
-			//syPackingListTailoringService.updateById(main);//修改成衣
+			String []messages=e.getMessage().split("fengexian");
+			if(messages.length>1){
+				main.setRecording(messages[1]);
+			}
+			syPackingListTailoringService.updateById(main);//修改成衣*/
 			e.printStackTrace();
 			result.setSuccess(false);
 			result.error500("操作失败:"+e.getMessage());
@@ -1361,19 +1375,18 @@ public class SyPackingListTailoringController {
 	 @ApiOperation(value="重新推送u8", notes="重新推送u8")
 	 @RequestMapping(value = "/testu8", method = {RequestMethod.POST})
 	 public Result testu8(String account,String recording){
-	 	 if (recording==null||recording.equals("")){
-		 	 return Result.error("没有推送记录,直接去调用推送接口就行");
-		 }
-	 	 String[] recordings=recording.split(",");
-	 	 Map<String,Map<String,String>> maps=new HashMap<>();
-	 	 for (int i=0;i<recordings.length;i++){
-			 Map<String,String> map=new HashMap<>();
-			 map.put("index",recordings[i].split("-")[1]);
-			 map.put("code",recordings[i].split("-")[2]);
-			 maps.put(recordings[i].split("-")[0],map);
+		 String message="";
+		 for (int i=0;i<3;i++){
+			 try {
+				print1(i);
+		  	 }catch (Exception e){
+			 	message+=e.getMessage();
+			 }
 		 }
-	 	 return Result.ok(maps);
+		 return Result.ok(message);
 	 }
 
-
+	void print1(int i){
+	 	throw new JeecgBootException("报错"+i+";");
+	}
 }

+ 104 - 67
jeecg-boot-module-system/src/main/java/org/jeecg/modules/splt/service/impl/SyPackingListTailoringServiceImpl.java

@@ -6,6 +6,7 @@ import com.baomidou.dynamic.datasource.annotation.DS;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.exception.JeecgBootException;
 import org.jeecg.common.util.oConvertUtils;
 import org.jeecg.config.InterfaceConnUtils;
@@ -689,14 +690,11 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
 			return new HashMap();//为空就传回空对象
 		}
 		JSONArray mapList=new JSONArray();
-		//JSONArray mapList2=new JSONArray();
 		JSONArray mapList3=new JSONArray();
 		JSONArray mapList4=new JSONArray();
 		JSONArray mapList5=new JSONArray();
 		JSONArray mapList6=new JSONArray();
 
-
-
 		JSONArray mapLists=new JSONArray();
 		//账套号
 		if (main!=null){
@@ -711,13 +709,6 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
 			map.put("CMAKER",createBy);//制单人
 			map.put("cVouchType",1);//传1
 
-		/*	JSONObject map2=new JSONObject();//材料出库单
-			map2.put("CVOUCHCODE",org.jeecg.modules.system.util.oConvertUtils.addOne(purchaseWarehousingMapper.getMaxCode("cCode","rdrecord11","dnmaketime")));//单号
-			map2.put("DDATE",main.getCreateTime());//日期(格式2015-01-01)
-			map2.put("CHANDLER",createBy);//审核人
-			map2.put("CMAKER",createBy);//制单人
-			map2.put("cOrderCode",main.getOrderNumber());//销售订单号*/
-
 			JSONObject map3=new JSONObject();//销售发货单
 			map3.put("CVOUCHCODE",org.jeecg.modules.system.util.oConvertUtils.addOne(purchaseWarehousingMapper.getMaxCode("cDLCode","DispatchList","dcreatesystime")));//发货单号
 			map3.put("DDATE",createDate);//发货日期(yyyy-MM-dd)
@@ -759,7 +750,6 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
 				map4.put("CGLTYPE","销售发货单");//来源单据类型
 				map5.put("CGLTYPE","委外订单");//来源单据类型
 				map6.put("CGLTYPE","销售出库单");//来源单据类型
-				//map2.put("CRDCODE","委外出库");//出库类别
 			}else {//查询采购订单表数据
 				if(mapt.get("orderNumber").equals("one")){
 					orderData=syPackingListTailoringMapper.getOmOrPo("PO_POMAIN","cPOID='"+mapt.get("mpOrder")+"'","POID");//委外订单号判断
@@ -771,7 +761,6 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
 				map4.put("CGLTYPE","销售发货单");//来源单据类型
 				map5.put("CGLTYPE","采购订单");//来源单据类型
 				map6.put("CGLTYPE","销售出库单");//来源单据类型
-				//map2.put("CRDCODE","采购出库");//出库类别
 			}
 			if(orderData!=null){
 				map.put("CVENCODE",orderData.get("cvencode"));//供应商编码
@@ -781,7 +770,6 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
 			}
 			for (SyPackingListTailoringItem item : main.getSyPackingListTailoringItemList()){
 				JSONObject mapItem=new JSONObject();
-				//JSONObject mapItem2=new JSONObject();
 				JSONObject mapItem3=new JSONObject();
 				JSONObject mapItem4=new JSONObject();
 				JSONObject mapItem5=new JSONObject();
@@ -789,7 +777,6 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
 
 
 				map.put("CACCID",mapt.get("account"));//账套号
-				//map2.put("CACCID",mapt.get("account"));//账套号
 				map3.put("CACCID",mapt.get("account"));//账套号
 				map4.put("CACCID",mapt.get("account"));//账套号
 				map5.put("CACCID",mapt.get("account"));//账套号
@@ -832,8 +819,6 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
 					mapItem.put("POAUTOIDCOL","MODetailsID");//订单明细ID对应字段名(关联单据类型为采购订单传ID,为采购到货单为Autoid,为委外订单传MODetailsID,为委外到货单为Autoid)
 					mapItem.put("AUTOID_PO",orderDataItem.get("id"));//明细ID(采购订单行ID/委外订单行ID)
 					map5.put("CGLTYPE","委外订单");
-				/*	mapItem2.put("AUTOID_ALL",orderDataItem.get("id"));//关联明细ID
-					mapItem2.put("ALLCAUTOIDCOL","AllocateId");//订单明细ID对应字段名(固定AllocateId)*/
 					mapItem5.put("POAUTOIDCOL","MODetailsID");//明细ID对应字段名(关联单据类型为采购订单传ID,委外订单传MODetailsID,入库单为Autoid)
 					mapItem5.put("AUTOID_PO",orderDataItem.get("id"));//明细ID(采购订单行ID/委外订单行ID)
 					mapItem5.put("IORITAXCOST",orderDataItem.get("iTaxPrice"));//原币单价
@@ -844,7 +829,6 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
 					String wheCode=syPackingListTailoringMapper.getWhCodeByVenCode(mapt.get("CVENCODE").toString());
 					if(wheCode!=null){
 						map.put("CWHCODE",wheCode);//仓库编码
-					//	map2.put("CWHCODE",wheCode);//仓库编码
 						map4.put("CWHCODE",wheCode);//仓库编码
 						mapItem3.put("CWHCODE",wheCode);//仓库编码	这个是子表需要字段
 						mapItem6.put("CWHCODE",wheCode);//仓库编码
@@ -869,10 +853,6 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
 					mapt.put("orderNumber",order.get("cSOCode"));//销售订单号
 					mapt.put("customerCode",order.get("cCusCode"));//客户编码
 					if(order!=null){//销售订单主表
-						//cPersonCode,cDepCode,cBusType,cPayCode,cexch_name,nflat
-						/*map2.put("CDEPCODE",order.get("cDepCode"));//部门编码(如果传空,取来源单据)
-						map2.put("CEXCH_NAME",order.get("cexch_name"));//币种名称(如果传空,接口默认人民币)
-						map2.put("CPERSONCODE",order.get("cPersonCode"));//业务员编码(如果传空,取来源单据)*/
 						map.put("cOrderCode",order.get("cSOCode"));//销售订单号
 						map3.put("CBUSTYPE",order.get("cBusType"));//业务类型(普通销售、分期付款)(如果传空,取来源单据)
 						map4.put("CEXCH_NAME",order.get("cexch_name"));//币种名称(如果传空,传来源单据;无来源单据,默认人民币)
@@ -885,17 +865,11 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
 					}
 				}
 
-
-
 				mapItem.put("CINVCODE",item.getInventoryCode());//存货编码
 				mapItem.put("IQUANTITY",item.getTotal());//数量
 				//mapItem.put("INUM",orderDataItem.get("inum"));//明细ID(采购订单行ID/委外订单行ID)
-
 				//mapItem.put("cBatch","x");//批号
 
-				/*mapItem2.put("CINVCODE",item.getInventoryCode());//存货编码(如果来源单据是委外订单,此字段需要传该订单的子件编码)
-				mapItem2.put("IQUANTITY",item.getTotal());//数量*/
-
 				mapItem3.put("CINVCODE",item.getInventoryCode());//存货编码
 				mapItem3.put("IQUANTITY",item.getTotal());//数量
 
@@ -912,9 +886,7 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
 				mapItem6.put("IQUANTITY",item.getTotal());//数量
 				mapItem6.put("size",item.getSize());//根据尺码判断
 
-
 				mapItems.add(mapItem);
-				//mapItems2.add(mapItem2);
 				mapItems3.add(mapItem3);
 				mapItems4.add(mapItem4);
 				mapItems5.add(mapItem5);
@@ -923,8 +895,6 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
 
 			map.put("DETAILList",mapItems);//明细集合
 			mapList.add(map);
-		/*	map2.put("DETAILList",mapItems2);//明细集合
-			mapList2.add(map2);*/
 			map3.put("DETAILList",mapItems3);//明细集合
 			mapList3.add(map3);
 			map4.put("DETAILList",mapItems4);//明细集合
@@ -943,45 +913,103 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
 			}
 			mapt.put("itemSort",mapSort);
 		}
-
-/*
-
-		if(true){
-			main.setRecording("903-3-1000130,902-2-1000244");
-			return null;
-		}
-
-
-		if(main.getRecording()!=null&&!main.getRecording().equals("")){
-			//上面已经收集到信息 可以进入到下次循环
-			//如何获取到发货单和出库单做采购订单是一个问题
-			//1、直接查询最后一个生成的单子	可能会搞混
-			//2、保存在recording里	可以但需要分离
-			//903-3-CVOUCHCODE,
-		}
-*/
 		text(mapList,"采购入库单");
 		text(mapList3,"销售发货单");
 		text(mapList5,"采购发票单");
-		JSONArray resturn1 = InterfaceConnUtils.doPost(mapList,"purchasein_import");//采购入库单		主表添加了一个字段,子表可能要添加一个字段
-		//JSONArray resturn2 = InterfaceConnUtils.doPost(mapList,"materialout_import");//材料出库单
-		JSONArray resturn3 = InterfaceConnUtils.doPost(mapList3,"consignment_import");//销售发货单
-		JSONArray resturn5 = InterfaceConnUtils.doPost(mapList5,"purinvoice_import");//采购发票单
 
-		result(resturn1,"采购入库单",((Map) mapList.get(0)).get("CACCID").toString(),main.getId());//采购入库单
+		String recording=null;
+		if(main.getRecording()!=null){
+			String[] recordings=main.getRecording().split(",");
+			Map<String,Map<String,String>> maps=new HashMap<>();
+			for (int i=0;i<recordings.length;i++){
+				Map<String,String> map=new HashMap<>();
+				map.put("index",recordings[i].split("-")[1]);
+				map.put("code",recordings[i].split("-")[2]);
+				maps.put(recordings[i].split("-")[0],map);
+			}
+			String account=mapList.getJSONObject(0).get("CACCID").toString();//获取账套号
+			if (maps.containsKey(account)){
+				switch (maps.get(account).get("index")){
+					case "1":	//代表已完成第一道
+						JSONArray resturn3 = InterfaceConnUtils.doPost(mapList3,"consignment_import");//销售发货单
+						recording=result(main,resturn3,"销售发货单",((Map) mapList.get(0)).get("CACCID").toString(),"2");//销售发货单
+						maps.get(account).put("code",resturn3.getJSONObject(0).get("U8ReceiptNo").toString());
+						recording(main,recording);
+						String u8ReceiptNo103= resturn3.getJSONObject(0).get("U8ReceiptNo").toString();
+						this.purchaseWarehousingMapper.updateVoucherHistoryCNumber(org.jeecg.modules.system.util.oConvertUtils.maxNumber(u8ReceiptNo103.substring(u8ReceiptNo103.length()-4 ) ),"108");
+					case "2":
+						JSONArray resturn5 = InterfaceConnUtils.doPost(mapList5,"purinvoice_import");//采购发票单
+						recording=result(main,resturn5,"采购发票单",((Map) mapList.get(0)).get("CACCID").toString(),"3");//采购发票单
+						recording(main,recording);
+						this.purchaseWarehousingMapper.updateVoucherHistoryCNumber(org.jeecg.modules.system.util.oConvertUtils.maxNumber(resturn5.getJSONObject(0).get("U8ReceiptNo").toString()),"109");
+					case "3":
+						String consignmentName=maps.get(account).get("code");//获取销售发货单
+						List<Map<String,Object>> consignmentMaps= syPackingListTailoringMapper.getDispatchLists(consignmentName);
+						if(consignmentMaps!=null){
+							for (Map map : consignmentMaps){
+								JSONObject jsonObject=mapList4.getJSONObject(0);//循环迭代
+								List<Map<String,Object>> mapItems4= (List<Map<String,Object>>) jsonObject.get("DETAILList");
+								for (Map itemMap4 :  mapItems4){
+									if(itemMap4.get("size").equals(map.get("cFree2"))&&(Double.parseDouble( itemMap4.get("IQUANTITY").toString())
+											==Double.parseDouble( map.get("iQuantity").toString()))&&!itemMap4.containsKey("AUTOID_SO")){//根据尺码判断
+										getcFree((JSONObject) itemMap4,map);
+										itemMap4.put("AUTOID_SO",map.get("iDLsID"));
+									}
+								}
+								System.out.println("mapItems4\t"+mapItems4);
+							}
+						}
+						text(mapList4,"销售出库单");
+						JSONArray resturn4 = InterfaceConnUtils.doPost(mapList4,"saleout_import");//
+						recording=result(main,resturn4,"销售出库单",((Map) mapList.get(0)).get("CACCID").toString(),"4");//销售出库单
+						maps.get(account).put("code",resturn4.getJSONObject(0).get("U8ReceiptNo").toString());
+						recording(main,recording);
+					case "4":
+						String saleoutName=maps.get(account).get("code");//销售出库单
+
+						this.purchaseWarehousingMapper.updateVoucherHistoryCNumber(org.jeecg.modules.system.util.oConvertUtils.maxNumber(saleoutName),"131");
+
+						List<Map<String,Object>> saleoutMaps= syPackingListTailoringMapper.getRdrecord32(saleoutName);
+						if(saleoutMaps!=null){
+							for (Map map : saleoutMaps){
+								JSONObject jsonObject=mapList6.getJSONObject(0);//循环迭代
+								List<Map<String,Object>> mapItems6= (List<Map<String,Object>>) jsonObject.get("DETAILList");
+								for (Map itemMap6 :  mapItems6){
+									itemMap6.put("DISAUTOIDCOL","AUTOID");
+									if(itemMap6.get("size").equals(map.get("cFree2"))&&(Double.parseDouble( itemMap6.get("IQUANTITY").toString())
+											==Double.parseDouble( map.get("iQuantity").toString()))&&!itemMap6.containsKey("AUTOID_DIS")){
+										itemMap6.put("AUTOID_DIS",map.get("autoid"));
+									}
+								}
+							}
+						}
+						text(mapList6,"销售发票单");
+						JSONArray resturn6 = InterfaceConnUtils.doPost(mapList6,"saleinvoice_import");//销售发票单
+						recording=result(main,resturn6,"销售发票单",((Map) mapList.get(0)).get("CACCID").toString(),"5");//销售发票单
+						recording(main,recording);
+				}
+				return mapt;
+			}
+		}
+
+		JSONArray resturn1 = InterfaceConnUtils.doPost(mapList,"purchasein_import");//采购入库单
+		recording=result(main,resturn1,"采购入库单",((Map) mapList.get(0)).get("CACCID").toString(),"1");//采购入库单
+		recording(main,recording);
 		this.purchaseWarehousingMapper.updateVoucherHistoryCNumber(org.jeecg.modules.system.util.oConvertUtils.maxNumber(resturn1.getJSONObject(0).get("U8ReceiptNo").toString()),"107");
 
-		result(resturn3,"销售发货单",((Map) mapList.get(0)).get("CACCID").toString(),main.getId());//销售发货单
+		JSONArray resturn3 = InterfaceConnUtils.doPost(mapList3,"consignment_import");//销售发货单
+		recording=result(main,resturn3,"销售发货单",((Map) mapList.get(0)).get("CACCID").toString(),"2");//销售发货单
+		recording(main,recording);
 		String u8ReceiptNo103= resturn3.getJSONObject(0).get("U8ReceiptNo").toString();
 		this.purchaseWarehousingMapper.updateVoucherHistoryCNumber(org.jeecg.modules.system.util.oConvertUtils.maxNumber(u8ReceiptNo103.substring(u8ReceiptNo103.length()-4 ) ),"108");
 
-
-		result(resturn5,"采购发票单",((Map) mapList.get(0)).get("CACCID").toString(),main.getId());//采购发票单
+		JSONArray resturn5 = InterfaceConnUtils.doPost(mapList5,"purinvoice_import");//采购发票单
+		recording=result(main,resturn5,"采购发票单",((Map) mapList.get(0)).get("CACCID").toString(),"3");//采购发票单
+		recording(main,recording);
 		this.purchaseWarehousingMapper.updateVoucherHistoryCNumber(org.jeecg.modules.system.util.oConvertUtils.maxNumber(resturn5.getJSONObject(0).get("U8ReceiptNo").toString()),"109");
 
 		JSONObject jsonObject3=resturn3.getJSONObject(0);//销售发货单
 		String consignmentName=jsonObject3.get("U8ReceiptNo").toString();//获取销售发货单
-		//String consignmentName= "20220401T00245841";// jsonObject3.get("U8ReceiptNo").toString();//获取销售发货单
 		List<Map<String,Object>> consignmentMaps= syPackingListTailoringMapper.getDispatchLists(consignmentName);
 		if(consignmentMaps!=null){
 			for (Map map : consignmentMaps){
@@ -1000,17 +1028,15 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
 
 		text(mapList4,"销售出库单");
 		JSONArray resturn4 = InterfaceConnUtils.doPost(mapList4,"saleout_import");//
-		result(resturn4,"销售出库单",((Map) mapList.get(0)).get("CACCID").toString(),main.getId());//销售出库单
-
+		recording=result(main,resturn4,"销售出库单",((Map) mapList.get(0)).get("CACCID").toString(),"4");//销售出库单
+		recording(main,recording);
 
 		JSONObject jsonObject4=resturn4.getJSONObject(0);//销售出库单
 		String saleoutName=jsonObject4.get("U8ReceiptNo").toString();//销售出库单
 
 		this.purchaseWarehousingMapper.updateVoucherHistoryCNumber(org.jeecg.modules.system.util.oConvertUtils.maxNumber(saleoutName),"131");
 
-		//String saleoutName= "0000005974";// jsonObject4.get("U8ReceiptNo").toString();//获取销售发货单
 		List<Map<String,Object>> saleoutMaps= syPackingListTailoringMapper.getRdrecord32(saleoutName);
-		//System.out.println("saleoutMaps\t"+saleoutMaps);
 		if(saleoutMaps!=null){
 			for (Map map : saleoutMaps){
 				JSONObject jsonObject=mapList6.getJSONObject(0);//循环迭代
@@ -1026,11 +1052,24 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
 		}
 		text(mapList6,"销售发票单");
 		JSONArray resturn6 = InterfaceConnUtils.doPost(mapList6,"saleinvoice_import");//销售发票单
-		result(resturn6,"销售发票单",((Map) mapList.get(0)).get("CACCID").toString(),main.getId());//销售发票单
+		recording=result(main,resturn6,"销售发票单",((Map) mapList.get(0)).get("CACCID").toString(),"5");//销售发票单
+		recording(main,recording);
 		//this.purchaseWarehousingMapper.updateVoucherHistoryCNumber(org.jeecg.modules.system.util.oConvertUtils.maxNumber(resturn6.getJSONObject(0).get("U8ReceiptNo").toString()),"120");
 		return mapt;
 	}
 
+	public void recording(SyPackingListTailoring syPackingListTailoring,String recording){
+		if(syPackingListTailoring.getRecording()!=null){
+			if(syPackingListTailoring.getRecording().substring(0,3).equals(recording.substring(0,3))){//如果是同一个账套号就被覆盖掉
+				syPackingListTailoring.setRecording(recording);
+			}else{
+				syPackingListTailoring.setRecording(syPackingListTailoring.getRecording()+","+recording);
+			}
+		}else{
+			syPackingListTailoring.setRecording(recording);
+		}
+	}
+
 	public void text(JSONArray mapList,String tableName){
 		try{
 			String txtWorld="\n"+((Map)mapList.get(0)).get("CACCID")+"\t"+new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS").format(System.currentTimeMillis())+"\n\n";
@@ -1044,14 +1083,12 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
 		}
 	}
 
-	public void result(JSONArray jsonArray,String tableName ,String account,String id){
+	public String result(SyPackingListTailoring main,JSONArray jsonArray,String tableName ,String account,String index){
 		JSONObject jsonObject=jsonArray.getJSONObject(0);
 		if(jsonObject.get("Result").equals("F")){//获取发货单是否成功添加
-			/*SyPackingListTailoring syPackingListTailoring=syPackingListTailoringMapper.selectById(id);
-			syPackingListTailoring.setRecording(account+"-"+tableName);
-			syPackingListTailoringMapper.updateById(syPackingListTailoring);*/
-			throw new JeecgBootException("账套"+account+"接口"+tableName+",原因\t"+ jsonObject.get("Description"));
+			throw new JeecgBootException("账套"+account+"接口"+tableName+",原因"+ jsonObject.get("Description"));
 		}
+		return account+"-"+index+"-"+jsonObject.get("ReceiptNo");//账套号-序号-生成的单号
 	}
 
 	public void getcFree(JSONObject itemMap,Map<String,Object> mapPOPodetails){