新增生产入库(源单:工序汇报单)上传调用方法,返回工序汇报单列表方法,扫描生产入库单源单方法等
1个文件已修改
433 ■■■■■ 已修改文件
CLOUDWEB/WebService1.asmx.cs 433 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CLOUDWEB/WebService1.asmx.cs
@@ -1540,6 +1540,35 @@
            return dal.DisSourceBillList(sWhere);
        }
        //返回工序汇报单列表
        /// <summary>
        /// 返回工序汇报单列表
        /// </summary>
        /// <param name="sWhere">过滤条件</param>
        /// <returns></returns>
        [WebMethod]
        public DataSet GetSc_ProcessReportBillList(string sWhere)
        {
            try
            {
                DataSet ds;
                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
                ds = oCN.RunProcReturn("select * from h_v_IF_ProcessReportBillList_Lite " + sWhere + " order by 单据号 desc,HMaterID", "h_v_IF_ProcessReportBillList_Lite");
                if (ds == null && ds.Tables[0].Rows.Count == 0)
                {
                    return null;
                }
                else
                {
                    return ds;
                }
            }
            catch (Exception e)
            {
                return null;
            }
        }
        [WebMethod]
        //根据流转卡单号得到相应信息
        public DataSet Check_ICMOReportBill(string lngBillKey, ref string sReturn)
@@ -15671,6 +15700,8 @@
                        string sJson_BatchNo = "";
                        string sJson_StockPlace = "";
                        string sJson_FAUXPROPID = "";
                        string sJson_FProduceDate = "";     //生产日期
                        string sJson_FExpiryDate = "";      //有效期至
                        string sJson_SubCustom = "";        //子表自定义字段
                        //子表自定义字段
@@ -15704,6 +15735,18 @@
                        else
                        {
                            sJson_StockPlace = Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FStockLocId"]) + "\"}},";
                        }
                        //是否启用保质期控制
                        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_Entry = sJson_Entry + "{" +
@@ -15762,8 +15805,8 @@
                        "\"FOwnerId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FOwnerId"]) + "\"}," +
                        "\"FEntrySrcEnteryId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntrySrcEnteryId"]) + "\"," +
                        "\"FEntrySrcInterId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntrySrcInterId"]) + "\"," +
                        //\"FProduceDate\":\"1900-01-01\",
                        //\"FExpiryDate\":\"1900-01-01\",
                        sJson_FProduceDate +
                        sJson_FExpiryDate +
                        "\"FWorkShopId1\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FWorkShopId1"]) + "\"}," +
                        "\"FParentOwnerTypeId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FParentOwnerTypeId"]) + "\"," +
                        "\"FParentOwnerId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FParentOwnerId"]) + "\"}," +
@@ -24042,7 +24085,7 @@
                        "\"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"]) + "\"}," +
                        //"\"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"]) + "\"," +
@@ -26209,7 +26252,7 @@
        {
            //获取系统参数
            Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
            if (oSystemParameter.ShowBill(ref sErrMsg) == false)
            if (oSystemParameter.ShowBillByOrgID(oMain.HSTOCKORGID,ref sErrMsg) == false)
            {
                sErrMsg = "获取系统参数失败! " + sErrMsg;
                return false;
@@ -26479,6 +26522,20 @@
            else if (sHSourceType == "3711")   //生产汇报单
            {
                if (SaveProductInBill_ICMOReport_CLD(oMain, sHSourceType, oSystemParameterMain, ref sErrMsg))
                {
                    //"保存成功!";
                    return true;
                }
                else
                {
                    //"保存失败!";
                    sErrMsg = "单据号:" + oMain.HBillNo + ",单据ID:" + oMain.HInterID + ";" + sErrMsg;
                    return false;
                }
            }
            else if (sHSourceType == "3714")   //工序汇报单
            {
                if (SaveProductInBill_ProcessReport_CLD(oMain, sHSourceType, oSystemParameterMain, ref sErrMsg))
                {
                    //"保存成功!";
                    return true;
@@ -27184,6 +27241,345 @@
            else
            {
                LogService.Write("生成生产入库单(源单:生产汇报单)成功!" + sRemark);
                sErrMsg = "生成生产入库单成功!单据号为:" + oMain.HBillNo;
                return true;
            }
        }
        /// <summary>
        /// 生产入库单   源单:工序汇报单
        /// </summary>
        /// <param name="oMain"></param>
        /// <param name="sErrMsg"></param>
        /// <returns></returns>
        public bool SaveProductInBill_ProcessReport_CLD(Model.ClsKf_ProductInBillMain 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_ProductInBillSub_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('1202','1202'," + 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_Sc_UpDateRelation_ProcessReportToProductIn_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_GetProductInBill_ProcessReport_CLD_New " + oMain.HInterID.ToString() + ",'" + oMain.HBillNo + "'", "h_p_Kf_GetProductInBill_ProcessReport_CLD_New");
                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\":\"false\",\"ValidateFlag\":\"True\",\"NumberSearch\":\"True\",\"InterationFlags\":\"\"," +
                    "\"Model\": { \"FBILLNO\":\"" + oMain.HBillNo + "\"," +
                    //\"FID\":\"0\",
                    "\"FBillType\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FBillType"]) + "\"}," +
                    "\"FDate\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FDate"]) + "\"," +
                    "\"FSTOCKORGID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FStockOrgId"]) + "\"}," +
                    //\"FStockId0\":{\"FNumber\":\"\"},
                    "\"FPRDORGID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FPrdOrgId"]) + "\"}," +
                    //\"FWorkShopId\":{\"FNumber\":\"\"},
                    "\"FOWNERTYPEID0\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FOwnerTypeId0"]) + "\"," +
                    "\"FOWNERID0\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FOwnerId0"]) + "\"}," +
                    "\"FSTOCKERID\":{\"FNAME\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FSTOCKERID"]) + "\"}," +
                    //\"FDescription\":\"\",
                    "\"FISENTRUST\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FIsEntrust"]) + "," +
                    "\"FCurrId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FCurrId"]) + "\"}," +
                    //\"FEntrustInStockId\":\"0\",
                    //\"FScanBox\":\"\",
                    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_FAuxpropId = "";
                        string sJson_StockPlace = "";
                        string sJson_FProduceDate = "";     //生产日期
                        string sJson_FExpiryDate = "";      //有效期至
                        string sJson_SubCustom = "";        //子表自定义字段
                        //子表自定义字段
                        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 (oSystemParameterMain.WMS_CampanyName == "凯贝奈特") //系统参数  客户定制化名称     空白为通用
                        {
                            sJson_FAuxpropId = " \"FAUXPROPID\":{\"FAUXPROPID__FF100001\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FAUXPROPID"]) + "\"}},";
                        }
                        else
                        {
                            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"]) + "\"}},";
                        }
                        //是否启用保质期控制
                        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_Entry = sJson_Entry + " {" +
                        //\"FEntryID\":\"0\",
                        " \"FSRCENTRYID\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSrcEntryId"]) + "," +
                        " \"FIsNew\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FIsNew"]) + "," +
                        " \"FMATERIALID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FMaterialId"]) + "\"}," +
                        " \"FCHECKPRODUCT\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FCheckProduct"]) + "," +
                        " \"FINSTOCKTYPE\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FInStockType"]) + "\"," +
                        " \"FPRODUCTTYPE\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FProductType"]) + "\"," +
                        " \"FUNITID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FUnitID"]) + "\"}," +
                        " \"FMUSTQTY\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FMustQty"]) + "," +
                        " \"FREALQTY\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FRealQty"]) + "," +
                        " \"FCostRate\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FCostRate"]) + "," +
                        " \"FBASEUNITID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FBaseUnitId"]) + "\"}," +
                        " \"FBASEMUSTQTY\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FBaseMustQty"]) + "," +
                        " \"FBASEREALQTY\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FBaseRealQty"]) + "," +
                        " \"FOWNERTYPEID\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FOwnerTypeId"]) + "\"," +
                        " \"FOWNERID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FOwnerId"]) + "\"}," +
                        " \"FSTOCKID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FStockId"]) + "\"}," +
                        sJson_StockPlace +
                        " \"FBOMID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FBomId"]) + "\"}," +
                        sJson_BatchNo +
                        " \"FISBACKFLUSH\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FISBACKFLUSH"]) + "," +
                        sJson_FAuxpropId +
                        " \"FMTONO\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FMtoNo"]) + "\"," +
                        " \"FPROJECTNO\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FProjectNo"]) + "\"," +
                        " \"FWORKSHOPID1\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FWorkShopId1"]) + "\"}," +
                        " \"FSHIFTGROUPID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FShiftGroupId"]) + "\"}," +
                        " \"FMOBILLNO\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FMoBillNo"]) + "\"," +
                        " \"FMOID\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FMoId"]) + "," +
                        " \"FMOENTRYID\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FMoEntryId"]) + "," +
                        " \"FMOENTRYSEQ\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FMoEntrySeq"]) + "," +
                        //" \"FMemo\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FMemo"]) + "\"," +
                        " \"FSTOCKUNITID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FStockUnitId"]) + "\"}," +
                        " \"FSTOCKREALQTY\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FStockRealQty"]) + "," +
                        " \"FSECUNITID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSecUnitId"]) + "\"}," +
                        //\"FSecRealQty\":\"0\",
                        " \"FSRCBILLTYPE\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSrcBillType"]) + "\"," +
                        " \"FSRCBILLNO\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSrcBillNo"]) + "\"," +
                        " \"FSRCINTERID\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSrcInterId"]) + "," +
                        " \"FBASEPRDREALQTY\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FBasePrdRealQty"]) + "," +
                        " \"FIsFinished\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FIsFinished"]) + "\"," +
                        " \"FStockStatusId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FStockStatusId"]) + "\"}," +
                        " \"FSRCENTRYSEQ\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSrcEntrySeq"]) + "," +
                        " \"FMOMAINENTRYID\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FMOMAINENTRYID"]) + "," +
                        " \"FKEEPERTYPEID\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FKeeperTypeId"]) + "\"," +
                        " \"FKEEPERID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FKeeperId"]) + "\"}," +
                        sJson_FProduceDate +
                        //\"FSelReStkQty\":\"0\",
                        sJson_FExpiryDate +
                        //\"FBaseSelReStkQty\":\"0\",
                        " \"FSNUNITID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSNUnitID"]) + "\"}," +
                        " \"FIsOverLegalOrg\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FIsOverLegalOrg"]) + "\"," +
                        sJson_SubCustom +
                        //\"FSerialSubEntity\":[{\"FDetailID\":\"0\",
                        //\"FSerialNo\":\"\",
                        //\"FSerialId\":{\"FNumber\":\"\"},
                        //\"FSerialNote\":\"\"}]
                        " \"FEntity_Link\": [ {  " +
                            " \"FEntity_Link_FFlowId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntity_Link_FFlowId"]) + "\"," +
                            " \"FEntity_Link_FFlowLineId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntity_Link_FFlowLineId"]) + "\"," +
                            " \"FEntity_Link_FRuleId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntity_Link_FRuleId"]) + "\"," +
                            " \"FEntity_Link_FSTableName\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntity_Link_FSTableName"]) + "\"," +
                            " \"FEntity_Link_FSBillId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntity_Link_FSBillId"]) + "\"," +
                            " \"FEntity_Link_FSId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntity_Link_FSId"]) + "\"," +
                            " \"FEntity_Link_FBasePrdRealQtyOld\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntity_Link_FBasePrdRealQtyOld"]) + "," +
                            " \"FEntity_Link_FBasePrdRealQty\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntity_Link_FBasePrdRealQty"]) + "" +
                        " } ]," +
                        " \"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[] { "PRD_INSTOCK", sJson }); //调用保存方式
                        sRemark = sRemark + " ;生成CLOUD单据" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:ffff");
                        //生成单据后更新自定义字段
                        oCn.RunProc("exec h_p_Sc_UpDateSelfFildProductIn '" + 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 + sJson;
                            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_ProductInBill_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[] { "PRD_INSTOCK", sJson2 }); //提交单据
                    string sJson3 = "{\"CreateOrgId\":0,\"Numbers\":[\"" + oMain.HBillNo + "\"]}";
                    var result3 = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Audit",
                    new object[] { "PRD_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;
            }
@@ -40666,6 +41062,35 @@
        #endregion
        #region 生产入库    扫描源单条码
        [WebMethod]
        public Model.ClsKf_ICStockBill_WMS get_SourceBarCode_ProductIn(Int64 HInterID, string HBillNo, string HBillType, string HSourceBillNo, string HSourceBillType, string HMaker, Int64 HStockOrgID, ref string sErrMsg)
        {
            Model.ClsKf_ICStockBill_WMS oBar = new Model.ClsKf_ICStockBill_WMS();
            //获取系统参数
            Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
            if (oSystemParameter.ShowBillByOrgID(HStockOrgID, ref sErrMsg) == false)
            {
                sErrMsg = "单据号:" + HBillNo + ",单据ID:" + HInterID + ";扫描源单时获取系统参数失败! " + sErrMsg;
                return null;
            }
            Int64 HAccessFlag = 0;   //是否物料条码带出源单信息标志(0为直接扫源单条码,1为物料条码带出源单信息)
            oBar = get_SourceBill_ProductIn(HInterID, HBillNo, HBillType, HSourceBillNo, HSourceBillType, HMaker, HStockOrgID, HAccessFlag, oSystemParameter.omodel, ref sErrMsg);
            if (oBar == null)
            {
                return null;
            }
            else
            {
                return oBar;
            }
        }
        #endregion
        #region 其他入库    扫描源单条码
        [WebMethod]