using System;
|
using System.Collections.Generic;
|
using System.Text;
|
using System.Data;
|
|
namespace DAL
|
{
|
public class ClsSc_PPBomChange_K3:DBUtility.ClsXt_BaseBill
|
{
|
public Model.ClsSc_PPBomChangeMain_K3 omodel = new Model.ClsSc_PPBomChangeMain_K3();
|
public List<Model.ClsSc_PPBomChangeSub_K3> DetailColl = new List<Model.ClsSc_PPBomChangeSub_K3>();
|
|
public ClsSc_PPBomChange_K3()
|
{
|
base.MvarItemKeySub = "PPBomChangeEntry";
|
base.MvarItemKeySub2 = "";
|
base.MvarItemKeySub3 = "";
|
base.MvarItemKeySub4 = "";
|
base.MvarItemKey="PPBomChange";
|
base.MvarReportTitle="生产投料变更单";
|
base.BillType = "1002502";
|
}
|
|
#region 固定代码
|
|
~ClsSc_PPBomChange_K3()
|
{
|
DetailColl = null;
|
}
|
|
#endregion 自定义方法
|
//修改单据
|
public override bool ModifyBill(Int64 lngBillKey, ref string sReturn)
|
{
|
try
|
{
|
//得到用户ID
|
DataSet DsBiller;
|
DsBiller = oK3Cn.RunProcReturn("select top 1 fuserid from t_User where fname='" + DBUtility.ClsPub.CurUserName + "'", "t_User");
|
if (DsBiller.Tables[0].Rows.Count != 0)
|
{
|
omodel.FBillerID = DBUtility.ClsPub.isLong(DsBiller.Tables[0].Rows[0][0]);
|
}
|
else
|
{
|
omodel.FBillerID = 16394;
|
}
|
omodel.HBillType = this.BillType;
|
//
|
//DataSet Ds1;
|
oCnK3.BeginTran();
|
omodel.HInterID = lngBillKey;
|
//删除主表
|
DeleteBill(lngBillKey, ref sReturn);
|
//oCnK3.RunProc("Delete From PPBomChange where FInterID=" + lngBillKey.ToString());
|
//
|
//插入子表
|
foreach (Model.ClsSc_PPBomChangeSub_K3 oSub in DetailColl)
|
{
|
oCnK3.RunProc("INSERT INTO PPBomChangeEntry (" +
|
"FID,FIndex,FICMOInterID,FICMOInterBN,FProductItemID" +
|
",FUnitID,FAuxQty,FPPBomBillNo,FPPBomEntryID,FChangeFlag" +
|
",FChangeReason,FItemID,FBomInterID,FMaterielType,FAuxQtyScrap" +
|
",FItemUnitID,FBOMInPutAuxQTY,FScrap,FAuxQtyLoss,FAuxQtyPick" +
|
",FAuxQtyMust,FSendItemDate,FStockID,FSPID,FBatchNo,FBackFlush" +
|
",FOperSN,FOperID,FMachinePos,FAuxStockQty,FPPBOMInterID" +
|
",FDiscardAuxQty,FLockFlag,FAuxQtySupply,FChangerID,FChangeDate" +
|
",FMark,FQty,FQtyScrap,FBOMInPutQTY,FQtyLoss,FQtyPick" +
|
",FQtyMust,FStockQty,FDiscardQty,FQtySupply,FClassID_SRC" +
|
",FPositionNo,FItemSize,FItemSuite,FNote1,FNote2,FNote3,FPlanMode" +
|
//",FMTONo,FOrderEntryID,FIsRepItem,FICSubsID"+
|
//",FICSubsEntryID,FIsKeyItem,FPriorityID"+
|
") Values (" +
|
omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + "," + oSub.FICMOInterID.ToString() + ",'" + oSub.FICMOInterBN + "'," + oSub.FProductItemID.ToString() +
|
"," + oSub.FProductUnitID.ToString() + "," + oSub.FAuxQty.ToString() + ",'" + oSub.FPPBomBillNo.ToString() + "'," + oSub.FPPBomEntryID.ToString() + ",'" + oSub.FChangeFlag.ToString() +
|
"',''," + oSub.FItemID.ToString() + "," + oSub.FBomInterID.ToString() + ",'" + oSub.FMaterielType.ToString() + "'," + oSub.FQtyScrap.ToString() +
|
"," + oSub.FUnitID.ToString() + "," + oSub.FBOMInPutAuxQTY.ToString() + ",0,0," + oSub.FAuxQtyPick.ToString() +
|
"," + oSub.FAuxQtyMust.ToString() + ",'" + oSub.FSendItemDate.ToShortDateString() + "'," + oSub.FStockID.ToString() + ",0,'" + oSub.FBatchNo + "',1059" +
|
",0,0,''," + oSub.FAuxStockQty.ToString() + "," + oSub.FPPBomInterID.ToString() +
|
"," + oSub.FDisCardAuxQty.ToString() + ",'0',0,0,null" +
|
",''," + oSub.FAuxQty.ToString() + "," + oSub.FQtyScrap.ToString() + "," + oSub.FBOMInPutAuxQTY.ToString() + ",0," + oSub.FAuxQtyPick.ToString() +
|
"," + oSub.FAuxQtyMust.ToString() + "," + oSub.FAuxStockQty.ToString() + "," + oSub.FDisCardAuxQty.ToString() + ",0,-88" +
|
",'','','','','','',14036" +
|
")");
|
|
//oCnK3.RunProc("update ICMO set FcommitQty=FcommitQty+" + oSub.Fauxqty + ",FAuxcommitQty=FAuxcommitQty+" + oSub.Fauxqty + " where Finterid=" + oSub.FICMOInterID);
|
}
|
//主表
|
oCnK3.RunProc("INSERT INTO PPBomChange(" +
|
"FID,FClassTypeID,FDate,FBillNo,FBillerID" +
|
",FCheckDate,FCheckFlag,FCheckerID,FBillType,FCheckDateLong" +
|
") Values (" +
|
omodel.HInterID.ToString() + "," + omodel.HBillType + ",'" + omodel.HDate.ToShortDateString() + "','" + omodel.HBillNo + "'," + omodel.FBillerID.ToString() +
|
",null,'0',0,1059,null" +
|
")");
|
|
//更新关联数量
|
//更新K3关联数量
|
//oCnK3.RunProc("EXEC p_UpdateBillRelateData " + this.BillType + "," + omodel.HInterID.ToString() + ",'PPBomChange','PPBomChangeEntry'");
|
//oCnK3.RunProc("EXEC h_p_K3_UpdateBillRelateData_ProdIn_New " + omodel.HInterID.ToString() + "," + omodel.HBillerID.ToString());
|
sReturn = "修改单据成功!";
|
oCnK3.Commit();
|
return true;
|
}
|
catch (Exception e)
|
{
|
sReturn = e.Message;
|
oCnK3.RollBack();
|
throw (e);
|
}
|
}
|
//新增单据
|
public override bool AddBill(ref string sReturn)
|
{
|
try
|
{
|
//得到用户ID
|
DataSet DsBiller;
|
//string HSourceBillType = "";
|
DsBiller = oK3Cn.RunProcReturn("select top 1 fuserid from t_User where fname='" + DBUtility.ClsPub.CurUserName + "'", "t_User");
|
|
if (DsBiller.Tables[0].Rows.Count != 0)
|
{
|
omodel.FBillerID = DBUtility.ClsPub.isLong(DsBiller.Tables[0].Rows[0][0]);
|
}
|
else
|
{
|
omodel.FBillerID = 16394;
|
}
|
omodel.HBillType = this.BillType;
|
//
|
DataSet Ds1;
|
//得到mainid
|
Ds1 = oCnK3.RunProcReturn("declare @InterID int set @InterID=0 exec GetICMaxNumOld 'PPBomChange',@InterID output select ltrim(@InterID)", "xt_xtgnb");
|
if (Ds1.Tables[0].Rows.Count != 0)
|
{
|
omodel.HInterID = DBUtility.ClsPub.isLong(Ds1.Tables[0].Rows[0][0]);
|
|
}
|
//若MAINDI重复则重新获取
|
oCnK3.BeginTran();
|
|
//插入子表
|
foreach (Model.ClsSc_PPBomChangeSub_K3 oSub in DetailColl)
|
{
|
oCnK3.RunProc("INSERT INTO PPBomChangeEntry (" +
|
"FID,FIndex,FICMOInterID,FICMOInterBN,FProductItemID" +
|
",FUnitID,FAuxQty,FPPBomBillNo,FPPBomEntryID,FChangeFlag" +
|
",FChangeReason,FItemID,FBomInterID,FMaterielType,FAuxQtyScrap" +
|
",FItemUnitID,FBOMInPutAuxQTY,FScrap,FAuxQtyLoss,FAuxQtyPick" +
|
",FAuxQtyMust,FSendItemDate,FStockID,FSPID,FBatchNo,FBackFlush" +
|
",FOperSN,FOperID,FMachinePos,FAuxStockQty,FPPBOMInterID"+
|
",FDiscardAuxQty,FLockFlag,FAuxQtySupply,FChangerID,FChangeDate" +
|
",FMark,FQty,FQtyScrap,FBOMInPutQTY,FQtyLoss,FQtyPick" +
|
",FQtyMust,FStockQty,FDiscardQty,FQtySupply,FClassID_SRC" +
|
",FPositionNo,FItemSize,FItemSuite,FNote1,FNote2,FNote3,FPlanMode"+
|
//",FMTONo,FOrderEntryID,FIsRepItem,FICSubsID"+
|
//",FICSubsEntryID,FIsKeyItem,FPriorityID"+
|
") Values (" +
|
omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + "," + oSub.FICMOInterID.ToString() + ",'" + oSub.FICMOInterBN + "'," + oSub.FProductItemID.ToString() +
|
"," + oSub.FProductUnitID.ToString() + "," + oSub.FAuxQty.ToString() + ",'" + oSub.FPPBomBillNo.ToString() + "'," + oSub.FPPBomEntryID.ToString() + ",'" + oSub.FChangeFlag.ToString() +
|
"',''," + oSub.FItemID.ToString() + "," + oSub.FBomInterID.ToString() + ",'" + oSub.FMaterielType.ToString() + "'," + oSub.FQtyScrap.ToString() +
|
"," + oSub.FUnitID.ToString() + "," + oSub.FBOMInPutAuxQTY.ToString() + ",0,0," + oSub.FAuxQtyPick.ToString() +
|
"," + oSub.FAuxQtyMust.ToString() + ",'" + oSub.FSendItemDate.ToShortDateString() + "'," + oSub.FStockID.ToString() +",0,'"+ oSub.FBatchNo+"',1059"+
|
",0,0,''," + oSub.FAuxStockQty.ToString() + "," + oSub.FPPBomInterID.ToString() +
|
"," + oSub.FDisCardAuxQty.ToString() +",'0',0,0,null"+
|
",''," + oSub.FAuxQty.ToString() + "," + oSub.FQtyScrap.ToString() + "," + oSub.FBOMInPutAuxQTY.ToString() + ",0," + oSub.FAuxQtyPick.ToString() +
|
"," + oSub.FAuxQtyMust.ToString() + "," + oSub.FAuxStockQty.ToString() + "," + oSub.FDisCardAuxQty.ToString() + ",0,-88" +
|
",'','','','','','',14036" +
|
")");
|
|
//oCnK3.RunProc("update ICMO set FcommitQty=FcommitQty+" + oSub.Fauxqty + ",FAuxcommitQty=FAuxcommitQty+" + oSub.Fauxqty + " where Finterid=" + oSub.FICMOInterID);
|
}
|
//主表
|
oCnK3.RunProc("INSERT INTO PPBomChange(" +
|
"FID,FClassTypeID,FDate,FBillNo,FBillerID" +
|
",FCheckDate,FCheckFlag,FCheckerID,FBillType,FCheckDateLong" +
|
") Values (" +
|
omodel.HInterID.ToString() + "," + omodel.HBillType + ",'" + omodel.HDate.ToShortDateString() + "','" + omodel.HBillNo + "'," + omodel.FBillerID.ToString() +
|
",null,'0',0,1059,null" +
|
")");
|
|
////插入子表
|
//foreach (Model.ClsKf_ProductInBillSub_K3 oSub in DetailColl)
|
//{
|
// oSub.HInterID = omodel.HInterID;
|
// oCnK3.RunProc(K3_BaseFun.Fun_GetAddBillSubSQL_ProdIn(oSub, DBUtility.ClsPub.VersionNum));
|
// HSourceBillType = oSub.HSourceBillType;
|
//}
|
////更新主表
|
//oCnK3.RunProc(K3_BaseFun.Fun_GetAddBillMainSQL_ProdIn(omodel, DBUtility.ClsPub.VersionNum));
|
//更新K3关联数量
|
//oCnK3.RunProc("EXEC p_UpdateBillRelateData " + this.BillType + "," + omodel.HInterID.ToString() + ",'PPBomChange','PPBomChangeEntry'");
|
//oCnK3.RunProc("EXEC h_p_K3_UpdateBillRelateData_ProdIn_New " + omodel.HInterID.ToString() + "," + omodel.HBillerID.ToString());
|
|
//
|
//
|
|
sReturn = "新增单据成功!";
|
oCnK3.Commit();
|
return true;
|
}
|
catch (Exception e)
|
{
|
sReturn = e.Message;
|
oCnK3.RollBack();
|
throw (e);
|
}
|
}
|
//显示单据
|
public override bool ShowBill(Int64 lngBillKey, ref string sReturn)
|
{
|
try
|
{
|
//查询主表
|
DataSet Ds ;
|
SQLHelper.ClsCNK3 oCn = new SQLHelper.ClsCNK3();
|
Ds = oCn.RunProcReturn("Select * from PPBomChange Where FID=" + lngBillKey.ToString(), "PPBomChange");
|
if(Ds.Tables[0].Rows.Count==0)
|
{
|
sReturn = "单据未找到!";
|
return false;
|
}
|
//赋值
|
//omodel.FICMOInterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["FICMOInterID"]);
|
//omodel.FOrderBillNo = Ds.Tables[0].Rows[0]["FOrderBillNo"].ToString().Trim();
|
omodel.FBillNo = Ds.Tables[0].Rows[0]["FBillNo"].ToString().Trim();
|
omodel.FDate = DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[0]["FDate"]);
|
//omodel.FItemID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["FItemID"]);
|
//omodel.FWorkShop = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["FWorkShop"]);
|
//omodel.FUnitID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["FUnitID"]);
|
//omodel.FAuxQty = DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[0]["FAuxQty"]);
|
//=================
|
omodel.FBillerID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["FBillerID"]);
|
omodel.FCheckerID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["FCheckerID"]);
|
omodel.FCheckDate = DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[0]["FCheckDate"]);
|
//
|
//循环
|
DataSet DsSub;
|
DsSub = oCn.RunProcReturn("Select * from PPBomChangeEntry Where FID=" + lngBillKey.ToString() + " order by HEntryID ", "PPBomChangeEntry");
|
DetailColl.Clear();//清空
|
for (int i = 0; i < DsSub.Tables[0].Rows.Count; i++)
|
{
|
Model.ClsSc_PPBomChangeSub_K3 oSub = new Model.ClsSc_PPBomChangeSub_K3();
|
oSub.HInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["FID"].ToString());
|
oSub.HEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["FIndex"].ToString());
|
|
oSub.FICMOInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["FICMOInterID"].ToString());
|
oSub.FICMOInterBN = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["FICMOInterBN"].ToString());
|
oSub.FProductItemID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["FProductItemID"].ToString());
|
oSub.FProductUnitID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["FUnitID"].ToString());
|
|
oSub.FAuxQty = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["FAuxQty"].ToString());
|
oSub.FPPBomBillNo = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["FPPBomBillNo"].ToString());
|
oSub.FPPBomInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["FPPBomInterID"].ToString());
|
oSub.FPPBomEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["FPPBomEntryID"].ToString());
|
oSub.FChangeFlag = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["FChangeFlag"].ToString());
|
//
|
oSub.FItemID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["FItemID"].ToString());
|
oSub.FMaterielType = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["FMaterielType"].ToString());
|
oSub.FQtyScrap = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["FQtyScrap"].ToString());
|
oSub.FUnitID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["FUnitID"].ToString());
|
oSub.FBOMInPutAuxQTY = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["FBOMInPutAuxQTY"].ToString());
|
oSub.FScrap = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["FScrap"].ToString());
|
oSub.FAuxQtyLoss = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["FAuxQtyLoss"].ToString());
|
//oSub.FRealScrap = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["FRealScrap"].ToString());
|
oSub.FAuxQtyPick = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["FAuxQtyPick"].ToString());
|
oSub.FAuxQtyMust = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["FAuxQtyMust"].ToString());
|
oSub.FAuxStockQty = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["FAuxStockQty"].ToString());
|
oSub.FDisCardAuxQty = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["FDisCardAuxQty"].ToString());
|
oSub.FSendItemDate = DBUtility.ClsPub.isDate(DsSub.Tables[0].Rows[i]["FSendItemDate"].ToString());
|
|
oSub.FStockID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["FStockID"].ToString());
|
oSub.FSPID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["FSPID"].ToString());
|
oSub.FBatchNo = DsSub.Tables[0].Rows[i]["FBatchNo"].ToString().Trim();
|
oSub.FBackFlush = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["FBackFlush"].ToString());
|
oSub.FOPerID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["FOPerID"].ToString());
|
oSub.FMachinePos = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["FMachinePos"].ToString());
|
//oSub.FNote = DsSub.Tables[0].Rows[i]["FNote1"].ToString().Trim();
|
oSub.FAuxQtySupply = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["FAuxQtySupply"].ToString());
|
oSub.FOperSN = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["FOperSN"].ToString());
|
oSub.FBomInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["FBomInterID"].ToString());
|
oSub.FPositionNo = DsSub.Tables[0].Rows[i]["FPositionNo"].ToString().Trim();
|
oSub.FItemSize = DsSub.Tables[0].Rows[i]["FItemSize"].ToString().Trim();
|
oSub.FItemSuite = DsSub.Tables[0].Rows[i]["FItemSuite"].ToString().Trim();
|
|
DetailColl.Add(oSub);
|
}
|
sReturn = "显示单据成功!";
|
return true;
|
}
|
catch (Exception e)
|
{
|
sReturn = e.Message;
|
throw (e);
|
}
|
}
|
//审核单据
|
public bool CheckBill_K3(Int64 lngBillKey, ref string sReturn)
|
{
|
try
|
{
|
//得到用户ID
|
DataSet DsBiller;
|
DsBiller = oK3Cn.RunProcReturn("select top 1 fuserid from t_User where fname='" + DBUtility.ClsPub.CurUserName + "'", "t_User");
|
if (DsBiller.Tables[0].Rows.Count != 0)
|
{
|
omodel.FBillerID = DBUtility.ClsPub.isLong(DsBiller.Tables[0].Rows[0][0]);
|
}
|
else
|
{
|
omodel.FBillerID = 16394;
|
}
|
omodel.HBillType = this.BillType;
|
omodel.HCheckDate = DateTime.Today.ToShortDateString();
|
string date = DateTime.Today.ToString();
|
//
|
//DataSet Ds1;
|
//主表
|
oCnK3.BeginTran();
|
oCnK3.RunProc("update PPBomChange set FCheckDate='" + omodel.HCheckDate + "',FCheckDateLong='"+date +"',FCheckerID="+ omodel.FBillerID.ToString() +",FCheckFlag='1' where FID=" +lngBillKey.ToString());
|
sReturn = "审核单据成功!";
|
oCnK3.Commit();
|
return true;
|
}
|
catch (Exception e)
|
{
|
sReturn = e.Message;
|
oCnK3.RollBack();
|
throw (e);
|
}
|
}
|
//反审单据
|
public bool AbandonCheck_K3(Int64 lngBillKey, ref string sReturn)
|
{
|
try
|
{
|
//得到用户ID
|
DataSet DsBiller;
|
DsBiller = oK3Cn.RunProcReturn("select top 1 FID from PPBomChangeEntry where FChangeFlag='1' and FID=" + lngBillKey.ToString() , "PPBomChangeEntry");
|
if (DsBiller.Tables[0].Rows.Count >= 1)
|
{
|
sReturn = "单据已变更,反审核单据失败!";
|
return false;
|
}
|
else
|
{
|
//
|
//DataSet Ds1;
|
//主表PPBomChange
|
oCnK3.BeginTran();
|
oCnK3.RunProc("update PPBomChange set FCheckDate=null,FCheckerID=0,FCheckFlag='0' where FID=" + lngBillKey.ToString());
|
sReturn = "反审核单据成功!";
|
oCnK3.Commit();
|
return true;
|
|
}
|
}
|
catch (Exception e)
|
{
|
sReturn = e.Message;
|
oCnK3.RollBack();
|
throw (e);
|
}
|
}
|
//变更
|
public bool ChangeBill_K3(Int64 lngBillKey, ref string sReturn)
|
{
|
try
|
{
|
//得到用户ID
|
DataSet DsBiller;
|
DsBiller = oK3Cn.RunProcReturn("select top 1 fuserid from t_User where fname='" + DBUtility.ClsPub.CurUserName + "'", "t_User");
|
DataSet Ds;
|
Ds = oK3Cn.RunProcReturn("select top 1 FID from PPBomChangeEntry where FChangeFlag='1' and FID=" + lngBillKey.ToString(), "PPBomChangeEntry");
|
if (Ds.Tables[0].Rows.Count >= 1)
|
{
|
sReturn = "单据已变更,变更失败!";
|
return false;
|
}
|
else
|
if (DsBiller.Tables[0].Rows.Count != 0)
|
{
|
omodel.FBillerID = DBUtility.ClsPub.isLong(DsBiller.Tables[0].Rows[0][0]);
|
}
|
else
|
{
|
omodel.FBillerID = 16394;
|
}
|
omodel.HBillType = this.BillType;
|
omodel.HCheckDate = DateTime.Today.ToShortDateString();
|
//
|
//DataSet Ds1;
|
//主表
|
oCnK3.BeginTran();
|
oCnK3.RunProc("exec PPBomChangeEntry_update " + lngBillKey.ToString());
|
oCnK3.RunProc("update PPBomChangeEntry set FChangeDate='" + omodel.HCheckDate + "',FChangerID=" + omodel.FBillerID.ToString() + ",FChangeFlag='1' where FID=" + lngBillKey.ToString());
|
sReturn = "变更成功!";
|
oCnK3.Commit();
|
return true;
|
}
|
catch (Exception e)
|
{
|
sReturn = e.Message;
|
oCnK3.RollBack();
|
throw (e);
|
}
|
}
|
//删除单据
|
public virtual bool DeleteBill(Int64 lngBillKey, ref string sReturn)
|
{
|
try
|
{
|
DataSet Ds;
|
oCnK3.BeginTran();
|
//
|
//Ds = oCnK3.RunProcReturn("select FSourceInterID from ICStockBillEntry where finterid=" + lngBillKey, "ICStockBillEntry");
|
//删除关联
|
//删除明细表
|
oCnK3.RunProc("Delete From PPBomChangeEntry where FID=" + lngBillKey.ToString());
|
//删除主表
|
//DeleteBillMain(lngBillKey);
|
oCnK3.RunProc("Delete From PPBomChange where FID=" + lngBillKey.ToString());
|
//删除关联
|
|
sReturn = "删除单据成功!";
|
oCnK3.Commit();
|
return true;
|
}
|
catch (Exception e)
|
{
|
sReturn = e.Message;
|
oCnK3.RollBack();
|
throw (e);
|
}
|
}
|
//单据号是否重复
|
public virtual bool IsExistBillNo(ref string sReturn, string sBillNo, DBUtility.ClsPub.Enum_BillStatus oBillStatus, Int64 lngBillKey)
|
{
|
try
|
{
|
string sSql = "";
|
if (oBillStatus == DBUtility.ClsPub.Enum_BillStatus.BillStatus_AddNew)
|
{
|
sSql = "Select FInterID from PPBomChange where FClassTypeID='" + MvarItemKey + "' and FBillNo ='" + sBillNo + "'";
|
}
|
else
|
{
|
sSql = "Select FInterID from PPBomChange where FClassTypeID='" + MvarItemKey + "' and FBillNo ='" + sBillNo + "' and FID<>" + lngBillKey.ToString();
|
}
|
DataSet Ds;
|
Ds = oCnK3.RunProcReturn(sSql, "PPBomChange");
|
if (Ds.Tables[0].Rows.Count != 0)
|
{
|
sReturn = "单号重复";
|
return true;
|
}
|
sReturn = "单号未重复";
|
return false;
|
}
|
catch (Exception e)
|
{
|
sReturn = e.Message;
|
return false;
|
}
|
}
|
|
|
}
|
|
}
|