using System; using System.Collections.Generic; using System.Text; using System.Data; namespace SCM { public class ClsGy_UserWarehouseRelation_Ctl : DBUtility.ClsGy_Base_Ctl { //SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); //原代码 用于 替换子项目 public string HOldNumber; public List DetailColl = new List(); public SCM.WMSWeb.WebService1 oWeb = new SCM.WMSWeb.WebService1(); //反审核 public bool AbandonCheck(Int64 lngBillKey, ref string sReturn) { try { oWeb.Url = ClsPub1.WEBSURL; oWeb.getRunProc(" Update Gy_UserWarehouseRelation set HChecker='',HCheckDate=null Where HItemID=" + lngBillKey.ToString(),ref DBUtility.ClsPub.sExeReturnInfo); sReturn = ""; return true; } catch (Exception e) { sReturn = e.Message; return false; } } //审核 public bool CheckBill(Int64 lngBillKey, ref string sReturn) { try { oWeb.Url = ClsPub1.WEBSURL; oWeb.getRunProc(" Update Gy_UserWarehouseRelation set HStopflag=0,HChecker='" + DBUtility.ClsPub.CurUserName + "',HCheckDate='" + DBUtility.ClsPub.GetServerDate(-1) + "' Where HItemID=" + lngBillKey.ToString(), ref DBUtility.ClsPub.sExeReturnInfo); //将其他 工价设置为 停用 oWeb.getRunProc(" exec h_p_Gy_UserWarehouseRelationStopflag " + lngBillKey.ToString(), ref DBUtility.ClsPub.sExeReturnInfo); // sReturn = ""; return true; } catch (Exception e) { sReturn = e.Message; return false; } } //新增 public override bool AddNew() { try { //oCn.BeginTran(); oWeb.Url = ClsPub1.WEBSURL; //插入子表 foreach (SCM.ClsGy_UserWarehouseRelation_Model oSub in DetailColl) { oWeb.getRunProc("Insert into Gy_UserWarehouseRelation " + " (HWHID,HUserID)" + " values('" + oSub.HWHID.ToString() + "','" + oSub.HUserID.ToString() + "'" + ") ", ref DBUtility.ClsPub.sExeReturnInfo); } //oCn.Commit(); return true; } catch (Exception e) { oCn.RollBack(); throw (e); } } //修改 public bool ModifyByID(string sItemID) { try { oWeb.Url = ClsPub1.WEBSURL; if (DetailColl.Count == 0) return false; //oCn.BeginTran(); //DeleteByID(sItemID); //删除记录 oWeb.getRunProc(" DELETE FROM Gy_UserWarehouseRelation Where HUserID='" + sItemID.ToString() + "'", ref DBUtility.ClsPub.sExeReturnInfo); //插入表 foreach (SCM.ClsGy_UserWarehouseRelation_Model oSub in DetailColl) { oWeb.getRunProc("Insert into Gy_UserWarehouseRelation " + " (HWHID,HUserID)" + " values('" + oSub.HWHID.ToString() + "','" + oSub.HUserID.ToString() + "'" + ") ", ref DBUtility.ClsPub.sExeReturnInfo); } //oCn.Commit(); return true; } catch (Exception e) { //oCn.RollBack(); throw (e); } } //显示单据 public bool ShowBill(string lngBillKey, ref string sReturn) { try { //查询主表 oWeb.Url = ClsPub1.WEBSURL; DataSet DsSub = new DataSet(); DsSub = oWeb.getDataSetBySQL("Select * from Gy_UserWarehouseRelation Where HUserID='" + lngBillKey.ToString() + "'", "Gy_UserWarehouseRelation", ref DBUtility.ClsPub.sExeReturnInfo); DetailColl.Clear();//清空 if (DsSub == null || DsSub.Tables[0].Rows.Count == 0) { return false; } for (int i = 0; i < DsSub.Tables[0].Rows.Count; i++) { SCM.ClsGy_UserWarehouseRelation_Model oSub = new SCM.ClsGy_UserWarehouseRelation_Model(); oSub.HWHID = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HWHID"]); oSub.HUserID = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HUserID"]); DetailColl.Add(oSub); } sReturn = "显示单据成功!"; return true; } catch (Exception e) { sReturn = e.Message; return false; } } //批改单据 public bool BatchModifyBill(Int64 lngBillKey, double sPrice, ref string sReturn) { try { //oCn.BeginTran(); //oCn.RunProc(" Update Gy_UserWarehouseRelation set HPrice=" + sPrice.ToString() + " Where HItemID=" + lngBillKey.ToString()); //sReturn = "修改单据成功!"; //oCn.Commit(); return true; } catch (Exception e) { sReturn = e.Message; //oCn.RollBack(); return false; } } //构造函数 public ClsGy_UserWarehouseRelation_Ctl() { MvarItemKey = "Gy_UserWarehouseRelation"; MvarReportTitle = "用户部门权限表"; } } }