using System;
|
using System.Collections.Generic;
|
using System.Text;
|
using System.Data;
|
|
namespace DAL
|
{
|
public class ClsGy_MouldFile:DBUtility.ClsXt_BaseBill
|
{
|
public Model.ClsGy_MouldFileMain omodel = new Model.ClsGy_MouldFileMain();
|
public List<Model.ClsGy_MouldFileSub> DetailColl = new List<Model.ClsGy_MouldFileSub>();
|
public List<Model.ClsGy_MouldFileSub2> DetailEmpColl = new List<Model.ClsGy_MouldFileSub2>();
|
|
public ClsGy_MouldFile()
|
{
|
base.MvarItemKeySub = "Gy_MouldFileSub";
|
base.MvarItemKeySub2 = "Gy_MouldFileSub2";
|
base.MvarItemKeySub3 = "Gy_MouldFileSub_SubMater";
|
base.MvarItemKeySub4 = "";
|
base.MvarItemKey="Gy_MouldFileMain";
|
base.MvarReportTitle="模具档案";
|
base.BillType="3899";
|
base.HBillSubType = "3899";
|
}
|
|
#region 固定代码
|
|
~ClsGy_MouldFile()
|
{
|
DetailColl = null;
|
}
|
|
#endregion 自定义方法
|
//修改单据
|
public override bool ModifyBill(Int64 lngBillKey, ref string sReturn)
|
{
|
try
|
{
|
//
|
oCn.BeginTran();
|
//更新主表
|
oCn.RunProc("UpDate Gy_MouldFileMain set " +
|
" HBillNo='" + omodel.HBillNo + "'" + //固定赋值===============
|
",HDate='" + omodel.HDate + "'" +
|
",HYear='" + omodel.HYear.ToString() + "'" +
|
",HPeriod='" + omodel.HPeriod.ToString() + "'" +
|
",HRemark='" + omodel.HRemark + "'" +
|
",HUpDater='" + DBUtility.ClsPub.CurUserName + "'" +
|
",HUpDateDate=getdate()" +
|
//========================================
|
",HMouldNo='" + omodel.HMouldNo + "'" +
|
",HName='" + omodel.HName + "'" +
|
",HModel='" + omodel.HModel + "'" +
|
",HModel2='" + omodel.HModel2 + "'" +
|
",HDiameter='" + omodel.HDiameter + "'" +
|
",HSubjoin='" + omodel.HSubjoin + "'" +
|
",HSubjoin2='" + omodel.HSubjoin2 + "'" +
|
",HPICNo='" + omodel.HPICNo + "'" +
|
",HWorkMaterModel='" + omodel.HWorkMaterModel + "'" +
|
",HMaterID=" + omodel.HMaterID.ToString() +
|
",HMaterNumber='" + omodel.HMaterNumber + "'" +
|
",HMouldType=" + omodel.HMouldType.ToString() +
|
",HUnitID=" + omodel.HUnitID.ToString() +
|
",HOutComDate='" + omodel.HOutComDate + "'" +
|
",HOutComNo='" + omodel.HOutComNo + "'" +
|
",HDeptID=" + omodel.HDeptID.ToString() +
|
",HSupID=" + omodel.HSupID.ToString() +
|
",HSupNumber='" + omodel.HSupNumber + "'" +
|
",HPrintQty=" + omodel.HPrintQty.ToString() +
|
",HMouldStatus='" + omodel.HMouldStatus + "'" +
|
",HWhID=" + omodel.HWhID.ToString() +
|
",HRoutingID=" + omodel.HRoutingID.ToString() +
|
",HBomID=" + omodel.HBomID.ToString() +
|
",HVersion='" + omodel.HVersion + "'" +
|
",HSPGroupID=" + omodel.HSPGroupID.ToString() +
|
",HSPID=" + omodel.HSPID.ToString() +
|
",HDesignLife=" + omodel.HDesignLife.ToString() +
|
",HUseLife=" + omodel.HUseLife.ToString() +
|
",HLeaveLife=" + omodel.HLeaveLife.ToString() +
|
",HProdQty=" + omodel.HProdQty.ToString() +
|
",HProdWeight=" + omodel.HProdWeight.ToString() +
|
" where HInterID=" + lngBillKey.ToString());
|
//删除关联
|
DeleteRelation(ref sReturn, lngBillKey);
|
//删除子表
|
DeleteBillSub(lngBillKey);
|
DeleteBillSub2(lngBillKey);
|
//插入子表
|
omodel.HInterID = lngBillKey;
|
foreach (Model.ClsGy_MouldFileSub oSub in DetailColl)
|
{
|
oCn.RunProc("Insert into Gy_MouldFileSub " +
|
" (HInterID,HEntryID,HRemark" +
|
",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" +
|
") values("
|
+ omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HRemark + "'" +
|
"," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() +
|
") ");
|
}
|
//
|
//插入子表2
|
foreach (Model.ClsGy_MouldFileSub2 oSubSec in DetailEmpColl)
|
{
|
oCn.RunProc("Insert into Gy_MouldFileSub2 " +
|
" (HInterID,HEntryID,HRemark" +
|
",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" +
|
")" +
|
" values("
|
+ omodel.HInterID.ToString() + "," + oSubSec.HEntryID.ToString() + ",'" + oSubSec.HRemark + "'" +
|
"," + oSubSec.HSourceInterID.ToString() + "," + oSubSec.HSourceEntryID.ToString() + ",'" + oSubSec.HSourceBillNo + "','" + oSubSec.HSourceBillType + "'," + oSubSec.HRelationQty.ToString() + "," + oSubSec.HRelationMoney.ToString() +
|
") ");
|
}
|
//foreach (Model.ClsGy_MouldFileSub oSub in DetailColl)
|
//{
|
// Ds = oCn.RunProcReturn("exec h_p_Gy_MouldFile_Qty " + oSub.HICMOInterID, "");
|
// if (Ds.Tables[0].Rows.Count == 0)
|
// return;
|
// if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBool"]) == "Y")
|
// {
|
// sReturn = "汇报数量超过计划数量!不允许保存";
|
// return false;
|
// }
|
//}
|
sReturn = "修改单据成功!";
|
oCn.Commit();
|
return true;
|
}
|
catch (Exception e)
|
{
|
sReturn = e.Message;
|
oCn.RollBack();
|
throw (e);
|
}
|
}
|
//新增单据
|
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 Gy_MouldFileMain " +
|
"(HBillType,HBillSubType,HInterID,HBillNo,HDate" +
|
",HYear,HPeriod,HRemark,HMaker,HMakeDate" +
|
",HMouldNo,HName,HModel,HModel2,HDiameter" +
|
",HSubjoin,HSubjoin2,HPICNo,HWorkMaterModel" +
|
",HMaterID,HMaterNumber,HMouldType,HUnitID" +
|
",HOutComDate,HOutComNo,HDeptID,HSupID,HSupNumber" +
|
",HPrintQty,HMouldStatus,HWhID,HRoutingID" +
|
",HBomID,HVersion,HSPGroupID,HSPID,HDesignLife" +
|
",HUseLife,HLeaveLife,HProdQty,HProdWeight" +
|
") " +
|
" values('" + this.BillType + "','" + this.HBillSubType + "'," +omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','" + omodel.HDate + "'" +
|
", " + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + omodel.HRemark + "','" + DBUtility.ClsPub.CurUserName + "',getdate()" +
|
",'" + omodel.HMouldNo + "','" + omodel.HName + "','" + omodel.HModel + "','" + omodel.HModel2 + "','" + omodel.HDiameter + "'" +
|
",'" + omodel.HSubjoin + "','" + omodel.HSubjoin2 + "','" + omodel.HPICNo + "','" + omodel.HWorkMaterModel + "'" +
|
"," + omodel.HMaterID.ToString() + ",'" + omodel.HMaterNumber + "'," + omodel.HMouldType.ToString() + "," + omodel.HUnitID.ToString() +
|
",'" + omodel.HOutComDate + "','" + omodel.HOutComNo + "'," + omodel.HDeptID.ToString() + "," + omodel.HSupID.ToString() + ",'" + omodel.HSupNumber + "'" +
|
"," + omodel.HPrintQty.ToString() + ",'" + omodel.HMouldStatus + "'," + omodel.HWhID.ToString() + "," + omodel.HRoutingID.ToString() +
|
"," + omodel.HBomID.ToString() + ",'" + omodel.HVersion + "'," + omodel.HSPGroupID.ToString() + "," + omodel.HSPID.ToString() + "," + omodel.HDesignLife.ToString() +
|
"," + omodel.HUseLife.ToString() + "," + omodel.HLeaveLife.ToString() + "," + omodel.HProdQty.ToString() + "," + omodel.HProdWeight.ToString() +
|
") ");
|
//
|
//插入子表
|
foreach (Model.ClsGy_MouldFileSub oSub in DetailColl)
|
{
|
oCn.RunProc("Insert into Gy_MouldFileSub " +
|
" (HInterID,HEntryID,HRemark" +
|
",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" +
|
") values("
|
+ omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HRemark + "'" +
|
"," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() +
|
") ");
|
}
|
//
|
//插入子表2
|
foreach (Model.ClsGy_MouldFileSub2 oSubSec in DetailEmpColl)
|
{
|
oCn.RunProc("Insert into Gy_MouldFileSub2 " +
|
" (HInterID,HEntryID,HRemark" +
|
",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" +
|
")" +
|
" values("
|
+ omodel.HInterID.ToString() + "," + oSubSec.HEntryID.ToString() + ",'" + oSubSec.HRemark + "'" +
|
"," + oSubSec.HSourceInterID.ToString() + "," + oSubSec.HSourceEntryID.ToString() + ",'" + oSubSec.HSourceBillNo + "','" + oSubSec.HSourceBillType + "'," + oSubSec.HRelationQty.ToString() + "," + oSubSec.HRelationMoney.ToString() +
|
") ");
|
}
|
//
|
//foreach (Model.ClsGy_MouldFileSub oSub in DetailColl)
|
//{
|
// Ds = oCn.RunProcReturn("exec h_p_Gy_MouldFile_Qty " + oSub.HICMOInterID, "");
|
// if (Ds.Tables[0].Rows.Count == 0)
|
// return;
|
// if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBool"]) == "Y")
|
// {
|
// sReturn = "汇报数量超过计划数量!不允许保存";
|
// return false;
|
// }
|
//}
|
//
|
sReturn = "新增单据成功!";
|
oCn.Commit();
|
return true;
|
}
|
catch (Exception e)
|
{
|
sReturn = e.Message;
|
oCn.RollBack();
|
throw (e);
|
}
|
}
|
//显示单据
|
public override bool ShowBill(Int64 lngBillKey, ref string sReturn)
|
{
|
try
|
{
|
//查询主表
|
DataSet Ds ;
|
Ds = oCn.RunProcReturn("Select * from Gy_MouldFileMain Where HInterID=" + lngBillKey.ToString(), "Gy_MouldFileMain");
|
if(Ds.Tables[0].Rows.Count==0)
|
{
|
sReturn = "单据未找到!";
|
return false;
|
}
|
//固定赋值===========================================
|
omodel.HYear = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HYear"]);
|
omodel.HPeriod = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HPeriod"]);
|
omodel.HBillType = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBillType"]);
|
omodel.HBillSubType = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBillSubType"]);
|
omodel.HInterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HInterID"]);
|
omodel.HDate = DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[0]["HDate"]);
|
omodel.HBillNo = Ds.Tables[0].Rows[0]["HBillNo"].ToString().Trim();
|
omodel.HBillStatus = DBUtility.ClsPub.isInt(Ds.Tables[0].Rows[0]["HBillStatus"]);
|
omodel.HCheckItemNowID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HCheckItemNowID"]);
|
omodel.HCheckItemNextID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HCheckItemNextID"]);
|
omodel.HCheckFlowID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HCheckFlowID"]);
|
omodel.HRemark = Ds.Tables[0].Rows[0]["HRemark"].ToString().Trim();
|
omodel.HBackDate = Ds.Tables[0].Rows[0]["HBackDate"].ToString().Trim();
|
omodel.HBacker = Ds.Tables[0].Rows[0]["HBacker"].ToString().Trim();
|
omodel.HCheckDate = Ds.Tables[0].Rows[0]["HCheckDate"].ToString().Trim();
|
omodel.HChecker = Ds.Tables[0].Rows[0]["HChecker"].ToString().Trim();
|
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.HCloseDate = Ds.Tables[0].Rows[0]["HCloseDate"].ToString().Trim();
|
omodel.HCloseMan = Ds.Tables[0].Rows[0]["HCloseMan"].ToString().Trim();
|
omodel.HCloseType = DBUtility.ClsPub.isBool(Ds.Tables[0].Rows[0]["HCloseType"]);
|
omodel.HDeleteDate = Ds.Tables[0].Rows[0]["HDeleteDate"].ToString().Trim();
|
omodel.HDeleteMan = Ds.Tables[0].Rows[0]["HDeleteMan"].ToString().Trim();
|
//========================================================
|
omodel.HMouldNo = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HMouldNo"]);
|
omodel.HName = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HName"]);
|
omodel.HModel = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HModel"]);
|
omodel.HModel2 = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HModel2"]);
|
omodel.HDiameter = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HDiameter"]);
|
omodel.HSubjoin = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HSubjoin"]);
|
omodel.HSubjoin2 = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HSubjoin2"]);
|
omodel.HPICNo = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HPICNo"]);
|
omodel.HWorkMaterModel = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HWorkMaterModel"]);
|
omodel.HMaterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HMaterID"]);
|
omodel.HMaterNumber = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HMaterNumber"]);
|
omodel.HMouldType = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HMouldType"]);
|
omodel.HUnitID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HUnitID"]);
|
omodel.HOutComDate = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HOutComDate"]);
|
omodel.HOutComNo = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HOutComNo"]);
|
omodel.HDeptID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HDeptID"]);
|
omodel.HSupID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HSupID"]);
|
omodel.HSupNumber = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HSupNumber"]);
|
omodel.HPrintQty = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HPrintQty"]);
|
omodel.HMouldStatus = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HMouldStatus"]);
|
omodel.HWhID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HWhID"]);
|
omodel.HRoutingID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HRoutingID"]);
|
omodel.HBomID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HBomID"]);
|
omodel.HVersion = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HVersion"]);
|
omodel.HSPGroupID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HSPGroupID"]);
|
omodel.HSPID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HSPID"]);
|
omodel.HDesignLife = DBUtility.ClsPub.isSingle(Ds.Tables[0].Rows[0]["HDesignLife"]);
|
omodel.HUseLife = DBUtility.ClsPub.isSingle(Ds.Tables[0].Rows[0]["HUseLife"]);
|
omodel.HLeaveLife = DBUtility.ClsPub.isSingle(Ds.Tables[0].Rows[0]["HLeaveLife"]);
|
omodel.HProdQty = DBUtility.ClsPub.isSingle(Ds.Tables[0].Rows[0]["HProdQty"]);
|
omodel.HProdWeight = DBUtility.ClsPub.isSingle(Ds.Tables[0].Rows[0]["HProdWeight"]);
|
|
//
|
|
//循环
|
DataSet DsSub ;
|
DsSub = oCn.RunProcReturn("Select * from Gy_MouldFileSub Where HInterID=" + lngBillKey.ToString(), "Gy_MouldFileSub");
|
DetailColl.Clear();//清空
|
for (int i = 0; i < DsSub.Tables[0].Rows.Count; i++)
|
{
|
Model.ClsGy_MouldFileSub oSub = new Model.ClsGy_MouldFileSub();
|
// 固定赋值===============================================
|
oSub.HInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HInterID"]);
|
oSub.HEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HEntryID"]);
|
oSub.HSourceInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSourceInterID"]);
|
oSub.HSourceEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSourceEntryID"]);
|
oSub.HSourceBillType = DsSub.Tables[0].Rows[i]["HSourceBillType"].ToString().Trim();
|
oSub.HSourceBillNo = DsSub.Tables[0].Rows[i]["HSourceBillNo"].ToString().Trim();
|
oSub.HRelationQty = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HRelationQty"]);
|
oSub.HRelationMoney = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HRelationMoney"]);
|
oSub.HCloseMan = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HCloseMan"]);
|
oSub.HCloseType = DBUtility.ClsPub.isBool(DsSub.Tables[0].Rows[i]["HCloseType"]);
|
oSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DsSub.Tables[0].Rows[i]["HEntryCloseDate"]);
|
oSub.HRemark = DsSub.Tables[0].Rows[i]["HRemark"].ToString().Trim();
|
//===================================================
|
DetailColl.Add(oSub);
|
}
|
//循环子表2
|
DataSet DsSubSec = new DataSet();
|
DsSubSec = oCn.RunProcReturn("Select * from Gy_MouldFileSub2 Where HInterID=" + lngBillKey.ToString(), "Gy_MouldFileMain");
|
DetailEmpColl.Clear();//清空
|
for (int i = 0; i < DsSubSec.Tables[0].Rows.Count; i++)
|
{
|
Model.ClsGy_MouldFileSub2 oSubSec = new Model.ClsGy_MouldFileSub2();
|
// 固定赋值===============================================
|
oSubSec.HInterID = DBUtility.ClsPub.isLong(DsSubSec.Tables[0].Rows[i]["HInterID"]);
|
oSubSec.HEntryID = DBUtility.ClsPub.isLong(DsSubSec.Tables[0].Rows[i]["HEntryID"]);
|
oSubSec.HSourceInterID = DBUtility.ClsPub.isLong(DsSubSec.Tables[0].Rows[i]["HSourceInterID"]);
|
oSubSec.HSourceEntryID = DBUtility.ClsPub.isLong(DsSubSec.Tables[0].Rows[i]["HSourceEntryID"]);
|
oSubSec.HSourceBillType = DsSubSec.Tables[0].Rows[i]["HSourceBillType"].ToString().Trim();
|
oSubSec.HSourceBillNo = DsSubSec.Tables[0].Rows[i]["HSourceBillNo"].ToString().Trim();
|
oSubSec.HRelationQty = DBUtility.ClsPub.isDoule(DsSubSec.Tables[0].Rows[i]["HRelationQty"]);
|
oSubSec.HRelationMoney = DBUtility.ClsPub.isDoule(DsSubSec.Tables[0].Rows[i]["HRelationMoney"]);
|
oSubSec.HCloseMan = DBUtility.ClsPub.isStrNull(DsSubSec.Tables[0].Rows[i]["HCloseMan"]);
|
oSubSec.HCloseType = DBUtility.ClsPub.isBool(DsSubSec.Tables[0].Rows[i]["HCloseType"]);
|
oSubSec.HEntryCloseDate = DBUtility.ClsPub.isDate(DsSubSec.Tables[0].Rows[i]["HEntryCloseDate"]);
|
oSubSec.HRemark = DsSubSec.Tables[0].Rows[i]["HRemark"].ToString().Trim();
|
//===================================================
|
//
|
DetailEmpColl.Add(oSubSec);
|
}
|
sReturn = "显示单据成功!";
|
return true;
|
}
|
catch (Exception e)
|
{
|
sReturn = e.Message;
|
throw (e);
|
}
|
}
|
|
public bool GetByID(int HMaterID)
|
{
|
DataSet DS;
|
try
|
{
|
DS = oCn.RunProcReturn("Select * from " + MvarItemKey + " Where HInterID='" + HMaterID + "'", MvarItemKey, ref DBUtility.ClsPub.sExeReturnInfo);
|
if (DS.Tables[0].Rows.Count == 0)
|
return false;
|
else
|
{
|
return GetInfo(DS);
|
}
|
}
|
catch (Exception e)
|
{
|
throw (e);
|
}
|
}
|
|
//返回项目信息
|
public bool GetInfo(DataSet Ds)
|
{
|
try
|
{
|
omodel = new Model.ClsGy_MouldFileMain();
|
omodel.HMaterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HMaterID"]);
|
omodel.HInitModel = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HInitModel"]);
|
omodel.HSupNumber = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HSupNumber"]);
|
omodel.HMaterNumber = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HMaterNumber"]);
|
omodel.HBarCode = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBarCode"]);
|
return true;
|
|
}
|
catch (Exception e)
|
{
|
throw (e);
|
}
|
}
|
|
|
//审核
|
public bool CheckBill(Int64 lngBillKey, ref string sReturn)
|
{
|
|
try
|
{
|
string HChecker = DBUtility.ClsPub.CurUserName;
|
string HCheckDate = DBUtility.ClsPub.GetServerDate(-1);
|
oCn.BeginTran();
|
oCn.RunProc(" Update " + MvarItemKey + " set HBillStatus='2',HChecker='" + HChecker + "',HCheckDate='" + HCheckDate + "' Where HInterID=" + lngBillKey.ToString());
|
oCn.Commit();
|
//生成调拨单
|
//得到调拨单 mainid 单据号
|
//long NewInterID = DBUtility.ClsPub.CreateBillID("1207", ref DBUtility.ClsPub.sExeReturnInfo);
|
//string NewBillNo = DBUtility.ClsPub.CreateBillCode("1207", ref DBUtility.ClsPub.sExeReturnInfo, true);//得到新单号
|
//oCn.RunProc("exec h_p_Kf_MoveStockBill_Add " + lngBillKey.ToString() + "," + NewInterID.ToString() + ",'" + NewBillNo + "','" + HChecker + "'");
|
//
|
sReturn = "审核单据成功!";
|
return true;
|
}
|
catch (Exception e)
|
{
|
sReturn = e.Message;
|
throw (e);
|
}
|
}
|
|
//反审核
|
public bool AbandonCheck(Int64 lngBillKey, ref string sReturn)
|
{
|
|
try
|
{
|
string HChecker = DBUtility.ClsPub.CurUserName;
|
string HCheckDate = DBUtility.ClsPub.GetServerDate(-1);
|
oCn.BeginTran();
|
//还原单据状态为未审核状态
|
oCn.RunProc(" Update " + MvarItemKey + " set HBillStatus='1',HChecker='',HCheckDate=null Where HInterID=" + lngBillKey.ToString());
|
sReturn = "反审核单据成功!";
|
oCn.Commit();
|
return true;
|
}
|
catch (Exception e)
|
{
|
sReturn = e.Message;
|
throw (e);
|
}
|
}
|
|
}
|
|
}
|