using System;
|
using System.Collections.Generic;
|
using System.Text;
|
using System.Data;
|
|
namespace DAL
|
{
|
public class ClsKf_WIPBal : DBUtility.ClsXt_BaseBill
|
{
|
public Model.ClsKf_WIPBal omodel = new Model.ClsKf_WIPBal();
|
|
public ClsKf_WIPBal()
|
{
|
base.MvarItemKey = "Kf_WIPBal";
|
base.MvarReportTitle = "在产品期初结存";
|
}
|
|
#region 固定代码
|
|
~ClsKf_WIPBal()
|
{
|
|
}
|
|
#endregion 自定义方法
|
//修改单据
|
public override bool ModifyBill(Int64 lngBillKey, ref string sReturn)
|
{
|
try
|
{
|
//oCn.BeginTran();
|
////更新主表
|
//oCn.RunProc("UpDate " + MvarItemKey + " set " +
|
//" HYear=" + omodel.HYear.ToString() +
|
//",HPeriod=" + omodel.HPeriod.ToString() +
|
//",HCostCenterID=" + omodel.HCostCenterID.ToString() +
|
//",HWorkShopID=" + omodel.HWorkShopID.ToString() +
|
//",HCostObjID=" + omodel.HCostObjID.ToString() +
|
//",HMaterID=" + omodel.HMaterID.ToString() +
|
//",HBatchNo='" + omodel.HBatchNo + "'" +
|
//",HBeginQty=" + omodel.HBeginQty.ToString() +
|
//",HReceive=" + omodel.HReceive.ToString() +
|
//",HSend=" + omodel.HSend.ToString() +
|
//",HYtdReceive=" + omodel.HYtdReceive.ToString() +
|
//",HYtdSend=" + omodel.HYtdSend.ToString() +
|
//",HEndQty=" + omodel.HEndQty.ToString() +
|
//",HEndQty_Rel=" + omodel.HEndQty_Rel.ToString() +
|
//",HBeginBal=" + omodel.HBeginBal.ToString() +
|
//",HDebit=" + omodel.HDebit.ToString() +
|
//",HCredit=" + omodel.HCredit.ToString() +
|
//",HEndBal=" + omodel.HEndBal.ToString() +
|
//",HEndBal_Rel=" + omodel.HEndBal_Rel.ToString() +
|
//",HYtdDebit=" + omodel.HYtdDebit.ToString() +
|
//",HYtdCredit=" + omodel.HYtdCredit.ToString() +
|
//",HBeginDiff=" + omodel.HBeginDiff.ToString() +
|
//",HReceiveDiff=" + omodel.HReceiveDiff.ToString() +
|
//",HSendDiff=" + omodel.HSendDiff.ToString() +
|
//",HEndDiff=" + omodel.HEndDiff.ToString() +
|
//",HYtdReceiveDiff=" + omodel.HYtdReceiveDiff.ToString() +
|
//",HYtdSendDiff=" + omodel.HYtdSendDiff.ToString() +
|
//" where HInterID=" + lngBillKey.ToString());
|
////删除关联
|
//DeleteRelation(ref sReturn, lngBillKey);
|
|
sReturn = "修改单据成功!";
|
oCn.Commit();
|
return true;
|
}
|
catch (Exception e)
|
{
|
sReturn = e.Message;
|
oCn.RollBack();
|
throw (e);
|
}
|
}
|
//新增单据
|
public override bool AddBill(ref string sReturn)
|
{
|
try
|
{
|
//若MAINDI重复则重新获取
|
oCn.BeginTran();
|
//主表
|
oCn.RunProc("Insert Into " + MvarItemKey + " " +
|
"(HMaker,HMakeDate" +
|
",HYear,HPeriod,HCostCenterID,HWorkShopID,HCostObjID" +
|
",HMaterID,HBatchNo,HBeginQty,HReceive,HSend" +
|
",HYtdReceive,HYtdSend,HEndQty,HEndQty_Rel,HBeginBal" +
|
",HDebit,HCredit,HEndBal,HEndBal_Rel,HYtdDebit" +
|
",HYtdCredit,HBeginDiff,HReceiveDiff,HSendDiff,HEndDiff" +
|
",HYtdReceiveDiff,HYtdSendDiff" +
|
") " +
|
" values('" + DBUtility.ClsPub.CurUserName + "',getdate()" +
|
", " + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + "," + omodel.HCostCenterID.ToString() + "," + omodel.HWorkShopID.ToString() + "," + omodel.HCostObjID.ToString() +
|
", " + omodel.HMaterID.ToString() + ",'" + omodel.HBatchNo + "'," + omodel.HBeginQty.ToString() + "," + omodel.HReceive.ToString() + "," + omodel.HSend.ToString() +
|
", " + omodel.HYtdReceive.ToString() + "," + omodel.HYtdSend.ToString() + "," + omodel.HEndQty.ToString() + "," + omodel.HEndQty_Rel.ToString() + "," + omodel.HBeginBal.ToString() +
|
", " + omodel.HDebit.ToString() + "," + omodel.HCredit.ToString() + "," + omodel.HEndBal.ToString() + "," + omodel.HEndBal_Rel.ToString() + "," + omodel.HYtdDebit.ToString() +
|
", " + omodel.HYtdCredit.ToString() + "," + omodel.HBeginDiff.ToString() + "," + omodel.HReceiveDiff.ToString() + "," + omodel.HSendDiff.ToString() + "," + omodel.HEndDiff.ToString() +
|
", " + omodel.HYtdReceiveDiff.ToString() + "," + omodel.HYtdSendDiff.ToString() +
|
") ");
|
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 " + MvarItemKey + " Where HInterID=" + lngBillKey.ToString(), MvarItemKey);
|
//if (Ds.Tables[0].Rows.Count == 0)
|
//{
|
// sReturn = "单据未找到!";
|
// return false;
|
//}
|
//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.HCostCenterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HCostCenterID"].ToString());
|
//omodel.HWorkShopID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HWorkShopID"].ToString());
|
//omodel.HCostObjID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HCostObjID"].ToString());
|
//omodel.HMaterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HMaterID"].ToString());
|
//omodel.HBatchNo = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBatchNo"].ToString());
|
//omodel.HBeginQty = DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[0]["HBeginQty"].ToString());
|
//omodel.HReceive = DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[0]["HReceive"].ToString());
|
//omodel.HSend = DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[0]["HSend"].ToString());
|
//omodel.HYtdReceive = DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[0]["HYtdReceive"].ToString());
|
//omodel.HYtdSend = DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[0]["HYtdSend"].ToString());
|
//omodel.HEndQty = DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[0]["HEndQty"].ToString());
|
//omodel.HEndQty_Rel = DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[0]["HEndQty_Rel"].ToString());
|
//omodel.HBeginBal = DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[0]["HBeginBal"].ToString());
|
//omodel.HDebit = DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[0]["HDebit"].ToString());
|
//omodel.HCredit = DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[0]["HCredit"].ToString());
|
//omodel.HEndBal = DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[0]["HEndBal"].ToString());
|
//omodel.HEndBal_Rel = DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[0]["HEndBal_Rel"].ToString());
|
//omodel.HYtdDebit = DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[0]["HYtdDebit"].ToString());
|
//omodel.HYtdCredit = DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[0]["HYtdCredit"].ToString());
|
//omodel.HBeginDiff = DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[0]["HBeginDiff"].ToString());
|
//omodel.HReceiveDiff = DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[0]["HReceiveDiff"].ToString());
|
//omodel.HSendDiff = DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[0]["HSendDiff"].ToString());
|
//omodel.HEndDiff = DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[0]["HEndDiff"].ToString());
|
//omodel.HYtdReceiveDiff = DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[0]["HYtdReceiveDiff"].ToString());
|
//omodel.HYtdSendDiff = DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[0]["HYtdSendDiff"].ToString());
|
////
|
//omodel.HMaker = Ds.Tables[0].Rows[0]["HMaker"].ToString().Trim();
|
//omodel.HMakeDate = DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[0]["HMakeDate"].ToString());
|
//omodel.HCheckMan = Ds.Tables[0].Rows[0]["HCheckMan"].ToString().Trim();
|
//omodel.HCheckDate = DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[0]["HCheckDate"].ToString());
|
sReturn = "显示单据成功!";
|
return true;
|
}
|
catch (Exception e)
|
{
|
sReturn = e.Message;
|
throw (e);
|
}
|
}
|
|
|
//重复会计年+会计月+物料
|
public bool HavBillCode(Int64 sHYear, Int64 sHPeriod, Int64 sHMater)
|
{
|
DataSet DS;
|
try
|
{
|
DS = oCn.RunProcReturn("Select * from " + MvarItemKey + " where HYear='" + sHYear + "'and HPeriod='" + sHPeriod + "'and HMaterID='" + sHMater + "'", MvarItemKey, ref Pub_Class.ClsPub.sExeReturnInfo);
|
if (DS.Tables[0].Rows.Count == 0)
|
return false;
|
else
|
{
|
return true;
|
}
|
}
|
catch (Exception e)
|
{
|
throw (e);
|
}
|
}
|
|
|
}
|
}
|