yxj
2023-06-06 e7b8cfdb15198da1fd1212a055a43849f364164a
新增换托调拨单模块调用方法
2个文件已修改
562 ■■■■■ 已修改文件
CLOUDWEB/WebService1.asmx.cs 562 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DLL/Pub_Class.dll 补丁 | 查看 | 原始文档 | blame | 历史
CLOUDWEB/WebService1.asmx.cs
@@ -16442,7 +16442,7 @@
            SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
            //获取系统参数
            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;
@@ -16466,8 +16466,12 @@
            try
            {
                oCn.BeginTran();
                //写入条码出入库表
                oCn.RunProc("EXEC h_p_Kf_ICStockBillSub_WMS_Insert_New " + oMain.HInterID.ToString() + ",'" + oMain.HBillType + "','" + oMain.HBillNo + "'");
                if (oSystemParameter.omodel.Kf_SellOutBillCheck_SourceBarCodeCtl != "Y")
                {
                    //写入条码出入库表
                    oCn.RunProc("EXEC h_p_Kf_ICStockBillSub_WMS_Insert_New " + oMain.HInterID.ToString() + ",'" + oMain.HBillType + "','" + oMain.HBillNo + "'");
                }
                //从配置文件获取 CLOUD网址、账套信息、登录用户、登录密码
                if (!Pub_Class.ClsPub.GetCLOUDLoginInfo(ref Pub_Class.ClsPub.sExeReturnInfo))
@@ -50205,6 +50209,477 @@
        #endregion
        #region 换托调拨单模块调用方法     20230531新增
        #region 换托调拨单模块 扫描调入托条码
        [WebMethod]
        public Model.ClsKf_ICStockBill_WMS get_BarCodePack_In_MoveStockBill_HuanTuo(Int64 HInterID, string HBillNo, string HBarCode_Pack, Int64 HStockOrgID, ref string sErrMsg)
        {
            SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
            Model.ClsKf_ICStockBill_WMS oBar = new Model.ClsKf_ICStockBill_WMS();
            //判断所扫调入托条码是否有效,有效返回对应托条码、仓库、仓位信息
            DataSet ds1 = oCn.RunProcReturn("exec h_p_WMS_AddPackBarCode_MoveStockBill_HuanTuo " + HInterID.ToString() + ",'" + HBillNo + "','" + HBarCode_Pack + "'," + HStockOrgID.ToString(), "h_p_WMS_AddPackBarCode_MoveStockBill_HuanTuo");
            if (ds1 == null || ds1.Tables[0].Rows.Count == 0)
            {
                sErrMsg = "单据号:" + HBillNo + ",单据ID:" + HInterID + ";判断所扫调入托条码是否有效失败!";
                return null;
            }
            else
            {
                if (DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0][0]) == 0)
                {
                    oBar.HInterID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HSourceInterID"]);
                    oBar.HSourceBillNo = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HBarCode_Pack"]);
                    oBar.HWhID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HWhID"]);
                    oBar.HWhName = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HWhName"]);
                    oBar.HSPID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HSPID"]);
                    oBar.HSPName = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HSPName"]);
                    return oBar;
                }
                else
                {
                    sErrMsg = "单据号:" + HBillNo + ",单据ID:" + HInterID + ";" + DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HRemark"]);
                    return null;
                }
            }
        }
        #endregion
        #region 换托调拨单模块 扫描调出条码
        [WebMethod]
        public bool get_BarCode_MoveStockBill_HuanTuo(Int64 HInterID, string HBillNo, string HBillType, string HBarCode, string HBarCode_Pack, Int64 HPackUnionInterID_In, Int64 HWhID, Int64 HSPID, string HMaker, Int64 HStockOrgID, ref string sErrMsg)
        {
            SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
            DataSet ds = oCN.RunProcReturn("exec h_p_WMS_AddBarCode_MoveStockBill_HuanTuo " + HInterID.ToString() + ",'" + HBillNo + "','" + HBillType + "','" + HBarCode + "','" + HBarCode_Pack + "'," + HPackUnionInterID_In.ToString() + "," + HWhID.ToString() + "," + HSPID.ToString() + ",'" + HMaker + "'," + HStockOrgID.ToString(), "h_p_WMS_AddBarCode_MoveStockBill_HuanTuo");
            if (ds == null || ds.Tables[0].Rows.Count == 0)
            {
                sErrMsg = "单据号:" + HBillNo + ",单据ID:" + HInterID + ";扫描调出条码判断失败!";
                return false;
            }
            else
            {
                if (DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0][0]) == 0)
                {
                    return true;
                }
                else
                {
                    sErrMsg = "单据号:" + HBillNo + ",单据ID:" + HInterID + ";" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HRemark"]);
                    return false;
                }
            }
        }
        #endregion
        #region 换托调拨单模块 返回列表信息
        [WebMethod]
        public DataSet GetBillEntry_Temp_MoveStockBill_HuanTuo(Int64 HInterID, string HBillNo, string HBillType, Int64 HStockOrgID, ref string sErrMsg)
        {
            SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
            DataSet DS = oCn.RunProcReturn("exec h_p_WMS_BillEntryTmp_MoveStockBill_HuanTuo " + HInterID.ToString() + ",'" + HBillType + "'", "h_p_WMS_BillEntryTmp_MoveStockBill_HuanTuo");
            return DS;
        }
        #endregion
        #region 换托调拨单模块 扫描删除明细表体行记录
        [WebMethod]
        public bool set_DelPackUnionBill_Temp_MoveStockBill_HuanTuo(Int64 HInterID, string HBarCode, string HBillType, ref string sErrMsg)
        {
            SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
            try
            {
                oCn.RunProc("Delete from KF_PonderationBillMain_Temp where HInterID=" + HInterID.ToString() + " and HBillType='" + HBillType + "' and ( HBarCode='" + HBarCode + "' or HBarCode_Pack='" + HBarCode + "')", ref DBUtility.ClsPub.sExeReturnInfo);
                return true;
            }
            catch (Exception e)
            {
                sErrMsg = "删除换托调拨记录失败!" + e.Message;
                return false;
            }
        }
        #endregion
        #region 上传生成换托调拨单
        [WebMethod]
        public bool set_SaveMoveStockBill_HuanTuo(Int64 HInterID, string HBillType, string HBillNo, string HBarCode_Pack, string HMaker, Int64 HStockOrgID, ref string sErrMsg)
        {
            SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
            int sStatus = 2;    //1=同仓库仓位换托;2=非同仓库仓位换托
            //获取系统参数
            Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
            if (oSystemParameter.ShowBillByOrgID(HStockOrgID, ref sErrMsg) == false)
            {
                sErrMsg = "获取系统参数失败! " + sErrMsg;
                return false;
            }
            //上传前判断
            DataSet Dsload = oCn.RunProcReturn("exec h_p_WMS_BeforeUpload_MoveStockBill_HuanTuo " + HInterID.ToString() + ",'" + HBillNo + "','" + HBillType + "'", "h_p_WMS_BeforeUpload_MoveStockBill_HuanTuo");
            if (Dsload == null || Dsload.Tables[0].Rows.Count == 0)
            {
                sErrMsg = "换托调拨上传前判断,发生错误!";
                return false;
            }
            else
            {
                if (DBUtility.ClsPub.isLong(Dsload.Tables[0].Rows[0][0]) == 1)
                {
                    sErrMsg = "单据号:" + HBillNo + ",单据ID:" + HInterID + ";" + DBUtility.ClsPub.isStrNull(Dsload.Tables[0].Rows[0]["HRemark"]);
                    return false;
                }
                else
                {
                    sStatus = DBUtility.ClsPub.isInt(Dsload.Tables[0].Rows[0]["HStatus"]);
                }
            }
            //同仓库仓位换托
            if (sStatus==1)
            {
                try
                {
                    oCn.BeginTran();
                    //生成条码出入库单据、调拨单据、组托单等
                    DataSet dsInsert = oCn.RunProcReturn("exec h_p_Kf_MoveStockBill_Insert_HuanTuo " + HInterID.ToString() + ",'" + HBillNo + "','" + HBillType + "','" + HMaker + "'," + HStockOrgID.ToString(), "h_p_Kf_MoveStockBill_Insert_HuanTuo");
                    if (dsInsert == null || dsInsert.Tables[0].Rows.Count == 0)
                    {
                        sErrMsg = "单据号:" + HBillNo + ",单据ID:" + HInterID + ";上传失败!";
                        oCn.RollBack();
                        return false;
                    }
                    else
                    {
                        if (DBUtility.ClsPub.isLong(dsInsert.Tables[0].Rows[0][0]) == 1)
                        {
                            sErrMsg = "上传失败,单据号:" + HBillNo + ",单据ID:" + HInterID + ";" + DBUtility.ClsPub.isStrNull(dsInsert.Tables[0].Rows[0]["HRemark"]);
                            oCn.RollBack();
                            return false;
                        }
                        else
                        {
                            sErrMsg = "生成同仓库仓位换托调拨单成功!单据号为:" + HBillNo;
                            oCn.Commit();
                            return true;
                        }
                    }
                }
                catch (Exception e)
                {
                    sErrMsg = "生成同仓库仓位换托调拨单失败!" + e.Message;
                    oCn.RollBack();
                    return false;
                }
            }
            else
            //非同仓库仓位换托
            {
                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(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);
                sRemark = sRemark + " ;获取验证CLOUD账号密码" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:ffff");
                try
                {
                    oCn.BeginTran();
                    //生成条码出入库单据、调拨单据、组托单等
                    DataSet dsInsert2 = oCn.RunProcReturn("exec h_p_Kf_MoveStockBill_Insert_HuanTuo " + HInterID.ToString() + ",'" + HBillNo + "','" + HBillType + "','" + HMaker + "'," + HStockOrgID.ToString(), "h_p_Kf_MoveStockBill_Insert_HuanTuo");
                    if (dsInsert2 == null || dsInsert2.Tables[0].Rows.Count == 0)
                    {
                        sErrMsg = "单据号:" + HBillNo + ",单据ID:" + HInterID + ";上传失败!";
                        oCn.RollBack();
                        return false;
                    }
                    else
                    {
                        if (DBUtility.ClsPub.isLong(dsInsert2.Tables[0].Rows[0][0]) == 1)
                        {
                            sErrMsg = "上传失败,单据号:" + HBillNo + ",单据ID:" + HInterID + ";" + DBUtility.ClsPub.isStrNull(dsInsert2.Tables[0].Rows[0]["HRemark"]);
                            oCn.RollBack();
                            return false;
                        }
                    }
                    sRemark = sRemark + " ;生成换托调拨单据" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:ffff");
                    //根据TMP表 返回 信息
                    DataSet Ds;
                    if (oSystemParameter.omodel.WMS_CloudMode == "N") //系统参数  是否为私有云模式(N为公有云模式,Y为私有云模式)
                    {
                        Ds = oCn.RunProcReturn("exec h_p_Kf_GetMoveOutBill_PUBCLD " + HInterID + ",'" + HBillNo + "'", "h_p_Kf_GetMoveOutBill_PUBCLD");
                        sRemark = sRemark + " ;公有云模式";
                    }
                    else
                    {
                        Ds = oCn.RunProcReturn("exec h_p_Kf_GetMoveOutBill_CLD " + HInterID + ",'" + HBillNo + "'", "h_p_Kf_GetMoveOutBill_CLD");
                        sRemark = sRemark + " ;私有云模式";
                    }
                    if (Ds == null || Ds.Tables[0].Rows.Count == 0 || Ds.Tables[1].Rows.Count == 0)
                    {
                        sErrMsg = "上传失败,单据号:" + HBillNo + ",单据ID:" + HInterID + ";获取WebAPI递入信息失败!";
                        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\":[]," +
                            "\"Model\":{ " +
                            "\"FBillNo\":\"" + HBillNo + "\"," +
                            "\"FBillTypeID\":{ \"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FBillTypeID"]) + "\" }," +
                            "\"FBizType\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FBizType"]) + "\"," +
                            "\"FTransferDirect\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FTransferDirect"]) + "\"," +
                            "\"FTransferBizType\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FTransferBizType"]) + "\"," +
                            "\"FSettleOrgId\":{ \"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FSettleOrgId"]) + "\" }," +
                            "\"FSaleOrgId\":{ \"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FSaleOrgId"]) + "\" }," +
                            "\"FStockOutOrgId\":{ \"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FStockOutOrgId"]) + "\" }," +
                            "\"FOwnerTypeOutIdHead\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FOwnerTypeOutIdHead"]) + "\"," +
                            "\"FOwnerOutIdHead\":{ \"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FOwnerOutIdHead"]) + "\" }," +
                            "\"FStockOrgId\":{ \"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FStockOrgId"]) + "\" }," +
                            "\"FIsIncludedTax\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FIsIncludedTax"]) + "," +
                            "\"FIsPriceExcludeTax\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FIsPriceExcludeTax"]) + "," +
                            "\"FOwnerTypeIdHead\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FOwnerTypeIdHead"]) + "\"," +
                            "\"FSETTLECURRID\":{ \"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FSETTLECURRID"]) + "\" }," +
                            "\"FOwnerIdHead\":{ \"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FOwnerIdHead"]) + "\" }," +
                            "\"FDate\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FDate"]) + "\"," +
                            "\"FBaseCurrId\":{ \"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FBaseCurrId"]) + "\" }," +
                            sJson_MainCustom +
                            "\"FBillEntry\": [  ";
                        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_SrcStockPlace = "";
                            string sJson_DestStockPlace = "";
                            string sJson_FProduceDate = "";     //生产日期
                            string sJson_FExpiryDate = "";      //有效期至
                            string sJson_FAUXPROPID = "";
                            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 (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 = "";
                            }
                            //调入仓位
                            if (Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSrcStockLocId"]) == "")
                            {
                                sJson_SrcStockPlace = "";
                            }
                            else
                            {
                                sJson_SrcStockPlace = Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSrcStockLocId"]) + "\"}},";
                            }
                            //调出仓位
                            if (Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FDestStockLocId"]) == "")
                            {
                                sJson_DestStockPlace = "";
                            }
                            else
                            {
                                sJson_DestStockPlace = Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FDestStockLocId"]) + "\"}},";
                            }
                            //辅助属性
                            sJson_FAUXPROPID = " \"FAUXPROPID\":{\"FAUXPROPID__FF100002\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FAUXPROPID"]) + "\"}},";
                            sJson_Entry = sJson_Entry + " {\"FSEQ\":\"" + Convert.ToString(i + 1) + "\"," +
                            "\"FMaterialId\":{ \"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FMaterialId"]) + "\" }," +
                            sJson_FAUXPROPID +
                            "\"FUnitID\":{ \"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FUnitID"]) + "\" }," +
                            "\"FQty\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FQty"]) + "\"," +
                            sJson_BatchNo +
                             "\"FSrcStockId\":{ \"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSrcStockId"]) + "\" }," +
                            sJson_SrcStockPlace +
                            //"\"FSrcStockLocId\":{\"FSRCSTOCKLOCID__FF100002\":{\"FNUMBER\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSrcStockLocId"]) + "\"}}," +
                            "\"FDestStockId\":{ \"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FDestStockId"]) + "\" }," +
                            sJson_DestStockPlace +
                            //"\"FDestStockLocId\":{\"FDESTSTOCKLOCID__FF100002\":{\"FNUMBER\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FDestStockLocId"]) + "\"}}," +
                            "\"FSrcStockStatusId\":{ \"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSrcStockStatusId"]) + "\" }," +
                            "\"FDestStockStatusId\":{ \"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FDestStockStatusId"]) + "\" }," +
                            // "\"FBusinessDate\":\"" + oMain.HDate.ToShortDateString() + "\"," +
                            sJson_FProduceDate +
                            sJson_FExpiryDate +
                            "\"FOwnerTypeOutId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FOwnerTypeOutId"]) + "\"," +
                            "\"FOwnerOutId\":{ \"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FOwnerOutId"]) + "\" }," +
                            "\"FOwnerTypeId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FOwnerTypeId"]) + "\"," +
                            "\"FOwnerId\":{ \"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FOwnerId"]) + "\" }," +
                            "\"FBaseUnitId\":{ \"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FBaseUnitId"]) + "\" }," +
                            "\"FBaseQty\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FBaseQty"]) + "\"," +
                            "\"FISFREE\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FISFREE"]) + "," +
                            "\"FKeeperTypeId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FKeeperTypeId"]) + "\"," +
                            "\"FKeeperId\":{ \"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FKeeperId"]) + "\" }," +
                            "\"FKeeperTypeOutId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FKeeperTypeOutId"]) + "\"," +
                            "\"FKeeperOutId\":{ \"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FKeeperOutId"]) + "\" }," +
                            "\"FDestMaterialId\":{ \"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FDestMaterialId"]) + "\" }," +
                            "\"FPriceUnitId\":{ \"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FPriceUnitId"]) + "\" }," +
                            "\"FPriceQty\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FPriceQty"]) + "\"," +
                            "\"FPriceBaseQty\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FPriceQty"]) + "\"," +
                            "\"FTransReserveLink\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FTransReserveLink"]) + "," +
                            sJson_SubCustom +
                            "\"FCheckDelivery\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FCheckDelivery"]) + "} ";
                        }
                        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_TransferDirect", 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 (oSystemParameter.omodel.Kf_MoveStockBill_AutoCheck == "Y") //系统参数  自动审核
                {
                    try
                    {
                        oCn.BeginTran();
                        //审核WMS单据
                        oCn.RunProc("Update Kf_ICStockBillMain Set HChecker='" + HMaker + "',HCheckDate=convert(varchar(10),getdate(),120),HBillStatus=2 where HInterID= " + HInterID.ToString());
                        //提交、审核金蝶云单据
                        HReturn = "";
                        string sJson2 = "{\"CreateOrgId\":0,\"Numbers\":[\"" + HBillNo + "\"]}";
                        var result2 = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Submit",
                        new object[] { "STK_TransferDirect", sJson2 });
                        string sJson3 = "{\"CreateOrgId\":0,\"Numbers\":[\"" + HBillNo + "\"]}";
                        var result3 = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Audit",
                        new object[] { "STK_TransferDirect", 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 = "生成并审核换托调拨单成功!单据号为:" + HBillNo;
                            oCn.Commit();
                            return true;
                        }
                    }
                    catch (Exception e)
                    {
                        LogService.Write("审核回滚" + sRemark);
                        sErrMsg = "审核换托调拨单失败!" + e.Message;
                        oCn.RollBack();
                        return false;
                    }
                }
                else
                {
                    LogService.Write("生成换托调拨单(源单:无源单)成功!" + sRemark);
                    sErrMsg = "生成换托调拨单成功!单据号为:" + HBillNo;
                    return true;
                }
            }
        }
        #endregion
        #endregion
        #region 生产装箱追溯单模块调用方法
        #region 扫描箱条码
@@ -50433,30 +50908,79 @@
        {
            SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
            Model.ClsKf_ICStockBill_WMS oBar = new Model.ClsKf_ICStockBill_WMS();
            //将单据信息存入条码出入库临时表
            DataSet ds1 = oCn.RunProcReturn("exec h_p_WMS_AddBillBarCode_BillCheck '" + HBillNo + "','" + HBillType + "','" + HMaker + "'," + HOWNERID.ToString(), "h_p_WMS_AddBillBarCode_BillCheck");
            if (ds1 == null || ds1.Tables[0].Rows.Count == 0)
            //获取系统参数
            Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
            if (oSystemParameter.ShowBillByOrgID(HOWNERID, ref sErrMsg) == false)
            {
                sErrMsg = "单据号:" + HBillNo + ";将单据信息存入条码出入库临时表失败!";
                sErrMsg = "获取系统参数失败! " + sErrMsg;
                return null;
            }
            else
            string sSourceBarCodeCtl = "N";   //校验-是否进行源单对应条码核对('Y'为核对)
            if (HBillType == "1205" && oSystemParameter.omodel.Kf_SellOutBillCheck_SourceBarCodeCtl == "Y")
            {
                if (DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0][0]) == 0)
                //销售出库单
                sSourceBarCodeCtl = "Y";
            }
            //校验-是否进行源单对应条码核对('Y'为核对)
            if (sSourceBarCodeCtl == "Y")
            {
                //将单据信息存入条码出入库临时表 KF_PonderationBillMain_Temp,单据对应条码信息写入条码出入库记录临时表 Kf_ICStockBillSub_WMS_Temp
                DataSet ds1 = oCn.RunProcReturn("exec h_p_WMS_AddBillBarCode_BillCheckVerify '" + HBillNo + "','" + HBillType + "','" + HMaker + "'," + HOWNERID.ToString(), "h_p_WMS_AddBillBarCode_BillCheckVerify");
                if (ds1 == null || ds1.Tables[0].Rows.Count == 0)
                {
                    oBar.HInterID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HInterID"]);
                    oBar.HBillNo = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HBillNo"]);
                    oBar.HWhID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HWhID"]);
                    oBar.HWhName = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HWhName"]);
                    oBar.HSPFlag = DBUtility.ClsPub.isBool(ds1.Tables[0].Rows[0]["HSPFlag"]);
                    oBar.HSPID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HSPID"]);
                    oBar.HSPName = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HSPName"]);
                    return oBar;
                    sErrMsg = "单据号:" + HBillNo + ";将单据信息存入条码出入库临时表失败!";
                    return null;
                }
                else
                {
                    sErrMsg = "单据号:" + HBillNo + ";" + DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HRemark"]);
                    if (DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0][0]) == 0)
                    {
                        oBar.HInterID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HInterID"]);
                        oBar.HBillNo = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HBillNo"]);
                        oBar.HWhID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HWhID"]);
                        oBar.HWhName = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HWhName"]);
                        oBar.HSPFlag = DBUtility.ClsPub.isBool(ds1.Tables[0].Rows[0]["HSPFlag"]);
                        oBar.HSPID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HSPID"]);
                        oBar.HSPName = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HSPName"]);
                        return oBar;
                    }
                    else
                    {
                        sErrMsg = "单据号:" + HBillNo + ";" + DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HRemark"]);
                        return null;
                    }
                }
            }
            else
            {
                //将单据信息存入条码出入库临时表
                DataSet ds1 = oCn.RunProcReturn("exec h_p_WMS_AddBillBarCode_BillCheck '" + HBillNo + "','" + HBillType + "','" + HMaker + "'," + HOWNERID.ToString(), "h_p_WMS_AddBillBarCode_BillCheck");
                if (ds1 == null || ds1.Tables[0].Rows.Count == 0)
                {
                    sErrMsg = "单据号:" + HBillNo + ";将单据信息存入条码出入库临时表失败!";
                    return null;
                }
                else
                {
                    if (DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0][0]) == 0)
                    {
                        oBar.HInterID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HInterID"]);
                        oBar.HBillNo = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HBillNo"]);
                        oBar.HWhID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HWhID"]);
                        oBar.HWhName = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HWhName"]);
                        oBar.HSPFlag = DBUtility.ClsPub.isBool(ds1.Tables[0].Rows[0]["HSPFlag"]);
                        oBar.HSPID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HSPID"]);
                        oBar.HSPName = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HSPName"]);
                        return oBar;
                    }
                    else
                    {
                        sErrMsg = "单据号:" + HBillNo + ";" + DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HRemark"]);
                        return null;
                    }
                }
            }
        }
@@ -51508,7 +52032,7 @@
            {
                //获取系统参数
                Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
                if (oSystemParameter.ShowBill(ref sErrMsg) == false)
                if (oSystemParameter.ShowBillByOrgID(HOWNERID, ref sErrMsg) == false)
                {
                    sErrMsg = "获取系统参数失败! " + sErrMsg;
                    return null;
DLL/Pub_Class.dll
Binary files differ