using System;
|
using System.Collections.Generic;
|
using System.Text;
|
using System.Data;
|
|
namespace DAL
|
{
|
public class ClsOA_EmpMessageBill : DBUtility.ClsXt_BaseBill
|
{
|
public Model.ClsOA_EmpMessageBillMain omodel = new Model.ClsOA_EmpMessageBillMain();
|
public List<Model.ClsOA_EmpMessageBillSub> DetailColl = new List<Model.ClsOA_EmpMessageBillSub>();
|
|
public ClsOA_EmpMessageBill()
|
{
|
base.MvarItemKeySub = "OA_EmpMessageBillSub";
|
base.MvarItemKeySub2 = "";
|
base.MvarItemKeySub3 = "";
|
base.MvarItemKeySub4 = "";
|
base.MvarItemKey = "OA_EmpMessageBillMain";
|
base.MvarReportTitle = "个人消息";
|
base.BillType = "4510";
|
}
|
|
#region 固定代码
|
|
~ClsOA_EmpMessageBill()
|
{
|
DetailColl = null;
|
}
|
|
#endregion 自定义方法
|
//修改单据
|
public override bool ModifyBill(Int64 lngBillKey, ref string sReturn)
|
{
|
//try
|
//{
|
// //
|
// oCn.BeginTran();
|
// //更新主表
|
// oCn.RunProc("UpDate OA_EmpMessageBillMain set " +
|
// " HDate='" + omodel.HDate.ToShortDateString() + "'" +
|
// ",HSendMan='" + omodel.HSendMan + "'" +
|
// ",HReceiveMan='" + omodel.HReceiveMan + "'" +
|
// ",HDescription='" + omodel.HDescription + "'" +
|
// ",HRemark='" + omodel.HRemark + "'" +
|
// ",HUpdater='" + DBUtility.ClsPub.CurUserName + "'" +
|
// ",HUpdateDate='" + DBUtility.ClsPub.GetServerDate(-1) + "'" +
|
// " where HInterID=" + lngBillKey.ToString());
|
// //删除关联
|
|
// //删除子表
|
// DeleteBillSub(lngBillKey);
|
// //插入子表
|
// foreach (Model.ClsOA_EmpMessageBillSub oSub in DetailColl)
|
// {
|
// oCn.RunProc("Insert into OA_EmpMessageBillSub " +
|
// " (HInterID,HEntryID,HReceiveMan,HReadFlag)" +
|
// " values("
|
// + this.omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HReceiveMan + "'," + DBUtility.ClsPub.BoolToString(oSub.HReadFlag) + "" +
|
// ") ");
|
// }
|
// sReturn = "修改单据成功!";
|
// oCn.Commit();
|
// return true;
|
//}
|
//catch (Exception e)
|
//{
|
// sReturn = e.Message;
|
// oCn.RollBack();
|
return false;
|
//}
|
}
|
//新增单据
|
public override bool AddBill(ref string sReturn)
|
{
|
try
|
{
|
//得到mainid
|
omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo);
|
//若MAINDI重复则重新获取
|
oCn.BeginTran();
|
//主表
|
oCn.RunProc("Insert Into OA_EmpMessageBillMain " +
|
"(HBillType,HInterID,HBillNo,HDate" +
|
",HMaker,HMakeDate,HBillStatus" +
|
",HYear,HPeriod,HRemark" +
|
",HSendMan,HReceiveMan,HDescription" +
|
",HRelationInterID,HRelationEntryID,HRelationBillType,HRelationBillNo" +
|
") " +
|
" values('" + this.BillType + "'," + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','" + DBUtility.ClsPub.GetServerDate(-1) + "'" +
|
",'" + DBUtility.ClsPub.CurUserName + "','" + DBUtility.ClsPub.GetServerDate(-1) + "'," + omodel.HBillStatus +
|
"," + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + omodel.HRemark + "'" +
|
",'" + omodel.HSendMan + "','" + omodel.HReceiveMan + "','" + omodel.HDescription + "'" +
|
"," + omodel.HRelationInterID + "," + omodel.HRelationEntryID + ",'" + omodel.HRelationBillType + "','" + omodel.HRelationBillNo + "'" +
|
") ");
|
//插入子表
|
foreach (Model.ClsOA_EmpMessageBillSub oSub in DetailColl)
|
{
|
oCn.RunProc("Insert into OA_EmpMessageBillSub " +
|
" (HInterID,HEntryID,HReceiveMan,HReadFlag)" +
|
" values("
|
+ omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HReceiveMan + "'," + DBUtility.ClsPub.BoolToString(oSub.HReadFlag) + "" +
|
") ");
|
}
|
sReturn = "新增单据成功!";
|
oCn.Commit();
|
return true;
|
}
|
catch (Exception e)
|
{
|
sReturn = e.Message;
|
oCn.RollBack();
|
return false;
|
}
|
}
|
//显示单据
|
public override bool ShowBill(Int64 lngBillKey, ref string sReturn)
|
{
|
try
|
{
|
//查询主表
|
DataSet Ds;
|
Ds = oCn.RunProcReturn("Select * from OA_EmpMessageBillMain Where HInterID=" + lngBillKey.ToString(), "OA_EmpMessageBillMain");
|
if (Ds.Tables[0].Rows.Count == 0)
|
{
|
sReturn = "单据未找到!";
|
return false;
|
}
|
//赋值
|
omodel.HInterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HInterID"].ToString());
|
omodel.HBillNo = Ds.Tables[0].Rows[0]["HBillNo"].ToString().Trim();
|
omodel.HDate = Convert.ToDateTime(Ds.Tables[0].Rows[0]["HDate"].ToString().Trim());
|
omodel.HYear = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HYear"].ToString());
|
omodel.HPeriod = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HPeriod"].ToString());
|
omodel.HRemark = Ds.Tables[0].Rows[0]["HRemark"].ToString().Trim();
|
omodel.HDescription = Ds.Tables[0].Rows[0]["HDescription"].ToString().Trim();
|
omodel.HSendMan = Ds.Tables[0].Rows[0]["HSendMan"].ToString().Trim();
|
omodel.HReceiveMan = Ds.Tables[0].Rows[0]["HReceiveMan"].ToString().Trim();
|
omodel.HRelationInterID =DBUtility.ClsPub.isLong( Ds.Tables[0].Rows[0]["HRelationInterID"]);
|
omodel.HRelationEntryID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HRelationEntryID"]);
|
omodel.HRelationBillNo = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HRelationBillNo"]);
|
omodel.HRelationBillType = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HReceiveMan"]);
|
//
|
omodel.HMaker = Ds.Tables[0].Rows[0]["HMaker"].ToString().Trim();
|
omodel.HMakeDate = Ds.Tables[0].Rows[0]["HMakeDate"].ToString().Trim();
|
omodel.HUpDateDate = Ds.Tables[0].Rows[0]["HUpDateDate"].ToString().Trim();
|
omodel.HUpDater = Ds.Tables[0].Rows[0]["HUpDater"].ToString().Trim();
|
omodel.HCheckDate = Ds.Tables[0].Rows[0]["HCheckDate"].ToString().Trim();
|
omodel.HChecker = Ds.Tables[0].Rows[0]["HChecker"].ToString().Trim();
|
omodel.HCloseDate = Ds.Tables[0].Rows[0]["HCloseDate"].ToString().Trim();
|
omodel.HCloseMan = Ds.Tables[0].Rows[0]["HCloseMan"].ToString().Trim();
|
omodel.HDeleteDate = Ds.Tables[0].Rows[0]["HDeleteDate"].ToString().Trim();
|
omodel.HDeleteMan = Ds.Tables[0].Rows[0]["HDeleteMan"].ToString().Trim();
|
//循环
|
//DataSet DsSub ;
|
//DsSub = oCn.RunProcReturn("Select * from OA_EmpMessageBillSub Where HInterID=" + lngBillKey.ToString() + " order by HEntryID ", "OA_EmpMessageBillSub");
|
//DetailColl.Clear();//清空
|
//for (int i = 0; i < DsSub.Tables[0].Rows.Count; i++)
|
//{
|
// ClsOA_EmpMessageBillSub oSub = new ClsOA_EmpMessageBillSub();
|
// oSub.HInterID =ClsPub.isLong( DsSub.Tables[0].Rows[i]["HInterID"].ToString());
|
// oSub.HEntryID =ClsPub.isLong( DsSub.Tables[0].Rows[i]["HEntryID"].ToString());
|
// oSub.HSendStatus = ClsPub.isInt(DsSub.Tables[0].Rows[i]["HSendStatus"]);
|
// oSub.HSendMan = DsSub.Tables[0].Rows[i]["HSendMan"].ToString().Trim();
|
// oSub.HDescription = DsSub.Tables[0].Rows[i]["HDescription"].ToString().Trim();
|
// oSub.HDate = ClsPub.isDate(DsSub.Tables[0].Rows[i]["HDate"]);
|
// DetailColl.Add(oSub);
|
//}
|
////DsSub = oCn.RunProcReturn("Select * from OA_EmpMessageBillSub2 Where HInterID=" + lngBillKey.ToString() + " order by HEntryID ", "OA_EmpMessageBillSub2");
|
////DetailColl2.Clear();//清空
|
////for (int i = 0; i < DsSub.Tables[0].Rows.Count; i++)
|
////{
|
//// ClsOA_EmpMessageBillSub2 oSub = new ClsOA_EmpMessageBillSub2();
|
//// oSub.HInterID = ClsPub.isLong(DsSub.Tables[0].Rows[i]["HInterID"].ToString());
|
//// oSub.HEntryID = ClsPub.isLong(DsSub.Tables[0].Rows[i]["HEntryID"].ToString());
|
//// oSub.HDeptID = ClsPub.isLong(DsSub.Tables[0].Rows[i]["HDeptID"].ToString());
|
//// oSub.HEmpID = ClsPub.isLong(DsSub.Tables[0].Rows[i]["HEmpID"].ToString());
|
//// oSub.HRemark = DsSub.Tables[0].Rows[i]["HRemark"].ToString().Trim();
|
//// oSub.HReason = DsSub.Tables[0].Rows[i]["HReason"].ToString().Trim();
|
//// oSub.HCloseMan = DsSub.Tables[0].Rows[i]["HCloseMan"].ToString().Trim();
|
//// oSub.HCloseType = ClsPub.isBool(DsSub.Tables[0].Rows[i]["HCloseType"].ToString());
|
//// DetailColl2.Add(oSub);
|
////}
|
//修改状态为已读
|
isRead(lngBillKey);
|
//
|
sReturn = "显示单据成功!";
|
return true;
|
}
|
catch (Exception e)
|
{
|
sReturn = e.Message;
|
return false;
|
}
|
}
|
|
/// <summary>
|
/// 根据ID,在生产计划查询中,得到信息
|
/// </summary>
|
/// <param name="lngBillKey"></param>
|
/// <param name="sReturn"></param>
|
/// <returns></returns>
|
|
public bool GetICMOSortInfoByID(Int64 lngBillKey, ref string sReturn)
|
{
|
try
|
{
|
//查询主表
|
DataSet Ds;
|
Ds = oCn.RunProcReturn("Select * from h_v_Sc_ICMOSortBillList Where HMainID=" + lngBillKey.ToString(), "h_v_Sc_ICMOSortBillList");
|
if (Ds.Tables[0].Rows.Count == 0)
|
{
|
sReturn = "单据未找到!";
|
return false;
|
}
|
//赋值
|
//=================
|
omodel.HDescription = "计划日期:" + DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[0]["日期"]).ToShortDateString() + "\r\n生产任务单号:" +
|
Ds.Tables[0].Rows[0]["生产任务单号"].ToString().Trim() + "\r\n备料状态:" + Ds.Tables[0].Rows[0]["备料状态"].ToString().Trim() +
|
"\r\n执行确认:" + Ds.Tables[0].Rows[0]["执行确认"].ToString().Trim();
|
//
|
sReturn = "显示单据成功!";
|
return true;
|
}
|
catch (Exception e)
|
{
|
sReturn = e.Message;
|
throw (e);
|
}
|
}
|
|
/// <summary>
|
/// 根据ID,修改状态为已读
|
/// </summary>
|
/// <param name="lngBillKey"></param>
|
/// <param name="sReturn"></param>
|
/// <returns></returns>
|
|
public void isRead(Int64 lngBillKey)
|
{
|
try
|
{
|
//查询主表
|
oCn.RunProcReturn("exec h_p_OA_EmpMessageBill_Read " + lngBillKey.ToString() + ",'" + DBUtility.ClsPub.CurUserName + "'", "gy_czygl");
|
}
|
catch (Exception e)
|
{
|
throw (e);
|
}
|
}
|
|
|
}
|
}
|