外购入库单 (源单:收料通知单)、其他入库单(源单:入库申请单),新增不同源单合并下推生单方法;生产领料单上传方法(旧)增加递入FOwnerTypeId
1个文件已修改
793 ■■■■■ 已修改文件
CLOUDWEB/WebService1.asmx.cs 793 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CLOUDWEB/WebService1.asmx.cs
@@ -18904,7 +18904,6 @@
                            "\"FMATERIALID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FMATERIALID"]) + "\"} ,  " +
                            "\"FSTOCKID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSTOCKID"]) + "\"}," +
                            sJson_StockPlace +
                            sJson_BatchNo +
                            //"\"FStockLocId\":{\"FSTOCKLOCID__FF100002\":{\"FNUMBER\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FStockLocId"]) + "\"}}," +
                            "\"FAPPQTY\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FAPPQTY"]) + ", " +
                            "\"FACTUALQTY\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FACTUALQTY"]) + ", " +
@@ -18924,6 +18923,7 @@
                            "\"FEntrySrcEntrySeq\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntrySrcEntrySeq"]) + "\" , " +
                            "\"FPARENTOWNERTYPEID\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FPARENTOWNERTYPEID"]) + "\" , " +
                            "\"FPARENTOWNERID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["HPARENTOWNERID"]) + "\"} , " +
                            "\"FOwnerTypeId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FOwnerTypeId"]) + "\"," +
                            "\"FOWNERID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["HOWNERID"]) + "\"} , " +
                            "\"FEntity_Link\": [ {  " +
                            "\"FEntity_Link_FFlowId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntity_Link_FFlowId"]) + "\" ,  " +
@@ -26900,7 +26900,6 @@
            }
        }
        /// <summary>
        /// 外购入库单   (源单:采购订单)
        /// </summary>
@@ -27301,6 +27300,439 @@
            else
            {
                LogService.Write("生成采购入库单(源单:采购订单)成功!" + sRemark);
                sErrMsg = "生成采购入库单成功!单据号为:" + oMain.HBillNo;
                return true;
            }
        }
        /// <summary>
        /// 外购入库单   (源单:收料通知单)  多行数据合并下推生单
        /// </summary>
        /// <param name="oMain"></param>
        /// <param name="sErrMsg"></param>
        /// <returns></returns>
        public bool SavePOStockInBill_POInStock_CLD_Merge(Model.ClsKf_POStockInBillMain oMain, string sHSourceType, Pub_Class.ClsXt_SystemParameterMain oSystemParameterMain, ref string sErrMsg)
        {
            string sRemark = "";
            //从配置文件获取 CLOUD网址、账套信息、登录用户、登录密码
            if (!Pub_Class.ClsPub.GetCLOUDLoginInfo(ref Pub_Class.ClsPub.sExeReturnInfo))
            {
                sErrMsg = Pub_Class.ClsPub.sExeReturnInfo;
                return false;
            }
            //获取CLOUD账号密码
            string sCLOUDUseName = Pub_Class.ClsPub.sCLOUDUseName;
            string sCLOUDPsd = Pub_Class.ClsPub.sCLOUDPsd;
            DataSet ds11 = get_SaveCLOUDUseNameandPsd(oMain.HInterID);
            if (ds11 == null || ds11.Tables[0].Rows.Count == 0)
            {
            }
            else
            {
                sCLOUDUseName = DBUtility.ClsPub.isStrNull(ds11.Tables[0].Rows[0]["HCloudUserName"]);
                sCLOUDPsd = DBUtility.ClsPub.isStrNull(ds11.Tables[0].Rows[0]["HCloudUserPsd"]);
            }
            string HReturn;
            ApiClient client = new ApiClient(Pub_Class.ClsPub.sCLOUDUrl);
            string dbId = Pub_Class.ClsPub.sCLOUDAcc; //AotuTest117
            bool bLogin = client.Login(dbId, sCLOUDUseName, sCLOUDPsd, 2052);
            SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
            sRemark = sRemark + " ;获取验证CLOUD账号密码" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:ffff");
            try
            {
                //判断会计期是否合理
                string s = "";
                int sYear = 0;
                int sPeriod = 0;
                if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(oMain.HDate, ref sYear, ref sPeriod, ref s) == false)
                {
                    sErrMsg = s;
                    return false;
                }
                oMain.HYear = sYear;
                oMain.HPeriod = sPeriod;
                oCn.BeginTran();
                //生成出入库单据
                //插入子表
                oCn.RunProc("EXEC h_p_Kf_POStockInBillSub_Insert_New " + oMain.HInterID.ToString() + ",'" + oMain.HBillNo + "','" + sHSourceType + "'");
                //插入主表
                oCn.RunProc("Insert Into Kf_ICStockBillMain   " +
                "(HBillType,HBillSubType,HInterID,HBillNo,HDate,HMainSourceBillType" +
                ",HYear,HPeriod,HRemark,HMaker,HMakeDate" +
                ",HSupID,HWHID,HSCWHID,HEmpID,HManagerID,HSecManagerID" +
                ",HKeeperID,HDeptID,HExplanation,HInnerBillNo,HRedBlueFlag" +
                ",HSTOCKORGID,HOWNERID" +
                ") " +
                " values('1201','1201'," + oMain.HInterID.ToString() + ",'" + oMain.HBillNo + "',convert(varchar(10),getdate(),120),'" + oMain.HMainSourceBillType + "'" +
                ", " + oMain.HYear.ToString() + "," + oMain.HPeriod.ToString() + ",'" + oMain.HRemark + "','" + oMain.HMaker + "',convert(varchar(10),getdate(),120)" +
                ", " + oMain.HSupID.ToString() + "," + oMain.HWHID.ToString() + "," + oMain.HSCWHID.ToString() + "," + oMain.HEmpID.ToString() + "," + oMain.HManagerID.ToString() + "," + oMain.HSecManagerID.ToString() +
                ", " + oMain.HKeeperID.ToString() + "," + oMain.HDeptID.ToString() + ",'" + oMain.HExplanation + "','" + oMain.HInnerBillNo + "'," + DBUtility.ClsPub.BoolToString(oMain.HRedBlueFlag) +
                ", " + oMain.HSTOCKORGID.ToString() + "," + oMain.HOWNERID.ToString() +
                ") ");
                //更新关联数量
                oCn.RunProc("exec h_p_Cg_UpDateRelation_POInStockToPOStockIn_Add " + oMain.HInterID.ToString());
                sRemark = sRemark + " ;生成出入库单据" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:ffff");
                //判断是否启用器具管理,系统参数  启用器具管理
                if (oSystemParameterMain.WMS_MouldManagerCtl == "Y")
                {
                    string HMouldBillType = "3803";
                    oCn.RunProc("EXEC h_p_Sc_MouldStockBill_Insert_New " + oMain.HInterID.ToString() + ",'" + oMain.HBillType + "','" + HMouldBillType + "'," + oMain.HSupID.ToString() + "," + oMain.HKeeperID.ToString() + "," + oMain.HSecManagerID.ToString() + "," + oMain.HDeptID.ToString() + ",1");
                }
                sRemark = sRemark + " ;判断是否启用器具管理" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:ffff");
                //根据TMP表 返回 信息
                DataSet Ds;
                if (oSystemParameterMain.WMS_CloudMode == "N") //系统参数  是否为私有云模式(N为公有云模式,Y为私有云模式)
                {
                    Ds = oCn.RunProcReturn("exec h_p_Kf_GetPOStockInBill_POInStock_PUBCLD_New " + oMain.HInterID.ToString() + ",'" + oMain.HBillNo + "'", "h_p_Kf_GetPOStockInBill_POInStock_PUBCLD_New");
                    sRemark = sRemark + " ;公有云模式";
                }
                else
                {
                    Ds = oCn.RunProcReturn("exec h_p_Kf_GetPOStockInBill_POInStock_CLD_Merge " + oMain.HInterID.ToString() + ",'" + oMain.HBillNo + "'", "h_p_Kf_GetPOStockInBill_POInStock_CLD_Merge");
                    sRemark = sRemark + " ;私有云模式";
                }
                if (Ds == null || Ds.Tables[0].Rows.Count == 0 || Ds.Tables[1].Rows.Count == 0)
                {
                    sErrMsg = "获取子表信息失败!";
                    oCn.RollBack();
                    return false;
                }
                else
                {
                    string sJson_MainCustom = "";   //主表自定义字段
                    sJson_MainCustom = Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["MainCustom"]);
                    string sJson_Main = "{\"Creator\":\"\",\"NeedUpDateFields\":[],\"NeedReturnFields\":[],\"IsDeleteEntry\":\"True\",\"SubSystemId\":\"\",\"IsVerifyBaseDataField\":\"false\"," +
                        "\"IsEntryBatchFill\":\"True\",\"ValidateFlag\":\"True\",\"NumberSearch\":\"True\",\"InterationFlags\":\"\"," +
                        "\"Model\": { \"FBILLNO\":\"" + oMain.HBillNo + "\"," +
                        //\"FID\":\"0\",
                        "\"FBillTypeID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FBillTypeID"]) + "\"}," +
                        //\"FBillNo\":\"\",
                        "\"FDate\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FDate"]) + "\"," +
                        "\"FStockOrgId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FStockOrgId"]) + "\"}," +
                        "\"FStockDeptId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FStockDeptId"]) + "\"}," +
                        "\"FStockerGroupId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FStockerGroupId"]) + "\"}," +
                        "\"FStockerId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FStockerId"]) + "\"}," +
                        "\"FDemandOrgId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FDemandOrgId"]) + "\"}," +
                        "\"FCorrespondOrgId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FCorrespondOrgId"]) + "\"}," +
                        "\"FPurchaseOrgId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FPurchaseOrgId"]) + "\"}," +
                        "\"FPurchaseDeptId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FPurchaseDeptId"]) + "\"}," +
                        "\"FPurchaserGroupId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FPurchaserGroupId"]) + "\"}," +
                        "\"FPurchaserId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FPurchaserId"]) + "\"}," +
                        //"\"FSupplierId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FSupplierId"]) + "\"}," +  //移最下方
                        "\"FSupplyId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FSupplyId"]) + "\"}," +
                        "\"FSupplyAddress\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FSupplyAddress"]) + "\"," +
                        "\"FSettleId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FSettleId"]) + "\"}," +
                        "\"FChargeId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FChargeId"]) + "\"}," +
                        "\"FOwnerTypeIdHead\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FOwnerTypeIdHead"]) + "\"," +
                        "\"FOwnerIdHead\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FOwnerIdHead"]) + "\"}," +
                        //\"FConfirmerId\":{\"FUserID\":\"\"},
                        //\"FConfirmDate\":\"1900-01-01\",
                        //\"FScanBox\":\"\",
                        //\"FCDateOffsetUnit\":\"\",
                        //\"FCDateOffsetValue\":\"0\",
                        "\"FProviderContactID\":{\"FCONTACTNUMBER\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FProviderContactID"]) + "\"}," +
                        //
                        "\"FDeliveryBill\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FDeliveryBill"]) + "\"," +
                        "\"FTakeDeliveryBill\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FTakeDeliveryBill"]) + "\"," +
                        "\"FBusinessType\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FBusinessType"]) + "\"," +
                        "\"FSupplierId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FSupplierId"]) + "\"}," +
                        sJson_MainCustom +
                        "\"FInStockFin\":{" +
                        //\"FEntryId\":\"0\",
                        "\"FPayOrgId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FPayOrgId"]) + "\"}," +
                        "\"FSettleOrgId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FSettleOrgId"]) + "\"}," +
                        "\"FSettleTypeId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FSettleTypeId"]) + "\"}," +
                        "\"FPayConditionId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FPayConditionId"]) + "\"}," +
                        "\"FSettleCurrId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FSettleCurrId"]) + "\"}," +
                        "\"FIsIncludedTax\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FIsIncludedTax"]) + "," +
                        "\"FPriceTimePoint\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FPriceTimePoint"]) + "\"," +
                        //\"FPriceListId\":{\"FNumber\":\"\"},
                        //\"FDiscountListId\":{\"FNumber\":\"\"},
                        "\"FLocalCurrId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FLocalCurrId"]) + "\"}," +
                        "\"FExchangeTypeId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FExchangeTypeId"]) + "\"}," +
                        "\"FExchangeRate\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FExchangeRate"]) + "," +
                        "\"FISPRICEEXCLUDETAX\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FISPRICEEXCLUDETAX"]) + "}," +
                         "\"FInStockEntry\": [  ";
                    string sJson_Entry = "";
                    for (int i = 0; i < Ds.Tables[1].Rows.Count; i++)
                    {
                        if (sJson_Entry != "")
                        {
                            sJson_Entry = sJson_Entry + " , ";
                        }
                        string sJson_BatchNo = "";
                        string sJson_StockPlace = "";
                        string sJson_FProduceDate = "";     //生产日期
                        string sJson_FExpiryDate = "";      //有效期至
                        string sJson_FAUXPROPID = "";       //辅助属性
                        string sJson_SubCustom = "";        //子表自定义字段
                        string sJson_Entry_Link = "";       //Link表递入数据
                        //子表自定义字段
                        sJson_SubCustom = Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["SubCustom"]);
                        //是否启用批次管理
                        if (Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["HISBATCHMANAGE"]) == "1")
                        {
                            sJson_BatchNo = "  \"FLOT\": {\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FLOT"]) + "\"},    \"FLOT_TEXT\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FLOT"]) + "\"  , " +    //批号
                                            "  \"FReceiveLot\": {\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FReceiveLot"]) + "\"},    \"FReceiveLot_TEXT\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FReceiveLot"]) + "\"  , ";    //收货批号
                        }
                        else
                        {
                            sJson_BatchNo = "";
                        }
                        //是否启用保质期控制
                        if (Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FISKFPERIOD"]) == "1")
                        {
                            sJson_FProduceDate = " \"FProduceDate\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FProduceDate"]) + "\",";
                            sJson_FExpiryDate = " \"FExpiryDate\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FExpiryDate"]) + "\",";
                        }
                        else
                        {
                            sJson_FProduceDate = "";
                            sJson_FExpiryDate = "";
                        }
                        //辅助属性
                        sJson_FAUXPROPID = " \"FAUXPROPID\":{\"FAUXPROPID__FF100002\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FAUXPROPID"]) + "\"}},";
                        //仓位
                        if (Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FStockLocId"]) == "")
                        {
                            sJson_StockPlace = "";
                        }
                        else
                        {
                            sJson_StockPlace = Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FStockLocId"]) + "\"}},";
                        }
                        //Link表递入数据
                        for (int j = 0; j < Ds.Tables[2].Rows.Count; j++)
                        {
                            if (Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["HEntryID"]) == Pub_Class.ClsPub.isStrNull(Ds.Tables[2].Rows[j]["HEntryID"]))
                            {
                                if (sJson_Entry_Link != "")
                                {
                                    sJson_Entry_Link = sJson_Entry_Link + " , ";
                                }
                                sJson_Entry_Link = sJson_Entry_Link + "{" +
                                    " \"FInStockEntry_Link_FFlowId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[2].Rows[j]["FEntity_Link_FFlowId"]) + "\"," +
                                    " \"FInStockEntry_Link_FFlowLineId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[2].Rows[j]["FEntity_Link_FFlowLineId"]) + "\"," +
                                    " \"FInStockEntry_Link_FRuleId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[2].Rows[j]["FEntity_Link_FRuleId"]) + "\"," +
                                    " \"FInStockEntry_Link_FSTableName\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[2].Rows[j]["FEntity_Link_FSTableName"]) + "\"," +
                                    " \"FInStockEntry_Link_FSBillId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[2].Rows[j]["FEntity_Link_FSBillId"]) + "\"," +
                                    " \"FInStockEntry_Link_FBASEUNITQTYOLD\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[2].Rows[j]["FEntity_Link_FBASEUNITQTYOLD"]) + "\"," +
                                    " \"FInStockEntry_Link_FREMAININSTOCKBASEQTYOLD\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[2].Rows[j]["FEntity_Link_FREMAININSTOCKBASEQTYOLD"]) + "\"," +
                                    " \"FInStockEntry_Link_FSId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[2].Rows[j]["FEntity_Link_FSId"]) + "\"" +
                                " } ";
                            }
                        }
                        sJson_Entry = sJson_Entry + "{" +
                        //{\"FEntryID\":\"0\",
                        "\"FRowType\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FRowType"]) + "\"," +
                        //\"FWWInType\":\"\",
                        "\"FMaterialId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FMaterialId"]) + "\"}," +
                        "\"FUnitID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FUnitID"]) + "\"}," +
                        //"\"FAuxPropId\":{\"FAUXPROPID__FF100002\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FAuxPropId"]) + "\"}}," +
                        sJson_FAUXPROPID +
                        "\"FParentMatId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FParentMatId"]) + "\"}," +
                        "\"FRealQty\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FRealQty"]) + "," +
                        "\"FPriceUnitID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FPriceUnitID"]) + "\"}," +
                        "\"FPrice\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FPrice"]) + "," +
                        "\"FTaxCombination\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FTaxCombination"]) + "\"}," +
                        sJson_BatchNo +
                        "\"FStockId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FStockId"]) + "\"}," +
                        //\"FDisPriceQty\":\"0\",
                        sJson_StockPlace +
                        "\"FStockStatusId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FStockStatusId"]) + "\"}," +
                        //\"FMtoNo\":\"\",
                        "\"FGiveAway\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FGiveAway"]) + "," +
                        //\"FNote\":\"\",
                        sJson_FProduceDate +
                        "\"FExtAuxUnitId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FExtAuxUnitId"]) + "\"}," +
                        //\"FExtAuxUnitQty\":\"0\",
                        "\"FCheckInComing\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FCheckInComing"]) + "," +
                        "\"FProjectNo\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FProjectNo"]) + "\"," +
                        "\"FSampleDamageQty\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSampleDamageQty"]) + "," +
                        "\"FSampleDamageBaseQty\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSampleDamageBaseQty"]) + "," +
                        "\"FIsReceiveUpdateStock\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FIsReceiveUpdateStock"]) + "," +
                        //\"FInvoicedJoinQty\":\"0\",
                        "\"FPriceBaseQty\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FPriceBaseQty"]) + "," +
                        //\"FSetPriceUnitID\":{\"FNumber\":\"\"},
                        "\"FRemainInStockUnitId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FRemainInStockUnitId"]) + "\"}," +
                        "\"FBILLINGCLOSE\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FBILLINGCLOSE"]) + "," +
                        "\"FRemainInStockQty\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FRemainInStockQty"]) + "," +
                        "\"FAPNotJoinQty\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FAPNotJoinQty"]) + "," +
                        "\"FRemainInStockBaseQty\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FRemainInStockBaseQty"]) + "," +
                        "\"FTaxPrice\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FTaxPrice"]) + "," +
                        "\"FEntryTaxRate\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntryTaxRate"]) + "," +
                        "\"FDiscountRate\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FDiscountRate"]) + "," +
                        //\"FCostPrice\":\"0\",
                        "\"FBOMId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FBOMId"]) + "\"}," +
                        "\"FSupplierLot\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSupplierLot"]) + "\"," +
                        sJson_FExpiryDate +
                        "\"FAuxUnitQty\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FAuxUnitQty"]) + "," +
                        //\"FBeforeDisPriceQty\":\"0\",
                        //
                        "\"FReqTraceNo\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FReqTraceNo"]) + "\"," +
                        "\"FPriceCoefficient\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FPriceCoefficient"]) + "," +
                        "\"FPriceUnitQty\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FPriceUnitQty"]) + "," +
                        "\"FBaseUnitID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FBaseUnitID"]) + "\"}," +
                        "\"FAuxUnitID\":{ \"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FAuxUnitID"]) + "\" }," +
                        "\"FPOOrderNo\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FPOOrderNo"]) + "\"," +
                        "\"FReceiveStockStatus\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FReceiveStockStatus"]) + "\"}," +
                        "\"FSRCBillNo\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSRCBillNo"]) + "\"," +
                        "\"FKeeperTypeId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FKeeperTypeId"]) + "\"," +
                        "\"FKeeperID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FKeeperID"]) + "\"}," +
                        "\"FOWNERID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FOWNERID"]) + "\"}," +
                        "\"FReceiveOwnerTypeId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FReceiveOwnerTypeId"]) + "\"," +
                        "\"FReceiveOwnerId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FReceiveOwnerId"]) + "\"}," +
                        //"\"FReceiveStockID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FReceiveStockID"]) + "\"}," +
                        "\"FMtoNo\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FMtoNo"]) + "\"," +
                        "\"FSNUnitID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSNUnitID"]) + "\"}," +
                        "\"FReceiveMtoNo\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FReceiveMtoNo"]) + "\"," +
                        "\"FSRCBIZUNITID\":{ \"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSRCBIZUNITID"]) + "\"}," +
                        "\"FPOORDERENTRYID\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FPOORDERENTRYID"]) + "," +
                        "\"FPriceListEntry\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FPriceListEntry"]) + "\"}," +
                        "\"FBaseUnitQty\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FBaseUnitQty"]) + "," +
                        "\"FMustQty\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FMustQty"]) + "," +
                        "\"FPURBASENUM\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FPURBASENUM"]) + "," +
                        "\"FStockBaseDen\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FStockBaseDen"]) + "," +
                        "\"FSRCBILLTYPEID\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSRCBILLTYPEID"]) + "\"," +
                        sJson_SubCustom +
                        //\"FEntryPruCost\":[{\"FDetailID\":\"0\"}],
                        "\"FTaxDetailSubEntity\":[{" +
                        //\"FDetailID\":\"0\",
                        "\"FTaxRate\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FTaxRate"]) + "," +
                        "\"FTaxAmount\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FTaxAmount"]) + "," +
                        "\"FTaxRateId\":{ \"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FTaxRateId"]) + "\" }," +
                        "\"FCostPercent\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FCostPercent"]) + "," +
                        "\"FTaxCostAmount\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FTaxCostAmount"]) + "," +
                        "\"FVAT\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FVAT"]) + "\"," +
                        "\"FSellerWithholding\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSellerWithholding"]) + "\"," +
                        "\"FBuyerWithholding\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FBuyerWithholding"]) + "\"" +
                        " } ]," +
                        //\"FSerialSubEntity\":[{\"FDetailID\":\"0\",
                        //\"FSerialNo\":\"\",
                        //\"FSerialNote\":\"\"}]
                        " \"FInStockEntry_Link\": [ " +
                        sJson_Entry_Link +
                        "]," +
                        " \"FBFLowId\":{\"FID\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FBFLowId"]) + "\"}}";
                    }
                    string sJson_End = "  ]  }}";
                    string sJson = sJson_Main + sJson_Entry + sJson_End;
                    sRemark = sRemark + " ;获取CLOUD单据API递入值" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:ffff");
                    //生成金蝶云单据
                    if (bLogin)
                    {
                        var result = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Save",
                        new object[] { "STK_InStock", sJson });
                        sRemark = sRemark + " ;生成CLOUD单据" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:ffff");
                        //生成单据后更新自定义字段
                        oCn.RunProc("exec h_p_Sc_UpDateSelfFildPOStockIn '" + oMain.HBillNo + "','" + sHSourceType + "'");
                        sRemark = sRemark + " ;生成单据后回填字段信息" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:ffff");
                        HReturn = result.ToString();
                        if (HReturn.Contains("\"IsSuccess\":false") == true)
                        {
                            sErrMsg = "生成采购入库单失败!" + HReturn;
                            LogService.Write("生成采购入库单(源单:收料通知单),多行数据合并下推生单失败!" + HReturn + sJson);   //写入txt文本
                            oCn.RollBack();
                            return false;
                        }
                        else
                        {
                            sRemark = sRemark + sJson;
                            oCn.Commit();
                        }
                    }
                    else
                    {
                        sErrMsg = "生成采购入库单失败!金蝶云登录失败!";
                        oCn.RollBack();
                        return false;
                    }
                }
            }
            catch (Exception e)
            {
                LogService.Write("生成回滚" + sRemark);
                sErrMsg = "生成采购入库单失败!" + e.Message;
                oCn.RollBack();
                return false;
            }
            if (oSystemParameterMain.Kf_POStockInBill_AutoCheck == "Y") //系统参数  自动审核
            {
                try
                {
                    oCn.BeginTran();
                    //审核WMS单据
                    oCn.RunProc("Update Kf_ICStockBillMain Set HChecker='" + oMain.HMaker + "',HCheckDate=convert(varchar(10),getdate(),120) where HInterID= " + oMain.HInterID.ToString());
                    //提交、审核金蝶云单据
                    HReturn = "";
                    string sJson2 = "{\"CreateOrgId\":0,\"Numbers\":[\"" + oMain.HBillNo + "\"]}";
                    var result2 = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Submit",
                    new object[] { "STK_InStock", sJson2 });
                    string sJson3 = "{\"CreateOrgId\":0,\"Numbers\":[\"" + oMain.HBillNo + "\"]}";
                    var result3 = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Audit",
                    new object[] { "STK_InStock", sJson3 });
                    HReturn = result2.ToString() + "," + result3.ToString();
                    if (HReturn.Contains("\"IsSuccess\":false") == true)
                    {
                        LogService.Write("审核单据失败" + sRemark);
                        sErrMsg = "生成采购入库单成功,审核单据失败!" + HReturn;
                        oCn.RollBack();
                        return true;
                    }
                    else
                    {
                        LogService.Write("生成并审核采购入库单(源单:收料通知单),多行数据合并下推生单成功!" + sRemark);
                        sErrMsg = "生成并审核采购入库单成功!单据号为:" + oMain.HBillNo;
                        oCn.Commit();
                        return true;
                    }
                }
                catch (Exception e)
                {
                    LogService.Write("审核回滚" + sRemark);
                    sErrMsg = "审核采购入库单失败!" + e.Message;
                    oCn.RollBack();
                    return false;
                }
            }
            else
            {
                LogService.Write("生成采购入库单(源单:收料通知单),多行数据合并下推生单成功!" + sRemark);
                sErrMsg = "生成采购入库单成功!单据号为:" + oMain.HBillNo;
                return true;
            }
@@ -33240,7 +33672,7 @@
        }
        /// <summary>
        /// 其他入库单   源单:入库申请单
        /// 其他入库单   源单:入库申请单    森楷专用
        /// </summary>
        /// <param name="oMain"></param>
        /// <param name="sErrMsg"></param>
@@ -33577,6 +34009,361 @@
            }
        }
        /// <summary>
        /// 其他入库单   源单:入库申请单    多行数据合并下推生单    森楷专用
        /// </summary>
        /// <param name="oMain"></param>
        /// <param name="sErrMsg"></param>
        /// <returns></returns>
        public bool SaveOtherInBill_StockInRequest_CLD_Merge_SenKai(Model.ClsKf_OtherInBillMain oMain, string sHSourceType, Pub_Class.ClsXt_SystemParameterMain oSystemParameterMain, ref string sErrMsg)
        {
            string sRemark = "";
            //从配置文件获取 CLOUD网址、账套信息、登录用户、登录密码
            if (!Pub_Class.ClsPub.GetCLOUDLoginInfo(ref Pub_Class.ClsPub.sExeReturnInfo))
            {
                sErrMsg = Pub_Class.ClsPub.sExeReturnInfo;
                return false;
            }
            //获取CLOUD账号密码
            string sCLOUDUseName = Pub_Class.ClsPub.sCLOUDUseName;
            string sCLOUDPsd = Pub_Class.ClsPub.sCLOUDPsd;
            DataSet ds11 = get_SaveCLOUDUseNameandPsd(oMain.HInterID);
            if (ds11 == null || ds11.Tables[0].Rows.Count == 0)
            {
            }
            else
            {
                sCLOUDUseName = DBUtility.ClsPub.isStrNull(ds11.Tables[0].Rows[0]["HCloudUserName"]);
                sCLOUDPsd = DBUtility.ClsPub.isStrNull(ds11.Tables[0].Rows[0]["HCloudUserPsd"]);
            }
            string HReturn;
            ApiClient client = new ApiClient(Pub_Class.ClsPub.sCLOUDUrl);
            string dbId = Pub_Class.ClsPub.sCLOUDAcc; //AotuTest117
            bool bLogin = client.Login(dbId, sCLOUDUseName, sCLOUDPsd, 2052);
            SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
            sRemark = sRemark + " ;获取验证CLOUD账号密码" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:ffff");
            try
            {
                //判断会计期是否合理
                string s = "";
                int sYear = 0;
                int sPeriod = 0;
                if (oSystemParameterMain.WMS_BillDateMode == "N") //系统参数  单据日期是否取界面递入日期
                {
                    oMain.HDate = DateTime.Today;
                }
                if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(oMain.HDate, ref sYear, ref sPeriod, ref s) == false)
                {
                    sErrMsg = s;
                    return false;
                }
                oMain.HYear = sYear;
                oMain.HPeriod = sPeriod;
                oCn.BeginTran();
                //生成出入库单据
                //插入子表
                oCn.RunProc("EXEC h_p_Kf_OtherInBillSub_Insert_New " + oMain.HInterID.ToString() + ",'" + oMain.HBillNo + "','" + sHSourceType + "'");
                //插入主表
                oCn.RunProc("Insert Into Kf_ICStockBillMain   " +
                "(HBillType,HBillSubType,HInterID,HBillNo,HDate,HMainSourceBillType" +
                ",HYear,HPeriod,HRemark,HMaker,HMakeDate" +
                ",HSupID,HWHID,HSCWHID,HEmpID,HManagerID,HSecManagerID" +
                ",HKeeperID,HDeptID,HExplanation,HInnerBillNo,HRedBlueFlag" +
                ",HStockStyle" +
                ",HSTOCKORGID,HOWNERID" +
                ") " +
                " values('1203','1203'," + oMain.HInterID.ToString() + ",'" + oMain.HBillNo + "','" + oMain.HDate.ToShortDateString() + "','" + oMain.HMainSourceBillType + "'" +
                ", " + oMain.HYear.ToString() + "," + oMain.HPeriod.ToString() + ",'" + oMain.HRemark + "','" + oMain.HMaker + "',convert(varchar(10),getdate(),120)" +
                ", " + oMain.HSupID.ToString() + "," + oMain.HWHID.ToString() + "," + oMain.HSCWHID.ToString() + "," + oMain.HEmpID.ToString() + "," + oMain.HManagerID.ToString() + "," + oMain.HSecManagerID.ToString() +
                ", " + oMain.HKeeperID.ToString() + "," + oMain.HDeptID.ToString() + ",'" + oMain.HExplanation + "','" + oMain.HInnerBillNo + "'," + DBUtility.ClsPub.BoolToString(oMain.HRedBlueFlag) +
                ",'" + oMain.HStockStyle + "'" +
                ", " + oMain.HSTOCKORGID.ToString() + "," + oMain.HOWNERID.ToString() +
                ") ");
                //更新关联数量
                oCn.RunProc("exec h_p_Kf_UpDateRelation_StockInRequestToOtherIn_Add " + oMain.HInterID.ToString());
                sRemark = sRemark + " ;生成出入库单据" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:ffff");
                //根据TMP表 返回 信息
                DataSet Ds;
                Ds = oCn.RunProcReturn("exec h_p_Kf_GetOtherInBill_StockInRequest_CLD_Merge_SenKai " + oMain.HInterID.ToString() + ",'" + oMain.HBillNo + "'", "h_p_Kf_GetOtherInBill_StockInRequest_CLD_Merge_SenKai");
                if (Ds == null || Ds.Tables[0].Rows.Count == 0 || Ds.Tables[1].Rows.Count == 0)
                {
                    sErrMsg = "获取子表信息失败!";
                    oCn.RollBack();
                    return false;
                }
                else
                {
                    string sJson_MainCustom = "";    //主表自定义字段
                    string sJson_Date = "";         //单据日期
                    sJson_MainCustom = Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["MainCustom"]);
                    if (oSystemParameterMain.WMS_BillDateMode == "Y") //系统参数  单据日期是否取界面递入日期
                    {
                        sJson_Date = "\"FDATE\":\"" + oMain.HDate.ToShortDateString() + "\",";
                    }
                    else
                    {
                        sJson_Date = "\"FDATE\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FDATE"]) + "\",";
                    }
                    string sJson_Main = "{\"Creator\":\"\",\"NeedUpDateFields\":[],\"NeedReturnFields\":[],\"IsDeleteEntry\":\"True\",\"SubSystemId\":\"\",\"IsVerifyBaseDataField\":\"false\",\"IsEntryBatchFill\":\"True\",\"ValidateFlag\":\"True\",\"NumberSearch\":\"True\",\"InterationFlags\":\"\"," +
                        "\"Model\":{ " +
                        //"FID": 0,
                        "\"FBillNo\":\"" + oMain.HBillNo + "\"," +
                        "\"FBillTypeID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FBillTypeID"]) + "\"}," +
                        "\"FStockOrgId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FStockOrgId"]) + "\"}," +
                        "\"FStockDirect\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FStockDirect"]) + "\"," +
                        sJson_Date +
                        "\"FSUPPLIERID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FSUPPLIERID"]) + "\"}," +
                        "\"FDeptId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FDeptId"]) + "\"}," +
                        "\"FACCEPTANCE\":{\"FStaffNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FACCEPTANCE"]) + "\"}," +
                        "\"FStockerId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FStockerId"]) + "\"}," +
                        "\"FSTOCKERGROUPID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FSTOCKERGROUPID"]) + "\"}," +
                        "\"FOwnerTypeIdHead\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FOwnerTypeIdHead"]) + "\"," +
                        "\"FOwnerIdHead\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FOwnerIdHead"]) + "\"}," +
                        "\"FNOTE\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FNOTE"]) + "\"," +
                        "\"FBaseCurrId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FBaseCurrId"]) + "\"}," +
                        //"FScanBox": "",
                        //"F_paez_Text": "",
                        sJson_MainCustom +
                        "\"FEntity\":[";
                    string sJson_Entry = "";
                    for (int i = 0; i < Ds.Tables[1].Rows.Count; i++)
                    {
                        if (sJson_Entry != "")
                        {
                            sJson_Entry = sJson_Entry + " , ";
                        }
                        string sJson_BatchNo = "";          //批号
                        string sJson_StockPlace = "";       //仓位
                        string sJson_FAUXPROPID = "";       //辅助属性
                        string sJson_FProduceDate = "";     //生产日期
                        string sJson_FExpiryDate = "";      //有效期至
                        string sJson_SubCustom = "";        //子表自定义字段
                        string sJson_Entry_Link = "";       //Link表递入数据
                        //子表自定义字段
                        sJson_SubCustom = Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["SubCustom"]);
                        //是否启用批次管理
                        if (Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["HISBATCHMANAGE"]) == "1")
                        {
                            sJson_BatchNo = "  \"FLOT\": {\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FLOT"]) + "\"},    \"FLOT_TEXT\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FLOT"]) + "\"  , ";
                        }
                        else
                        {
                            sJson_BatchNo = "";
                        }
                        //仓位
                        if (Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FStockLocId"]) == "")
                        {
                            sJson_StockPlace = "";
                        }
                        else
                        {
                            sJson_StockPlace = Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FStockLocId"]) + "\"}},";
                        }
                        //辅助属性
                        sJson_FAUXPROPID = " \"FAUXPROPID\":{\"FAUXPROPID__FF100003\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FAUXPROPID"]) + "\"}},";
                        //是否启用保质期控制
                        if (Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FISKFPERIOD"]) == "1")
                        {
                            sJson_FProduceDate = " \"FProduceDate\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FProduceDate"]) + "\",";
                            sJson_FExpiryDate = " \"FExpiryDate\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FExpiryDate"]) + "\",";
                        }
                        else
                        {
                            sJson_FProduceDate = "";
                            sJson_FExpiryDate = "";
                        }
                        //Link表递入数据
                        for (int j = 0; j < Ds.Tables[2].Rows.Count; j++)
                        {
                            if (Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["HEntryID"]) == Pub_Class.ClsPub.isStrNull(Ds.Tables[2].Rows[j]["HEntryID"]))
                            {
                                if (sJson_Entry_Link != "")
                                {
                                    sJson_Entry_Link = sJson_Entry_Link + " , ";
                                }
                                sJson_Entry_Link = sJson_Entry_Link + "{" +
                                    " \"FEntity_Link_FFlowId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[2].Rows[j]["FEntity_Link_FFlowId"]) + "\"," +
                                    " \"FEntity_Link_FFlowLineId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[2].Rows[j]["FEntity_Link_FFlowLineId"]) + "\"," +
                                    " \"FEntity_Link_FRuleId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[2].Rows[j]["FEntity_Link_FRuleId"]) + "\"," +
                                    " \"FEntity_Link_FSTableName\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[2].Rows[j]["FEntity_Link_FSTableName"]) + "\"," +
                                    " \"FEntity_Link_FSBillId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[2].Rows[j]["FEntity_Link_FSBillId"]) + "\"," +
                                    " \"FEntity_Link_FBASEQTYOLD\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[2].Rows[j]["FEntity_Link_FBASEQTYOLD"]) + "\"," +
                                    " \"FEntity_Link_FSId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[2].Rows[j]["FEntity_Link_FSId"]) + "\"" +
                                " } ";
                            }
                        }
                        sJson_Entry = sJson_Entry + "{" +
                        //"FEntryID": 0,
                        " \"FInStockType\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FInStockType"]) + "\"," +
                        " \"FMaterialId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FMaterialId"]) + "\"}," +
                        " \"FUnitID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FUnitID"]) + "\"}," +
                        " \"FStockId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FStockId"]) + "\"}," +
                        sJson_StockPlace +
                        " \"FStockStatusId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FStockStatusId"]) + "\"}," +
                        sJson_BatchNo +
                        sJson_FAUXPROPID +
                        //"F_TFKO_Assistant2": {
                        //            "FNumber": ""
                        //},
                        //"F_TFKO_Assistant": {
                        //            "FNumber": ""
                        //},
                        //"F_TFKO_Assistant1": {
                        //            "FNumber": ""
                        //},
                        //"F_TFKO_Assistant3": {
                        //            "FNumber": ""
                        //},
                        //"F_TFKO_Text": "",
                        //"F_TFKO_Text1": "",
                        //"F_TFKO_Text2": "",
                        //"F_TFKO_Text3": "",
                        //"FExtAuxUnitQty": 0,
                        " \"FQty\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FQty"]) + "\"," +
                        //"FEntryNote": "",
                        " \"FBomId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FBomId"]) + "\"}," +
                        sJson_FProduceDate +
                        sJson_FExpiryDate +
                        " \"FExtAuxUnitId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FExtAuxUnitId"]) + "\"}," +
                        " \"FMtoNo\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FMtoNo"]) + "\"," +
                        " \"FProjectNo\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FProjectNo"]) + "\"," +
                        " \"FOwnerTypeId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FOwnerTypeId"]) + "\"," +
                        " \"FOwnerId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FOwnerId"]) + "\"}," +
                        " \"FKeeperTypeId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FKeeperTypeId"]) + "\"," +
                        " \"FKeeperId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FKeeperId"]) + "\"}," +
                        " \"FSRCBILLTYPEID\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSRCBILLTYPEID"]) + "\"," +
                        " \"FSRCBILLNO\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSRCBILLNO"]) + "\"," +
                        " \"FBaseUnitId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FBaseUnitId"]) + "\"}," +
                        " \"FSECUNITID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSECUNITID"]) + "\"}," +
                        " \"FSNUNITID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSNUNITID"]) + "\"}," +
                        sJson_SubCustom +
                        //"FSerialSubEntity": [
                        //    {
                        //            "FDetailID": 0,
                        //        "FSerialNo": "",
                        //        "FSerialNote": ""
                        //    }
                        //]
                        " \"FEntity_Link\": [" +
                        sJson_Entry_Link +
                        "]   }  ";
                    }
                    string sJson_End = "  ]  }}";
                    string sJson = sJson_Main + sJson_Entry + sJson_End;
                    sRemark = sRemark + " ;获取CLOUD单据API递入值" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:ffff");
                    //生成金蝶云单据
                    if (bLogin)
                    {
                        var result = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Save",
                        new object[] { "STK_MISCELLANEOUS", sJson });
                        sRemark = sRemark + " ;生成CLOUD单据" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:ffff");
                        HReturn = result.ToString();
                        if (HReturn.Contains("\"IsSuccess\":false") == true)
                        {
                            sErrMsg = "生成其他入库单失败!" + HReturn;
                            LogService.Write("生成其他入库单(源单:入库申请单),多行数据合并下推生单失败失败!" + HReturn + sJson);   //写入txt文本
                            oCn.RollBack();
                            return false;
                        }
                        else
                        {
                            sRemark = sRemark + sJson;
                            oCn.Commit();
                        }
                    }
                    else
                    {
                        sErrMsg = "生成其他入库单失败!金蝶云登录失败!";
                        oCn.RollBack();
                        return false;
                    }
                }
            }
            catch (Exception e)
            {
                LogService.Write("生成回滚" + sRemark);
                sErrMsg = "生成其他入库单失败!" + e.Message;
                oCn.RollBack();
                return false;
            }
            if (oSystemParameterMain.Kf_OtherInBill_AutoCheck == "Y") //系统参数  自动审核
            {
                try
                {
                    oCn.BeginTran();
                    //审核WMS单据
                    oCn.RunProc("Update Kf_ICStockBillMain Set HChecker='" + oMain.HMaker + "',HCheckDate=convert(varchar(10),getdate(),120) where HInterID= " + oMain.HInterID.ToString());
                    //提交、审核金蝶云单据
                    HReturn = "";
                    string sJson2 = "{\"CreateOrgId\":0,\"Numbers\":[\"" + oMain.HBillNo + "\"]}";
                    var result2 = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Submit",
                    new object[] { "STK_MISCELLANEOUS", sJson2 });
                    string sJson3 = "{\"CreateOrgId\":0,\"Numbers\":[\"" + oMain.HBillNo + "\"]}";
                    var result3 = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Audit",
                    new object[] { "STK_MISCELLANEOUS", sJson3 });
                    HReturn = result2.ToString() + "," + result3.ToString();
                    if (HReturn.Contains("\"IsSuccess\":false") == true)
                    {
                        LogService.Write("审核单据失败" + sRemark);
                        sErrMsg = "生成其他入库单成功,审核单据失败!" + HReturn;
                        oCn.RollBack();
                        return true;
                    }
                    else
                    {
                        LogService.Write("生成并审核其他入库单(源单:入库申请单),多行数据合并下推生单失败成功!" + sRemark);
                        sErrMsg = "生成并审核其他入库单成功!单据号为:" + oMain.HBillNo;
                        oCn.Commit();
                        return true;
                    }
                }
                catch (Exception e)
                {
                    LogService.Write("审核回滚" + sRemark);
                    sErrMsg = "审核其他入库单失败!" + e.Message;
                    oCn.RollBack();
                    return false;
                }
            }
            else
            {
                LogService.Write("生成其他入库单(源单:入库申请单),多行数据合并下推生单失败成功!" + sRemark);
                sErrMsg = "生成其他入库单成功!单据号为:" + oMain.HBillNo;
                return true;
            }
        }
        #endregion
        #region 其他入库    校验模式*