huxy 2 лет назад
Родитель
Сommit
2e8878e649

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

@@ -640,7 +640,7 @@ public class SyPreAssembledPackingListServiceImpl extends ServiceImpl<SyPreAssem
 					}
 				}
 				for (String key : maps.keySet()){
-					updateQuantity(maps.get(key),key);
+					//updateQuantity(maps.get(key),key);
 				}
 				SyShippingDetails syShippingDetails=syShippingDetailsMapper.selectById(syPreAssembledPackingList.getSyDeclarationElementsId());
 				if(syShippingDetails!=null){
@@ -669,6 +669,7 @@ public class SyPreAssembledPackingListServiceImpl extends ServiceImpl<SyPreAssem
 			BigDecimal total4=new BigDecimal("0");//(本次数量+现有数量)>1.9*发货数量就报错
 			String name="";
 			for (SyPreAssembledPackingListItem item :main.getSyPreAssembledPackingListItemList()){
+				System.out.println("size\t"+item.getSizeTables());
 				total3=total3.add(item.getTotal());
 				String ids="";
 				int num2=0;

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

@@ -954,9 +954,11 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 			//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", org.jeecg.modules.system.util.oConvertUtils.addOne(purchaseWarehousingMapper.getMaxCode("cCode","RdRecord01","ddate DESC,cCode")));//获取单据号
+			map.put("CVOUCHCODE", org.jeecg.modules.system.util.oConvertUtils.addOne(purchaseWarehousingMapper.getMaxCode("cCode+100","RdRecord01","cCode")));//获取单据号
+			//map.put("CVOUCHCODE", main.getId());//获取单据号
 			map.put("DDATE",createDate);//日期(格式2015-01-01)
 			map.put("CMAKER",createBy);//制单人
+			map.put("CMEMO",main.getRemarks());//制单人
 			map.put("CHANDLER",createBy);//审核人
 			map.put("cVouchType",1);//传1
 
@@ -984,8 +986,9 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 			JSONObject map5=new JSONObject();//采购发票
 			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("CTYPE","专用");//发票类型(01:专用 02:普票)
 			map5.put("CMAKER",createBy);//制单人
+			map5.put("CGLTYPE","入库单");
 			map5.put("CHANDLER",createBy);//审核人
 
 			JSONObject map6=new JSONObject();//销售发票
@@ -1027,7 +1030,7 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 				map.put("CRDCODE","12");//入库类别(采购入库/委外入库)
 				map.put("CGLTYPE","委外订单");//来源单据类型
 				map4.put("CGLTYPE","销售发货单");//来源单据类型
-				map5.put("CGLTYPE","委外订单");//来源单据类型
+				//map5.put("CGLTYPE","委外订单");//来源单据类型
 				map6.put("CGLTYPE","销售出库单");//来源单据类型
 			}else {//查询采购订单表数据
 				if(mapt.get("account1").equals("901")){
@@ -1035,7 +1038,7 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 					map.put("CRDCODE","12");//入库类别(采购入库/委外入库)
 					map.put("CGLTYPE","委外订单");//来源单据类型
 					map4.put("CGLTYPE","销售发货单");//来源单据类型
-					map5.put("CGLTYPE","委外订单");//来源单据类型
+					//map5.put("CGLTYPE","委外订单");//来源单据类型
 					map6.put("CGLTYPE","销售出库单");//来源单据类型
 				}else{
 					if(mapt.get("orderNumber").equals("one")){
@@ -1046,7 +1049,7 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 					map.put("CRDCODE","11");//入库类别(采购入库/委外入库)
 					map.put("CGLTYPE","采购订单");//来源单据类型
 					map4.put("CGLTYPE","销售发货单");//来源单据类型
-					map5.put("CGLTYPE","采购订单");//来源单据类型
+					//map5.put("CGLTYPE","采购订单");//来源单据类型
 					map6.put("CGLTYPE","销售出库单");//来源单据类型
 				}
 			}
@@ -1135,8 +1138,8 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 						mapItem.put("CBATCHPROPERTY3",item.getRolls());
 						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)
+						//map5.put("CGLTYPE","采购订单");
+						mapItem5.put("POAUTOIDCOL","Autoid");//明细ID对应字段名(关联单据类型为采购订单传ID,委外订单传MODetailsID,入库单为Autoid)
 						mapItem5.put("AUTOID_PO",orderDataItem.get("id"));//明细ID(采购订单行ID/委外订单行ID)
 						mapItem5.put("IORITAXCOST",orderDataItem.get("iTaxPrice"));//原币单价
 						/*mapItem5.put("IORIMONEY",orderDataItem.get("iMoney"));//原币金额
@@ -1153,7 +1156,7 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 					mapItem.put("POAUTOIDCOL","MODetailsID");//订单明细ID对应字段名(关联单据类型为采购订单传ID,为采购到货单为Autoid,为委外订单传MODetailsID,为委外到货单为Autoid)
 					mapItem.put("AUTOID_PO",orderDataItem.get("id"));//明细ID(采购订单行ID/委外订单行ID)
 					mapItem.put("CBATCHPROPERTY3",item.getRolls());
-					map5.put("CGLTYPE","委外订单");
+					//map5.put("CGLTYPE","委外订单");
 					if(item.getInventoryCcode()!=null&&item.getInventoryCcode().indexOf("040")>-1&&mapt.get("account").equals("903")){//903账套中物料分类为040的印花面料
 						List<Map<String,Object>> orderDataItem3 =syPackingListFabricMapper.getOM_MOMaterials(item.getOmpoIdItem(),item.getInventoryCode());//委外订单子表
 						Map<String,Object> mapStr1=syPackingListFabricMapper.getOM_MOMain(item.getOmpoIdItem(),item.getInventoryCode());//供应商编码,存货编码
@@ -1189,8 +1192,8 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 						}
 					}
 
-					mapItem5.put("POAUTOIDCOL","MODetailsID");//明细ID对应字段名(关联单据类型为采购订单传ID,委外订单传MODetailsID,入库单为Autoid)
-					mapItem5.put("AUTOID_PO",orderDataItem.get("id"));//明细ID(采购订单行ID/委外订单行ID)
+					mapItem5.put("POAUTOIDCOL","Autoid");//明细ID对应字段名(关联单据类型为采购订单传ID,委外订单传MODetailsID,入库单为Autoid)
+					//mapItem5.put("AUTOID_PO",orderDataItem.get("id"));//明细ID(采购订单行ID/委外订单行ID)
 					mapItem5.put("IORITAXCOST",orderDataItem.get("iTaxPrice"));//原币单价
 					/*mapItem5.put("IORIMONEY",orderDataItem.get("iMoney"));//原币金额
 					mapItem5.put("IMONEY",orderDataItem.get("iNatMoney"));//本币金额*/
@@ -1206,6 +1209,8 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 					mapItem6.put("CWHCODE",mapt.get("CWHCODE"));//仓库编码
 				}
 				mapt.put("poid","one");//重置销售订单id
+				mapItem5.put("CDEFINE23",item.getDeclarationUnit());//报关单位
+				mapItem5.put("CDEFINE33",item.getDeclarationName());//报关品名
 
 				//if(item.getSyOrderDataItemId()!=null){//销售发货单 ---查询销售订单子表数据  顺序---5
 				if(orderDataItem!=null&&orderDataItem.containsKey("iSOsID")&&orderDataItem.get("iSOsID")!=null){
@@ -1318,8 +1323,6 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 		}
 
 		text(mapList,"采购入库单");
-		text(mapList3,"销售发货单");
-		text(mapList5,"采购发票单");
 		if(mapList2!=null&&mapList2.size()>0){
 			text(mapList2,"材料出库单");
 			text(mapList7,"印厂采购入库单");
@@ -1355,12 +1358,34 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 			if (maps.containsKey(account)){
 				switch (maps.get(account).get("index")){
 					case "1":	//代表已完成第一道
-						JSONArray resturn5 = InterfaceConnUtils.doPost(mapList5,"purinvoice_import");//采购发票单
-						recording=result(main,resturn5,"采购发票单",((Map) mapList.get(0)).get("CACCID").toString(),"2");//采购发票单
-						recording(main,recording);
-						this.purchaseWarehousingMapper.updateVoucherHistoryCNumber(org.jeecg.modules.system.util.oConvertUtils.maxNumber(resturn5.getJSONObject(0).get("U8ReceiptNo").toString()),"109");
-						if(((Map) mapList.get(0)).get("CACCID").toString().equals("901")){
-							return account+"账套推送成功!";
+						//JSONObject jsonObject1=resturn1.getJSONObject(0);//采购入库单
+						String purchaseinName=maps.get(account).get("code");//获取销售发货单
+						//String purchaseinName=jsonObject1.get("U8ReceiptNo").toString();//获取销售发货单
+						List<Map<String,Object>> purchaseinMaps= syPackingListTailoringMapper.getRdRecord01(purchaseinName);
+						if(purchaseinMaps!=null){
+							for (Map map : purchaseinMaps){
+								JSONObject jsonObject=mapList5.getJSONObject(0);//循环迭代
+								List<Map<String,Object>> mapItems5= (List<Map<String,Object>>) jsonObject.get("DETAILList");
+								for (Map itemMap5 :  mapItems5){
+									if((Double.parseDouble( itemMap5.get("IQUANTITY").toString())
+											==Double.parseDouble( map.get("iQuantity").toString()))&&!itemMap5.containsKey("AUTOID_SO")){//根据尺码判断
+										//getcFree((JSONObject) itemMap5,map);
+										itemMap5.put("AUTOID_PO",map.get("AutoID"));
+									}
+								}
+								System.out.println("mapItems4\t"+mapItems5);
+							}
+						}
+						text(mapList3,"销售发货单");
+						text(mapList5,"采购发票单");
+						if(!((Map) mapList.get(0)).get("CACCID").toString().equals("903")){
+							JSONArray resturn5 = InterfaceConnUtils.doPost(mapList5,"purinvoice_import");//采购发票单
+							recording=result(main,resturn5,"采购发票单",((Map) mapList.get(0)).get("CACCID").toString(),"2");//采购发票单
+							recording(main,recording);
+							this.purchaseWarehousingMapper.updateVoucherHistoryCNumber(org.jeecg.modules.system.util.oConvertUtils.maxNumber(resturn5.getJSONObject(0).get("U8ReceiptNo").toString()),"109");
+							if(((Map) mapList.get(0)).get("CACCID").toString().equals("901")){
+								return account+"账套推送成功!";
+							}
 						}
 					case "2":
 						if(account.equals("901")){
@@ -1371,7 +1396,7 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 						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");
+						this.purchaseWarehousingMapper.updateVoucherHistoryCNumber(u8ReceiptNo103,"108");
 					case "3":
 						String consignmentName=maps.get(account).get("code");//获取销售发货单
 						List<Map<String,Object>> consignmentMaps= syPackingListTailoringMapper.getDispatchLists(consignmentName);
@@ -1427,11 +1452,34 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 		recording(main,recording);
 		this.purchaseWarehousingMapper.updateVoucherHistoryCNumber(org.jeecg.modules.system.util.oConvertUtils.maxNumber(resturn1.getJSONObject(0).get("U8ReceiptNo").toString()),"107");
 
-		JSONArray resturn5 = InterfaceConnUtils.doPost(mapList5,"purinvoice_import");//采购发票单
-		recording=result(main,resturn5,"采购发票单",((Map) mapList.get(0)).get("CACCID").toString(),"2");//采购发票单
-		recording(main,recording);
-		this.purchaseWarehousingMapper.updateVoucherHistoryCNumber(org.jeecg.modules.system.util.oConvertUtils.maxNumber(resturn5.getJSONObject(0).get("U8ReceiptNo").toString()),"109");
+		JSONObject jsonObject1=resturn1.getJSONObject(0);//采购入库单
+		String purchaseinName=jsonObject1.get("U8ReceiptNo").toString();//获取销售发货单
+		List<Map<String,Object>> purchaseinMaps= syPackingListTailoringMapper.getRdRecord01(purchaseinName);
+
+		if(purchaseinMaps!=null){
+			for (Map map : purchaseinMaps){
+				JSONObject jsonObject=mapList5.getJSONObject(0);//循环迭代
+				List<Map<String,Object>> mapItems5= (List<Map<String,Object>>) jsonObject.get("DETAILList");
+				for (Map itemMap5 :  mapItems5){
+					if((Double.parseDouble( itemMap5.get("IQUANTITY").toString())
+							==Double.parseDouble( map.get("iQuantity").toString()))&&!itemMap5.containsKey("AUTOID_PO")){//根据尺码判断
+						//getcFree((JSONObject) itemMap5,map);
+						itemMap5.put("AUTOID_PO",map.get("AutoID"));
+					}
+				}
+				System.out.println("mapItems4\t"+mapItems5);
+			}
+		}
 
+		text(mapList3,"销售发货单");
+		text(mapList5,"采购发票单");
+		if(!((Map) mapList.get(0)).get("CACCID").toString().equals("903")){
+			JSONArray resturn5 = InterfaceConnUtils.doPost(mapList5,"purinvoice_import");//采购发票单
+			recording=result(main,resturn5,"采购发票单",((Map) mapList.get(0)).get("CACCID").toString(),"2");//采购发票单
+			recording(main,recording);
+			this.purchaseWarehousingMapper.updateVoucherHistoryCNumber(org.jeecg.modules.system.util.oConvertUtils.maxNumber(resturn5.getJSONObject(0).get("U8ReceiptNo").toString()),"109");
+
+		}
 		if(((Map) mapList.get(0)).get("CACCID").toString().equals("901")){
 			return mapList.getJSONObject(0).get("CACCID").toString()+"账套推送成功!";
 		}
@@ -1440,7 +1488,7 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 		recording=result(main,resturn3,"销售发货单",((Map) mapList.get(0)).get("CACCID").toString(),"3");//销售发货单
 		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");
+		this.purchaseWarehousingMapper.updateVoucherHistoryCNumber(u8ReceiptNo103,"108");
 
 		JSONObject jsonObject3=resturn3.getJSONObject(0);//销售发货单
 		String consignmentName=jsonObject3.get("U8ReceiptNo").toString();//获取销售发货单
@@ -1450,8 +1498,8 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 				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")){//根据尺码判断
+					if((Double.parseDouble( itemMap4.get("IQUANTITY").toString())
+							==Double.parseDouble( map.get("iQuantity").toString()))&&!itemMap4.containsKey("AUTOID_PO")){//根据尺码判断
 						getcFree((JSONObject) itemMap4,map);
 						itemMap4.put("AUTOID_SO",map.get("iDLsID"));
 					}
@@ -1614,7 +1662,7 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 		itemMap.put("CDEFINE34",setNull(mapPOPodetails.get("cDefine34")));
 		itemMap.put("CDEFINE35",setNull(mapPOPodetails.get("cDefine35")));
 		itemMap.put("CDEFINE36",setNull(mapPOPodetails.get("cDefine36")));
-		itemMap.put("CDEFINE37",setNull(mapPOPodetails.get("cDefine37")));
+		//itemMap.put("CDEFINE37",setNull(mapPOPodetails.get("cDefine37")));
 		itemMap.put("CFREE1",setNull(mapPOPodetails.get("cFree1")));
 		itemMap.put("CFREE2",setNull(mapPOPodetails.get("cFree2")));
 		itemMap.put("CFREE3",setNull(mapPOPodetails.get("cFree3")));

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

@@ -1309,6 +1309,7 @@ public class SyPackingListTailoringController {
 							break;
 						}
 					}catch (Exception e){
+						e.printStackTrace();
 						message+=e.getMessage();
 					}
 				}

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

@@ -251,6 +251,16 @@ public class SyPackingListTailoringItem implements Serializable {
 	@ApiModelProperty(value = "是否新增")
 	private int isAdd;
 
+
+	@TableField(exist = false)
+	@ApiModelProperty(value = "报关品名")
+	private String declarationName;
+
+
+	@TableField(exist = false)
+	@ApiModelProperty(value = "报关品名")
+	private String declarationUnit;
+
 	/**采购/委外订单号*/
 	//@TableField(exist = false)
 	@Excel(name = "采购/委外订单号", width = 15)

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

@@ -50,7 +50,9 @@ public interface SyPackingListTailoringMapper extends BaseMapper<SyPackingListTa
     //获取供应商,区分来源
     public List<Map<String,Object>> getDispatchLists(String id);
 
-    public List<Map<String,Object>> getRdrecord32(String id);
+    public List<Map<String,Object>> getRdRecord01(String id);
 
     String[] getExcelId();
+
+    public List<Map<String,Object>> getRdrecord32(String id);
 }

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

@@ -156,7 +156,11 @@
 		ompo_Account,
 		ompo_Id,
 		spur_Or_Sub_Order,
-		inventory_Code
+		inventory_Code,
+		(select declaration_Name from sy_declaration_elements
+		where id=sy_packing_list_tailoring_item.elements_Id limit 1) declaration_Name,
+		(select declaration_unit from sy_declaration_elements
+		where id=sy_packing_list_tailoring_item.elements_Id limit 1) declaration_unit
 		FROM  sy_packing_list_tailoring_item
 		WHERE sy_packing_list_tailoring_id =  #{id}
 		and del_flag=0

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

@@ -150,7 +150,7 @@
     </select>
 
     <select id="getOmOrPo" parameterType="java.lang.String" resultType="java.util.HashMap">
-        select cvencode,nflat,cPayCode,${id} as id  from ${tableName}
+        select cvencode,nflat,cPayCode,${id} as id,cexch_name as cexchname  from ${tableName}
         where  ${orderName}
     </select>
 
@@ -174,6 +174,10 @@
         select * from DispatchLists where dlid=(select dlid from DispatchList where cDLCode=#{value})
     </select>
 
+    <select id="getRdRecord01" parameterType="java.lang.String" resultType="java.util.HashMap">
+        select * from rdrecords01 where ID =(select ID  from rdrecord01 where cCode=#{value})
+    </select>
+
     <select id="getRdrecord32" parameterType="java.lang.String" resultType="java.util.HashMap">
         select cinvcode,iQuantity,autoid,cFree2 from rdrecords32  where ID = (select ID  from rdrecord32  where ccode=#{value})
     </select>

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

@@ -803,8 +803,10 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
 			//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", org.jeecg.modules.system.util.oConvertUtils.addOne(purchaseWarehousingMapper.getMaxCode("cCode","RdRecord01","ddate DESC,cCode")));//获取单据号
+			map.put("CVOUCHCODE", org.jeecg.modules.system.util.oConvertUtils.addOne(purchaseWarehousingMapper.getMaxCode("cCode+100","RdRecord01","cCode")));//获取单据号
+			//map.put("CVOUCHCODE", main.getId());//获取单据号
 			map.put("DDATE",createDate);//日期(格式2015-01-01)
+			map.put("CMEMO",main.getMemo());//制单人
 			map.put("CMAKER",createBy);//制单人
 			map.put("CHANDLER",createBy);//审核人
 			map.put("cVouchType",1);//传1
@@ -825,7 +827,7 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
 			JSONObject map5=new JSONObject();//采购发票
 			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("CTYPE","专用");//发票类型(01:专用 02:普票)
 			map5.put("CMAKER",createBy);//制单人
 			map5.put("CHANDLER",createBy);//审核人
 
@@ -882,6 +884,7 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
 				}
 			}
 			if(orderData!=null){
+				map3.put("CEXCH_NAME",orderData.get("cexchname"));//币种名称
 				map.put("CVENCODE",orderData.get("cvencode"));//供应商编码
 				mapt.put("CVENCODE",orderData.get("cvencode"));//供应商编码
 				map5.put("IEXCHRATE",orderData.get("nflat"));//汇率(如果传空,接口默认1)cPayCode
@@ -927,9 +930,9 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
 						getcFree(mapItem6,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)
+						map5.put("CGLTYPE","入库单");
+						mapItem5.put("POAUTOIDCOL","Autoid");//明细ID对应字段名(关联单据类型为采购订单传ID,委外订单传MODetailsID,入库单为Autoid)
+						//mapItem5.put("AUTOID_PO",orderDataItem.get("id"));//明细ID(采购订单行ID/委外订单行ID)
 						mapItem5.put("IORITAXCOST",orderDataItem.get("iTaxPrice"));//原币单价
 						/*mapItem5.put("IORIMONEY",orderDataItem.get("iMoney"));//原币金额
 						mapItem5.put("IMONEY",orderDataItem.get("iNatMoney"));//本币金额*/
@@ -941,17 +944,18 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
 					getcFree(mapItem,orderDataItem2);
 					getcFree(mapItem3,orderDataItem2);
 					getcFree(mapItem5,orderDataItem2);
+					mapItem5.put("CDEFINE23","");//单位
+					mapItem5.put("CDEFINE33","");//品名
 					getcFree(mapItem6,orderDataItem2);
 					mapItem.put("POAUTOIDCOL","MODetailsID");//订单明细ID对应字段名(关联单据类型为采购订单传ID,为采购到货单为Autoid,为委外订单传MODetailsID,为委外到货单为Autoid)
 					mapItem.put("AUTOID_PO",orderDataItem.get("id"));//明细ID(采购订单行ID/委外订单行ID)
-					map5.put("CGLTYPE","委外订单");
-					mapItem5.put("POAUTOIDCOL","MODetailsID");//明细ID对应字段名(关联单据类型为采购订单传ID,委外订单传MODetailsID,入库单为Autoid)
-					mapItem5.put("AUTOID_PO",orderDataItem.get("id"));//明细ID(采购订单行ID/委外订单行ID)
+					map5.put("CGLTYPE","入库单");
+					mapItem5.put("POAUTOIDCOL","Autoid");//明细ID对应字段名(关联单据类型为采购订单传ID,委外订单传MODetailsID,入库单为Autoid)
+					//mapItem5.put("AUTOID_PO",orderDataItem.get("id"));//明细ID(采购订单行ID/委外订单行ID)
 					mapItem5.put("IORITAXCOST",orderDataItem.get("iTaxPrice"));//原币单价
 					/*mapItem5.put("IORIMONEY",orderDataItem.get("iMoney"));//原币金额
 					mapItem5.put("IMONEY",orderDataItem.get("iNatMoney"));//本币金额*/
 				}
-
 				if(!mapt.get("CVENCODE").equals("one")){//查询供应商表获取编码 	顺序---3
 					if(!mapt.containsKey("CWHCODE")){
 						String wheCode=syPackingListTailoringMapper.getWhCodeByVenCode(mapt.get("CVENCODE").toString());
@@ -976,6 +980,8 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
 				}
 				//}
 
+				mapItem5.put("CDEFINE23",item.getDeclarationUnit());//报关单位
+				mapItem5.put("CDEFINE33",item.getDeclarationName());//报关品名
 				if(!mapt.get("poid").equals("one")){//销售订单
 					Map<String,Object> order=syPackingListTailoringMapper.getSoMain(mapt.get("poid").toString());//
 					mapt.put("orderNumber",order.get("cSOCode"));//销售订单号
@@ -1008,6 +1014,7 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
 				//mapItem4.put("AUTOID_SO","10300001");//关联明细ID 测试用先写
 
 				mapItem5.put("CINVCODE",item.getInventoryCode());//存货编码
+				mapItem5.put("size",item.getSize());//根据尺码判断
 				mapItem5.put("IQUANTITY",item.getTotal());//数量
 
 				mapItem6.put("CINVCODE",item.getInventoryCode());//存货编码
@@ -1045,8 +1052,6 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
 
 
 		text(mapList,"采购入库单");
-		text(mapList3,"销售发货单");
-		text(mapList5,"采购发票单");
 
 		/*if(true){
 			return null;
@@ -1066,6 +1071,29 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
 			if (maps.containsKey(account)){
 				switch (maps.get(account).get("index")){
 					case "1":	//代表已完成第一道
+						//JSONObject jsonObject1=resturn1.getJSONObject(0);//采购入库单
+						String purchaseinName=maps.get(account).get("code");//获取销售发货单
+						//String purchaseinName=jsonObject1.get("U8ReceiptNo").toString();//获取销售发货单
+						List<Map<String,Object>> purchaseinMaps= syPackingListTailoringMapper.getRdRecord01(purchaseinName);
+						if(purchaseinMaps!=null){
+							for (Map map : purchaseinMaps){
+								System.out.println("mapt4\n"+map);
+								JSONObject jsonObject=mapList5.getJSONObject(0);//循环迭代
+								List<Map<String,Object>> mapItems5= (List<Map<String,Object>>) jsonObject.get("DETAILList");
+
+								System.out.println("mapItems5\t"+mapItems5);
+								for (Map itemMap5 :  mapItems5){
+									if(itemMap5.get("size").equals(map.get("cFree2"))&&(Double.parseDouble( itemMap5.get("IQUANTITY").toString())
+											==Double.parseDouble( map.get("iQuantity").toString()))&&!itemMap5.containsKey("AUTOID_PO")){//根据尺码判断
+										//getcFree((JSONObject) itemMap5,map);
+										itemMap5.put("AUTOID_PO",map.get("AutoID"));
+									}
+								}
+								System.out.println("mapItems4\t"+mapItems5);
+							}
+						}
+						text(mapList3,"销售发货单");
+						text(mapList5,"采购发票单");
 						JSONArray resturn5 = InterfaceConnUtils.doPost(mapList5,"purinvoice_import");//采购发票单
 						recording=result(main,resturn5,"采购发票单",((Map) mapList.get(0)).get("CACCID").toString(),"2");//采购发票单
 						recording(main,recording);
@@ -1076,7 +1104,7 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
 						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");
+						this.purchaseWarehousingMapper.updateVoucherHistoryCNumber(u8ReceiptNo103,"108");
 					case "3":
 						String consignmentName=maps.get(account).get("code");//获取销售发货单
 						List<Map<String,Object>> consignmentMaps= syPackingListTailoringMapper.getDispatchLists(consignmentName);
@@ -1107,6 +1135,8 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
 							for (Map map : saleoutMaps){
 								JSONObject jsonObject=mapList6.getJSONObject(0);//循环迭代
 								List<Map<String,Object>> mapItems6= (List<Map<String,Object>>) jsonObject.get("DETAILList");
+								System.out.println("获取数据1\t"+saleoutMaps);
+								System.out.println("获取数据2\t"+mapItems6);
 								for (Map itemMap6 :  mapItems6){
 									itemMap6.put("DISAUTOIDCOL","AUTOID");
 									if(itemMap6.get("size").equals(map.get("cFree2"))&&(Double.parseDouble( itemMap6.get("IQUANTITY").toString())
@@ -1130,7 +1160,26 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
 		recording(main,recording);
 		this.purchaseWarehousingMapper.updateVoucherHistoryCNumber(org.jeecg.modules.system.util.oConvertUtils.maxNumber(resturn1.getJSONObject(0).get("U8ReceiptNo").toString()),"107");
 
+		JSONObject jsonObject1=resturn1.getJSONObject(0);//采购入库单
+		String purchaseinName=jsonObject1.get("U8ReceiptNo").toString();//获取销售发货单
+		List<Map<String,Object>> purchaseinMaps= syPackingListTailoringMapper.getRdRecord01(purchaseinName);
+		if(purchaseinMaps!=null){
+			for (Map map : purchaseinMaps){
+				JSONObject jsonObject=mapList5.getJSONObject(0);//循环迭代
+				List<Map<String,Object>> mapItems5= (List<Map<String,Object>>) jsonObject.get("DETAILList");
+				for (Map itemMap5 :  mapItems5){
+					if(itemMap5.get("size").equals(map.get("cFree2"))&&(Double.parseDouble( itemMap5.get("IQUANTITY").toString())
+							==Double.parseDouble( map.get("iQuantity").toString()))&&!itemMap5.containsKey("AUTOID_SO")){//根据尺码判断
+						//getcFree((JSONObject) itemMap5,map);
+						itemMap5.put("AUTOID_PO",map.get("AutoID"));
+					}
+				}
+				System.out.println("mapItems4\t"+mapItems5);
+			}
+		}
 
+		text(mapList3,"销售发货单");
+		text(mapList5,"采购发票单");
 		JSONArray resturn5 = InterfaceConnUtils.doPost(mapList5,"purinvoice_import");//采购发票单
 		recording=result(main,resturn5,"采购发票单",((Map) mapList.get(0)).get("CACCID").toString(),"2");//采购发票单
 		recording(main,recording);
@@ -1141,10 +1190,10 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
 		recording=result(main,resturn3,"销售发货单",((Map) mapList.get(0)).get("CACCID").toString(),"3");//销售发货单
 		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");
+		this.purchaseWarehousingMapper.updateVoucherHistoryCNumber(u8ReceiptNo103,"108");
 
 		JSONObject jsonObject3=resturn3.getJSONObject(0);//销售发货单
-		String consignmentName=jsonObject3.get("U8ReceiptNo").toString();//获取销售发货单
+		String consignmentName=jsonObject3.get("U8ReceiptNo").toString();//获取销售发货单fadfad
 		List<Map<String,Object>> consignmentMaps= syPackingListTailoringMapper.getDispatchLists(consignmentName);
 		if(consignmentMaps!=null){
 			for (Map map : consignmentMaps){
@@ -1261,7 +1310,7 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
 		itemMap.put("CDEFINE34",setNull(mapPOPodetails.get("cDefine34")));
 		itemMap.put("CDEFINE35",setNull(mapPOPodetails.get("cDefine35")));
 		itemMap.put("CDEFINE36",setNull(mapPOPodetails.get("cDefine36")));
-		itemMap.put("CDEFINE37",setNull(mapPOPodetails.get("cDefine37")));
+		//itemMap.put("CDEFINE37",setNull(mapPOPodetails.get("cDefine37")));
 		itemMap.put("CFREE1",setNull(mapPOPodetails.get("cFree1")));
 		itemMap.put("CFREE2",setNull(mapPOPodetails.get("cFree2")));
 		itemMap.put("CFREE3",setNull2(mapPOPodetails.get("cFree3")));