2 커밋 9a85791c6d ... 4cc47e43f8

작성자 SHA1 메시지 날짜
  chen 4cc47e43f8 Merge branch 'master' of http://139.196.39.194:9021/chenc/sen-yu-new-service 2 년 전
  chen a699fe31a7 调整 2 년 전

+ 69 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/config/InterfaceConnUtils.java

@@ -0,0 +1,69 @@
+package org.jeecg.config;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import org.apache.commons.codec.binary.Base64;
+import org.apache.http.HttpResponse;
+import org.apache.http.client.HttpClient;
+import org.apache.http.client.config.RequestConfig;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.impl.client.DefaultHttpClient;
+import org.apache.http.util.EntityUtils;
+import org.apache.http.client.config.RequestConfig.Builder;
+
+import javax.xml.bind.DatatypeConverter;
+import java.io.UnsupportedEncodingException;
+
+public class InterfaceConnUtils {
+    public static JSONArray doPost(JSONArray json, String url) {
+        //定义测试返回JSON
+        JSONArray onejb = new JSONArray();
+        HttpClient httpClient = new DefaultHttpClient();
+        HttpPost httpPost=new HttpPost(url);
+        httpPost.setHeader("Content-Type", "application/json");
+        String tokenCode = "sap:Cwa1QJrhfhtXbzSGZi94ydBPNQCPbmz7";
+        //使用base64进行加密
+        byte[] tokenByte = Base64.encodeBase64((tokenCode).getBytes());
+        //将加密的信息转换为string
+        String tokenStr = new String(tokenByte);
+        //Basic
+        String token = "Basic "+tokenStr;
+        String encoding="";
+        try {
+            encoding = DatatypeConverter.printBase64Binary("ZKANB01:Kb6a5553ec90a".getBytes("UTF-8"));
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
+        //把认证信息发到header中
+//        httpPost.setHeader("Authorization", "Basic "+token);
+        httpPost.setHeader("Authorization", "Basic "+encoding);
+
+        //result
+        //JSONObject  backjson=new JSONObject();
+        //backjson.put("data", json);
+        StringEntity entity;
+        entity = new StringEntity(json.toString(),"utf-8");
+        entity.setContentEncoding("utf-8");
+        entity.setContentType("application/json");
+
+        httpPost.setEntity(entity);
+        Builder customReqConf = RequestConfig.custom();
+        customReqConf.setConnectTimeout(50000);
+        customReqConf.setSocketTimeout(50000);
+        customReqConf.setConnectionRequestTimeout(60000);
+        httpPost.setConfig(customReqConf.build());
+        try {
+            //调用接口
+            HttpResponse response = httpClient.execute(httpPost);
+            //返回信息
+            String resultStr = EntityUtils.toString(response.getEntity(),"UTF-8");
+            onejb=JSONArray.parseArray(resultStr);
+            System.out.println("返回消息内容:"+onejb);
+            // jf.put("head",JsonChangeUtils.testJson(mapList));
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return onejb;
+    }
+}

+ 631 - 105
jeecg-boot-module-system/src/main/java/org/jeecg/modules/openApi/service/impl/PurchaseWarehousingServiceImpl.java

@@ -1,8 +1,10 @@
 package org.jeecg.modules.openApi.service.impl;
 
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.dynamic.datasource.annotation.DS;
-import net.sf.json.JSONObject;
 import org.apache.commons.lang.StringUtils;
+import org.jeecg.config.InterfaceConnUtils;
 import org.jeecg.modules.openApi.entity.PurchaseWarehousing;
 import org.jeecg.modules.openApi.mapper.PurchaseWarehousingMapper;
 import org.jeecg.modules.openApi.mapper.SubcontractingOrderMapper;
@@ -79,41 +81,34 @@ public class PurchaseWarehousingServiceImpl extends ServiceImpl<PurchaseWarehous
         return map1;
     }
 
+   //由于前期是自己插入U8数据库 所有会有很多业务可能会包含无用的业务  目前是直接在插入的时候对其数据进行整理调用第三方接口
     public void save(List<Map<String, Object>> mapList,String accID){
         if(mapList!=null&&mapList.size()>0){
 
             for(Map<String,Object> map:mapList){
                 //获取主表最大编码
-                Map<String,Integer> pkMap = callGetUAMaxPK2("rd",accID);
-                if(pkMap.get("iFatherId")==null){
-                    throw new RuntimeException("获取入库单主表ID失败");
-                }
-                map.put("ID",pkMap.get("iFatherId"));
-//                map.put("ID", oConvertUtils.addOne(getMaxId("ID","RdRecord01")));
-
-                System.out.println(map.get("ID"));
+//                Map<String,Integer> pkMap = callGetUAMaxPK2("rd",accID);
+//                if(pkMap.get("iFatherId")==null){
+//                    throw new RuntimeException("获取入库单主表ID失败");
+//                }
+//                map.put("ID",pkMap.get("iFatherId"));
+////                map.put("ID", oConvertUtils.addOne(getMaxId("ID","RdRecord01")));
+//
+//                System.out.println(map.get("ID"));
                 //获取最大code
                 String cCode=oConvertUtils.addOne(this.baseMapper.getMaxCode("cCode","RdRecord01","dnmaketime"));
 
                 if(cCode!=null){
                     map.put("cCode",cCode);
-                    this.baseMapper.updateVoucherHistoryCNumber(oConvertUtils.maxNumber(String.valueOf(map.get("cCode"))),"24");
+//                    this.baseMapper.updateVoucherHistoryCNumber(oConvertUtils.maxNumber(String.valueOf(map.get("cCode"))),"24");
                 }else{
                     throw new RuntimeException("获取入库单号失败");
                 }
-                if(accID.equals("903")){
-                    if(map.get("cMaker")==null||map.get("cMaker").equals("")){
-                        throw new RuntimeException("缺少制单人字段");
-                    }
-                    map.put("cHandler",map.get("cMaker"));
-                }else{
-                    map.put("cMaker","陈创");
-                    map.put("cHandler","陈创");
-                }
+
 
                 //日期
                 Long longtime=Long.valueOf(String.valueOf(map.get("dDate")));
-                String formatTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date(longtime));
+                String formatTime = new SimpleDateFormat("yyyy-MM-dd").format(new Date(longtime));
                 map.put("dDate",formatTime);
                 //红蓝标识
                 if(map.get("cVouchType").toString().equals("1")){
@@ -194,10 +189,25 @@ public class PurchaseWarehousingServiceImpl extends ServiceImpl<PurchaseWarehous
                         //判断是否外部供应商  外部则进入下一波做调拨单 非则不做
                         if(!cVenAbbName.equals("宁波森语")&&!cVenAbbName.equals("马菲羊")&&!cVenAbbName.equals("森语集团")){
                             iscVenCodeReceiver=true;
+                            //获取制单人
+                            map.put("cMaker","陈创");
+                            map.put("cHandler","陈创");
+                        }else{
+                            //获取制单人
+                            if(map.get("cMaker")==null||map.get("cMaker").equals("")){
+                                throw new RuntimeException("缺少制单人字段");
+                            }
+                            map.put("cHandler",map.get("cMaker"));
                         }
                     }else{
                         throw new RuntimeException("未能找到接收方信息");
                     }
+                }else{
+                    //获取制单人
+                    if(map.get("cMaker")==null||map.get("cMaker").equals("")){
+                        throw new RuntimeException("缺少制单人字段");
+                    }
+                    map.put("cHandler",map.get("cMaker"));
                 }
 
 
@@ -212,13 +222,13 @@ public class PurchaseWarehousingServiceImpl extends ServiceImpl<PurchaseWarehous
                         if(itemMap.get("cBatch")==null||String.valueOf(itemMap.get("cBatch")).equals("")){
                             message=message+"第"+rowId+"行缺少批号;";
                         }
-                        //获取子表最大id
-                        Map<String,Integer> pkMapChild = callGetUAMaxPK2("rd",accID);
-                        if(pkMap.get("iChildId")==null){
-                            message=message+"第"+rowId+"行获取入库单子表ID失败;";
-                            throw new RuntimeException("获取入库单子表ID失败");
-                        }
-                        itemMap.put("AutoID",pkMapChild.get("iChildId"));
+//                        //获取子表最大id
+//                        Map<String,Integer> pkMapChild = callGetUAMaxPK2("rd",accID);
+//                        if(pkMapChild.get("iChildId")==null){
+//                            message=message+"第"+rowId+"行获取入库单子表ID失败;";
+//                            throw new RuntimeException("获取入库单子表ID失败");
+//                        }
+//                        itemMap.put("AutoID",pkMapChild.get("iChildId"));
 //                        itemMap.put("AutoID",oConvertUtils.addOne(getMaxId("AutoID","rdrecords01")));
                         //主表id
                         itemMap.put("ID",map.get("ID"));
@@ -238,6 +248,7 @@ public class PurchaseWarehousingServiceImpl extends ServiceImpl<PurchaseWarehous
                             if(itemMap.get("moDetailId")!=null&&StringUtils.isNotBlank(String.valueOf(itemMap.get("moDetailId")))) {
                                 itemMap.put("iPOsID", itemMap.get("moDetailId"));//采购订单行id
                                 itemMap.put("iOMoDID", "");//委外订单行id
+                                itemMap.put("POAUTOIDCOL","ID");
                                 rowmId = String.valueOf(itemMap.get("moDetailId"));
                                 //获取订单行的数据
                                 Map<String,Object> mapPOPodetails= this.baseMapper.getPOPodetails(rowmId);
@@ -258,29 +269,22 @@ public class PurchaseWarehousingServiceImpl extends ServiceImpl<PurchaseWarehous
                                         iReceivedQTY=getDecimalNew(String.valueOf(mapPOPodetails.get("iReceivedQTY"))).subtract(getDecimalNew(String.valueOf(itemMap.get("iQuantity"))));
                                         //回写到现存量 如果不是调拨业务则入库单需要回写现存量 如果是调拨单 那么只要在调拨或者其他入库的时候回写现存量
                                         if(iscVenCodeReceiver==false){
-                                            message=message+"第"+rowId+"行"+saveCurrentStock(itemMap,"2");
+//                                            message=message+"第"+rowId+"行"+saveCurrentStock(itemMap,"2");
                                         }
                                     }else{//篮字则相加
                                         iReceivedQTY=getDecimalNew(String.valueOf(mapPOPodetails.get("iReceivedQTY"))).add(getDecimalNew(String.valueOf(itemMap.get("iQuantity"))));
                                         //回写到现存量 如果不是调拨业务则入库单需要回写现存量 如果是调拨单 那么只要在调拨或者其他入库的时候回写现存量
                                         if(iscVenCodeReceiver==false){
-                                            saveCurrentStock(itemMap,"1");
+//                                            saveCurrentStock(itemMap,"1");
                                         }
                                     }
                                     Map<String,Object> mapFreceivedqty=new HashMap<>();
                                     mapFreceivedqty.put("iReceivedQTY",iReceivedQTY);//到货数量
                                     mapFreceivedqty.put("ID",rowmId);//订单行id
                                     //回写到采购订单对应行
-                                    this.baseMapper.updatePodetailsfreceivedqty(mapFreceivedqty);
+//                                    this.baseMapper.updatePodetailsfreceivedqty(mapFreceivedqty);
                                     //回写到现存量
 
-
-//                                        Integer isCount= this.baseMapper.getCurrentStockCount(itemMap);
-//                                        if(isCount!=null&&isCount>0){
-//
-//
-//                                        }
-
                                     //判断存货是否勾选批次管理 勾选则需要新增表
                                     if(ispc){
                                         //新增AA_BatchProperty
@@ -297,6 +301,7 @@ public class PurchaseWarehousingServiceImpl extends ServiceImpl<PurchaseWarehous
                             if(itemMap.get("moDetailId")!=null&&StringUtils.isNotBlank(String.valueOf(itemMap.get("moDetailId")))){
                                 itemMap.put("iPOsID","");//采购订单行id
                                 itemMap.put("iOMoDID",itemMap.get("moDetailId"));//委外订单行id
+                                itemMap.put("POAUTOIDCOL","MODetailsID");
                                 String moDetailId=String.valueOf(itemMap.get("moDetailId"));//委外订单行id
                                 //获取来源订单号
                                 Map<String,Object> omMoDetails=this.baseMapper.getOMMoDetails(moDetailId);
@@ -311,6 +316,7 @@ public class PurchaseWarehousingServiceImpl extends ServiceImpl<PurchaseWarehous
                                     getcFree(itemMap,mapOMMODetails);
                                     //加工费 原币无税单价*数量
                                     BigDecimal iProcessFee=getDecimalNew(String.valueOf(itemMap.get("iOriCost"))).multiply(getDecimalNew(String.valueOf(itemMap.get("iQuantity"))));
+                                    itemMap.put("iOriCost",itemMap.get("iOriCost"));//原币无税单价、加工费单价
                                     itemMap.put("iProcessFee",iProcessFee.doubleValue());
                                     itemMap.put("cWhCode",map.get("cWhCode"));//获取仓库
                                     //回写入库数量到委外订单行
@@ -320,26 +326,20 @@ public class PurchaseWarehousingServiceImpl extends ServiceImpl<PurchaseWarehous
                                         iReceivedQTY=getDecimalNew(String.valueOf(mapOMMODetails.get("iReceivedQTY"))).subtract(getDecimalNew(String.valueOf(itemMap.get("iQuantity"))));
                                         //回写到现存量 如果不是调拨业务则入库单需要回写现存量 如果是调拨单 那么只要在调拨或者其他入库的时候回写现存量
                                         if(iscVenCodeReceiver==false) {
-                                            message=message+"第"+rowId+"行"+saveCurrentStock(itemMap,"2");
+//                                            message=message+"第"+rowId+"行"+saveCurrentStock(itemMap,"2");
                                         }
                                     }else{//蓝字则相加
                                         iReceivedQTY=getDecimalNew(String.valueOf(mapOMMODetails.get("iReceivedQTY"))).add(getDecimalNew(String.valueOf(itemMap.get("iQuantity"))));
                                         //回写到现存量 如果不是调拨业务则入库单需要回写现存量 如果是调拨单 那么只要在调拨或者其他入库的时候回写现存量
                                         if(iscVenCodeReceiver==false) {
-                                            saveCurrentStock(itemMap,"1");
+//                                            saveCurrentStock(itemMap,"1");
                                         }
                                     }
                                     Map<String,Object> mapFreceivedqty=new HashMap<>();
                                     mapFreceivedqty.put("iReceivedQTY",iReceivedQTY);//入库数量
                                     mapFreceivedqty.put("ID",rowmId);//订单行id
                                     //回写到委外订单对应行
-                                    this.baseMapper.updateOMMODetailsfreceivedqty(mapFreceivedqty);
-
-//                                        Integer isCount= this.baseMapper.getCurrentStockCount(itemMap);
-//                                        if(isCount!=null&&isCount>0){
-//                                            //修改现存量
-//                                            this.baseMapper.updateCurrentStock(itemMap);
-//                                        }
+//                                    this.baseMapper.updateOMMODetailsfreceivedqty(mapFreceivedqty);
                                     //判断存货是否勾选批次管理 勾选则需要新增表
                                     if(ispc) {
                                         //新增AA_BatchProperty
@@ -361,7 +361,7 @@ public class PurchaseWarehousingServiceImpl extends ServiceImpl<PurchaseWarehous
 
                         rowId++;
                         if(StringUtils.isEmpty(message)) {
-                            this.baseMapper.saveRdrecords01(itemMap);
+//                            this.baseMapper.saveRdrecords01(itemMap); //子表新增
                         }
                     }
                     if(StringUtils.isNotBlank(message)){
@@ -369,18 +369,100 @@ public class PurchaseWarehousingServiceImpl extends ServiceImpl<PurchaseWarehous
                     }
 //                    this.baseMapper.saveRdrecords01One(itemList);
                 }
-                this.baseMapper.saveRdRecord01One(map);
-                //调拨单
+//                this.baseMapper.saveRdRecord01One(map); //主表新增
 
-                if(iscVenCodeReceiver){
-                    //保存调拨单
-                    saveTransVouch(map,itemList,accID);
+                //由于前期是自己插入U8数据库 后前改变方式先择调用第三方插入接口 所以需要把字段名整体转换成第三方的
+                JSONArray resturn =InterfaceConnUtils.doPost(saveRdRecord01JSON(map,itemList,accID),"http://192.168.1.103:8087/api/U8Server/purchaseinlist_batch_get");
+                if(resturn.getJSONObject(0).get("Result").equals("T")){
+                    //成功
+                    //调拨单
+                    if(iscVenCodeReceiver){
+                        //保存调拨单
+                        saveTransVouch(map,itemList,accID);
+                    }
+                }else{
+                    //失败
+                    throw new RuntimeException(resturn.getJSONObject(0).get("Description")+"");
                 }
 
             }
         }
     }
 
+    //由于前期是自己插入U8数据库 后前改变方式先择调用第三方插入接口 所以需要把字段名整体转换成第三方的
+    public JSONArray saveRdRecord01JSON(Map<String,Object> map,List<Map<String,Object>> itemList,String accID){
+        JSONArray jsonArraySave=new JSONArray();
+        if(map!=null){
+            //主表
+            JSONObject saveJson=new JSONObject();
+            saveJson.put("CACCID",accID);
+            saveJson.put("CVOUCHCODE",map.get("cCode"));
+            saveJson.put("DDATE",map.get("dDate"));
+            saveJson.put("CWHCODE",map.get("cWhCode"));
+            saveJson.put("CRDCODE",map.get("cRdCode"));
+            saveJson.put("IEXCHRATE",map.get("iExchRate"));
+            saveJson.put("CMEMO",map.get("cMemo"));
+            saveJson.put("CMAKER",map.get("cMaker"));
+            saveJson.put("CHANDLER",map.get("cHandler"));
+            saveJson.put("CDEFINE13",map.get("cOrderCode"));
+            saveJson.put("CGLTYPE",map.get("cSource"));
+            //子表
+            if(itemList!=null){
+                JSONArray itemJsonArray=new JSONArray();
+                for(Map<String,Object> m:itemList){
+                    JSONObject saveItemJson=new JSONObject();
+                    saveItemJson.put("CINVCODE",m.get("cInvCode"));
+                    saveItemJson.put("IQUANTITY",m.get("iQuantity"));
+                    saveItemJson.put("CBMEMO",m.get("cbMemo"));
+                    saveItemJson.put("CBATCH",m.get("cBatch"));
+                    saveItemJson.put("AUTOID_PO",m.get("moDetailId"));
+                    saveItemJson.put("POAUTOIDCOL",m.get("POAUTOIDCOL"));
+                    saveItemJson.put("IPROCESSCOST",m.get("iOriCost"));
+                    //获取自定义项 自由项 批次项
+                    getCDEFINEJson(saveItemJson,m);
+                    itemJsonArray.add(saveItemJson);
+                }
+                saveJson.put("DETAILList",itemJsonArray);
+            }
+            jsonArraySave.add(saveJson);
+        }
+        System.out.println("入库json:"+jsonArraySave.toString());
+        return jsonArraySave;
+
+    }
+
+    public void getCDEFINEJson(JSONObject saveItemJson,Map<String,Object> m){
+        saveItemJson.put("CDEFINE22",m.get("cDefine22"));
+        saveItemJson.put("CDEFINE23",m.get("cDefine23"));
+        saveItemJson.put("CDEFINE24",m.get("cDefine24"));
+        saveItemJson.put("CDEFINE25",m.get("cDefine25"));
+        saveItemJson.put("CDEFINE26",m.get("cDefine26"));
+        saveItemJson.put("CDEFINE27",m.get("cDefine27"));
+        saveItemJson.put("CDEFINE28",m.get("cDefine28"));
+        saveItemJson.put("CDEFINE29",m.get("cDefine29"));
+        saveItemJson.put("CDEFINE30",m.get("cDefine30"));
+        saveItemJson.put("CDEFINE31",m.get("cDefine31"));
+        saveItemJson.put("CDEFINE32",m.get("cDefine32"));
+        saveItemJson.put("CDEFINE33",m.get("cDefine33"));
+        saveItemJson.put("CDEFINE34",m.get("cDefine34"));
+        saveItemJson.put("CDEFINE35",m.get("cDefine35"));
+        saveItemJson.put("CDEFINE36",m.get("cDefine36"));
+        saveItemJson.put("CDEFINE37",m.get("cDefine37"));
+        saveItemJson.put("CFREE1",m.get("cFree1"));
+        saveItemJson.put("CFREE2",m.get("cFree2"));
+        saveItemJson.put("CFREE3",m.get("cFree3"));
+        saveItemJson.put("CFREE4",m.get("cFree4"));
+        saveItemJson.put("CFREE5",m.get("cFree5"));
+        saveItemJson.put("CFREE6",m.get("cFree6"));
+        saveItemJson.put("CFREE7",m.get("cFree7"));
+        saveItemJson.put("CFREE8",m.get("cFree8"));
+        saveItemJson.put("CFREE9",m.get("cFree9"));
+        saveItemJson.put("CFREE10",m.get("cFree10"));
+        saveItemJson.put("CBATCHPROPERTY2",m.get("cBatchProperty2"));
+        saveItemJson.put("CBATCHPROPERTY8",m.get("cBatchProperty8"));
+        saveItemJson.put("CBATCHPROPERTY9",m.get("cBatchProperty9"));
+    }
+
     //回写现存量
     public String saveCurrentStock(Map<String,Object> itemMap,String type){
         String message="";
@@ -591,27 +673,17 @@ public class PurchaseWarehousingServiceImpl extends ServiceImpl<PurchaseWarehous
         return decimal;
     }
 
-    //保存调拨单
+    //保存调拨单 由于前期是自己插入U8数据库 所有会有很多业务可能会包含无用的业务  目前是直接在插入的时候对其数据进行整理调用第三方接口
     public void saveTransVouch(Map<String,Object> rdRecord01Map,List<Map<String,Object>> rdRecords01List,String accID){
         Map<String,Object> transVouchMao=new HashMap<>();
-        //获取主表最大ID
-        Map<String,Integer> pkMap = callGetUAMaxPK2("tr",accID);
-        if(pkMap.get("iFatherId")==null){
-            throw new RuntimeException("获取入库单主表ID失败");
-        }
-        transVouchMao.put("ID",pkMap.get("iFatherId"));
-//        transVouchMao.put("ID",oConvertUtils.addOne(getMaxId("ID","TransVouch")));
         //获取最大编码
         transVouchMao.put("cTVCode",oConvertUtils.addOne(this.baseMapper.getMaxCode("cTVCode","TransVouch","dnmaketime")));
-        //修改最大编码
-        this.baseMapper.updateVoucherHistoryCNumber(oConvertUtils.maxNumber(String.valueOf(transVouchMao.get("cTVCode"))),"0304");
         //单据日期
         Date date=new Date();
-        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
         transVouchMao.put("dTVDate",formatter.format(date));
         //转出部门
         transVouchMao.put("cODepCode","");
-
         //转出仓库
         transVouchMao.put("cOWhCode",rdRecord01Map.get("cWhCode"));
         //转入仓库??
@@ -635,7 +707,6 @@ public class PurchaseWarehousingServiceImpl extends ServiceImpl<PurchaseWarehous
         }else{
             throw new RuntimeException("接收方编码不能为空");
         }
-//        transVouchMao.put("cIWhCode","");
         //通过下游订单号获取订单数据
         Map<String,Object> OM_MOmainMap=this.baseMapper.getOM_MOmainBycCode(String.valueOf(rdRecords01List.get(0).get("downstreamOrderNumber")));
         if(OM_MOmainMap==null){
@@ -648,7 +719,6 @@ public class PurchaseWarehousingServiceImpl extends ServiceImpl<PurchaseWarehous
         transVouchMao.put("cDefine13",rdRecords01List.get(0).get("downstreamOrderNumber"));//1
         //业务员
         transVouchMao.put("cPersonCode",OM_MOmainMap.get("cPersonCode"));
-        this.baseMapper.saveTransVouch(transVouchMao);
         String messge="";
         List<Map<String,Object>> transVouchsList=new ArrayList<>();
         if(rdRecords01List!=null&&rdRecords01List.size()>0){
@@ -664,7 +734,6 @@ public class PurchaseWarehousingServiceImpl extends ServiceImpl<PurchaseWarehous
                 vouchsMap.put("MoDetailsID",mapOMMODetails.get("MODetailsID"));//委外订单子表id
                 vouchsMap.put("invcode",mapOMMODetails.get("cInvCode"));//产品编码
                 vouchsMap.put("comcode",rdRecords01List.get(0).get("downstreamOrderNumber"));//委外订单号
-//                vouchsMap.put("cDefine22",recordsMap.get("cDefine22"));//款号
                 vouchsMap.put("cTVBatch",recordsMap.get("cBatch"));//批号
                 vouchsMap.put("cInvCode",recordsMap.get("cInvCode"));//存货编码
                 vouchsMap.put("iTVQuantity",recordsMap.get("iQuantity"));//数量
@@ -672,26 +741,8 @@ public class PurchaseWarehousingServiceImpl extends ServiceImpl<PurchaseWarehous
                 getcFree(vouchsMap,recordsMap);
                 //获取批次属性
                 getcBatchProperty(vouchsMap,recordsMap);
-
-//                vouchsMap.put("cFree1",recordsMap.get("cFree1"));//颜色
-//                vouchsMap.put("cFree2",recordsMap.get("cFree2"));//尺码
-//                vouchsMap.put("cFree4",recordsMap.get("cFree4"));//光坯门幅
-//                vouchsMap.put("cFree6",recordsMap.get("cFree6"));//克重/工艺
-//                vouchsMap.put("cFree5",recordsMap.get("cFree5"));//品质/品种
-//                vouchsMap.put("cFree3",recordsMap.get("cFree3"));//品质/品种
-//                vouchsMap.put("cFree7",recordsMap.get("cFree7"));//品质/品种
-//                vouchsMap.put("cFree8",recordsMap.get("cFree8"));//品质/品种
-//                vouchsMap.put("cFree9",recordsMap.get("cFree9"));//品质/品种
-//                vouchsMap.put("cFree10",recordsMap.get("cFree10"));//品质/品种
-//                vouchsMap.put("cDefine30",recordsMap.get("cDefine30"));//染厂色号
                 vouchsMap.put("cbMemo",recordsMap.get("cbMemo"));//备注
                 vouchsMap.put("cTVCode",transVouchMao.get("cTVCode"));//主表调拨单号
-                //获取子表最大id
-                Map<String,Integer> pkMapChild = callGetUAMaxPK2("tr",accID);
-                if(pkMap.get("iChildId")==null){
-                    throw new RuntimeException("获取调拨单子表ID失败");
-                }
-                vouchsMap.put("autoID",pkMapChild.get("iChildId"));
 //                vouchsMap.put("autoID", oConvertUtils.addOne(getMaxId("autoID","TransVouchs")));//子表id
                 vouchsMap.put("ID",transVouchMao.get("ID"));//主表ID
                 //根据存货与自由项找对应子件
@@ -702,21 +753,6 @@ public class PurchaseWarehousingServiceImpl extends ServiceImpl<PurchaseWarehous
                 if(OM_MOMaterialsList!=null&&OM_MOMaterialsList.size()>0){
                     if(OM_MOMaterialsList.size()==1){
                         vouchsMap.put("iomids",OM_MOMaterialsList.get(0).get("MOMaterialsID"));//委外订单自件id
-                        //回写调拨数量
-                        //已领数量
-                        BigDecimal iSendQTY=getDecimalNew(String.valueOf(OM_MOMaterialsList.get(0).get("iSendQTY")));//已领数量
-                        //调拨数量
-                        BigDecimal fTransQty=getDecimalNew(String.valueOf(OM_MOMaterialsList.get(0).get("fTransQty"))).add(getDecimalNew(String.valueOf(vouchsMap.get("iTVQuantity"))));//调拨数量
-//                        if(iSendQTY.doubleValue()>fTransQty.doubleValue()){
-                            //调拨数量回写到对应委外子件
-                            Map<String,Object> updateOM_MOMaterials=new HashMap<>();
-                            updateOM_MOMaterials.put("MOMaterialsID",OM_MOMaterialsList.get(0).get("MOMaterialsID"));//委外订单子件id
-                            updateOM_MOMaterials.put("fTransQty",fTransQty.doubleValue());//调拨数量
-                        System.out.println("调拨数量:"+fTransQty.doubleValue());
-                            this.baseMapper.updateOM_MOMaterialsfTransQty(updateOM_MOMaterials);
-//                        }else{
-//                            throw new RuntimeException("第"+vI+"调拨数量不能大于子件已领数量");
-//                        }
                     }else{
                         throw new RuntimeException("第"+vI+"行找到多个对应下游委外订单子件行");
                     }
@@ -724,7 +760,6 @@ public class PurchaseWarehousingServiceImpl extends ServiceImpl<PurchaseWarehous
                     throw new RuntimeException("第"+vI+"行未找到对应下游委外订单子件行");
                 }
                 vouchsMap.put("irowno",recordsMap.get("irowno"));//行号
-                this.baseMapper.saveTransVouchs(vouchsMap);
                 transVouchsList.add(vouchsMap);
             }
         }
@@ -732,10 +767,54 @@ public class PurchaseWarehousingServiceImpl extends ServiceImpl<PurchaseWarehous
         if(StringUtils.isNotBlank(messge)){
 
         }
-        //保存其他出库单
-        saveRdRecord09(transVouchMao,transVouchsList);
-        //保存其他入库单
-        saveRdRecord08(transVouchMao,transVouchsList);
+        //由于前期是自己插入U8数据库 后前改变方式先择调用第三方插入接口 所以需要把字段名整体转换成第三方的
+        JSONArray resturn =InterfaceConnUtils.doPost(saveRdRecord09JSON(transVouchMao,transVouchsList,accID),"http://192.168.1.103:8087/api/U8Server/transvouch_import");
+        if(resturn.getJSONObject(0).get("Result").equals("T")){
+            //成功
+        }else{
+            //失败
+            throw new RuntimeException(resturn.getJSONObject(0).get("Description")+"");
+        }
+    }
+
+    //由于前期是自己插入U8数据库 后前改变方式先择调用第三方插入接口 所以需要把字段名整体转换成第三方的
+    public JSONArray saveRdRecord09JSON(Map<String,Object> transVouchMao,List<Map<String,Object>> transVouchsList,String accID){
+        JSONArray jsonArraySave=new JSONArray();
+        if(transVouchMao!=null){
+            //主表
+            JSONObject saveJson=new JSONObject();
+            saveJson.put("CACCID",accID);
+            saveJson.put("CVOUCHCODE",transVouchMao.get("cTVCode"));
+            saveJson.put("DDATE",transVouchMao.get("dTVDate"));
+            saveJson.put("CORDCODE",23);
+            saveJson.put("CIRDCODE",13);
+            saveJson.put("COWHCODE",transVouchMao.get("cOWhCode"));
+            saveJson.put("CIWHCODE",transVouchMao.get("cIWhCode"));
+            saveJson.put("CMAKER","陈创");
+            saveJson.put("CHANDLER","陈创");
+            saveJson.put("CODEPCODE","");
+            saveJson.put("CIDEPCODE",transVouchMao.get("cIDepCode"));
+            saveJson.put("CPERSONCODE",transVouchMao.get("cPersonCode"));
+            saveJson.put("CDEFINE13",transVouchMao.get("cDefine13"));
+            //子表
+            if(transVouchsList!=null){
+                JSONArray itemJsonArray=new JSONArray();
+                for(Map<String,Object> m:transVouchsList){
+                    JSONObject saveItemJson=new JSONObject();
+                    saveItemJson.put("CINVCODE",m.get("cInvCode"));
+                    saveItemJson.put("IQUANTITY",m.get("iTVQuantity"));
+                    saveItemJson.put("CBATCH",m.get("cTVBatch"));
+                    saveItemJson.put("CBMEMO",m.get("cbMemo"));
+                    //获取自定义项 自由项 批次项
+                    getCDEFINEJson(saveItemJson,m);
+                    itemJsonArray.add(saveItemJson);
+                }
+                saveJson.put("DETAILList",itemJsonArray);
+            }
+            jsonArraySave.add(saveJson);
+        }
+        System.out.println("调拨单json:"+jsonArraySave.toString());
+        return jsonArraySave;
     }
 
     //根据调拨单新增其他出库单
@@ -829,4 +908,451 @@ public class PurchaseWarehousingServiceImpl extends ServiceImpl<PurchaseWarehous
     }
 
 
+//    public void save(List<Map<String, Object>> mapList,String accID){
+//        if(mapList!=null&&mapList.size()>0){
+//
+//            for(Map<String,Object> map:mapList){
+//                //获取主表最大编码
+//                Map<String,Integer> pkMap = callGetUAMaxPK2("rd",accID);
+//                if(pkMap.get("iFatherId")==null){
+//                    throw new RuntimeException("获取入库单主表ID失败");
+//                }
+//                map.put("ID",pkMap.get("iFatherId"));
+////                map.put("ID", oConvertUtils.addOne(getMaxId("ID","RdRecord01")));
+//
+//                System.out.println(map.get("ID"));
+//                //获取最大code
+//                String cCode=oConvertUtils.addOne(this.baseMapper.getMaxCode("cCode","RdRecord01","dnmaketime"));
+//
+//                if(cCode!=null){
+//                    map.put("cCode",cCode);
+//                    this.baseMapper.updateVoucherHistoryCNumber(oConvertUtils.maxNumber(String.valueOf(map.get("cCode"))),"24");
+//                }else{
+//                    throw new RuntimeException("获取入库单号失败");
+//                }
+//
+//
+//                //日期
+//                Long longtime=Long.valueOf(String.valueOf(map.get("dDate")));
+//                String formatTime = new SimpleDateFormat("yyyy-MM-dd").format(new Date(longtime));
+//                map.put("dDate",formatTime);
+//                //红蓝标识
+//                if(map.get("cVouchType").toString().equals("1")){
+//                    map.put("cVouchType",0);//采购入库
+//                }else{
+//                    map.put("cVouchType",1);//红字入库
+//                }
+//                //入库类别、采购类型
+//                if(map.get("cRdCode").toString().equals("采购入库")){
+//                    //采购入库
+//                    map.put("cRdCode","11");
+//                    map.put("cPTCode","01");
+//                    map.put("cSource","采购订单");
+//                    //获取汇率、币种
+//                    Map<String,Object> PO_PomainMap=this.baseMapper.getPO_PomainBycPOID(String.valueOf(map.get("cOrderCode")));
+//                    if(PO_PomainMap!=null){
+//                        map.put("iExchRate",getDecimalNew(String.valueOf(PO_PomainMap.get("nflat"))).doubleValue());
+//                        map.put("cExch_Name",PO_PomainMap.get("cexch_name"));
+//                    }else{
+//                        throw new RuntimeException("采购订单没有匹配的订单号");
+//                    }
+//                }else{
+//                    //委外入库
+//                    map.put("cRdCode","12");
+//                    map.put("cPTCode","01");
+//                    map.put("cSource","委外订单");
+//                    //获取汇率、币种
+//                    Map<String,Object> OM_MOmainMap=this.baseMapper.getOM_MOmainBycCode(String.valueOf(map.get("cOrderCode")));
+//                    if(OM_MOmainMap!=null){
+//                        map.put("iExchRate",getDecimalNew(String.valueOf(OM_MOmainMap.get("nflat"))).doubleValue());
+//                        map.put("cExch_Name",OM_MOmainMap.get("cexch_name"));
+//                    }else{
+//                        throw new RuntimeException("委外订单没有匹配的订单号");
+//                    }
+//                }
+//                //获取部门编码
+//                if(map.get("cPersonCode")!=null){
+//                    String cPersonCode=String.valueOf(map.get("cPersonCode"));
+//                    Map<String,Object> personMap=this.baseMapper.getPerson(cPersonCode);
+//                    if(personMap==null){
+//                        throw new RuntimeException("通过业务员编码未找到部门");
+//                    }else{
+//                        map.put("cDepCode",personMap.get("cDepCode"));
+//                    }
+//                }else{
+//                    throw new RuntimeException("业务员编码不能为空");
+//                }
+//                //获取根据供应商获取仓库编码
+//                String cVenCode=String.valueOf(map.get("cVenCode"));
+//                if(map.get("cVenCode")!=null){
+//                    Map<String,Object> whCodeMap= this.baseMapper.getWhCodeByVenCode(cVenCode);
+//                    if(whCodeMap!=null){
+//                        //获取供应商简称
+//                        map.put("cVenAbbName",whCodeMap.get("cVenAbbName"));
+//                        map.put("cVenCode",whCodeMap.get("cVenCode"));
+//                        //获取成品仓
+//                        if(whCodeMap.get("cVenDefine2")!=null){
+//                            String cWhCode=String.valueOf(whCodeMap.get("cVenDefine2"));//成品仓库
+//                            map.put("cWhCode",cWhCode);
+//                        }else{
+//                            throw new RuntimeException("未找到供应商的成品仓库");
+//                        }
+//                    }else{
+//                        throw new RuntimeException("未找到供应商");
+//                    }
+//
+//                }else{
+//                    throw new RuntimeException("供应商编码不能为空");
+//                }
+//
+//                //判断接收方是否有只值 宁波森语 马菲羊 森语集团
+//                boolean iscVenCodeReceiver=false;
+//                if(map.get("cVenCodeReceiver")!=null&&!String.valueOf(map.get("cVenCodeReceiver")).equals("")){
+//                    //根据接收方获取供应商信息
+//                    Map<String,Object> mapVenCode= this.baseMapper.getWhCodeByVenCode(String.valueOf(map.get("cVenCodeReceiver")));
+//                    if(mapVenCode!=null){
+//                        String cVenAbbName=String.valueOf(mapVenCode.get("cVenAbbName"));//供应商简称
+//                        //判断是否外部供应商  外部则进入下一波做调拨单 非则不做
+//                        if(!cVenAbbName.equals("宁波森语")&&!cVenAbbName.equals("马菲羊")&&!cVenAbbName.equals("森语集团")){
+//                            iscVenCodeReceiver=true;
+//                            //获取制单人
+//                            map.put("cMaker","陈创");
+//                            map.put("cHandler","陈创");
+//                        }else{
+//                            //获取制单人
+//                            if(map.get("cMaker")==null||map.get("cMaker").equals("")){
+//                                throw new RuntimeException("缺少制单人字段");
+//                            }
+//                            map.put("cHandler",map.get("cMaker"));
+//                        }
+//                    }else{
+//                        throw new RuntimeException("未能找到接收方信息");
+//                    }
+//                }else{
+//                    //获取制单人
+//                    if(map.get("cMaker")==null||map.get("cMaker").equals("")){
+//                        throw new RuntimeException("缺少制单人字段");
+//                    }
+//                    map.put("cHandler",map.get("cMaker"));
+//                }
+//
+//
+//                //子表
+//                List<Map<String,Object>> itemList=new ArrayList<>();
+//                if(map.get("item")!=null&&!map.get("item").equals("")){
+//                    itemList=(List<Map<String,Object>>)map.get("item");
+//                    Integer rowId=1;
+//                    String message="";
+//                    for(Map<String,Object> itemMap:itemList){
+//                        //获取P号
+//                        if(itemMap.get("cBatch")==null||String.valueOf(itemMap.get("cBatch")).equals("")){
+//                            message=message+"第"+rowId+"行缺少批号;";
+//                        }
+//                        //获取子表最大id
+//                        Map<String,Integer> pkMapChild = callGetUAMaxPK2("rd",accID);
+//                        if(pkMapChild.get("iChildId")==null){
+//                            message=message+"第"+rowId+"行获取入库单子表ID失败;";
+//                            throw new RuntimeException("获取入库单子表ID失败");
+//                        }
+//                        itemMap.put("AutoID",pkMapChild.get("iChildId"));
+//                        itemMap.put("AutoID",oConvertUtils.addOne(getMaxId("AutoID","rdrecords01")));
+//                        //主表id
+//                        itemMap.put("ID",map.get("ID"));
+//                        //行号
+//                        itemMap.put("irowno",rowId);
+//                        //订单号
+//                        itemMap.put("cPOID",String.valueOf(map.get("cOrderCode")));
+//                        String rowmId="";
+//                        //判断是否批次管理
+//                        Boolean ispc=false;
+//                        Map<String,Object> mapInvCode= this.baseMapper.getInventoryBycInvCode(String.valueOf(itemMap.get("cInvCode")));
+//                        if(mapInvCode!=null&&String.valueOf(mapInvCode.get("bInvBatch")).equals("true")){
+//                            ispc=true;
+//                        }
+//                        //订单子表id
+//                        if(map.get("cRdCode").toString().equals("11")){
+//                            if(itemMap.get("moDetailId")!=null&&StringUtils.isNotBlank(String.valueOf(itemMap.get("moDetailId")))) {
+//                                itemMap.put("iPOsID", itemMap.get("moDetailId"));//采购订单行id
+//                                itemMap.put("iOMoDID", "");//委外订单行id
+//                                itemMap.put("POAUTOIDCOL","ID");
+//                                rowmId = String.valueOf(itemMap.get("moDetailId"));
+//                                //获取订单行的数据
+//                                Map<String,Object> mapPOPodetails= this.baseMapper.getPOPodetails(rowmId);
+//
+//                                if(mapPOPodetails!=null){
+//
+//
+//                                    map.put("ipurorderid",mapPOPodetails.get("POID"));
+//                                    //获取订单行的价格字段
+//                                    getCost(itemMap,mapPOPodetails);
+//                                    //获取订单行的自定义项数据
+//                                    getcFree(itemMap,mapPOPodetails);
+//                                    itemMap.put("cWhCode",map.get("cWhCode"));//获取仓库 供回写现存量用
+//                                    //回写到货数量到采购订单行
+//                                    //如果是红字入库则相减
+//                                    BigDecimal iReceivedQTY=new BigDecimal("0.0");
+//                                    if(map.get("cVouchType").toString().equals("1")){
+//                                        iReceivedQTY=getDecimalNew(String.valueOf(mapPOPodetails.get("iReceivedQTY"))).subtract(getDecimalNew(String.valueOf(itemMap.get("iQuantity"))));
+//                                        //回写到现存量 如果不是调拨业务则入库单需要回写现存量 如果是调拨单 那么只要在调拨或者其他入库的时候回写现存量
+//                                        if(iscVenCodeReceiver==false){
+//                                            message=message+"第"+rowId+"行"+saveCurrentStock(itemMap,"2");
+//                                        }
+//                                    }else{//篮字则相加
+//                                        iReceivedQTY=getDecimalNew(String.valueOf(mapPOPodetails.get("iReceivedQTY"))).add(getDecimalNew(String.valueOf(itemMap.get("iQuantity"))));
+//                                        //回写到现存量 如果不是调拨业务则入库单需要回写现存量 如果是调拨单 那么只要在调拨或者其他入库的时候回写现存量
+//                                        if(iscVenCodeReceiver==false){
+//                                            saveCurrentStock(itemMap,"1");
+//                                        }
+//                                    }
+//                                    Map<String,Object> mapFreceivedqty=new HashMap<>();
+//                                    mapFreceivedqty.put("iReceivedQTY",iReceivedQTY);//到货数量
+//                                    mapFreceivedqty.put("ID",rowmId);//订单行id
+//                                    //回写到采购订单对应行
+//                                    this.baseMapper.updatePodetailsfreceivedqty(mapFreceivedqty);
+//                                    //回写到现存量
+//
+//                                    //判断存货是否勾选批次管理 勾选则需要新增表
+//                                    if(ispc){
+//                                        //新增AA_BatchProperty
+//                                        message=message+saveAA_BatchProperty(map,itemMap,mapPOPodetails);
+//                                    }
+//                                }else{
+//                                    message=message+"第"+rowId+"行未找到对应的采购订单行;";
+//                                }
+//                            }else{
+//                                message=message+"第"+rowId+"行缺少采购订单行id;";
+//                            }
+//                        }else{//委外入库
+//
+//                            if(itemMap.get("moDetailId")!=null&&StringUtils.isNotBlank(String.valueOf(itemMap.get("moDetailId")))){
+//                                itemMap.put("iPOsID","");//采购订单行id
+//                                itemMap.put("iOMoDID",itemMap.get("moDetailId"));//委外订单行id
+//                                itemMap.put("POAUTOIDCOL","MODetailsID");
+//                                String moDetailId=String.valueOf(itemMap.get("moDetailId"));//委外订单行id
+//                                //获取来源订单号
+//                                Map<String,Object> omMoDetails=this.baseMapper.getOMMoDetails(moDetailId);
+//                                itemMap.put("iordercode",omMoDetails.get("csoordercode"));//来源订单号
+//                                rowmId=String.valueOf(itemMap.get("moDetailId"));
+//                                //获取订单行数据
+//                                Map<String,Object> mapOMMODetails=this.baseMapper.getOMMODetails(rowmId);
+//                                if(mapOMMODetails!=null){
+//                                    //获取订单行的价格字段
+//                                    getCost(itemMap,mapOMMODetails);
+//                                    //获取订单的自定义数据
+//                                    getcFree(itemMap,mapOMMODetails);
+//                                    //加工费 原币无税单价*数量
+//                                    BigDecimal iProcessFee=getDecimalNew(String.valueOf(itemMap.get("iOriCost"))).multiply(getDecimalNew(String.valueOf(itemMap.get("iQuantity"))));
+//                                    itemMap.put("iProcessFee",iProcessFee.doubleValue());
+//                                    itemMap.put("cWhCode",map.get("cWhCode"));//获取仓库
+//                                    //回写入库数量到委外订单行
+//                                    //如果是红字入库则相减
+//                                    BigDecimal iReceivedQTY=new BigDecimal("0.0");
+//                                    if(map.get("cVouchType").toString().equals("1")){
+//                                        iReceivedQTY=getDecimalNew(String.valueOf(mapOMMODetails.get("iReceivedQTY"))).subtract(getDecimalNew(String.valueOf(itemMap.get("iQuantity"))));
+//                                        //回写到现存量 如果不是调拨业务则入库单需要回写现存量 如果是调拨单 那么只要在调拨或者其他入库的时候回写现存量
+//                                        if(iscVenCodeReceiver==false) {
+//                                            message=message+"第"+rowId+"行"+saveCurrentStock(itemMap,"2");
+//                                        }
+//                                    }else{//蓝字则相加
+//                                        iReceivedQTY=getDecimalNew(String.valueOf(mapOMMODetails.get("iReceivedQTY"))).add(getDecimalNew(String.valueOf(itemMap.get("iQuantity"))));
+//                                        //回写到现存量 如果不是调拨业务则入库单需要回写现存量 如果是调拨单 那么只要在调拨或者其他入库的时候回写现存量
+//                                        if(iscVenCodeReceiver==false) {
+//                                            saveCurrentStock(itemMap,"1");
+//                                        }
+//                                    }
+//                                    Map<String,Object> mapFreceivedqty=new HashMap<>();
+//                                    mapFreceivedqty.put("iReceivedQTY",iReceivedQTY);//入库数量
+//                                    mapFreceivedqty.put("ID",rowmId);//订单行id
+//                                    //回写到委外订单对应行
+//                                    this.baseMapper.updateOMMODetailsfreceivedqty(mapFreceivedqty);
+//                                    //判断存货是否勾选批次管理 勾选则需要新增表
+//                                    if(ispc) {
+//                                        //新增AA_BatchProperty
+//                                        message = message + saveAA_BatchProperty(map, itemMap, mapOMMODetails);
+//                                    }
+//                                }else{
+//                                    message=message+"第"+rowId+"未找到对应的委外订单行;";
+//                                }
+//                            }else{
+//                                message=message+"第"+rowId+"缺少委外订单行id;";
+//                            }
+//                        }
+//                        //如果是红字入库则处理是否需要做结算单
+//                        if(map.get("cVouchType").toString().equals("1")){
+//                            //保存结算单
+//                            savePurSettleVouch(map,itemMap,rowmId);
+//                            itemMap.put("iQuantity","-"+itemMap.get("iQuantity"));
+//                        }
+//
+//                        rowId++;
+//                        if(StringUtils.isEmpty(message)) {
+//                            this.baseMapper.saveRdrecords01(itemMap); //子表新增
+//                        }
+//                    }
+//                    if(StringUtils.isNotBlank(message)){
+//                        throw new RuntimeException(message);
+//                    }
+////                    this.baseMapper.saveRdrecords01One(itemList);
+//                }
+//                this.baseMapper.saveRdRecord01One(map); //主表新增
+//                //调拨单
+//
+//                if(iscVenCodeReceiver){
+//                    //保存调拨单
+//                    saveTransVouch(map,itemList,accID);
+//                }
+//            }
+//        }
+//    }
+
+
+//    //保存调拨单
+//    public void saveTransVouch(Map<String,Object> rdRecord01Map,List<Map<String,Object>> rdRecords01List,String accID){
+//        Map<String,Object> transVouchMao=new HashMap<>();
+//        //获取主表最大ID
+//        Map<String,Integer> pkMap = callGetUAMaxPK2("tr",accID);
+//        if(pkMap.get("iFatherId")==null){
+//            throw new RuntimeException("获取入库单主表ID失败");
+//        }
+//        transVouchMao.put("ID",pkMap.get("iFatherId"));
+////        transVouchMao.put("ID",oConvertUtils.addOne(getMaxId("ID","TransVouch")));
+//        //获取最大编码
+//        transVouchMao.put("cTVCode",oConvertUtils.addOne(this.baseMapper.getMaxCode("cTVCode","TransVouch","dnmaketime")));
+//        //修改最大编码
+//        this.baseMapper.updateVoucherHistoryCNumber(oConvertUtils.maxNumber(String.valueOf(transVouchMao.get("cTVCode"))),"0304");
+//        //单据日期
+//        Date date=new Date();
+//        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
+//        transVouchMao.put("dTVDate",formatter.format(date));
+//        //转出部门
+//        transVouchMao.put("cODepCode","");
+//
+//        //转出仓库
+//        transVouchMao.put("cOWhCode",rdRecord01Map.get("cWhCode"));
+//        //转入仓库??
+//        //通过接收方查询原材料仓库
+////        String cVenCodeReceiver=rdRecord01Map.get("cVenCodeReceiver").toString();
+//        //获取根据供应商获取仓库编码
+//        String cVenCodeReceiver=String.valueOf(rdRecord01Map.get("cVenCodeReceiver"));
+//        if(rdRecord01Map.get("cVenCodeReceiver")!=null){
+//            Map<String,Object> whCodeMap= this.baseMapper.getWhCodeByVenCode(cVenCodeReceiver);
+//            if(whCodeMap!=null){
+//                if(whCodeMap.get("cVenDefine1")!=null){
+//                    String cWhCode=String.valueOf(whCodeMap.get("cVenDefine1"));//原材料仓库
+//                    transVouchMao.put("cIWhCode",cWhCode);
+//                }else{
+//                    throw new RuntimeException("未找到接收方的原材料仓库");
+//                }
+//            }else{
+//                throw new RuntimeException("未找到接收方");
+//            }
+//
+//        }else{
+//            throw new RuntimeException("接收方编码不能为空");
+//        }
+////        transVouchMao.put("cIWhCode","");
+//        //通过下游订单号获取订单数据
+//        Map<String,Object> OM_MOmainMap=this.baseMapper.getOM_MOmainBycCode(String.valueOf(rdRecords01List.get(0).get("downstreamOrderNumber")));
+//        if(OM_MOmainMap==null){
+//            throw new RuntimeException("未找到下游订单");
+//        }
+//        //转入部门
+//        transVouchMao.put("cIDepCode",OM_MOmainMap.get("cDepCode"));
+//        //订单号
+//        transVouchMao.put("cMPoCode",rdRecords01List.get(0).get("downstreamOrderNumber"));//1
+//        transVouchMao.put("cDefine13",rdRecords01List.get(0).get("downstreamOrderNumber"));//1
+//        //业务员
+//        transVouchMao.put("cPersonCode",OM_MOmainMap.get("cPersonCode"));
+//        this.baseMapper.saveTransVouch(transVouchMao);
+//        String messge="";
+//        List<Map<String,Object>> transVouchsList=new ArrayList<>();
+//        if(rdRecords01List!=null&&rdRecords01List.size()>0){
+//            Integer vI=1;
+//            //循环入库单子表
+//            for(Map<String,Object> recordsMap:rdRecords01List){
+//                Map<String,Object> vouchsMap=new HashMap<>();
+//                //获取下游委外订单行数据
+//                Map<String,Object> mapOMMODetails=this.baseMapper.getOMMODetails(String.valueOf(recordsMap.get("downstreamRowId")));//1
+//                if(mapOMMODetails==null){
+//                    throw new RuntimeException("第"+vI+"行未找到对应下游委外订单表体行");
+//                }
+//                vouchsMap.put("MoDetailsID",mapOMMODetails.get("MODetailsID"));//委外订单子表id
+//                vouchsMap.put("invcode",mapOMMODetails.get("cInvCode"));//产品编码
+//                vouchsMap.put("comcode",rdRecords01List.get(0).get("downstreamOrderNumber"));//委外订单号
+////                vouchsMap.put("cDefine22",recordsMap.get("cDefine22"));//款号
+//                vouchsMap.put("cTVBatch",recordsMap.get("cBatch"));//批号
+//                vouchsMap.put("cInvCode",recordsMap.get("cInvCode"));//存货编码
+//                vouchsMap.put("iTVQuantity",recordsMap.get("iQuantity"));//数量
+//                //获取自由项与自定义项
+//                getcFree(vouchsMap,recordsMap);
+//                //获取批次属性
+//                getcBatchProperty(vouchsMap,recordsMap);
+//
+////                vouchsMap.put("cFree1",recordsMap.get("cFree1"));//颜色
+////                vouchsMap.put("cFree2",recordsMap.get("cFree2"));//尺码
+////                vouchsMap.put("cFree4",recordsMap.get("cFree4"));//光坯门幅
+////                vouchsMap.put("cFree6",recordsMap.get("cFree6"));//克重/工艺
+////                vouchsMap.put("cFree5",recordsMap.get("cFree5"));//品质/品种
+////                vouchsMap.put("cFree3",recordsMap.get("cFree3"));//品质/品种
+////                vouchsMap.put("cFree7",recordsMap.get("cFree7"));//品质/品种
+////                vouchsMap.put("cFree8",recordsMap.get("cFree8"));//品质/品种
+////                vouchsMap.put("cFree9",recordsMap.get("cFree9"));//品质/品种
+////                vouchsMap.put("cFree10",recordsMap.get("cFree10"));//品质/品种
+////                vouchsMap.put("cDefine30",recordsMap.get("cDefine30"));//染厂色号
+//                vouchsMap.put("cbMemo",recordsMap.get("cbMemo"));//备注
+//                vouchsMap.put("cTVCode",transVouchMao.get("cTVCode"));//主表调拨单号
+//                //获取子表最大id
+//                Map<String,Integer> pkMapChild = callGetUAMaxPK2("tr",accID);
+//                if(pkMap.get("iChildId")==null){
+//                    throw new RuntimeException("获取调拨单子表ID失败");
+//                }
+//                vouchsMap.put("autoID",pkMapChild.get("iChildId"));
+////                vouchsMap.put("autoID", oConvertUtils.addOne(getMaxId("autoID","TransVouchs")));//子表id
+//                vouchsMap.put("ID",transVouchMao.get("ID"));//主表ID
+//                //根据存货与自由项找对应子件
+//
+//
+//
+//                List<Map<String,Object>> OM_MOMaterialsList= this.baseMapper.getOM_MOMaterials(vouchsMap);
+//                if(OM_MOMaterialsList!=null&&OM_MOMaterialsList.size()>0){
+//                    if(OM_MOMaterialsList.size()==1){
+//                        vouchsMap.put("iomids",OM_MOMaterialsList.get(0).get("MOMaterialsID"));//委外订单自件id
+//                        //回写调拨数量
+//                        //已领数量
+//                        BigDecimal iSendQTY=getDecimalNew(String.valueOf(OM_MOMaterialsList.get(0).get("iSendQTY")));//已领数量
+//                        //调拨数量
+//                        BigDecimal fTransQty=getDecimalNew(String.valueOf(OM_MOMaterialsList.get(0).get("fTransQty"))).add(getDecimalNew(String.valueOf(vouchsMap.get("iTVQuantity"))));//调拨数量
+////                        if(iSendQTY.doubleValue()>fTransQty.doubleValue()){
+//                        //调拨数量回写到对应委外子件
+//                        Map<String,Object> updateOM_MOMaterials=new HashMap<>();
+//                        updateOM_MOMaterials.put("MOMaterialsID",OM_MOMaterialsList.get(0).get("MOMaterialsID"));//委外订单子件id
+//                        updateOM_MOMaterials.put("fTransQty",fTransQty.doubleValue());//调拨数量
+//                        System.out.println("调拨数量:"+fTransQty.doubleValue());
+//                        this.baseMapper.updateOM_MOMaterialsfTransQty(updateOM_MOMaterials);
+////                        }else{
+////                            throw new RuntimeException("第"+vI+"调拨数量不能大于子件已领数量");
+////                        }
+//                    }else{
+//                        throw new RuntimeException("第"+vI+"行找到多个对应下游委外订单子件行");
+//                    }
+//                }else{
+//                    throw new RuntimeException("第"+vI+"行未找到对应下游委外订单子件行");
+//                }
+//                vouchsMap.put("irowno",recordsMap.get("irowno"));//行号
+//                this.baseMapper.saveTransVouchs(vouchsMap);
+//                transVouchsList.add(vouchsMap);
+//            }
+//        }
+//
+//        if(StringUtils.isNotBlank(messge)){
+//
+//        }
+//        //保存其他出库单
+//        saveRdRecord09(transVouchMao,transVouchsList);
+//        //保存其他入库单
+//        saveRdRecord08(transVouchMao,transVouchsList);
+//
+//    }
+
+
 }