using System; 
 | 
using System.Collections.Generic; 
 | 
using System.Text; 
 | 
using System.Data; 
 | 
  
 | 
namespace DAL 
 | 
{ 
 | 
    public class ClsKF_PonderationBillMain_Audit_Temp_View : DBUtility.ClsGy_Base_View 
 | 
    { 
 | 
         
 | 
        // 
 | 
        public Model.ClsKF_PonderationBillMain_Audit_Temp omodel = new Model.ClsKF_PonderationBillMain_Audit_Temp(); 
 | 
        SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); 
 | 
  
 | 
        public ClsKF_PonderationBillMain_Audit_Temp_View() 
 | 
        { 
 | 
            base.MvarReportTitle = "出入库条码稽核临时表"; 
 | 
            base.MvarItemKey = "KF_PonderationBillMain_Audit_Temp"; 
 | 
            base.SQLName = "Select HItemID from KF_PonderationBillMain_Audit_Temp Order by HItemID "; 
 | 
        } 
 | 
        // 
 | 
        public void Dispose() 
 | 
        { 
 | 
            GC.SuppressFinalize(this); 
 | 
        } 
 | 
        // 
 | 
  
 | 
        //根据扫描条码 数量 判断条码档案数量  
 | 
        public bool CheckQtyByBarCodeBill(long InterID, string sBillType, string sBatchNo, string sBarCode, ref double sRelQty) 
 | 
        { 
 | 
            DataSet DS; 
 | 
            try 
 | 
            { 
 | 
                DS = oCn.RunProcReturn("exec h_p_Kf_CheckBarCodeQty " + InterID.ToString() + ",'" + sBillType + "','" + sBatchNo + "','" + sBarCode + "'," + sRelQty.ToString(), "h_p_Kf_CheckBarCodeQty", ref DBUtility.ClsPub.sExeReturnInfo); 
 | 
                if (DS.Tables[0].Rows.Count == 0) 
 | 
                { 
 | 
                    sRelQty = sRelQty; 
 | 
                    return true; 
 | 
                } 
 | 
                else 
 | 
                { 
 | 
                    double sQtyMust = 0; 
 | 
                    sQtyMust = DBUtility.ClsPub.isDoule(DS.Tables[0].Rows[0]["HQtyMust"]); 
 | 
                    sRelQty = sQtyMust; 
 | 
                    return false; 
 | 
                } 
 | 
            } 
 | 
            catch (Exception e) 
 | 
            { 
 | 
                sRelQty = 0; 
 | 
                throw (e); 
 | 
            } 
 | 
        } 
 | 
  
 | 
        ////判断明细表中条码库存、K3库存 是否充足 (仓库仓位批次) 
 | 
        //public bool CheckQtyByBarCode_Sub(long HInterID, string sBillType, long HMaterID, Int64 HWhID, Int64 HSPID, Int64 HSCWhID, Int64 HSCSPID, string HBatchNo, Int64 HSourceInterID, Int64 HSourceEntryID, string sWhere, ref string sReturn) 
 | 
        //{ 
 | 
        //    DataSet DSBarCode; 
 | 
        //    DataSet DS; 
 | 
        //    DataSet DSk3; 
 | 
        //    string sBarCode; 
 | 
        //    string sBatchNo; 
 | 
        //    Int64 sHWHID; 
 | 
        //    Int64 sHSPID; 
 | 
        //    double sQty; 
 | 
        //    try 
 | 
        //    { 
 | 
        //        DSBarCode=GetBarCodeByID_View(HInterID, sBillType, HMaterID, HWhID, HSPID, HSCWhID, HSCSPID, HBatchNo, HSourceInterID, HSourceEntryID, sWhere); 
 | 
        //        if (DSBarCode == null || DSBarCode.Tables[0].Rows.Count == 0) 
 | 
        //        { 
 | 
        //            sReturn = "正常!"; 
 | 
        //            return true; 
 | 
        //        } 
 | 
        //        for (int i = 0; i <= DSBarCode.Tables[0].Rows.Count - 1; i++) 
 | 
        //        { 
 | 
        //            sBarCode = DBUtility.ClsPub.isStrNull(DSBarCode.Tables[0].Rows[i]["HBarCode"].ToString()); 
 | 
        //            sBatchNo = DBUtility.ClsPub.isStrNull(DSBarCode.Tables[0].Rows[i]["HBatchNo"].ToString()); 
 | 
        //            sHWHID = DBUtility.ClsPub.isInt(DSBarCode.Tables[0].Rows[i]["HWHID"].ToString()); 
 | 
        //            sHSPID = DBUtility.ClsPub.isInt(DSBarCode.Tables[0].Rows[i]["HStockPlaceID"].ToString()); 
 | 
        //            sQty = DBUtility.ClsPub.isDoule(DSBarCode.Tables[0].Rows[i]["HQty"].ToString()); 
 | 
  
 | 
        //            DS = oCn.RunProcReturn("exec h_p_KF_ICInventory_WMS '" + sBarCode + "'," + sHWHID.ToString() + "," + sHSPID.ToString() + ",'" + sBatchNo + "'", "h_p_KF_ICInventory_WMS", ref DBUtility.ClsPub.sExeReturnInfo); 
 | 
        //            DSk3 = oCn.RunProcReturn("exec h_p_k3_icinventory '" + sBarCode + "'," + sHWHID.ToString() + "," + sHSPID.ToString(), "h_p_k3_icinventory", ref DBUtility.ClsPub.sExeReturnInfo); 
 | 
        //            if (DS.Tables[0].Rows.Count == 0) 
 | 
        //            { 
 | 
        //                sReturn = "条码" + sBarCode + "无条码库存!"; 
 | 
        //                return false; 
 | 
        //            }  
 | 
        //            else if (DSk3.Tables[0].Rows.Count == 0) 
 | 
        //            { 
 | 
        //                sReturn = "条码" + sBarCode + "无K3库存!"; 
 | 
        //                return false; 
 | 
        //            } 
 | 
        //            else 
 | 
        //            { 
 | 
        //                double sKCQty = 0; 
 | 
        //                double sKCQtyk3 = 0; 
 | 
        //                sKCQty = DBUtility.ClsPub.isDoule(DS.Tables[0].Rows[0]["HQty"]); 
 | 
        //                sKCQtyk3 = DBUtility.ClsPub.isDoule(DSk3.Tables[0].Rows[0]["HQty"]); 
 | 
        //                if (sQty > sKCQty && sQty > sKCQtyk3) 
 | 
        //                { 
 | 
        //                    sReturn = "条码" + sBarCode + "的扫描数量" + sQty + "大于条码库存数量" + sKCQty + ",大于K3库存数量" + sKCQtyk3 + "!"; 
 | 
        //                    return false; 
 | 
        //                } 
 | 
        //                else if (sQty > sKCQty && sQty < sKCQtyk3) 
 | 
        //                { 
 | 
        //                    sReturn = "条码" + sBarCode + "的扫描数量" + sQty + "大于条码库存数量" + sKCQty + "!"; 
 | 
        //                    return false; 
 | 
        //                } 
 | 
        //                else if (sQty < sKCQty && sQty > sKCQtyk3) 
 | 
        //                { 
 | 
        //                    sReturn = "条码" + sBarCode + "的扫描数量" + sQty + ",大于K3库存数量" + sKCQtyk3 + "!"; 
 | 
        //                    return false; 
 | 
        //                } 
 | 
        //                else 
 | 
        //                { 
 | 
  
 | 
        //                } 
 | 
        //            } 
 | 
        //        } 
 | 
        //    } 
 | 
        //    catch (Exception e) 
 | 
        //    { 
 | 
        //        sReturn = e.Message; 
 | 
        //        throw (e); 
 | 
        //    } 
 | 
        //    return false; 
 | 
        //} 
 | 
  
 | 
        //根据条码 数量 判断条码库存 是否充足 (仓库仓位) 
 | 
        public bool CheckQtyByBarCode(string sBarCode, long HWHID, long HSPID, string sBatchNo, double sQty, ref double sRelQty) 
 | 
        { 
 | 
            DataSet DS; 
 | 
            DataSet DSk3; 
 | 
            try 
 | 
            { 
 | 
                DS = oCn.RunProcReturn("exec h_p_KF_ICInventory_WMS '" + sBarCode + "'," + HWHID.ToString() + "," + HSPID.ToString() + ",'" + sBatchNo + "'", "h_p_KF_ICInventory_WMS", ref DBUtility.ClsPub.sExeReturnInfo); 
 | 
                DSk3 = oCn.RunProcReturn("exec h_p_k3_icinventory '" + sBarCode + "'," + HWHID.ToString() + "," + HSPID.ToString(), "h_p_k3_icinventory", ref DBUtility.ClsPub.sExeReturnInfo); 
 | 
                if (DS.Tables[0].Rows.Count == 0 || DSk3.Tables[0].Rows.Count == 0) 
 | 
                { 
 | 
                    sRelQty = 0; 
 | 
                    return false; 
 | 
                } 
 | 
                else 
 | 
                { 
 | 
                    double sKCQty = 0; 
 | 
                    double sKCQtyk3 = 0; 
 | 
                    sKCQty = DBUtility.ClsPub.isDoule(DS.Tables[0].Rows[0]["HQty"]); 
 | 
                    sKCQtyk3 = DBUtility.ClsPub.isDoule(DSk3.Tables[0].Rows[0]["HQty"]); 
 | 
                    if (sQty > sKCQty && sQty > sKCQtyk3) 
 | 
                    { 
 | 
                        sRelQty = sKCQtyk3; 
 | 
                        return false; 
 | 
                    } 
 | 
                    else if (sQty > sKCQty && sQty < sKCQtyk3) 
 | 
                    { 
 | 
                        sRelQty = sKCQty; 
 | 
                        return false; 
 | 
                    } 
 | 
                    else if (sQty < sKCQty && sQty > sKCQtyk3) 
 | 
                    { 
 | 
                        sRelQty = sKCQtyk3; 
 | 
                        return false; 
 | 
                    } 
 | 
                    else 
 | 
                    { 
 | 
                        sRelQty = sQty; 
 | 
                        return true; 
 | 
                    } 
 | 
                } 
 | 
            } 
 | 
            catch (Exception e) 
 | 
            { 
 | 
                sRelQty = 0; 
 | 
                throw (e); 
 | 
            } 
 | 
        } 
 | 
  
 | 
        //根据条码 数量 判断条码库存 是否充足 并且带出 仓库仓位 
 | 
        public bool CheckQtyByBarCode(long InterID, string sBillType, string sBarCode, ref long HWHID, ref long HSPID, double sQty, ref double sRelQty) 
 | 
        { 
 | 
            DataSet DS; 
 | 
            DataSet DSk3; 
 | 
            try 
 | 
            { 
 | 
                //单条码,一张单据一条条码 
 | 
                //DS = oCn.RunProcReturn("exec h_p_KF_ICInventory_WMS_GetWHAndSP_Single " + InterID.ToString() + ",'" + sBillType + "','" + sBarCode + "'," + HWHID.ToString() + "," + HSPID.ToString(), "h_p_KF_ICInventory_WMS_GetWHAndSP_Single", ref DBUtility.ClsPub.sExeReturnInfo); 
 | 
                //原判断条码库存 
 | 
                DS = oCn.RunProcReturn("exec h_p_KF_ICInventory_WMS_GetWHAndSP_Audit " + InterID.ToString() + ",'" + sBillType + "','" + sBarCode + "'," + HWHID.ToString() + "," + HSPID.ToString(), "h_p_KF_ICInventory_WMS_GetWHAndSP_Audit", ref DBUtility.ClsPub.sExeReturnInfo); 
 | 
                //DS = oCn.RunProcReturn("exec h_p_KF_ICInventory_WMS_GetWHAndSP " + InterID.ToString() + ",'" + sBillType + "','" + sBarCode + "'", "h_p_KF_ICInventory_WMS_GetWHAndSP", ref DBUtility.ClsPub.sExeReturnInfo); 
 | 
                if (DS.Tables[0].Rows.Count == 0) 
 | 
                { 
 | 
                    sRelQty = 0; 
 | 
                    return false; 
 | 
                } 
 | 
                else 
 | 
                { 
 | 
                    double sKFQty = 0; 
 | 
                    double sKFQtyk3 = 0; 
 | 
                    sKFQty = DBUtility.ClsPub.isDoule(DS.Tables[0].Rows[0]["HKFQty"]); 
 | 
                    HWHID = DBUtility.ClsPub.isLong(DS.Tables[0].Rows[0]["HWhID"]); 
 | 
                    HSPID = DBUtility.ClsPub.isLong(DS.Tables[0].Rows[0]["HSPID"]); 
 | 
                    DSk3 = oCn.RunProcReturn("exec h_p_K3_ICInventory_WMS_GetWHAndSP_Audit " + InterID.ToString() + ",'" + sBillType + "','" + sBarCode + "'," + HWHID.ToString() + "," + HSPID.ToString(), "h_p_K3_ICInventory_WMS_GetWHAndSP_Audit", ref DBUtility.ClsPub.sExeReturnInfo); 
 | 
                    if (DSk3.Tables[0].Rows.Count == 0) 
 | 
                    { 
 | 
                        sRelQty = 0; 
 | 
                        return false; 
 | 
                    } 
 | 
                    sKFQtyk3 = DBUtility.ClsPub.isDoule(DSk3.Tables[0].Rows[0]["HKFQty"]); 
 | 
                    if (sQty > sKFQty && sQty > sKFQtyk3) 
 | 
                    { 
 | 
                        sRelQty = sKFQtyk3; 
 | 
                        return false; 
 | 
                    } 
 | 
                    else if (sQty > sKFQty && sQty < sKFQtyk3) 
 | 
                    { 
 | 
                        sRelQty = sKFQty; 
 | 
                        return false; 
 | 
                    } 
 | 
                    else if (sQty < sKFQty && sQty > sKFQtyk3) 
 | 
                    { 
 | 
                        sRelQty = sKFQtyk3; 
 | 
                        return false; 
 | 
                    } 
 | 
                    else 
 | 
                    { 
 | 
                        sRelQty = sQty; 
 | 
                        return true; 
 | 
                    } 
 | 
                } 
 | 
            } 
 | 
            catch (Exception e) 
 | 
            { 
 | 
                sRelQty = 0; 
 | 
                throw (e); 
 | 
            } 
 | 
        } 
 | 
  
 | 
        //根据条码 判断条码是否在待稽核列表 
 | 
        public bool CheckInfoByBarCode_Audit(long HInterID, string sBarCode) 
 | 
        { 
 | 
            DataSet DS; 
 | 
            try 
 | 
            { 
 | 
                DS = oCn.RunProcReturn("exec h_p_KF_CheckInfoByBarCode_Audit " + HInterID.ToString() + ",'" + sBarCode + "'", "h_p_KF_CheckInfoByBarCode_Audit", ref DBUtility.ClsPub.sExeReturnInfo); 
 | 
                if (DS.Tables[0].Rows.Count == 0) 
 | 
                { 
 | 
                    return false; 
 | 
                } 
 | 
                else 
 | 
                { 
 | 
                    return true; 
 | 
                } 
 | 
            } 
 | 
            catch (Exception e) 
 | 
            { 
 | 
                throw (e); 
 | 
            } 
 | 
        } 
 | 
          
 | 
        //返回项目信息 
 | 
        public override bool GetInfoByID(Int64 sItemID) 
 | 
        { 
 | 
            DataSet DS ; 
 | 
            try 
 | 
            { 
 | 
                DS = oCn.RunProcReturn("Select * from " + MvarItemKey + " Where HItemID='" + sItemID + "'", MvarItemKey, ref DBUtility.ClsPub.sExeReturnInfo); 
 | 
                if (DS.Tables[0].Rows.Count  == 0) 
 | 
                    return false; 
 | 
                else 
 | 
                { 
 | 
                    return GetInfo(DS); 
 | 
                } 
 | 
            } 
 | 
            catch (Exception e) 
 | 
            { 
 | 
                throw (e); 
 | 
            } 
 | 
        } 
 | 
  
 | 
         
 | 
  
 | 
        //根据代码返回项目信息 
 | 
        public DataSet GetInfoByID_View_Check(long HInterID, string sBillType, string sWhere) 
 | 
        { 
 | 
            DataSet DS; 
 | 
            try 
 | 
            { 
 | 
                DS = oCn.RunProcReturn("Select * from h_v_KF_PonderationBillMain_Audit_Temp_Wh_SP Where HInterID=" + HInterID.ToString() + " and HBillType='" + sBillType + "' " + sWhere, "h_v_KF_PonderationBillMain_Audit_Temp_Wh_SP", ref DBUtility.ClsPub.sExeReturnInfo); 
 | 
                if (DS.Tables[0].Rows.Count == 0) 
 | 
                    return null; 
 | 
                else 
 | 
                { 
 | 
                    return DS; 
 | 
                } 
 | 
            } 
 | 
            catch (Exception e) 
 | 
            { 
 | 
                throw (e); 
 | 
            } 
 | 
        } 
 | 
  
 | 
        //根据代码返回项目信息(盘点) 
 | 
        public DataSet GetInfoByID_View_CheckStcok(long HInterID, string sBillType, string sWhere) 
 | 
        { 
 | 
            DataSet DS; 
 | 
            try 
 | 
            { 
 | 
                DS = oCn.RunProcReturn("exec h_p_KF_PonderationBillMain_Audit_Temp_CheckStock " + HInterID.ToString() + ",'" + sBillType + "'", "h_p_KF_PonderationBillMain_Audit_Temp_CheckStock", ref DBUtility.ClsPub.sExeReturnInfo); 
 | 
                if (DS.Tables[0].Rows.Count == 0) 
 | 
                    return null; 
 | 
                else 
 | 
                { 
 | 
                    return DS; 
 | 
                } 
 | 
            } 
 | 
            catch (Exception e) 
 | 
            { 
 | 
                throw (e); 
 | 
            } 
 | 
        } 
 | 
  
 | 
         
 | 
  
 | 
        //根据代码返回项目信息 
 | 
        public DataSet GetInfoByID_View_FIFO(long HInterID, string sBillType, string sWhere) 
 | 
        { 
 | 
            DataSet DS; 
 | 
            try 
 | 
            { 
 | 
                DS = oCn.RunProcReturn("select * from  h_v_Kf_ICInventory_FIFO_Tmp Where HInterID=" + HInterID.ToString() + " and HBillType='" + sBillType + "' " + sWhere, "h_v_Kf_ICInventory_FIFO_Tmp", ref DBUtility.ClsPub.sExeReturnInfo); 
 | 
                if (DS.Tables[0].Rows.Count == 0) 
 | 
                    return null; 
 | 
                else 
 | 
                { 
 | 
                    return DS; 
 | 
                } 
 | 
            } 
 | 
            catch (Exception e) 
 | 
            { 
 | 
                throw (e); 
 | 
            } 
 | 
        } 
 | 
  
 | 
        //根据代码返回项目信息 
 | 
        public DataSet GetInfoByID_View_FIFO(long HInterID, string sBillType, long HMaterID, string sWhere) 
 | 
        { 
 | 
            DataSet DS; 
 | 
            try 
 | 
            { 
 | 
                DS = oCn.RunProcReturn("select * from  h_v_Kf_ICInventory_FIFO_Tmp_New Where HInterID=" + HInterID.ToString() + " and HBillType='" + sBillType + "'  and HMaterID=" + HMaterID.ToString() + sWhere, "h_v_Kf_ICInventory_FIFO_Tmp_New", ref DBUtility.ClsPub.sExeReturnInfo); 
 | 
                if (DS.Tables[0].Rows.Count == 0) 
 | 
                    return null; 
 | 
                else 
 | 
                { 
 | 
                    return DS; 
 | 
                } 
 | 
            } 
 | 
            catch (Exception e) 
 | 
            { 
 | 
                throw (e); 
 | 
            } 
 | 
        } 
 | 
        ////根据代码返回项目信息 
 | 
        //public DataSet GetCusAndBarCodeByID_View(long HInterID, string sWhere) 
 | 
        //{ 
 | 
        //    DataSet DS; 
 | 
        //    try 
 | 
        //    { 
 | 
        //        DS = oCn.RunProcReturn("Select * from h_v_K3_GetCusAndBarCodeList Where HInterID=" + HInterID.ToString() + sWhere, "h_v_K3_GetCusAndBarCodeList", ref DBUtility.ClsPub.sExeReturnInfo); 
 | 
        //        if (DS.Tables[0].Rows.Count == 0) 
 | 
        //            return null; 
 | 
        //        else 
 | 
        //        { 
 | 
        //            return DS; 
 | 
        //        } 
 | 
        //    } 
 | 
        //    catch (Exception e) 
 | 
        //    { 
 | 
        //        throw (e); 
 | 
        //    } 
 | 
        //} 
 | 
  
 | 
        //根据代码返回项目信息 
 | 
        public DataSet GetBarCodeByID_View(long HInterID, string sBillType, long HMaterID, string sWhere) 
 | 
        { 
 | 
            DataSet DS; 
 | 
            try 
 | 
            { 
 | 
                DS = oCn.RunProcReturn("Select * from KF_PonderationBillMain_Audit_Temp Where HQty<>0 and HInterID=" + HInterID.ToString() + " and HBillType='" + sBillType + "' and HMaterID=" + HMaterID + sWhere, "KF_PonderationBillMain_Audit_Temp", ref DBUtility.ClsPub.sExeReturnInfo); 
 | 
                if (DS.Tables[0].Rows.Count == 0) 
 | 
                    return null; 
 | 
                else 
 | 
                { 
 | 
                    return DS; 
 | 
                } 
 | 
            } 
 | 
            catch (Exception e) 
 | 
            { 
 | 
                throw (e); 
 | 
            } 
 | 
        } 
 | 
  
 | 
  
 | 
        ////根据代码返回项目信息 
 | 
        //public DataSet GetBarCodeByID_View(long HInterID, string sBillType, long HMaterID, Int64 HWhID, Int64 HSPID, Int64 HSCWhID, Int64 HSCSPID, string HBatchNo, Int64 HSourceInterID, Int64 HSourceEntryID, string sWhere) 
 | 
        //{ 
 | 
        //    DataSet DS; 
 | 
        //    try 
 | 
        //    { 
 | 
        //        DS = oCn.RunProcReturn("Select HBarCode,sum(HQty) HQty from KF_PonderationBillMain_Audit_Temp Where HQty<>0 and HInterID=" + HInterID.ToString() + 
 | 
        //                    " and HBillType='" + sBillType + "'" + 
 | 
        //                    " and HMaterID=" + HMaterID + 
 | 
        //                    " and HWHID=" + HWhID + 
 | 
        //                    " and HStockPlaceID=" + HSPID + 
 | 
        //                    " and HSCWHID=" + HSCWhID + 
 | 
        //                    " and HOutStockPlaceID=" + HSCSPID + 
 | 
        //                    " and HBatchNo='" + HBatchNo + "'" + 
 | 
        //                    " and HSourceInterID=" + HSourceInterID + 
 | 
        //                    " and HSourceEntryID=" + HSourceEntryID + 
 | 
        //                     sWhere + 
 | 
        //                    " Group by HBarCode", "KF_PonderationBillMain_Audit_Temp", ref DBUtility.ClsPub.sExeReturnInfo); 
 | 
        //        if (DS.Tables[0].Rows.Count == 0) 
 | 
        //            return null; 
 | 
        //        else 
 | 
        //        { 
 | 
        //            return DS; 
 | 
        //        } 
 | 
        //    } 
 | 
        //    catch (Exception e) 
 | 
        //    { 
 | 
        //        throw (e); 
 | 
        //    } 
 | 
        //} 
 | 
  
 | 
  
 | 
  
 | 
        //根据代码返回项目信息 
 | 
        public DataSet GetBarCodeByID_View(long HInterID, string sBillType, long HMaterID, Int64 HWhID, Int64 HSPID, Int64 HSCWhID, Int64 HSCSPID, string HBatchNo, Int64 HSourceInterID, Int64 HSourceEntryID, string sWhere) 
 | 
        { 
 | 
            DataSet DS; 
 | 
            try 
 | 
            { 
 | 
                DS = oCn.RunProcReturn("Select HBatchNo,HBarCode,HWHID,HStockPlaceID,HSCWHID,HOutStockPlaceID,sum(HQty) HQty from KF_PonderationBillMain_Audit_Temp Where HQty<>0 and HInterID=" + HInterID.ToString() + 
 | 
                            " and HBillType='" + sBillType + "'" + 
 | 
                            " and HMaterID=" + HMaterID + 
 | 
                    //" and HWHID=" + HWhID + 
 | 
                    //" and HStockPlaceID=" + HSPID + 
 | 
                    //" and HSCWHID=" + HSCWhID + 
 | 
                    //" and HOutStockPlaceID=" + HSCSPID + 
 | 
                            " and (HBatchNo='" + HBatchNo + "' or '" + HBatchNo + "' ='')" + 
 | 
                            " and HSourceInterID=" + HSourceInterID + 
 | 
                            " and HSourceEntryID=" + HSourceEntryID + 
 | 
                             sWhere + 
 | 
                            " Group by HBatchNo,HBarCode,HWHID,HStockPlaceID,HSCWHID,HOutStockPlaceID", "KF_PonderationBillMain_Audit_Temp", ref DBUtility.ClsPub.sExeReturnInfo); 
 | 
                if (DS.Tables[0].Rows.Count == 0) 
 | 
                    return null; 
 | 
                else 
 | 
                { 
 | 
                    return DS; 
 | 
                } 
 | 
            } 
 | 
            catch (Exception e) 
 | 
            { 
 | 
                throw (e); 
 | 
            } 
 | 
        } 
 | 
  
 | 
        //根据代码返回项目信息 
 | 
        public override bool GetInfoByNumber(string sNumber) 
 | 
        { 
 | 
            DataSet DS; 
 | 
            try 
 | 
            { 
 | 
                DS = oCn.RunProcReturn("Select * from " + MvarItemKey + " Where HBarCode='" + sNumber + "'", MvarItemKey, ref DBUtility.ClsPub.sExeReturnInfo); 
 | 
                if (DS.Tables[0].Rows.Count == 0) 
 | 
                    return false; 
 | 
                else 
 | 
                { 
 | 
                    return GetInfo(DS); 
 | 
                } 
 | 
            } 
 | 
            catch (Exception e) 
 | 
            { 
 | 
                throw (e); 
 | 
            } 
 | 
        }  
 | 
        //返回项目信息 
 | 
        public override bool GetInfo(DataSet Ds) 
 | 
        { 
 | 
            try 
 | 
            { 
 | 
                omodel = new Model.ClsKF_PonderationBillMain_Audit_Temp(); 
 | 
                omodel.HItemID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HItemID"]); 
 | 
                omodel.HInterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HInterID"]); 
 | 
                omodel.HBarCode = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBarCode"]); 
 | 
                omodel.HMaterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HMaterID"]); 
 | 
                omodel.HProcID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HProcID"]); 
 | 
                omodel.HWhID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HWhID"]); 
 | 
                omodel.HSCWHID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HSCWHID"]); 
 | 
                omodel.HStockPlaceID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HStockPlaceID"]); 
 | 
                omodel.HOutStockPlaceID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HOutStockPlaceID"]); 
 | 
                omodel.HGroupID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HGroupID"]); 
 | 
                omodel.HQty = DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[0]["HQty"]); 
 | 
                omodel.HPieceQty = DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[0]["HPieceQty"]); 
 | 
                omodel.HAddr = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HAddr"]); 
 | 
                omodel.HAuditFlag = DBUtility.ClsPub.isBool(Ds.Tables[0].Rows[0]["HAuditFlag"]); 
 | 
                // 
 | 
                omodel.HSourceBillType = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HSourceBillType"]); 
 | 
                omodel.HSourceInterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HSourceInterID"]); 
 | 
                omodel.HSourceEntryID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HSourceEntryID"]); 
 | 
                return true; 
 | 
  
 | 
            } 
 | 
            catch (Exception e) 
 | 
            { 
 | 
                throw (e); 
 | 
            } 
 | 
        } 
 | 
  
 | 
        
 | 
        //根据代码返回项目信息 
 | 
        public DataSet GetCusAndBarCodeByID_View(long HInterID, string sWhere) 
 | 
        { 
 | 
            DataSet DS; 
 | 
            try 
 | 
            { 
 | 
                DS = oCn.RunProcReturn("Select * from h_v_K3_GetCusAndBarCodeList Where HInterID=" + HInterID.ToString() + sWhere, "h_v_K3_GetCusAndBarCodeList", ref DBUtility.ClsPub.sExeReturnInfo); 
 | 
                if (DS.Tables[0].Rows.Count == 0) 
 | 
                    return null; 
 | 
                else 
 | 
                { 
 | 
                    return DS; 
 | 
                } 
 | 
            } 
 | 
            catch (Exception e) 
 | 
            { 
 | 
                throw (e); 
 | 
            } 
 | 
        } 
 | 
  
 | 
         
 | 
  
 | 
        //根据代码返回项目信息 
 | 
        public DataSet GetInfoByID_View(long HInterID, string sBillType, string sWhere) 
 | 
        { 
 | 
            DataSet DS; 
 | 
            try 
 | 
            { 
 | 
                DS = oCn.RunProcReturn("Select * from h_v_KF_PonderationBillMain_Audit_Temp Where HInterID=" + HInterID.ToString() + " and HBillType='" + sBillType + "' " + sWhere, "h_v_KF_PonderationBillMain_Audit_Temp", ref DBUtility.ClsPub.sExeReturnInfo); 
 | 
                if (DS.Tables[0].Rows.Count == 0) 
 | 
                    return null; 
 | 
                else 
 | 
                { 
 | 
                    return DS; 
 | 
                } 
 | 
            } 
 | 
            catch (Exception e) 
 | 
            { 
 | 
                throw (e); 
 | 
            } 
 | 
        } 
 | 
  
 | 
  
 | 
        //根据代码返回项目信息 
 | 
        public DataSet GetInfoByID_View_Sum(long HInterID, string sBillType, string sWhere) 
 | 
        { 
 | 
            DataSet DS; 
 | 
            try 
 | 
            { 
 | 
                DS = oCn.RunProcReturn("Select * from h_v_KF_PonderationBillMain_Audit_Temp_Sum Where HInterID=" + HInterID.ToString() + " and HBillType='" + sBillType + "' " + sWhere, "h_v_KF_PonderationBillMain_Audit_Temp_Sum", ref DBUtility.ClsPub.sExeReturnInfo); 
 | 
                if (DS.Tables[0].Rows.Count == 0) 
 | 
                    return null; 
 | 
                else 
 | 
                { 
 | 
                    return DS; 
 | 
                } 
 | 
            } 
 | 
            catch (Exception e) 
 | 
            { 
 | 
                throw (e); 
 | 
            } 
 | 
        } 
 | 
  
 | 
        //根据代码返回项目信息(未上传) 
 | 
        public DataSet GetInfoByID_View(string sBillType, string sWhere) 
 | 
        { 
 | 
            DataSet DS; 
 | 
            try 
 | 
            { 
 | 
                DS = oCn.RunProcReturn("Select * from h_v_KF_PonderationBillMain_Audit_Temp_OffLine Where  HBillType='" + sBillType + "' " + sWhere, "h_v_KF_PonderationBillMain_Audit_Temp_OffLine", ref DBUtility.ClsPub.sExeReturnInfo); 
 | 
                if (DS.Tables[0].Rows.Count == 0) 
 | 
                    return null; 
 | 
                else 
 | 
                { 
 | 
                    return DS; 
 | 
                } 
 | 
            } 
 | 
            catch (Exception e) 
 | 
            { 
 | 
                throw (e); 
 | 
            } 
 | 
        } 
 | 
  
 | 
        //返回缓存列表信息 
 | 
        public DataSet GetKF_PonderationBillMain_Audit_TempList(string sBillType, string sWhere) 
 | 
        { 
 | 
            DataSet DS; 
 | 
            try 
 | 
            { 
 | 
                DS = oCn.RunProcReturn("exec  h_p_KF_GetPonderationBillMain_Audit_TempList '" + sBillType + "','" +sWhere + "'", "h_p_KF_GetPonderationBillMain_Audit_TempList", ref DBUtility.ClsPub.sExeReturnInfo); 
 | 
                if (DS.Tables[0].Rows.Count == 0) 
 | 
                    return null; 
 | 
                else 
 | 
                { 
 | 
                    return DS; 
 | 
                } 
 | 
            } 
 | 
            catch (Exception e) 
 | 
            { 
 | 
                throw (e); 
 | 
            } 
 | 
        } 
 | 
  
 | 
        //返回缓存列表信息(倒箱单) 
 | 
        public DataSet GetKF_PonderationBillMain_Audit_TempList_ChangeBox(string sBillType, string sWhere) 
 | 
        { 
 | 
            DataSet DS; 
 | 
            try 
 | 
            { 
 | 
                DS = oCn.RunProcReturn("exec  h_p_KF_GetPonderationBillMain_Audit_TempList_ChangeBox '" + sBillType + "','" + sWhere + "'", "h_p_KF_GetPonderationBillMain_Audit_TempList_ChangeBox", ref DBUtility.ClsPub.sExeReturnInfo); 
 | 
                if (DS.Tables[0].Rows.Count == 0) 
 | 
                    return null; 
 | 
                else 
 | 
                { 
 | 
                    return DS; 
 | 
                } 
 | 
            } 
 | 
            catch (Exception e) 
 | 
            { 
 | 
                throw (e); 
 | 
            } 
 | 
        } 
 | 
  
 | 
        ////根据代码返回项目信息 
 | 
        //public DataSet GetInfoByID_View(long HInterID, string sBillType, string sWhere) 
 | 
        //{ 
 | 
        //    DataSet DS; 
 | 
        //    try 
 | 
        //    { 
 | 
        //        DS = oCn.RunProcReturn("Select * from h_v_KF_PonderationBillMain_Audit_Temp Where HInterID=" + HInterID.ToString() + " and HBillType='" + sBillType + "' " + sWhere, "h_v_KF_PonderationBillMain_Audit_Temp", ref DBUtility.ClsPub.sExeReturnInfo); 
 | 
        //        if (DS.Tables[0].Rows.Count == 0) 
 | 
        //            return null; 
 | 
        //        else 
 | 
        //        { 
 | 
        //            return DS; 
 | 
        //        } 
 | 
        //    } 
 | 
        //    catch (Exception e) 
 | 
        //    { 
 | 
        //        throw (e); 
 | 
        //    } 
 | 
        //} 
 | 
  
 | 
        public DataSet GetMaterByBarCode_View(string sWhere) 
 | 
        { 
 | 
            DataSet DS; 
 | 
            try 
 | 
            { 
 | 
                DS = oCn.RunProcReturn(" exec h_p_KF_ICInventory_BarCodeMater_Main '" + sWhere + "'","h_p_KF_ICInventory_BarCodeMater_Main", ref DBUtility.ClsPub.sExeReturnInfo); 
 | 
                if (DS.Tables[0].Rows.Count == 0) 
 | 
                    return null; 
 | 
                else 
 | 
                { 
 | 
                    return DS; 
 | 
                } 
 | 
            } 
 | 
            catch (Exception e) 
 | 
            { 
 | 
                throw (e); 
 | 
            } 
 | 
        } 
 | 
  
 | 
  
 | 
  
 | 
        public DataSet GetICInventoryByBarCode_View(string sWhere) 
 | 
        { 
 | 
            DataSet DS; 
 | 
            try 
 | 
            { 
 | 
                DS = oCn.RunProcReturn(" exec h_p_KF_ICInventory_BarCodeMater_Sub '" + sWhere + "'","h_p_KF_ICInventory_BarCodeMater_Sub", ref DBUtility.ClsPub.sExeReturnInfo); 
 | 
                if (DS.Tables[0].Rows.Count == 0) 
 | 
                    return null; 
 | 
                else 
 | 
                { 
 | 
                    return DS; 
 | 
                } 
 | 
            } 
 | 
            catch (Exception e) 
 | 
            { 
 | 
                throw (e); 
 | 
            } 
 | 
        } 
 | 
  
 | 
  
 | 
  
 | 
        public DataSet GetMaterByBarCodeSP_View(string sWhere) 
 | 
        { 
 | 
            DataSet DS; 
 | 
            try 
 | 
            { 
 | 
                DS = oCn.RunProcReturn(" exec h_p_KF_ICInventory_BarCodeSP_Sub '" + sWhere + "'","h_p_KF_ICInventory_BarCodeSP_Sub", ref DBUtility.ClsPub.sExeReturnInfo); 
 | 
                if (DS.Tables[0].Rows.Count == 0) 
 | 
                    return null; 
 | 
                else 
 | 
                { 
 | 
                    return DS; 
 | 
                } 
 | 
            } 
 | 
            catch (Exception e) 
 | 
            { 
 | 
                throw (e); 
 | 
            } 
 | 
        } 
 | 
  
 | 
  
 | 
  
 | 
        public DataSet GetICInventoryByBarCodeSP_View(string sWhere) 
 | 
        { 
 | 
            DataSet DS; 
 | 
            try 
 | 
            { 
 | 
                DS = oCn.RunProcReturn(" exec h_p_KF_ICInventory_BarCodeSP_Main '" + sWhere + "'","h_p_KF_ICInventory_BarCodeSP_Main", ref DBUtility.ClsPub.sExeReturnInfo); 
 | 
                if (DS.Tables[0].Rows.Count == 0) 
 | 
                    return null; 
 | 
                else 
 | 
                { 
 | 
                    return DS; 
 | 
                } 
 | 
            } 
 | 
            catch (Exception e) 
 | 
            { 
 | 
                throw (e); 
 | 
            } 
 | 
        } 
 | 
  
 | 
  
 | 
  
 | 
  
 | 
         
 | 
        //返回即时库存 
 | 
        public DataSet Get_ICInventoryByBarCodeList(string sBarCode, long sHWHID, long sHSPID, string sWhere) 
 | 
        { 
 | 
            DataSet DS; 
 | 
            try 
 | 
            { 
 | 
                DS = oCn.RunProcReturn("exec h_p_KF_ICInventoryByBarCodeList '" + sBarCode + "'," + sHWHID.ToString() + "," + sHSPID.ToString(), "h_p_KF_ICInventoryByBarCodeList", ref DBUtility.ClsPub.sExeReturnInfo); 
 | 
                if (DS.Tables[0].Rows.Count == 0) 
 | 
                    return null; 
 | 
                else 
 | 
                { 
 | 
                    return DS; 
 | 
                } 
 | 
            } 
 | 
            catch (Exception e) 
 | 
            { 
 | 
                throw (e); 
 | 
            } 
 | 
        } 
 | 
  
 | 
        //根据物料返回即时库存 
 | 
        public DataSet Get_ICInventoryByMaterID(long sHMaterID, string sWhere) 
 | 
        { 
 | 
            DataSet DS; 
 | 
            try 
 | 
            { 
 | 
                DS = oCn.RunProcReturn("exec h_p_KF_ICInventoryByMaterID " + sHMaterID.ToString(), "h_p_KF_ICInventoryByMaterID", ref DBUtility.ClsPub.sExeReturnInfo); 
 | 
                if (DS.Tables[0].Rows.Count == 0) 
 | 
                    return null; 
 | 
                else 
 | 
                { 
 | 
                    return DS; 
 | 
                } 
 | 
            } 
 | 
            catch (Exception e) 
 | 
            { 
 | 
                throw (e); 
 | 
            } 
 | 
        } 
 | 
  
 | 
        //判断扫描记录,是否按照先进先出规则 
 | 
        public bool CheckICInventory_FIFO_Tmp(long InterID, string sBillType, ref string sReturn) 
 | 
        { 
 | 
            SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); 
 | 
            DataSet DS; 
 | 
            try 
 | 
            { 
 | 
                DS = oCn.RunProcReturn("exec h_p_Kf_ICInventory_FIFO_Tmp_Check " + InterID.ToString() + "," + sBillType.ToString(), "h_p_Kf_ICInventory_FIFO_Tmp_Check", ref DBUtility.ClsPub.sExeReturnInfo); 
 | 
                if (DS.Tables[0].Rows.Count == 0 || DS == null) 
 | 
                { 
 | 
                    oCn.CnClose(); 
 | 
                    oCn.CnDispose(); 
 | 
                    sReturn = "null未知错误"; 
 | 
                    return false;       //不存在 入库数量超过条码本身额定数量 条码 
 | 
                } 
 | 
                else 
 | 
                { 
 | 
                    if (DBUtility.ClsPub.isDoule(DS.Tables[0].Rows[0][0]) == 1) 
 | 
                    { 
 | 
                        oCn.CnClose(); 
 | 
                        oCn.CnDispose(); 
 | 
                        sReturn = DBUtility.ClsPub.isStrNull(DS.Tables[0].Rows[0][1]); 
 | 
                        return false; 
 | 
                    } 
 | 
                    else 
 | 
                    { 
 | 
                        oCn.CnClose(); 
 | 
                        oCn.CnDispose(); 
 | 
                        sReturn = "正常!"; 
 | 
                        return true; 
 | 
                    } 
 | 
                } 
 | 
            } 
 | 
            catch (Exception e) 
 | 
            { 
 | 
                sReturn = e.Message; 
 | 
                throw (e); 
 | 
            } 
 | 
        } 
 | 
  
 | 
        //根据VDA箱号 数量 判断扫描数量 是否匹配  
 | 
        public bool CheckQtyByVDAPack(long InterID, string sBillType, string sVDAPack, ref string sReturn) 
 | 
        { 
 | 
            DataSet DS; 
 | 
            try 
 | 
            { 
 | 
                DS = oCn.RunProcReturn("select sum(HQty) HQty,HVDAQty from  KF_PonderationBillMain_Audit_Temp  where HInterID=" + InterID.ToString() + " and HBillType='" + sBillType + "' and HVDAPack='" + sVDAPack + "' group by HVDAQty", "KF_PonderationBillMain_Audit_Temp", ref DBUtility.ClsPub.sExeReturnInfo); 
 | 
                if (DS.Tables[0].Rows.Count == 0) 
 | 
                { 
 | 
                    return false; 
 | 
                } 
 | 
                else 
 | 
                { 
 | 
                    double sQty = 0; 
 | 
                    double sVDAQty = 0; 
 | 
                    sQty = DBUtility.ClsPub.isDoule(DS.Tables[0].Rows[0]["HQty"]); 
 | 
                    sVDAQty = DBUtility.ClsPub.isDoule(DS.Tables[0].Rows[0]["HVDAQty"]); 
 | 
                    if (sQty != sVDAQty) 
 | 
                    { 
 | 
                        sReturn = "本托数量与 VDA数量不一致!"; 
 | 
                        return false; 
 | 
                    } 
 | 
                    else 
 | 
                    { 
 | 
                        sReturn = "正常"; 
 | 
                        return true; 
 | 
                    } 
 | 
                } 
 | 
            } 
 | 
            catch (Exception e) 
 | 
            { 
 | 
                throw (e); 
 | 
            } 
 | 
        } 
 | 
  
 | 
  
 | 
  
 | 
  
 | 
  
 | 
    } 
 | 
} 
 |