using System; using System.Collections.Generic; using System.Text; using System.Data; namespace DAL { public class ClsKF_PonderationBillMain_Temp_View : DBUtility.ClsGy_Base_View { // public Model.ClsKF_PonderationBillMain_Temp omodel = new Model.ClsKF_PonderationBillMain_Temp(); SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); public ClsKF_PonderationBillMain_Temp_View() { base.MvarReportTitle = "出入库条码临时表"; base.MvarItemKey = "KF_PonderationBillMain_Temp"; base.SQLName = "Select HItemID from KF_PonderationBillMain_Temp Order by HItemID "; } // public void Dispose() { GC.SuppressFinalize(this); } // #region 单据列表数据处理 //显示物料明细列表、模治具列表、先进先出列表信息 public DataSet GetBillEntry_TmpList(long HInterID, string HBillNo, string HBillType, ref string sMouldManagerCtl, ref string sFIFOCtl, ref string sErrMsg) { SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); string sSimpleMode = "N"; //是否启用扫码简易模式,只显示已扫码源单记录(Y,N) //获取系统参数 Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter(); if (oSystemParameter.ShowBill(ref sErrMsg) == false) { sErrMsg = "单据号:" + HBillNo + ",单据ID:" + HInterID + ";返回物料明细列表时获取系统参数失败! " + sErrMsg; return null; } //判断是否启用器具管理(Y,N) if (oSystemParameter.omodel.WMS_MouldManagerCtl == "Y") //启用模治具管理 { sMouldManagerCtl = "Y"; } //判断是否启用先进先出管理(Y,N),是否启用扫码简易模式,只显示已扫码源单记录(Y,N) if (HBillType == "1204") //生产领料单 { if (oSystemParameter.omodel.Kf_MateOutBill_FIFOCtl == "Y") //生产领料单-先进先出控制 { sFIFOCtl = "Y"; } if (oSystemParameter.omodel.Kf_MateOutBill_SimpleMode == "Y") //生产领料单-扫码简易模式 { sSimpleMode = "Y"; } } if (HBillType == "1205" && oSystemParameter.omodel.Kf_SellOutBill_FIFOCtl == "Y") //销售出库单-先进先出控制 { sFIFOCtl = "Y"; } if (HBillType == "1211" && oSystemParameter.omodel.Kf_EntrustOutBill_FIFOCtl == "Y") //委外出库单-先进先出控制 { sFIFOCtl = "Y"; } DataSet DS = oCn.RunProcReturn("exec h_p_WMS_BillEntryTmpList " + HInterID.ToString() + ",'" + HBillType + "','" + sMouldManagerCtl + "','" + sFIFOCtl + "','" + sSimpleMode + "'", "h_p_WMS_BillEntryTmpList"); return DS; } #endregion //缓存列表界面,返回缓存列表信息 public DataSet GetKf_PonderationBillMain_TempList_New(string sHBillType, string sHMaker, Int64 sHOWNERID) { SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); DataSet Ds = oCn.RunProcReturn("exec h_p_KF_GetPonderationBillMain_TempList_New '" + sHBillType + "','" + sHMaker + "'," + sHOWNERID.ToString(), "h_p_KF_GetPonderationBillMain_TempList_New"); if (Ds == null || Ds.Tables[0].Rows.Count == 0) { return null; } else { return Ds; } } //缓存列表已上传列表 public DataSet GetKf_ICStockBillList(string sHBillType, string sHMaker, Int64 sHOWNERID) { SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); DataSet Ds = oCn.RunProcReturn("exec h_p_Kf_ICStockBillList '" + sHBillType + "','" + sHMaker + "'," + sHOWNERID.ToString(), "h_p_Kf_ICStockBillList"); if (Ds == null || Ds.Tables[0].Rows.Count == 0) { return null; } else { return Ds; } } //缓存列表已上传查询 public DataSet GetKf_ICStockBillQueryList(string BillType,string HBillNo, string HSourceBillNo) { SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); DataSet Ds = oCn.RunProcReturn("exec h_p_Kf_ICStockBillQueryList '" + BillType + "','" + HBillNo + "','" + HSourceBillNo+"'", "h_p_Kf_ICStockBillQueryList"); if (Ds == null || Ds.Tables[0].Rows.Count == 0) { return null; } else { return Ds; } } //扫描条码返回出入库条码临时表信息 public DataSet GetInfoByID_View(long HInterID, string sBillType, string sWhere) { DataSet DS; try { DS = oCn.RunProcReturn("Select * from h_v_KF_PonderationBillMain_Temp Where HInterID=" + HInterID.ToString() + " and HBillType='" + sBillType + "' " + sWhere, "h_v_KF_PonderationBillMain_Temp", ref DBUtility.ClsPub.sExeReturnInfo); if (DS.Tables[0].Rows.Count == 0) return null; else { return DS; } } catch (Exception e) { throw (e); } } //扫描条码返回出入库条码临时表信息 一条条码显示一行 public DataSet GetInfoByIDDetails_View(long HInterID, string sBillType, string sWhere) { DataSet DS; try { DS = oCn.RunProcReturn("Select top 20 * from h_v_KF_PonderationBillMainDetails_Temp Where HQty<>0 And HInterID=" + HInterID.ToString() + " and HBillType='" + sBillType + "' " + sWhere + " order by HMakeDate desc ", "h_v_KF_PonderationBillMain_Temp", ref DBUtility.ClsPub.sExeReturnInfo); if (DS.Tables[0].Rows.Count == 0) return null; else { return DS; } } catch (Exception e) { 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 DSErp; 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 " + InterID.ToString() + ",'" + sBillType + "','" + sBarCode + "'," + HWHID.ToString() + "," + HSPID.ToString(), "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 sKFQtyErp = 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"]); //强制返回99999,已没有作用 DSErp = oCn.RunProcReturn("exec h_p_IF_ICInventory_WMS_GetWHAndSP " + InterID.ToString() + ",'" + sBillType + "','" + sBarCode + "'," + HWHID.ToString() + "," + HSPID.ToString(), "h_p_IF_ICInventory_WMS_GetWHAndSP", ref DBUtility.ClsPub.sExeReturnInfo); if (DSErp.Tables[0].Rows.Count == 0) { sRelQty = 0; return false; } sKFQtyErp = DBUtility.ClsPub.isDoule(DSErp.Tables[0].Rows[0]["HKFQty"]); if (sQty > sKFQty && sQty > sKFQtyErp) { sRelQty = sKFQtyErp; return false; } else if (sQty > sKFQty && sQty < sKFQtyErp) { sRelQty = sKFQty; return false; } else if (sQty < sKFQty && sQty > sKFQtyErp) { sRelQty = sKFQtyErp; return false; } else { sRelQty = sQty; return true; } } } catch (Exception e) { sRelQty = 0; throw (e); } } //编辑时,返回条码临时表信息 public DataSet GetBarCodeByID_View(long HInterID, string sBillType, long HMaterID, Int64 HAuxPropID, string HMTONo, Int64 HWhID, Int64 HSPID, Int64 HSCWhID, Int64 HSCSPID, string HBatchNo, Int64 HSourceInterID, Int64 HSourceEntryID, string sWhere) { DataSet DS; try { DS = oCn.RunProcReturn("Select HMTONo,HBatchNo,HBarCode,HWHID,HStockPlaceID,HSCWHID,HOutStockPlaceID,sum(HQty) HQty from KF_PonderationBillMain_Temp Where HQty<>0 and HInterID=" + HInterID.ToString() + " and HBillType='" + sBillType + "'" + " and HMaterID=" + HMaterID + " and HAuxPropID=" + HAuxPropID + " and HMTONo='" + HMTONo + "'" + //" 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,HMTONo,HBarCode,HWHID,HStockPlaceID,HSCWHID,HOutStockPlaceID", "KF_PonderationBillMain_Temp", ref DBUtility.ClsPub.sExeReturnInfo); if (DS.Tables[0].Rows.Count == 0) return null; else { return DS; } } catch (Exception e) { throw (e); } } //编辑条码数量时 判断条码档案数量 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); } } //编辑条码数量时 判断条码库存 是否充足 (仓库仓位) public bool CheckQtyByBarCode(string sBarCode, long HWHID, long HSPID, long HAuxPropID, string sBatchNo, string HMTONo, double sQty, ref double sRelQty) { DataSet DS; DataSet DSErp; try { DS = oCn.RunProcReturn("exec h_p_KF_ICInventory_WMS '" + sBarCode + "'," + HWHID.ToString() + "," + HSPID.ToString() + "," + HAuxPropID.ToString() + ",'" + sBatchNo + "','" + HMTONo + "'", "h_p_KF_ICInventory_WMS", ref DBUtility.ClsPub.sExeReturnInfo); DSErp = oCn.RunProcReturn("exec h_p_IF_ICInventory '" + sBarCode + "'," + HWHID.ToString() + "," + HSPID.ToString(), "h_p_IF_ICInventory", ref DBUtility.ClsPub.sExeReturnInfo); if (DS.Tables[0].Rows.Count == 0 || DSErp.Tables[0].Rows.Count == 0) { sRelQty = 0; return false; } else { double sKCQty = 0; double sKCQtyErp = 0; sKCQty = DBUtility.ClsPub.isDoule(DS.Tables[0].Rows[0]["HQty"]); sKCQtyErp = DBUtility.ClsPub.isDoule(DSErp.Tables[0].Rows[0]["HQty"]); if (sQty > sKCQty && sQty > sKCQtyErp) { sRelQty = sKCQtyErp; return false; } else if (sQty > sKCQty && sQty < sKCQtyErp) { sRelQty = sKCQty; return false; } else if (sQty < sKCQty && sQty > sKCQtyErp) { sRelQty = sKCQtyErp; return false; } else { sRelQty = sQty; return true; } } } catch (Exception e) { sRelQty = 0; throw (e); } } public bool CheakBarCodeAndCP(long HCusID, string sCPStr, string sBarCode, ref string sReturn) { DataSet DS; try { DS = oCn.RunProcReturn("exec h_p_CheakBarCodeAndCP " + HCusID.ToString() + ",'" + sCPStr + "','" + sBarCode + "'", "h_p_CheakBarCodeAndCP", ref DBUtility.ClsPub.sExeReturnInfo); //if (DS.Tables[0].Rows.Count == 0) if (DS == null || DS.Tables[0].Rows.Count == 0) { sReturn = "验证失败!"; return false; } else { double sBack = DBUtility.ClsPub.isDoule(DS.Tables[0].Rows[0]["HBack"]); string sBackRemark = DBUtility.ClsPub.isStrNull(DS.Tables[0].Rows[0]["HBackRemark"]); if (sBack == 0) { sReturn = "验证通过!"; return true; } else { sReturn = sBackRemark; return false; } } } catch (Exception e) { sReturn = e.Message; 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_WHAndSP(long HInterID, string sBarCode) { DataSet DS; try { DS = oCn.RunProcReturn("exec h_p_KF_ICInventory_WMS_GetWHAndSPAndBC " + HInterID.ToString() + ",'" + sBarCode + "'" , "h_p_KF_ICInventory_WMS_GetWHAndSPAndBC", 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_Temp_Wh_SP Where HInterID=" + HInterID.ToString() + " and HBillType='" + sBillType + "' " + sWhere, "h_v_KF_PonderationBillMain_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_Temp_CheckStock " + HInterID.ToString() + ",'" + sBillType + "'", "h_p_KF_PonderationBillMain_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_Temp Where HQty<>0 and HInterID=" + HInterID.ToString() + " and HBillType='" + sBillType + "' and HMaterID=" + HMaterID + sWhere, "KF_PonderationBillMain_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_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_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_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.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_Sub(long HInterID, string sBillType, string sWhere) { DataSet DS; try { DS = oCn.RunProcReturn("exec h_p_KF_PonderationBillMain_Temp_Sub " + HInterID.ToString() + " ,'" + sBillType + "' ", "h_p_KF_PonderationBillMain_Temp_Sub", 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_Sub_FIFO(long HInterID, string sBillType, string sWhere) { DataSet DS; try { DS = oCn.RunProcReturn("exec h_p_KF_PonderationBillMain_Temp_FIFO " + HInterID.ToString() + " ,'" + sBillType + "' ", "h_p_KF_PonderationBillMain_Temp_FIFO", 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_Sub_FIFO_Bill(string sBillNo, string sBillType, string sWhere) { DataSet DS; try { DS = oCn.RunProcReturn("exec h_p_KF_PonderationBillMain_Temp_FIFO_Bill '" + sBillNo + "' ,'" + sBillType + "' ", "h_p_KF_PonderationBillMain_Temp_FIFO_Bill", 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_Temp_Sum Where HInterID=" + HInterID.ToString() + " and HBillType='" + sBillType + "' " + sWhere, "h_v_KF_PonderationBillMain_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_Temp_OffLine Where HBillType='" + sBillType + "' " + sWhere, "h_v_KF_PonderationBillMain_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_TempList(string sBillType, string sWhere) { DataSet DS; try { DS = oCn.RunProcReturn("exec h_p_KF_GetPonderationBillMain_TempList '" + sBillType + "','" +sWhere + "'", "h_p_KF_GetPonderationBillMain_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_TempList_ChangeBox(string sBillType, string sWhere) { DataSet DS; try { DS = oCn.RunProcReturn("exec h_p_KF_GetPonderationBillMain_TempList_ChangeBox '" + sBillType + "','" + sWhere + "'", "h_p_KF_GetPonderationBillMain_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_Temp Where HInterID=" + HInterID.ToString() + " and HBillType='" + sBillType + "' " + sWhere, "h_v_KF_PonderationBillMain_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, long sHWhID, string sWhere) { DataSet DS; try { DS = oCn.RunProcReturn("exec h_p_KF_ICInventoryByMaterID " + sHMaterID.ToString() + "," + sHWhID.ToString(), "h_p_KF_ICInventoryByMaterID", ref DBUtility.ClsPub.sExeReturnInfo); if (DS == null || 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_Temp where HInterID=" + InterID.ToString() + " and HBillType='" + sBillType + "' and HVDAPack='" + sVDAPack + "' group by HVDAQty", "KF_PonderationBillMain_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); } } } }