using System;
|
using System.Collections.Generic;
|
using System.Data;
|
using System.Linq;
|
using System.Text;
|
|
namespace DAL
|
{
|
public class ClsGy_StdWorkTimes_Ctl : DBUtility.ClsGy_Base_Ctl
|
{
|
SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
|
//原代码 用于 替换子项目
|
public string HOldNumber;
|
public Model.ClsGy_StdWorkTimes_Model omodel = new Model.ClsGy_StdWorkTimes_Model();
|
public List<Model.ClsGy_StdWorkTimes_Model> DetailColl = new List<Model.ClsGy_StdWorkTimes_Model>();
|
|
//反审核
|
public bool AbandonCheck(Int64 lngBillKey, ref string sReturn)
|
{
|
try
|
{
|
oCn.RunProc(" Update Gy_StdWorkTimes set HChecker='',HCheckDate=null Where HItemID=" + lngBillKey.ToString());
|
sReturn = "";
|
return true;
|
}
|
catch (Exception e)
|
{
|
sReturn = e.Message;
|
return false;
|
}
|
}
|
|
//审核
|
public bool CheckBill(Int64 lngBillKey, ref string sReturn)
|
{
|
|
try
|
{
|
oCn.RunProc(" Update Gy_StdWorkTimes set HStopflag=0,HChecker='" + DBUtility.ClsPub.CurUserName + "',HCheckDate='" + DBUtility.ClsPub.GetServerDate(-1) + "' Where HItemID=" + lngBillKey.ToString());
|
//将其他 工价设置为 停用
|
//oCn.RunProc(" exec h_p_Gy_ProcPriceStopflag " + lngBillKey.ToString());
|
//
|
sReturn = "";
|
return true;
|
}
|
catch (Exception e)
|
{
|
sReturn = e.Message;
|
return false;
|
}
|
}
|
|
|
//新增
|
public override bool AddNew()
|
{
|
|
try
|
{
|
oCn.BeginTran();
|
//插入子表
|
foreach (Model.ClsGy_StdWorkTimes_Model oSub in DetailColl)
|
{
|
oCn.RunProc("Insert into Gy_StdWorkTimes " +
|
" (HMaterID,HProcID,HStdWorkTimes,HUpperlimit,HLowerlimit" +
|
",HStopflag,HMaker,HMakeDate,HRemark,HUSEORGID,HStdPiece,HStdPric)" +
|
" values(" + oSub.HMaterID.ToString() + "," + oSub.HProcID.ToString() + "," + oSub.HStdWorkTimes.ToString() +
|
"," + oSub.HUpperlimit.ToString() + "," + oSub.HLowerlimit.ToString() + "," + Convert.ToString(oSub.HStopflag ? 1 : 0) +
|
",'" + oSub.HMaker + "','" + oSub.HMakeDate + "','" + oSub.HRemark + "'," + oSub.HUSEORGID+","+ oSub.HStdPiece.ToString()+","+ oSub.HStdPric.ToString() + ")");
|
}
|
oCn.Commit();
|
return true;
|
}
|
catch (Exception e)
|
{
|
oCn.RollBack();
|
throw (e);
|
}
|
}
|
|
//修改
|
public override bool ModifyByID(Int64 sItemID)
|
{
|
try
|
{
|
oCn.BeginTran();
|
|
//插入表
|
foreach (Model.ClsGy_StdWorkTimes_Model oSub in DetailColl)
|
{
|
string sql = string.Format(@"Update Gy_StdWorkTimes set" +
|
" HMaterID=" + oSub.HMaterID.ToString() +
|
",HProcID=" + oSub.HProcID.ToString() +
|
",HStdWorkTimes=" + oSub.HStdWorkTimes.ToString() +
|
",HUpperlimit=" + oSub.HUpperlimit.ToString() +
|
",HLowerlimit=" + oSub.HLowerlimit.ToString() +
|
",HMaker='" + oSub.HMaker + "'" +
|
",HMakeDate='" + oSub.HMakeDate + "'" +
|
",HRemark='" + oSub.HRemark.ToString() + "'" +
|
",HUSEORGID=" + oSub.HUSEORGID +
|
" where HItemID=" + sItemID);
|
oCn.RunProc(sql);
|
}
|
oCn.Commit();
|
return true;
|
}
|
catch (Exception e)
|
{
|
oCn.RollBack();
|
throw (e);
|
}
|
}
|
|
//显示单据
|
public bool ShowBill(Int64 lngBillKey, ref string sReturn)
|
{
|
try
|
{
|
//查询主表
|
DataSet DsSub = new DataSet();
|
DsSub = oCn.RunProcReturn("Select * from Gy_StdWorkTimes Where HitemID=" + lngBillKey.ToString(), "Gy_StdWorkTimes");
|
DetailColl.Clear();//清空
|
for (int i = 0; i < DsSub.Tables[0].Rows.Count; i++)
|
{
|
Model.ClsGy_StdWorkTimes_Model oSub = new Model.ClsGy_StdWorkTimes_Model();
|
oSub.HMaterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HMaterID"]);
|
oSub.HProcID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HProcID"]);
|
oSub.HStdWorkTimes = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HStdWorkTimes"]);
|
oSub.HUpperlimit = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HUpperlimit"]);
|
oSub.HLowerlimit = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HLowerlimit"]);
|
oSub.HRemark = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HRemark"]);
|
oSub.HMaker = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HMaker"]);
|
oSub.HMakeDate = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HMakeDate"]);
|
oSub.HStopflag = ((DsSub.Tables[0].Rows[i]["HStopflag"].ToString() == "1")?true:false);
|
oSub.HUSEORGID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HUSEORGID"]);
|
|
DetailColl.Add(oSub);
|
}
|
sReturn = "显示单据成功!";
|
return true;
|
}
|
catch (Exception e)
|
{
|
sReturn = e.Message;
|
return false;
|
}
|
}
|
|
//根据物料ID、工序ID 删除 标准工时
|
public bool DeleteByMaterIDAndHProcID(Int64 HMaterID, Int64 HProcID)
|
{
|
try
|
{
|
oCn.RunProc("Delete from Gy_StdWorkTimes where HMaterID=" + HMaterID.ToString() + " and HProcID=" + HProcID.ToString());
|
return true;
|
}
|
catch (Exception e)
|
{
|
return false;
|
}
|
}
|
|
public ClsGy_StdWorkTimes_Ctl()
|
{
|
MvarItemKey = "Gy_StdWorkTimes";
|
MvarReportTitle = "标准工时资料";
|
}
|
}
|
}
|