瀏覽代碼

预装箱单推送接口、成衣接收云工厂接口

huxy 2 年之前
父節點
當前提交
b557c39f45
共有 14 個文件被更改,包括 375 次插入223 次删除
  1. 7 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/spapl/entity/SyPreAssembledPackingList.java
  2. 9 8
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/spapl/mapper/xml/SyPreAssembledPackingListItemMapper.xml
  3. 2 3
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/spapl/mapper/xml/SyPreAssembledPackingListMapper.xml
  4. 53 34
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/spapl/service/impl/SyPreAssembledPackingListServiceImpl.java
  5. 1 5
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/spapl/vo/PackingHeaderVo.java
  6. 0 6
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/spapl/vo/PackingLineVo.java
  7. 3 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/splfi/controller/SyPackingListFabricController.java
  8. 12 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/splfi/entity/SyPackingListFabricItem.java
  9. 100 67
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/splt/controller/SyPackingListTailoringController.java
  10. 4 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/splt/entity/SyPackingListTailoring.java
  11. 5 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/splt/mapper/SyPackingListTailoringMapper.java
  12. 6 6
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/splt/mapper/xml/syPackingListTailoringItemMapper.xml
  13. 7 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/splt/mapper/xml/syPackingListTailoringMapper.xml
  14. 166 93
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/splt/service/impl/SyPackingListTailoringServiceImpl.java

+ 7 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/spapl/entity/SyPreAssembledPackingList.java

@@ -204,6 +204,13 @@ public class SyPreAssembledPackingList implements Serializable {
 	@ApiModelProperty(value = "二维表格")
 	private List<SizeTable> sizeTables;
 
+	//最底层供应商编码
+	@ApiModelProperty(value = "最底层供应商编码")
+	private java.lang.String supplierCode;
+	//最底层供应商名称
+	@ApiModelProperty(value = "最底层供应商名称")
+	private java.lang.String supplier;
+
 	public SyPreAssembledPackingList(){
 
 	}

+ 9 - 8
jeecg-boot-module-system/src/main/java/org/jeecg/modules/spapl/mapper/xml/SyPreAssembledPackingListItemMapper.xml

@@ -35,13 +35,13 @@
 			plan_Quantity,/*计划装箱数量*/
 			actual_Packing_Qty,/*实际装箱数量*/
 			net_weight,
-			sum(total_net_weight) total_net_weight,/*总净重*/
+			total_net_weight total_net_weight,/*总净重*/
 			gross_weight,
-			sum(total_gross_weight) total_gross_weight,/*总毛重*/
+			total_gross_weight total_gross_weight,/*总毛重*/
 			outer_box_length,/*长*/
 			outer_Box_Width,/*宽*/
 			outer_Box_Height,/*高*/
-			sum(total_volume) total_volume,/*总体积*/
+			total_volume total_volume,/*总体积*/
 			net_weight_too net_weight_too,/*净净重*/
 			unit_price,
 			sum(total_price) total_price,/*总价*/
@@ -194,7 +194,7 @@
 			inventory_Code AS itemCode/*物料code*/,
 			hod AS hod/*预发货日期*/,
 			size AS size/*尺码*/,
-			plan_Quantity AS planPackingQty/*计划装箱数量*/,
+			(total/box_number) AS planPackingQty/*计划装箱数量*/,
 			actual_Packing_Qty AS actualPackingQty,/*实际装箱数量*/
 			distribution_Point AS featureCode2/*分销点/DC/LABEL*/,
 			with_Code AS planSizeSpec/*计划配码规格*/,
@@ -202,7 +202,9 @@
 			end_Case_Number AS endBoxNo/*结束箱号*/,
 			pieces_Box AS setQty/*件数/每箱*/,
 			box_Number AS cartons/*箱数*/,
-			total AS sets/*总件数*/,
+		    (SELECT SUM(total) FROM sy_pre_assembled_packing_list_item WHERE
+			sy_Pre_Assembled_Packing_List_Id=#{value}
+			AND group_id=sypre.group_id) AS sets/*总件数*/,
 			outer_Box_Length AS boxLength/*外箱长度*/,
 			outer_Box_Width AS boxWidth/*外箱宽度*/,
 			outer_Box_Height AS boxHeight/*外箱高度*/,
@@ -210,16 +212,15 @@
 			net_Weight AS boxNetWeight/*净重/箱*/,
 			total_Net_Weight AS totalNetWeight/*总净重*/,
 			gross_Weight AS boxGrossWeight/*毛重/箱*/,
-			total_Gross_Weight AS totalGrossWeight/*总毛重*/,
+		 	total_Gross_Weight AS totalGrossWeight/*总毛重*/,
 			net_Weight_Too AS netNetWeight/*NN.W净净重*/,
-
 			sy_pre_assembled_packing_list_id AS attributeString1/*预装箱单头表id*/,
 			id AS attributeString2/*预装箱单行表id*/,
 			group_id AS attributeString3/*预装箱单分组id*/,
 
 			unit_Price AS unitPrice/*单价*/,
 			total_Price AS totalPrice/*总价*/
-		FROM sy_pre_assembled_packing_list_item
+		FROM sy_pre_assembled_packing_list_item sypre
 		where sy_Pre_Assembled_Packing_List_Id=#{value}
 		AND del_flag=0
 		ORDER BY packingLineNum

+ 2 - 3
jeecg-boot-module-system/src/main/java/org/jeecg/modules/spapl/mapper/xml/SyPreAssembledPackingListMapper.xml

@@ -117,13 +117,12 @@
         size_Range  AS size_Range,/*尺寸范围*/
         item_number AS styleNo,/*款号*/
         product_Name AS  productName,/*品名*/
-        supplier_code supplierNumber, /*供应商编码*/
-
+        (SELECT supplier_code FROM sy_pre_assembled_packing_list_item
+        WHERE sy_pre_assembled_packing_list_id=#{value } LIMIT 1 ) supplierNumber, /*供应商编码*/
         id as attributeString1,/*主表id*/
         order_Number as soNum,/*销售订单号*/
         container_Code as attributeString2,/*集装箱代号*/
         elements_Id as attributeString3,/*申报要素id*/
-
         create_By AS preparer/*创建人*/,
         create_Time AS preparationTime/*创建时间*/
     FROM `sy_pre_assembled_packing_list`

+ 53 - 34
jeecg-boot-module-system/src/main/java/org/jeecg/modules/spapl/service/impl/SyPreAssembledPackingListServiceImpl.java

@@ -81,16 +81,18 @@ public class SyPreAssembledPackingListServiceImpl extends ServiceImpl<SyPreAssem
 				item1.setRemainingQuantity(boxNumber);//该尺码的剩余数量
 				item1.setSize(size.getSize());//获取尺码
 				item1.setActualPackingQty(size.getQuantity());//获取该尺码计划装箱数量
+
 				item1.setTotalPrice(boxNumber.multiply(item1.getUnitPrice()));//获取总价		箱数*单价-->件数*单价
 //				item1.setBoxNumber(boxNumber);//获取箱数
-				boxNumber=boxNumber.divide(item.getPiecesBox(),6,BigDecimal.ROUND_HALF_UP);
-				item1.setTotalNetWeight(boxNumber.multiply(item1.getNetWeight()));//获取总净重		净重*箱数
-				item1.setTotalGrossWeight(boxNumber.multiply(item1.getGrossWeight()));//获取总毛重 	箱数*毛重/箱
+				//boxNumber=boxNumber.divide(item.getPiecesBox(),6,BigDecimal.ROUND_HALF_UP);
+				//item1.setTotalNetWeight(boxNumber.multiply(item1.getNetWeight()));//获取总净重		净重*箱数
+				//item1.setTotalGrossWeight(boxNumber.multiply(item1.getGrossWeight()));//获取总毛重 	箱数*毛重/箱
 				//item1.setTotalNetWeight(boxNumber.multiply(new BigDecimal(size.getProportion())));//获取净净重 不知
-				BigDecimal volume=boxNumber.multiply(item1.getOuterBoxHeight());
-				volume=volume.multiply(item1.getOuterBoxLength());
-				volume=volume.multiply(item1.getOuterBoxWidth());
-				item1.setTotalVolume(volume.divide(new BigDecimal(1000000)));//获取总体积	长*宽*高*箱数
+				//BigDecimal volume=boxNumber.multiply(item1.getOuterBoxHeight());
+				//volume=volume.multiply(item1.getOuterBoxLength());
+				//volume=volume.multiply(item1.getOuterBoxWidth());
+				//item1.setTotalVolume(volume.divide(new BigDecimal(1000000)));//获取总体积	长*宽*高*箱数
+
 
 				item1.setSyDeclarationElementsItemId(size.getItemId());//获取到发运明细子表id
 				item1.setSort(size.getNum());//获取序号
@@ -106,7 +108,7 @@ public class SyPreAssembledPackingListServiceImpl extends ServiceImpl<SyPreAssem
 				item1.setSyOrderDataId(syItem.getSyOrderDataId());//获取到订单子表id
 				item1.setSalesman(syItem.getSalesman());//获取业务员
 				item1.setSalesDepartment(syItem.getSalesDepartment());//获取销售部门
-				item1.setInventoryCode(syItem.getInventoryCcode());
+				item1.setInventoryCode(syItem.getInventoryCode());
 				syPreAssembledPackingListItemMapper.insert(item1);//添加子表数据
 				//原剩余数量-预装箱单装箱数量=新剩余数量
 				syItem.setSurplusQuantity(syItem.getSurplusQuantity().subtract(item1.getTotal()));
@@ -138,13 +140,13 @@ public class SyPreAssembledPackingListServiceImpl extends ServiceImpl<SyPreAssem
 				//item1.setBoxNumber(boxNumber);//获取箱数
 				boxNumber=boxNumber.divide(item.getPiecesBox(),6,BigDecimal.ROUND_HALF_UP);
 
-				item1.setTotalNetWeight(boxNumber.multiply(item1.getNetWeight()));//获取总净重		净重*箱数
-				item1.setTotalGrossWeight(boxNumber.multiply(item1.getGrossWeight()));//获取总毛重 	箱数*毛重/箱
+				//item1.setTotalNetWeight(boxNumber.multiply(item1.getNetWeight()));//获取总净重		净重*箱数
+				//item1.setTotalGrossWeight(boxNumber.multiply(item1.getGrossWeight()));//获取总毛重 	箱数*毛重/箱
 				//item1.setTotalNetWeight(boxNumber.multiply(new BigDecimal(size.getProportion())));//获取净净重 不知
-				BigDecimal volume=boxNumber.multiply(item1.getOuterBoxHeight());//获取体积
-				volume=volume.multiply(item1.getOuterBoxLength());
-				volume=volume.multiply(item1.getOuterBoxWidth());
-				item1.setTotalVolume(volume.divide(new BigDecimal(1000000)));//获取总体积	长*宽*高*箱数
+				//BigDecimal volume=boxNumber.multiply(item1.getOuterBoxHeight());//获取体积
+			//	volume=volume.multiply(item1.getOuterBoxLength());
+				//volume=volume.multiply(item1.getOuterBoxWidth());
+				//item1.setTotalVolume(volume.divide(new BigDecimal(1000000)));//获取总体积	长*宽*高*箱数
 
 				//item.setSyDeclarationElementsItemId(size.getItemId());//获取到发运明细子表id
 				item1.setId(size.getItemId());//从尺码表中获取到id
@@ -153,11 +155,17 @@ public class SyPreAssembledPackingListServiceImpl extends ServiceImpl<SyPreAssem
 				item1.setSyDeclarationElementsItemId(syDeclarationElementsItemId);
 				//获取发育明细数据
 				SyShippingDetailsItem syItem=syShippingDetailsItemMapper.selectById(item1.getSyDeclarationElementsItemId());
-				//获取委外/采购订单子表Id
-				item1.setOmpoIdItem(syItem.getOmpoIdItem());
-				item1.setOrderNumber(syItem.getOrderNumber());//获取订单号
-				//获取订单子表id
-				item1.setSyOrderDataItemId(syItem.getSyOrderDataItemId());
+				if(syItem!=null){
+					//获取委外/采购订单子表Id
+					item1.setOmpoIdItem(syItem.getOmpoIdItem());
+					item1.setOmpoAccount(syItem.getOmpoAccount());
+					item1.setOmpoId(syItem.getOmpoId());
+					item1.setOrderNumber(syItem.getOrderNumber());//获取订单号
+					item1.setSupplierCode(syItem.getSupplierCode());
+					item1.setSupplier(syItem.getSupplier());
+					//获取订单子表id
+					item1.setSyOrderDataItemId(syItem.getSyOrderDataItemId());
+				}
 				if(item.getIsAdd()>0){//如果为0就添加数据
 					item1.setSyPreAssembledPackingListId(pid);
 					item1.setId(oConvertUtils.id());//获取到随机id
@@ -172,12 +180,14 @@ public class SyPreAssembledPackingListServiceImpl extends ServiceImpl<SyPreAssem
 				queryWrapperCount.eq("sy_Declaration_Elements_Item_Id",item1.getSyDeclarationElementsItemId());
 				BigDecimal total=syPreAssembledPackingListItemMapper.selectOne(queryWrapperCount).getTotal();
 				///原剩余数量-预装箱单数量=新剩余数量
-				syItem.setSurplusQuantity(syItem.getSurplusQuantity().subtract(total));
-				//预装箱单数量-剩余数量=超发数量
-				syItem.setExcessQuantity(total.subtract(syItem.getSurplusQuantity()));
-				//标识已被参照
-				//syItem.setIsReference(1);	由预托书回写
-				syShippingDetailsItemMapper.updateById(syItem);//修改发运明细发货数量和超出数量,如不需要就注释
+				if(syItem!=null){
+					syItem.setSurplusQuantity(syItem.getSurplusQuantity().subtract(total));
+					//预装箱单数量-剩余数量=超发数量
+					syItem.setExcessQuantity(total.subtract(syItem.getSurplusQuantity()));
+					//标识已被参照
+					//syItem.setIsReference(1);	由预托书回写
+					syShippingDetailsItemMapper.updateById(syItem);//修改发运明细发货数量和超出数量,如不需要就注释
+				}
 				typeConversion(item1);//修改预托书数量
 			}
 		}
@@ -249,11 +259,13 @@ public class SyPreAssembledPackingListServiceImpl extends ServiceImpl<SyPreAssem
 			BigDecimal total=syPreAssembledPackingListItemMapper.selectOne(queryWrapperCount).getTotal();
 			//获取发育明细数据
 			SyShippingDetailsItem syItem=syShippingDetailsItemMapper.selectById(item.getSyDeclarationElementsItemId());
-			//发货-预装箱单数量=剩余数量
-			syItem.setSurplusQuantity(syItem.getSurplusQuantity().subtract(total));
-			//预装箱单数量-发货=超发数量
-			syItem.setExcessQuantity(total.subtract(syItem.getSurplusQuantity()));
-			syShippingDetailsItemMapper.updateById(syItem);//修改数据
+			if(syItem!=null){
+				//发货-预装箱单数量=剩余数量
+				syItem.setSurplusQuantity(syItem.getSurplusQuantity().subtract(total));
+				//预装箱单数量-发货=超发数量
+				syItem.setExcessQuantity(total.subtract(syItem.getSurplusQuantity()));
+				syShippingDetailsItemMapper.updateById(syItem);//修改数据
+			}
 		}
 		syPreAssembledPackingListItemMapper.deleteByMainId(syPreAssembledPackingList.getId());//将子表的删除状态都变成1
 		if(syPreAssembledPackingList.getSyPreAssembledPackingListItemList()!=null){
@@ -279,7 +291,7 @@ public class SyPreAssembledPackingListServiceImpl extends ServiceImpl<SyPreAssem
 		//问题:这样会查询到上次就已经删除的数据,数据会乱
 		//思路:让上次被删除的数据避免被重用
 		List<SyPreAssembledPackingListItem> items2=syPreAssembledPackingListItemMapper.selectAll(id);
-		for(SyPreAssembledPackingListItem item : items2){//要根据这个去改变对应发运明细的剩余数量
+		/*for(SyPreAssembledPackingListItem item : items2){//要根据这个去改变对应发运明细的剩余数量
 			if(objs.indexOf(item.getId())!=-1){//如果这条数据已经被删除的数据就执行下条数据
 				continue;
 			}
@@ -290,7 +302,7 @@ public class SyPreAssembledPackingListServiceImpl extends ServiceImpl<SyPreAssem
 			//超发数量=剩余数量-本次删除次数
 			syItem.setExcessQuantity(syItem.getSurplusQuantity().subtract(item.getTotal()));
 			syShippingDetailsItemMapper.updateById(syItem);//修改数据
-		}
+		}*/
 		QueryWrapper queryWrapper=new QueryWrapper();
 		queryWrapper.eq("sy_pre_assembled_packing_list_id",id);
 		List<SyLetterDepositItem> syLetterDepositItem=syLetterDepositItemMapper.selectList(queryWrapper);
@@ -467,6 +479,8 @@ public class SyPreAssembledPackingListServiceImpl extends ServiceImpl<SyPreAssem
 				main.setSpurOrSubOrder(syItem.getPurOrSubOrder());//修改委外订单号
 				main.setElementsId(syItem.getElementsId());//获取申报要素id
 				main.setOmpoId(syItem.getOmpoId());//修改委外订单id
+				/*main.setSupplierCode(syItem.getSupplierCode());
+				main.setSupplier(syItem.getSupplier());*/
 				main.setSyOrderDataId(syItem.getSyOrderDataId());
 				syPreAssembledPackingListMapper.updateById(main);
 			}
@@ -547,13 +561,16 @@ public class SyPreAssembledPackingListServiceImpl extends ServiceImpl<SyPreAssem
 						item1.setSize(size.getSize());//获取尺码
 						item1.setActualPackingQty(size.getQuantity());//获取该尺码计划装箱数量
 						//item1.setBoxNumber(boxNumber);//获取箱数
-						boxNumber=boxNumber.divide(item.getPiecesBox(),6,BigDecimal.ROUND_HALF_UP);
+
+						//boxNumber=boxNumber.divide(item.getPiecesBox(),6,BigDecimal.ROUND_HALF_UP);
+						boxNumber=item1.getBoxNumber();//根据箱数来算
 						item1.setTotalNetWeight(boxNumber.multiply(item1.getNetWeight()));//获取总净重		净重*箱数
 						item1.setTotalGrossWeight(boxNumber.multiply(item1.getGrossWeight()));//获取总毛重 	箱数*毛重/箱
 						BigDecimal volume=boxNumber.multiply(item1.getOuterBoxHeight());
 						volume=volume.multiply(item1.getOuterBoxLength());
 						volume=volume.multiply(item1.getOuterBoxWidth());
 						item1.setTotalVolume(volume.divide(new BigDecimal(1000000)));//获取总体积	长*宽*高*箱数
+
 						item1.setSyDeclarationElementsItemId(size.getItemId());//获取到发运明细子表id
 						item1.setSort(size.getNum());//获取序号
 						item1.setId(oConvertUtils.id());//获取到随机id
@@ -573,11 +590,13 @@ public class SyPreAssembledPackingListServiceImpl extends ServiceImpl<SyPreAssem
 							item1.setSyOrderDataItemId(syItem.getSyOrderDataItemId());//获取到订单子表id
 							item1.setSalesman(syItem.getSalesman());//获取业务员
 							item1.setSalesDepartment(syItem.getSalesDepartment());//获取销售部门
-							item1.setInventoryCode(syItem.getInventoryCcode());
+							item1.setInventoryCode(syItem.getInventoryCode());
 							item1.setOrderNumber(syItem.getOrderNumber()); //销售订单号
 							item1.setOmpoId(syItem.getOmpoId());//采购委外订单id
 							item1.setOmpoAccount(syItem.getOmpoAccount());//采购委外账套号
 							item1.setOmpoIdItem(syItem.getOmpoIdItem());//采购委外订单子表id
+							item1.setSupplierCode(syItem.getSupplierCode());
+							item1.setSupplier(syItem.getSupplier());
 							syPreAssembledPackingList.setOrderNumber(syItem.getOrderNumber());
 							syPreAssembledPackingList.setItemNumber(syItem.getItemNumber());
 							syPreAssembledPackingList.setSpurOrSubOrder(syItem.getPurOrSubOrder());

+ 1 - 5
jeecg-boot-module-system/src/main/java/org/jeecg/modules/spapl/vo/PackingHeaderVo.java

@@ -43,7 +43,6 @@ public class PackingHeaderVo {
     private String  preparationTime;//制单日期
     @ApiModelProperty("采购/委外订单号对应的ID(唯一标识)")
     private String attributeBigint1;//采购/委外订单号对应的ID(唯一标识)
-
     @ApiModelProperty("预装箱单头表id")
     private String  attributeString1;//预装箱单头表id
     @ApiModelProperty("ERP销售订单号")
@@ -52,8 +51,5 @@ public class PackingHeaderVo {
     private String  attributeString2;//集装箱代号
     @ApiModelProperty("申报要素ID")
     private String  attributeString3;//申报要素ID
-
-
     private List<PackingLineVo> lines;//子表集合
-
-}
+}

+ 0 - 6
jeecg-boot-module-system/src/main/java/org/jeecg/modules/spapl/vo/PackingLineVo.java

@@ -105,10 +105,4 @@ public class PackingLineVo {
     private String attributeString2;//预装箱单行表id
     @ApiModelProperty("分组groupid")
     private String attributeString3;//分组groupid
-/*
- attributeString1
- attributeString2
- attributeString3
-*/
-
 }

+ 3 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/splfi/controller/SyPackingListFabricController.java

@@ -591,7 +591,9 @@ public class SyPackingListFabricController {
 	 @AutoLog(value = "测试接收功能")
 	 @ApiOperation(value="测试接收功能", notes="测试接收功能")
 	 @PostMapping(value = "/saveBath")
-	 public Result saveBath(@RequestBody JSONArray json){
+	 public Result saveBath(@RequestBody String str){
+		 str=JSON.parse(str).toString();
+		 JSONArray json=JSONObject.parseArray(str);
 		 Result result=new Result();
 		 try {
 			 if(json!=null&&json.size()>0) {

+ 12 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/splfi/entity/SyPackingListFabricItem.java

@@ -325,6 +325,18 @@ public class SyPackingListFabricItem implements Serializable {
 	@ApiModelProperty(value = "区分成衣跟面辅料")
 	private String inventoryCcode;
 
+	//采购委外账套号
+	@ApiModelProperty(value = "采购委外账套号")
+	private java.lang.String ompoAccount;
+
+	//委外采购主表Id
+	@ApiModelProperty(value = "委外采购主表Id")
+	private java.lang.String ompoId;
+
+	//委外采购子表Id
+	@ApiModelProperty(value = "委外采购子表Id")
+	private java.lang.String ompoIdItem;
+
 	/**报关单价*/
 	@Excel(name = "报关单价", width = 15)
 	@ApiModelProperty(value = "报关单价")

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

@@ -13,10 +13,14 @@ import javax.servlet.http.HttpServletResponse;
 
 import cn.afterturn.easypoi.excel.ExcelExportUtil;
 import cn.afterturn.easypoi.excel.entity.TemplateExportParams;
+import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.google.gson.Gson;
 import com.google.gson.GsonBuilder;
+import com.google.gson.JsonArray;
+import netscape.javascript.JSObject;
 import org.apache.poi.hssf.usermodel.HSSFWorkbook;
 import org.apache.poi.hssf.util.HSSFColor;
 import org.apache.poi.ss.usermodel.*;
@@ -137,12 +141,12 @@ public class SyPackingListTailoringController {
 		return Result.OK(pageList);
 	}
 
-	/* *//**
+	 /**
 	  * 分页列表查询
 	  *
 	  * @param id
 	  * @return
-	  *//*
+	  */
 	 @AutoLog(value = "根据预装箱单-id获取数据")
 	 @ApiOperation(value="根据预装箱单-id获取数据", notes="根据预装箱单-id获取数据")
 	 @GetMapping(value = "/querySpaplId")
@@ -157,7 +161,7 @@ public class SyPackingListTailoringController {
 		 result.setMessage("查询成功!");
 		 result.setSuccess(true);
 		 return result;
-	 }*/
+	 }
 
 	 /**
 	  * 分页列表查询
@@ -168,7 +172,7 @@ public class SyPackingListTailoringController {
 	 @AutoLog(value = "预装箱单批量生成数据")
 	 @ApiOperation(value="预装箱单批量生成数据", notes="预装箱单批量生成数据")
 	 @GetMapping(value = "/querySpaplId2")
-	 public Result<?> querySpaplId(String[] ids) {
+	 public Result<?> querySpaplId2(String[] ids) {
 		 Result<SyPackingListTailoring> result=new Result<>();
 		 if(oConvertUtils.isEmpty(ids)){
 			 result.setSuccess(false);
@@ -1022,7 +1026,7 @@ public class SyPackingListTailoringController {
 	 @AutoLog(value = "装箱单成衣JSON")
 	 @ApiOperation(value="装箱单成衣JSON", notes="装箱单成衣JSON")
 	 @GetMapping(value = "/pushSplt")
-	 public JSONArray pushSplt(String id) {
+	 public String pushSplt(String id) {
   		 List list=new ArrayList();
   		 SyPackingListTailoring syPackingListTailoring= syPackingListTailoringService.getById(id);
 		 syPackingListTailoring.setContainerCode(null);//集装箱代号
@@ -1063,7 +1067,7 @@ public class SyPackingListTailoringController {
 		 jsonObject.put("splt", userGson.toJson(JSONObject.toJSON(list)));
 		 JSONArray jsonArray=new JSONArray();
 		 jsonArray.add(jsonObject);
-  		 return jsonArray;
+  		 return jsonArray.toString();
 	 }
 
 	 @AutoLog(value = "装箱单成衣实体类数据")
@@ -1111,17 +1115,20 @@ public class SyPackingListTailoringController {
 	 @PostMapping(value = "/saveBath")
 	 @AutoLog(value = "测试接收功能")
 	 @ApiOperation(value="测试接收功能", notes="测试接收功能")
-	 public Result saveBath(@RequestBody JSONArray json){
+	 public Result saveBath(@RequestBody String str){
+	 	 str=JSON.parse(str).toString();
+		 JSONArray json=JSONObject.parseArray(str);
 		 Result result=new Result();
 		 try {
 			 if(json!=null&&json.size()>0) {
 				 //账套1
-				 List<Map<String, Object>> mapListOne = new ArrayList<>();
+				// List<Map<String, Object>> mapListOne = new ArrayList<>();
 				 for (int i = 0; i < json.size(); i++) {
 					 //获取对象
 					 JSONObject jsonObject = json.getJSONObject(i);
 					 //获取json名
 					 String spapl = jsonObject.get("splt").toString();
+					 System.out.println("spapl\t"+spapl);
 					 //转list
 					 List<SyPackingListTailoring> syPackingListTailorings=JSONObject.parseArray(spapl,SyPackingListTailoring.class);
 					//生成数据
@@ -1199,65 +1206,59 @@ public class SyPackingListTailoringController {
 	 @ApiOperation(value="装箱单成衣推送u8", notes="装箱单成衣推送u8")
 	 @GetMapping(value = "/pushBatch")
 	 public  Result pushToU8(String[] ids) {
-		 long startTime = System.currentTimeMillis();
-		 Result result=new Result();
-		 if(oConvertUtils.isEmpty(ids)){
-			 result.setSuccess(false);
-			 result.setMessage("请至少选中一条数据");
-			return result;
-		 }/*
-		 JSONArray items=new JSONArray();*/
-		 List<SyPackingListTailoring> mains=new ArrayList<>();
-		 Map<String,Object> map=new HashMap<>();
-		 for (int i=0;i<ids.length;i++){
-			 SyPackingListTailoring main=syPackingListTailoringService.getById(ids[i]);
-			 QueryWrapper queryWrapper=new QueryWrapper();
-			 queryWrapper.eq("sy_packing_list_tailoring_id",main.getId());
-			 queryWrapper.eq("del_flag","0");
-			 List<SyPackingListTailoringItem> syPackingListTailoringItems=syPackingListTailoringItemService.list(queryWrapper);
-			 if(syPackingListTailoringItems!=null){
-			 	 main.setSyPackingListTailoringItemList(syPackingListTailoringItems);
-			 	 mains.add(main);
-			 	 map.put("account",main.getSyPackingListTailoringItemList().get(0).getOmpoAccount());//委外采购账套号
-			 	 map.put("ompoId",main.getOmpoId());//采购委外主表id
-			 	 map.put("mpOrder",main.getPurchase());//采购委外订单号
-				 System.out.println("mporder\t"+main.getPurchase());//采购委外订单号
-				 map.put("customerCode","one");//客户编码
-				 map.put("CVENCODE","one");//供应商编码
-			 	 map.put("orderNumber","one");//销售订单号
-			 	// map.put("soId","one");//销售订单号
-			 }
-		 }
-		 System.out.println("循环前\n"+map);
-		 for (int i=0;i<1;i++){//最多循环3次
-			 if (map.get("account").equals("903")){
-				// map=
-				syPackingListTailoringService.three(mains,map);
-			 }else if(map.get("account").equals("902")){
-				// map=
-				syPackingListTailoringService.two(mains,map);
-			 }else if(map.get("account").equals("901")){
-				 //map=
-				syPackingListTailoringService.one(mains,map);
-			 }
-		 }
-		 System.out.println("循环后\n"+map);
-		 //返回的map需要判断,是去102还是101或者完成
-		 //需要返回客户编码,销售订单号,账套号
-		 //--委外采购订单主表(主表id+订单号)-->委外采购订单子表(主表id)-->销售订单子表(销售订单子表ID)-->销售订单主表(主表id)
-		 //-->获取客户信息,如果是上游账套就再来一次-->怎么获取上一个账套的委外采购订单号
-
-		/* items.addAll(syPackingListTailoringService.one(mains1));
-		 items.addAll(syPackingListTailoringService.two(mains2));
-		 items.addAll(syPackingListTailoringService.three(mains3));*/
-		// result.setResult(items);
-		 result.setSuccess(true);
-		 result.setMessage("未开发完,测试用");
-		/* System.out.println("mapList\n"+items);
-		 System.out.println("mapList的长度\t"+items.size());*/
-		// System.out.println("生成流水号"+ org.jeecg.modules.system.util.oConvertUtils.maxNumber(String.valueOf("00108")));
-		 long endTime = System.currentTimeMillis();
-		 System.out.println("查询子表后程序运行时间:" + (endTime - startTime) + "ms");
+	 	Result result=new Result();
+	 	try {
+			if(oConvertUtils.isEmpty(ids)){
+				result.setSuccess(false);
+				result.setMessage("请至少选中一条数据");
+				return result;
+			}
+			List<SyPackingListTailoring> mains=new ArrayList<>();
+			Map<String,Object> map=new HashMap<>();
+			for (int i=0;i<ids.length;i++){
+				SyPackingListTailoring main=syPackingListTailoringService.getById(ids[i]);
+				QueryWrapper queryWrapper=new QueryWrapper();
+				queryWrapper.eq("sy_packing_list_tailoring_id",main.getId());
+				queryWrapper.eq("del_flag","0");
+				List<SyPackingListTailoringItem> syPackingListTailoringItems=syPackingListTailoringItemService.list(queryWrapper);
+				if(syPackingListTailoringItems!=null){
+					main.setSyPackingListTailoringItemList(syPackingListTailoringItems);
+					mains=new ArrayList<>();//只存放一条数据
+					mains.add(main);
+					map.put("account",main.getSyPackingListTailoringItemList().get(0).getOmpoAccount());//委外采购账套号
+					map.put("ompoId",main.getSyPackingListTailoringItemList().get(0).getOmpoId());//采购委外主表id
+					if(main.getPurchase()==null){
+						map.put("mpOrder",main.getSyPackingListTailoringItemList().get(0).getSpurOrSubOrder());//采购委外订单号
+					}else{
+						map.put("mpOrder",main.getPurchase());//采购委外订单号
+					}
+					map.put("customerCode","one");//客户编码
+					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")){
+							System.out.println("第"+(x+1)+"次,访问了903");
+							syPackingListTailoringService.three(mains,map);
+						}else if(map.get("account").equals("902")){
+							System.out.println("第"+(x+1)+"次,访问了902");
+							syPackingListTailoringService.two(mains,map);
+						}else if(map.get("account").equals("901")){
+							System.out.println("第"+(x+1)+"次,访问了901");
+							syPackingListTailoringService.one(mains,map);
+						}
+					}
+					System.out.println("循环后\n"+map);
+				}
+			}
+			result.setSuccess(true);
+			result.setMessage("u8已成功生成单据");
+		}catch (Exception e){
+			e.printStackTrace();
+			result.setSuccess(false);
+			result.error500("操作失败:"+e.getMessage());
+		}
 		 return result;
 	 }
 
@@ -1324,4 +1325,36 @@ public class SyPackingListTailoringController {
 		 result.setResult(jsonArray2);
 		 return  result;
 	 }
+
+	 @AutoLog(value = "调试接口-销售出库")
+	 @ApiOperation(value="调试接口-销售出库", notes="调试接口-销售出库")
+	 @RequestMapping(value = "/pushJson3", method = {RequestMethod.POST})
+	 public Result json3(@RequestBody JSONArray jsonArray){
+		 JSONArray jsonArray2= InterfaceConnUtils.doPost(jsonArray,"saleout_import");
+		 Result result=new Result();
+		 result.setResult(jsonArray2);
+		 return  result;
+	 }
+
+	 @AutoLog(value = "调试接口-销售发票")
+	 @ApiOperation(value="调试接口-销售发票", notes="调试接口-销售发票")
+	 @RequestMapping(value = "/pushJson4", method = {RequestMethod.POST})
+	 public Result json4(@RequestBody JSONArray jsonArray){
+		 JSONArray jsonArray2= InterfaceConnUtils.doPost(jsonArray,"saleinvoice_import");
+		 Result result=new Result();
+		 result.setResult(jsonArray2);
+		 return  result;
+	 }
+
+	 @AutoLog(value = "调试接口-采购入库")
+	 @ApiOperation(value="调试接口-采购入库", notes="调试接口-采购入库")
+	 @RequestMapping(value = "/pushJson5", method = {RequestMethod.POST})
+	 public Result json5(@RequestBody JSONArray jsonArray){
+		 JSONArray jsonArray2= InterfaceConnUtils.doPost(jsonArray,"purchasein_import");
+		 Result result=new Result();
+		 result.setResult(jsonArray2);
+		 return  result;
+	 }
+
+
 }

+ 4 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/splt/entity/SyPackingListTailoring.java

@@ -188,6 +188,10 @@ public class SyPackingListTailoring implements Serializable {
 	@ApiModelProperty(value = "业务员")
 	private java.lang.String salesman;
 
+	/*recording*/
+	@ApiModelProperty(value = "u8推送记录")
+	private java.lang.String recording;
+
 	/**syOrderDataId*/
 	//@Excel(name = "syOrderDataId", width = 15)
 	@ApiModelProperty(value = "syOrderDataId")

+ 5 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/splt/mapper/SyPackingListTailoringMapper.java

@@ -46,4 +46,9 @@ public interface SyPackingListTailoringMapper extends BaseMapper<SyPackingListTa
 
     //获取前面流程未带下来的数据
     public String getOrderDataId(String id);
+
+    //获取供应商,区分来源
+    public List<Map<String,Object>> getDispatchLists(String id);
+
+    public List<Map<String,Object>> getSaleBillVouchs(String id);
 }

+ 6 - 6
jeecg-boot-module-system/src/main/java/org/jeecg/modules/splt/mapper/xml/syPackingListTailoringItemMapper.xml

@@ -38,13 +38,13 @@
 			sum(total) plan_Quantity,/*计划装箱数量*/
 			sum(total) actual_Packing_Qty,/*实际装箱数量*/
 			net_weight,
-			sum(total_net_weight) total_net_weight,/*总净重*/
+			total_net_weight total_net_weight,/*总净重*/
 			gross_weight,
-			sum(total_gross_weight) total_gross_weight,/*总毛重*/
+			total_gross_weight total_gross_weight,/*总毛重*/
 			outer_box_length,
 			outer_Box_Width,
 			outer_Box_Height,
-			sum(total_volume) total_volume,/*总体积*/
+			total_volume total_volume,/*总体积*/
 			net_weight_too,/*净净重*/
 			unit_price,
 			sum(total_price) total_price,/*总价*/
@@ -93,13 +93,13 @@
 		SUM(total) total,/*件数*/
 		SUM(plan_Quantity) planQuantity,/*件数*/
 		net_weight,
-		sum(total_net_weight) total_net_weight,/*总净重*/
+		total_net_weight total_net_weight,/*总净重*/
 		gross_weight,
-		sum(total_gross_weight)  total_gross_weight,/*总毛重*/
+		total_gross_weight  total_gross_weight,/*总毛重*/
 		outer_box_length,
 		outer_Box_Width,
 		outer_Box_Height,
-		sum(total_volume)  total_volume,/*总体积*/
+		total_volume  total_volume,/*总体积*/
 		net_weight_too net_weight_too,/*净净重*/
 		unit_price,
 		sum(total_price)  total_price,/*总价*/

+ 7 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/splt/mapper/xml/syPackingListTailoringMapper.xml

@@ -170,4 +170,11 @@
         SELECT sy_order_data_id  FROM sy_pre_assembled_packing_list WHERE id=#{id}
     </select>
 
+    <select id="getDispatchLists" parameterType="java.lang.String" resultType="java.util.HashMap">
+        select * from DispatchLists where dlid=(select dlid from DispatchList where cDLCode=#{value })
+    </select>
+
+    <select id="getSaleBillVouchs" parameterType="java.lang.String" resultType="java.util.HashMap">
+        select cinvcode,iQuantity,autoid from SaleBillVouchs where sbvid= (select sbvid from SaleBillVouch where cSBVCode=#{value });
+    </select>
 </mapper>

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

@@ -88,14 +88,16 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
 				item1.setSize(size.getSize());//获取尺码
 				item1.setTotalPrice(boxNumber.multiply(item1.getUnitPrice()));//获取总价		箱数*单价-->件数*单价
 //				item1.setBoxNumber(boxNumber);//获取箱数
-				boxNumber=boxNumber.divide(item.getPiecesBox(),6,BigDecimal.ROUND_HALF_UP);
+
+				/*boxNumber=boxNumber.divide(item.getPiecesBox(),6,BigDecimal.ROUND_HALF_UP);
 				item1.setTotalNetWeight(boxNumber.multiply(item1.getNetWeight()));//获取总净重		净重*箱数
 				item1.setTotalGrossWeight(boxNumber.multiply(item1.getGrossWeight()));//获取总毛重 	箱数*毛重/箱
 				//item1.setTotalNetWeight(boxNumber.multiply(new BigDecimal(size.getProportion())));//获取净净重 不知
 				BigDecimal volume=boxNumber.multiply(item1.getOuterBoxHeight());
 				volume=volume.multiply(item1.getOuterBoxLength());
 				volume=volume.multiply(item1.getOuterBoxWidth());
-				item1.setTotalVolume(volume.divide(new BigDecimal(1000000)));//获取总体积	长*宽*高*箱数
+				item1.setTotalVolume(volume.divide(new BigDecimal(1000000)));//获取总体积	长*宽*高*箱数*/
+
 				item1.setSyPreAssembledPackingListItemId(size.getItemId());//获取到预装箱单子表id
 				item1.setSort(size.getNum());//获取序号
 				item1.setId(oConvertUtils.id());//获取到随机id
@@ -111,6 +113,8 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
 				item1.setOmpoId(syPreItem.getOmpoId());//获取采购委外主表id
 				item1.setOmpoIdItem(syPreItem.getOmpoIdItem());//获取采购委外子表id
 				item1.setOmpoAccount(syPreItem.getOmpoAccount());//委外采购账套号
+				item1.setSupplier(syPreItem.getSupplier());
+				item1.setSupplierCode(syPreItem.getSupplierCode());
 				syPreAssembledPackingListItemMapper.updateById(syPreItem);//修改剩余数量
 				syPackingListTailoringItemMapper.insert(item1);//添加子表数据
 			}
@@ -135,14 +139,14 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
 				item1.setActualPackingQty(boxNumber);
 				item1.setTotalPrice(boxNumber.multiply(item1.getUnitPrice()));//获取总价		箱数*单价-->件数*单价
 				//item1.setBoxNumber(boxNumber);//获取箱数
-				boxNumber=boxNumber.divide(item.getPiecesBox(),6,BigDecimal.ROUND_HALF_UP);
+				/*boxNumber=boxNumber.divide(item.getPiecesBox(),6,BigDecimal.ROUND_HALF_UP);
 				item1.setTotalNetWeight(boxNumber.multiply(item1.getNetWeight()));//获取总净重		净重*箱数
 				item1.setTotalGrossWeight(boxNumber.multiply(item1.getGrossWeight()));//获取总毛重 	箱数*毛重/箱
 				//item1.setTotalNetWeight(boxNumber.multiply(new BigDecimal(size.getProportion())));//获取净净重 不知
 				BigDecimal volume=boxNumber.multiply(item1.getOuterBoxHeight());//获取体积
 				volume=volume.multiply(item1.getOuterBoxLength());
 				volume=volume.multiply(item1.getOuterBoxWidth());
-				item1.setTotalVolume(volume.divide(new BigDecimal(1000000)));//获取总体积	长*宽*高*箱数
+				item1.setTotalVolume(volume.divide(new BigDecimal(1000000)));//获取总体积	长*宽*高*箱数*/
 
 				//item.setSyDeclarationElementsItemId(size.getItemId());//获取到发运明细子表id
 				item1.setId(size.getItemId());//从尺码表中获取到id
@@ -264,6 +268,9 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
 			s1.setInventoryCcode(syPreAssembledPackingListItem.getInventoryCcode());//物料分类
 			s1.setWithCode(syPreAssembledPackingListItem.getWithCode());//配码规则
 			s1.setOmpoAccount(syPreAssembledPackingListItem.getOmpoAccount());//采购委外账套号
+
+			s1.setSupplier(syPreAssembledPackingListItem.getSupplier());
+			s1.setSupplierCode(syPreAssembledPackingListItem.getSupplierCode());
 			s1.setYmoney(syPreAssembledPackingListItem.getYmoney());//佣金
 			s1.setElementsId(syPackingListTailoring.getElementsId());//申报要素id
 			/*s1.getOmpoId(syPreAssembledPackingListItem.getOmpoId())//采购委外主表id
@@ -551,7 +558,7 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
 					item.setSyPackingListTailoringId(syPackingListTailoring.getId());//获取主表id
 					item.setElementsId(syPackingListTailoring.getElementsId());//申报要素id
 					BigDecimal boxNumber1=item.getBoxNumber();//获取箱数
-					item.setGroupId(oConvertUtils.id());//分组随机id
+					item.setGroupId(oConvertUtils.id());//分组随机idv1
 					item.setDelFlag("0");//默认为未删除
 					syPackingListTailoring.setTotal(syPackingListTailoring.getTotal().add(item.getTotal()));
 					item.setSmallPo(syPackingListTailoring.getSmallPo());
@@ -571,13 +578,16 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
 						item1.setActualPackingQty(boxNumber);//实际装箱数量
 						item1.setPlanQuantity(boxNumber);//计划装箱数量
 						item1.setSize(size.getSize());//获取尺码
-						boxNumber=boxNumber.divide(item.getPiecesBox(),6,BigDecimal.ROUND_HALF_UP);
+
+					/*	boxNumber=boxNumber.divide(item.getPiecesBox(),6,BigDecimal.ROUND_HALF_UP);
 						item1.setTotalNetWeight(boxNumber.multiply(item1.getNetWeight()));//获取总净重		净重*箱数
 						item1.setTotalGrossWeight(boxNumber.multiply(item1.getGrossWeight()));//获取总毛重 	箱数*毛重/箱
 						BigDecimal volume=boxNumber.multiply(item1.getOuterBoxHeight());
 						volume=volume.multiply(item1.getOuterBoxLength());
 						volume=volume.multiply(item1.getOuterBoxWidth());
-						item1.setTotalVolume(volume.divide(new BigDecimal(1000000)));//获取总体积	长*宽*高*箱数
+						item1.setTotalVolume(volume.divide(new BigDecimal(1000000)));//获取总体积	长*宽*高*箱数*/
+
+
 						item1.setSyPreAssembledPackingListItemId(size.getItemId());//获取到预装箱单子表id
 						item1.setSort(size.getNum());//获取序号
 						item1.setId(oConvertUtils.id());//获取到随机id
@@ -589,7 +599,6 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
 							item1.setHod(new SimpleDateFormat("yyyy-MM-dd").parse(syPreItem.getHod()));//预发货日期
 							item1.setWithCode(syPreItem.getWithCode());
 
-							item1.setOmpoIdItem(syPreItem.getOmpoIdItem());//获取委外/采购订单子表Id
 							item1.setUnitPrice(syPreItem.getUnitPrice());//获取销售单价
 							//item1.setFactoryUnitPrice(new BigDecimal(syPreItem.getFactoryUnitPrice()==null?"0":syPreItem.getFactoryUnitPrice()));//工厂单价
 							item1.setInventoryName(syPreItem.getInventoryName());//存货名称
@@ -603,6 +612,8 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
 							item1.setOmpoId(syPreItem.getOmpoId());//主表id
 							item1.setOmpoIdItem(syPreItem.getOmpoIdItem());//子表id
 							item1.setOmpoAccount(syPreItem.getOmpoAccount());//子表id
+							item1.setSupplier(syPreItem.getSupplier());
+							item1.setSupplierCode(syPreItem.getSupplierCode());
 							syPreAssembledPackingListItemMapper.updateById(syPreItem);//修改剩余数量
 						}
 						syPackingListTailoring.setTotalPrice(syPackingListTailoring.getTotalPrice().add(item1.getTotalPrice()));//获取总价
@@ -689,6 +700,7 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
 	}
 
 	Map<String,Object> saveBatch(List<SyPackingListTailoring> mains,Map<String,Object> mapt){
+		mapt.put("customerCode","xxx");//进入方法时设置客户编码为空
 		if(mains==null||mains.size()==0){
 			return new HashMap();//为空就传回空对象
 		}
@@ -707,40 +719,43 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
 			Map<String,String> mapSort=new HashMap<>();
 
 			String createBy="进出口平台管理员";
+			//String createDate=main.getCreateTime().toString();
+			String createDate=new SimpleDateFormat("yyyy-MM-dd hh:mm:ss").format(main.getCreateTime());//转化日期类型
 			JSONObject map=new JSONObject();//采购(委外)入库单
-			map.put("CVOUCHCODE",purchaseWarehousingMapper.getMaxCode("id+1","RdRecord01","dnmaketime"));//获取单据号
-			map.put("DDATE",main.getCreateTime());//日期(格式2015-01-01)
+			map.put("CVOUCHCODE", org.jeecg.modules.system.util.oConvertUtils.addOne(purchaseWarehousingMapper.getMaxCode("cCode","RdRecord01","dnmaketime")));//获取单据号
+			map.put("DDATE",createDate);//日期(格式2015-01-01)
 			map.put("CMAKER",createBy);//制单人
 			map.put("cVouchType",1);//传1
 
 		/*	JSONObject map2=new JSONObject();//材料出库单
-			map2.put("CVOUCHCODE",purchaseWarehousingMapper.getMaxCode("ID+1","rdrecord11","dnmaketime"));//单号
+			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",purchaseWarehousingMapper.getMaxCode("DLID+1","DispatchList","dcreatesystime"));//发货单号
-			map3.put("DDATE",main.getCreateTime());//发货日期(yyyy-MM-dd)
+			map3.put("CVOUCHCODE",org.jeecg.modules.system.util.oConvertUtils.addOne(purchaseWarehousingMapper.getMaxCode("cDLCode","DispatchList","dcreatesystime")));//发货单号
+			map3.put("DDATE",createDate);//发货日期(yyyy-MM-dd)
 			map3.put("BRETURNFLAG","0");//退货标识(1:退货,0:发货)
 			map3.put("CMAKER",createBy);//制单人名称
+			//map3.put("CVERIFIER",createBy);//审核人名称
 
 			JSONObject map4=new JSONObject();//销售出库单
-			map4.put("CVOUCHCODE",purchaseWarehousingMapper.getMaxCode("ID+1","rdrecord32","dnmaketime"));//单据号
-			map4.put("DDATE",main.getCreateTime());//订单日期(格式2015-01-01)
+			map4.put("CVOUCHCODE",org.jeecg.modules.system.util.oConvertUtils.addOne(purchaseWarehousingMapper.getMaxCode("ccode","rdrecord32","dnmaketime")));//单据号
+			map4.put("DDATE",createDate);//订单日期(格式2015-01-01)
 			map4.put("CMAKER",createBy);//制单人
 
 			JSONObject map5=new JSONObject();//采购发票
-			map5.put("CVOUCHCODE",purchaseWarehousingMapper.getMaxCode("PBVID+1","PurBillVouch","cmaketime"));//发票号
-			map5.put("DDATE",main.getCreateTime());//发票日期(格式2015-01-01)
-			map5.put("CTYPE","x");//发票类型(01:专用 02:普票)
+			map5.put("CVOUCHCODE",org.jeecg.modules.system.util.oConvertUtils.addOne(purchaseWarehousingMapper.getMaxCode("cpbvcode ","PurBillVouch","cmaketime")));//发票号
+			map5.put("DDATE",createDate);//发票日期(格式2015-01-01)
+			map5.put("CTYPE","普通");//发票类型(01:专用 02:普票)
 			map5.put("CMAKER",createBy);//制单人
 
 			JSONObject map6=new JSONObject();//销售发票
-			map6.put("CVOUCHCODE",purchaseWarehousingMapper.getMaxCode("SBVID+1","SaleBillVouch","dcreatesystime"));//发票号
-			map6.put("DDATE",main.getCreateTime());//发票日期(yyyy-MM-dd)
-			map6.put("CTYPE","x");//发票类型(普通,专用)
+			map6.put("CVOUCHCODE",org.jeecg.modules.system.util.oConvertUtils.addOne(purchaseWarehousingMapper.getMaxCode("cSBVCode","SaleBillVouch","dcreatesystime")));//发票号
+			map6.put("DDATE",createDate);//发票日期(yyyy-MM-dd)
+			map6.put("CTYPE","普通");//发票类型(普通,专用)
 			map6.put("CMAKER",createBy);//制单人名称
 
 			JSONArray mapItems=new JSONArray();
@@ -755,16 +770,22 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
 			if(mapt.get("account").equals("903")){//查询委外订单主表数据	顺序---1
 				orderData=syPackingListTailoringMapper.getOmOrPo("om_momain","cCode='"+mapt.get("mpOrder")+"'","moid");
 				map.put("CRDCODE","委外入库");//入库类别(采购入库/委外入库)
-				map.put("CGLTYPE","委外订单");//制单人
+				map.put("CGLTYPE","委外订单");//来源单据类型
+				map4.put("CGLTYPE","销售发货单");//来源单据类型
+				map5.put("CGLTYPE","委外订单");//来源单据类型
+				map6.put("CGLTYPE","销售出库单");//来源单据类型
 				//map2.put("CRDCODE","委外出库");//出库类别
-			}else {//查询委外订单表数据
+			}else {//查询采购订单表数据
 				if(mapt.get("orderNumber").equals("one")){
-					orderData=syPackingListTailoringMapper.getOmOrPo("PO_POMAIN","cPOID='"+mapt.get("mpOrder")+"'","POID");
+					orderData=syPackingListTailoringMapper.getOmOrPo("PO_POMAIN","cPOID='"+mapt.get("mpOrder")+"'","POID");//委外订单号判断
 				}else{
 					orderData=syPackingListTailoringMapper.getOmOrPo("PO_POMAIN","cPOID='"+mapt.get("orderNumber")+"'","POID");//根据采购订单号判断
 				}
 				map.put("CRDCODE","采购入库");//入库类别(采购入库/委外入库)
-				map.put("CGLTYPE","采购订单");//制单人
+				map.put("CGLTYPE","采购订单");//来源单据类型
+				map4.put("CGLTYPE","销售发货单");//来源单据类型
+				map5.put("CGLTYPE","采购订单");//来源单据类型
+				map6.put("CGLTYPE","销售出库单");//来源单据类型
 				//map2.put("CRDCODE","采购出库");//出库类别
 			}
 			if(orderData!=null){
@@ -793,29 +814,33 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
 
 				Map<String,Object> orderDataItem=null;// inum
 				if(!mapt.get("account").equals("903")){ //采购订单子表数据  顺序---2
+					System.out.println("mapt.get(\"orderNumber\")\n"+mapt.get("orderNumber"));
 					if(mapt.get("orderNumber").equals("one")){
 						orderDataItem=syPackingListTailoringMapper.getOmOrPoItem("PO_PoDetails", "ID='"+item.getOmpoIdItem()+"'","ID");
 					}else{
-						orderDataItem=syPackingListTailoringMapper.getOmOrPoItem("PO_PoDetails", "poid='"+orderData.get("id")+"' and irowno=xxx" +
-								"xxxxxxxxxxxxxxxx" +
-								"xxxxxxxx" +
-								"xxxxxxxxxx" +
-								"xxxxxxxx" +
-								"xxxxxxx","ID");
+						if(orderData!=null&&orderData.containsKey("id")){
+							orderDataItem=syPackingListTailoringMapper.getOmOrPoItem("PO_PoDetails", "poid='"+orderData.get("id")+"' and irowno='"+
+									((Map<String,String>)mapt.get("itemSort")).get(item.getId())+"'","ID");//根据行号获取信息
+						}
+					}
+					if(orderDataItem!=null){
+						Map<String,Object> orderDataItem2=purchaseWarehousingMapper.getPOPodetails(orderDataItem.get("id").toString());//获取自由项
+						getcFree(mapItem,orderDataItem2);
+						getcFree(mapItem5,orderDataItem2);
+						mapItem.put("POAUTOIDCOL","ID");//订单明细ID对应字段名(关联单据类型为采购订单传ID,为采购到货单为Autoid,为委外订单传MODetailsID,为委外到货单为Autoid)
+						mapItem.put("AUTOID_PO",orderDataItem.get("id"));//明细ID(采购订单行ID/委外订单行ID)
+						map5.put("CGLTYPE","采购订单");
+						mapItem5.put("POAUTOIDCOL","ID");//明细ID对应字段名(关联单据类型为采购订单传ID,委外订单传MODetailsID,入库单为Autoid)
+						mapItem5.put("AUTOID_PO",orderDataItem.get("id"));//明细ID(采购订单行ID/委外订单行ID)
+						mapItem5.put("IORIMONEY",orderDataItem.get("iMoney"));//原币金额
+						mapItem5.put("IMONEY",orderDataItem.get("iNatMoney"));//本币金额
 					}
-					Map<String,Object> orderDataItem2=purchaseWarehousingMapper.getPOPodetails(orderDataItem.get("id").toString());//获取自由项
-					getcFree(mapItem,orderDataItem2);
-					mapItem.put("POAUTOIDCOL","ID");//订单明细ID对应字段名(关联单据类型为采购订单传ID,为采购到货单为Autoid,为委外订单传MODetailsID,为委外到货单为Autoid)
-					mapItem.put("AUTOID_PO",orderDataItem.get("id"));//明细ID(采购订单行ID/委外订单行ID)
-					map5.put("CGLTYPE","采购订单");
-					mapItem5.put("POAUTOIDCOL","ID");//明细ID对应字段名(关联单据类型为采购订单传ID,委外订单传MODetailsID,入库单为Autoid)
-					mapItem5.put("AUTOID_PO",orderDataItem.get("id"));//明细ID(采购订单行ID/委外订单行ID)
 				}else{//委外订单子表数据  顺序---2
 					//第二次怎么获取采购订单的子表id	查询销售订单子表保存行号去绑定上游的账套
 					orderDataItem=syPackingListTailoringMapper.getOmOrPoItem("OM_MODetails", "MODetailsID='"+item.getOmpoIdItem()+"'","MODetailsID");
 					Map<String,Object> orderDataItem2=purchaseWarehousingMapper.getOMMoDetails(item.getOmpoIdItem());//获取自由项
 					getcFree(mapItem,orderDataItem2);
-					System.out.println("mapItem\t"+mapItem);
+					getcFree(mapItem5,orderDataItem2);
 					mapItem.put("POAUTOIDCOL","MODetailsID");//订单明细ID对应字段名(关联单据类型为采购订单传ID,为采购到货单为Autoid,为委外订单传MODetailsID,为委外到货单为Autoid)
 					mapItem.put("AUTOID_PO",orderDataItem.get("id"));//明细ID(采购订单行ID/委外订单行ID)
 					map5.put("CGLTYPE","委外订单");
@@ -823,10 +848,9 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
 					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("IORIMONEY",orderDataItem.get("iMoney"));//原币金额
+					mapItem5.put("IMONEY",orderDataItem.get("iNatMoney"));//本币金额
 				}
-				mapItem5.put("IORIMONEY",orderDataItem.get("iMoney"));//原币金额
-				mapItem5.put("IMONEY",orderDataItem.get("iNatMoney"));//本币金额
-
 				if(!mapt.get("CVENCODE").equals("one")){//查询供应商表获取编码 	顺序---3
 					String wheCode=syPackingListTailoringMapper.getWhCodeByVenCode(mapt.get("CVENCODE").toString());
 					if(wheCode!=null){
@@ -837,24 +861,24 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
 						mapItem6.put("CWHCODE",wheCode);//仓库编码
 					}
 				}
-
+				mapt.put("poid","one");//重置销售订单id
 
 				if(item.getSyOrderDataItemId()!=null){//销售发货单 ---查询销售订单子表数据  顺序---5
-					Map<String,Object> orderDataItem2=syPackingListTailoringMapper.getSoMainItem(orderDataItem.get("iSOsID").toString());
-					System.out.println("irowno\t"+orderDataItem2.get("irowno"));
-					System.out.println("id\t"+item.getId());
-					mapSort.put(item.getId(),orderDataItem2.get("irowno").toString());
-					mapItem3.put("ITAXUNITPRICE",orderDataItem2.get("iTaxUnitPrice"));//原币含税单价(如果传空,取来源单据)(以含税单价为准自动计算相关价格及金额
-					mapItem3.put("ITAXRATE",orderDataItem2.get("iTaxRate"));//税率(如果传空,取来源单据,无来源单据,取存货档案对应的销项税率)
-					mapItem3.put("SOAUTOIDCOL","ISOSID");//来源单据明细ID对应字段名(如果取销售订单主键,需传固定值ISOSID)
-					mapItem3.put("AUTOID_SO",orderDataItem2.get("iSOsID"));//来源单据明细ID
-					mapt.put("orderNumber", orderDataItem2.get("id"));
+					if(orderDataItem!=null&&orderDataItem.containsKey("iSOsID")){
+						Map<String,Object> orderDataItem2=syPackingListTailoringMapper.getSoMainItem(orderDataItem.get("iSOsID").toString());
+						mapSort.put(item.getId(),orderDataItem2.get("irowno").toString());
+						mapItem3.put("ITAXUNITPRICE",orderDataItem2.get("iTaxUnitPrice"));//原币含税单价(如果传空,取来源单据)(以含税单价为准自动计算相关价格及金额)
+						mapItem3.put("ITAXRATE",orderDataItem2.get("iTaxRate"));//税率(如果传空,取来源单据,无来源单据,取存货档案对应的销项税率
+						mapItem3.put("SOAUTOIDCOL","ISOSID");//来源单据明细ID对应字段名(如果取销售订单主键,需传固定值ISOSID)
+						mapItem3.put("AUTOID_SO",orderDataItem2.get("iSOsID"));//来源单据明细ID
+						mapt.put("poid", orderDataItem2.get("id"));
+					}
 				}
 
-				if(!mapt.get("orderNumber").equals("one")){//销售订单
-					Map<String,Object> order=syPackingListTailoringMapper.getSoMain(mapt.get("orderNumber").toString());//
+				if(!mapt.get("poid").equals("one")){//销售订单
+					Map<String,Object> order=syPackingListTailoringMapper.getSoMain(mapt.get("poid").toString());//
 					mapt.put("orderNumber",order.get("cSOCode"));//销售订单号
-					mapt.put("customerCode",order.get("cCusCode"));//销售订单号
+					mapt.put("customerCode",order.get("cCusCode"));//客户编码
 					if(order!=null){//销售订单主表
 						//cPersonCode,cDepCode,cBusType,cPayCode,cexch_name,nflat
 						/*map2.put("CDEPCODE",order.get("cDepCode"));//部门编码(如果传空,取来源单据)
@@ -871,7 +895,7 @@ 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("INUM",orderDataItem.get("inum"));//明细ID(采购订单行ID/委外订单行ID)
 
 				//mapItem.put("cBatch","x");//批号
 
@@ -884,13 +908,13 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
 				mapItem4.put("CINVCODE",item.getInventoryCode());//存货编码
 				mapItem4.put("IQUANTITY",item.getTotal());//数量
 				mapItem4.put("SOAUTOIDCOL","IDLSID");//订单明细ID对应字段名(关联单据类型为发货单IDLSID)
-				mapItem4.put("AUTOID_PO","10300001");//关联明细ID 测试用先写
+				//mapItem4.put("AUTOID_SO","10300001");//关联明细ID 测试用先写
 
 				mapItem5.put("CINVCODE",item.getInventoryCode());//存货编码
 				mapItem5.put("IQUANTITY",item.getTotal());//数量
 
 				mapItem6.put("CINVCODE",item.getInventoryCode());//存货编码
-				mapItem6.put("IQUNTITY",item.getTotal());//数量
+				mapItem6.put("IQUANTITY",item.getTotal());//数量
 
 				mapItems.add(mapItem);
 				//mapItems2.add(mapItem2);
@@ -922,56 +946,105 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
 			}
 			mapt.put("itemSort",mapSort);
 		}
+		try{
+			String txtWorld=((Map)mapList.get(0)).get("CACCID")+"\t"+new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS").format(System.currentTimeMillis())+"\n\n";
+			txtWorld+=mapList.toString()+"\n\n";
+			txtWorld+=mapList3.toString()+"\n\n";
+			txtWorld+=mapList4.toString()+"\n\n";
+			txtWorld+=mapList5.toString()+"\n\n";
+			txtWorld+=mapList6.toString()+"\n\n";
+			FileWriter file =new FileWriter ("D:\\test1\\test.txt",true);
+			file.write(txtWorld);	//以字节数组类型写入内容
+			file.close();
+			System.out.println("已创建test.txt文件,已写入内容");
+		}catch (Exception e){
+			e.printStackTrace();
+		}
 
-		mapLists.addAll(mapList);
-		String txtWorld=mapt.get("account")+"\t"+new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS").format(System.currentTimeMillis())+"\n\n";
-		txtWorld+=mapList.toString()+"\n\n";
-		txtWorld+=mapList3.toString()+"\n\n";
-		txtWorld+=mapList4.toString()+"\n\n";
-		txtWorld+=mapList5.toString()+"\n\n";
-		txtWorld+=mapList6.toString()+"\n\n";
+		/*mapLists.addAll(mapList);
 		//mapLists.addAll(mapList2);
 		mapLists.addAll(mapList3);
 		mapLists.addAll(mapList4);
 		mapLists.addAll(mapList5);
-		mapLists.addAll(mapList6);
-
-		System.out.println("mapList1\n"+mapList);
-	//	System.out.println("mapList2\n"+mapList2);
-		System.out.println("mapList3\n"+mapList3);
-		System.out.println("mapList4\n"+mapList4);
-		System.out.println("mapList5\n"+mapList5);
-		System.out.println("mapList6\n"+mapList6);
+		mapLists.addAll(mapList6);*/
 
-		/*JSONArray resturn1 = InterfaceConnUtils.doPost(mapList,"purchasein_import");//采购入库单		主表添加了一个字段,子表可能要添加一个字段
+		JSONArray resturn1 = InterfaceConnUtils.doPost(mapList,"purchasein_import");//采购入库单		主表添加了一个字段,子表可能要添加一个字段
 		//JSONArray resturn2 = InterfaceConnUtils.doPost(mapList,"materialout_import");//材料出库单
 		JSONArray resturn3 = InterfaceConnUtils.doPost(mapList3,"consignment_import");//销售发货单
-		JSONArray resturn4 = InterfaceConnUtils.doPost(mapList4,"saleout_import");//销售出库单
 		JSONArray resturn5 = InterfaceConnUtils.doPost(mapList5,"purinvoice_import");//采购发票单
-		JSONArray resturn6 = InterfaceConnUtils.doPost(mapList6,"saleinvoice_import");//销售发票单
 
-		System.out.println("调用接口后返回的信息resturn1\n"+resturn1);
-		//System.out.println("调用接口后返回的信息resturn2\n"+resturn2);
-		System.out.println("调用接口后返回的信息resturn3\n"+resturn3);
-		System.out.println("调用接口后返回的信息resturn4\n"+resturn4);
-		System.out.println("调用接口后返回的信息resturn5\n"+resturn5);
-		System.out.println("调用接口后返回的信息resturn6\n"+resturn6);*/
+		result(resturn1,"采购入库单",((Map) mapList.get(0)).get("CACCID").toString(),mains.get(0).getId());//采购入库单
+		this.purchaseWarehousingMapper.updateVoucherHistoryCNumber(org.jeecg.modules.system.util.oConvertUtils.maxNumber(resturn1.getJSONObject(0).get("U8ReceiptNo").toString()),"107");
 
-		try{
-			FileWriter file =new FileWriter ("D:\\test1\\test.txt",true);
-			//FileOutputStream fo = new FileOutputStream(file);
-			//向文件中写入内容
-		//	byte [] bytecontent = txtWorld.getBytes();	//将字符串转换文字节数组类型
-			file.write(txtWorld);	//以字节数组类型写入内容
-			//关闭文件输出流
-			file.close();
-			System.out.println("已创建test.txt文件,已写入内容");
-		}catch (Exception e){
-			e.printStackTrace();
+		result(resturn3,"销售发货单",((Map) mapList.get(0)).get("CACCID").toString(),mains.get(0).getId());//销售发货单
+		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(),mains.get(0).getId());//采购发票单
+		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){
+				JSONObject jsonObject=mapList4.getJSONObject(0);//循环迭代
+				List<Map<String,Object>> mapItems4= (List<Map<String,Object>>) jsonObject.get("DETAILList");
+				for (Map itemMap4 :  mapItems4){
+					if(itemMap4.get("CINVCODE").equals(map.get("cinvcode"))&&itemMap4.get("IQUANTITY").equals(map.get("iQuantity"))&&!itemMap4.containsKey("AUTOID_SO")){
+						getcFree((JSONObject) itemMap4,map);
+						itemMap4.put("AUTOID_SO",map.get("iDLsID"));
+					}
+				}
+			}
+		}
+
+		JSONArray resturn4 = InterfaceConnUtils.doPost(mapList4,"saleout_import");//销售出库单
+		result(resturn4,"销售出库单",((Map) mapList.get(0)).get("CACCID").toString(),mains.get(0).getId());//销售出库单
+
+
+		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.getSaleBillVouchs(saleoutName);
+		//System.out.println("saleoutMaps\t"+saleoutMaps);
+		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("CINVCODE").equals(map.get("cinvcode"))&&itemMap6.get("IQUANTITY").equals(map.get("iQuantity"))&&!itemMap6.containsKey("AUTOID_DIS")){
+						itemMap6.put("AUTOID_DIS",map.get("autoid"));
+					}
+				}
+			}
 		}
+
+		JSONArray resturn6 = InterfaceConnUtils.doPost(mapList6,"saleinvoice_import");//销售发票单
+		result(resturn6,"销售发票单",((Map) mapList.get(0)).get("CACCID").toString(),mains.get(0).getId());//销售发票单
+		this.purchaseWarehousingMapper.updateVoucherHistoryCNumber(org.jeecg.modules.system.util.oConvertUtils.maxNumber(resturn6.getJSONObject(0).get("U8ReceiptNo").toString()),"120");
+
+
+
 		return mapt;
 	}
 
+	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("报错接口"+tableName+",原因\t"+ jsonObject.get("Description"));
+		}
+	}
 
 	public void getcFree(JSONObject itemMap,Map<String,Object> mapPOPodetails){
 		itemMap.put("CDEFINE22",setNull(mapPOPodetails.get("cDefine22")));