using System; using System.Collections.Generic; using System.Text; using System.Data; using System.Windows.Forms; namespace DAL { public class ClsGy_BarCodeEdit_Ctl { SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); public Model.ClsGy_BarCodeEdit_Model omodel = new Model.ClsGy_BarCodeEdit_Model(); public List DetailColl = new List(); //新增 public bool AddNew() { try { oCn.BeginTran(); foreach (Model.ClsGy_BarCodeEdit_Model omodel in DetailColl) { oCn.RunProc("INSERT INTO [Kf_ICStockBillSub_WMS] " + "([HInterID],[HEntryID],[HBillType],[HMaterID],[HProcID] " + ",[HWhID],[HSCWhID],[HStockPlaceID],[HOutStockPlaceID],[HGroupID] " + ",[HQty],[HBarCode],[HAddr],[HBatchNo],[HMaker],[HMakeDate] " + ",[HSourceInterID],[HSourceEntryID],[HSourceBillType],[HSourceItemID],[HBarCodeType]) " + " Values ('" + omodel.HInterID + "'," + omodel.HEntryID.ToString() + ",'" + omodel.HBillType + "'," + omodel.HMaterID.ToString() + "," + omodel.HProcID.ToString() + "," + omodel.HWhID.ToString() + "," + omodel.HSCWhID.ToString() + "," + omodel.HStockPlaceID.ToString() + "," + omodel.HOutStockPlaceID.ToString() + "," + omodel.HGroupID.ToString() + "," + omodel.HQty.ToString() + ",'" + omodel.HBarCode + "','" + omodel.HAddr + "','" + omodel.HBatchNo + "','" + DBUtility.ClsPub.CurUserName + "',getdate()" + "," + omodel.HSourceInterID.ToString() + "," + omodel.HSourceEntryID.ToString() + ",'" + omodel.HSourceBillType + "'," + omodel.HSourceItemID.ToString() + ",'" + omodel.HBarCodeType + "'" + ")", ref DBUtility.ClsPub.sExeReturnInfo); } oCn.Commit(); return true; } catch (Exception e) { oCn.RollBack(); throw (e); } } //删除 public bool DeleteByID(Int64 sItemID) { try { oCn.RunProc("Delete from Kf_ICStockBillSub_WMS where HItemID='" + sItemID + "'", ref Pub_Class.ClsPub.sExeReturnInfo); return true; } catch (Exception e) { throw (e); } } //设置单据网络信息 public DataSet SetGridViewByBillNo(string sBillNo) { DataSet DS; try { DS = oCn.RunProcReturn("Select * from h_v_Kf_StockBarCodeList Where HBillType='" + sBillNo + "'", "h_v_Kf_StockBarCodeList", ref Pub_Class.ClsPub.sExeReturnInfo); if (DS.Tables[0].Rows.Count == 0) return null; else { return DS; } } catch (Exception e) { return null; } } //根据条码判断信息 public bool HavParentCarCode(string sCode) { DataSet DS; try { DS = oCn.RunProcReturn("Select * from Gy_BarCodeBill Where hbarcode='" + sCode + "'", "Gy_BarCodeBill", ref Pub_Class.ClsPub.sExeReturnInfo); if (DS.Tables[0].Rows.Count == 0) return false; //if (DBUtility.ClsPub.isStrNull(DS.Tables[0].Rows[0]["HBarCodeType"]) == "箱号条码") //{ // DataSet oDS; // try // { // oDS = oCn.RunProcReturn("select * from h_v_Sc_PackUnionBillList where 箱号条形码=" + sCode, "Sc_PackUnionBillMain", ref Pub_Class.ClsPub.sExeReturnInfo); // if (oDS.Tables[0].Rows.Count == 0) // return false; // else // { // DetailColl.Clear(); // for (int i = 0; i < oDS.Tables[0].Rows.Count; i++) // { // omodel.HMaterID = DBUtility.ClsPub.isLong(oDS.Tables[0].Rows[i]["HMaterID"]); // omodel.HQty = DBUtility.ClsPub.isDoule(oDS.Tables[0].Rows[i]["数量"]); // omodel.HBarCode = DBUtility.ClsPub.isStrNull(oDS.Tables[0].Rows[i]["箱号条形码"]); // DetailColl.Add(omodel); // } // return true; // } // } // catch (Exception e) // { // throw (e); // } //} else { // omodel.HMaterID = DBUtility.ClsPub.isLong(DS.Tables[0].Rows[0]["HMaterID"]); // omodel.HQty = DBUtility.ClsPub.isDoule(DS.Tables[0].Rows[0]["HQty"]); // omodel.HBarCode = DBUtility.ClsPub.isStrNull(DS.Tables[0].Rows[0]["HBarCode"]); // omodel.HBatchNo = DBUtility.ClsPub.isStrNull(DS.Tables[0].Rows[0]["HBatchNo"]); // omodel.HSourceInterID = DBUtility.ClsPub.isLong(DS.Tables[0].Rows[0]["HSourceInterID"]); // omodel.HSourceEntryID = DBUtility.ClsPub.isLong(DS.Tables[0].Rows[0]["HSourceEntryID"]); // omodel.HSourceBillType = DBUtility.ClsPub.isStrNull(DS.Tables[0].Rows[0]["HSourceBillType"]); return true; } } catch (Exception e) { throw (e); } } public bool Show(long sMater) { DataSet DS; try { DS = oCn.RunProcReturn("Select * from Kf_ICStockBillSub_WMS Where HMaterID='" + sMater + "'", "Kf_ICStockBillSub_WMS", ref Pub_Class.ClsPub.sExeReturnInfo); if (DS.Tables[0].Rows.Count == 0) return false; else { omodel.HMaterID = DBUtility.ClsPub.isLong(DS.Tables[0].Rows[0]["HMaterID"]); omodel.HQty = DBUtility.ClsPub.isDoule(DS.Tables[0].Rows[0]["HQty"]); omodel.HBarCode = DBUtility.ClsPub.isStrNull(DS.Tables[0].Rows[0]["HBarCode"]); omodel.HBatchNo = DBUtility.ClsPub.isStrNull(DS.Tables[0].Rows[0]["HBatchNo"]); omodel.HSourceInterID = DBUtility.ClsPub.isLong(DS.Tables[0].Rows[0]["HSourceInterID"]); omodel.HSourceEntryID = DBUtility.ClsPub.isLong(DS.Tables[0].Rows[0]["HSourceEntryID"]); omodel.HSourceBillType = DBUtility.ClsPub.isStrNull(DS.Tables[0].Rows[0]["HSourceBillType"]); return true; } } catch (Exception e) { throw (e); } } } }