using System;
|
using System.Collections.Generic;
|
using System.Text;
|
using System.Data;
|
|
namespace DAL
|
{
|
public class ClsKf_VirtualStockInBill_K3:DBUtility.ClsXt_BaseBill
|
{
|
public Model.ClsKf_VirtualStockInBillMain_K3 omodel = new Model.ClsKf_VirtualStockInBillMain_K3();
|
public List<Model.ClsKf_VirtualStockInBillSub_K3> DetailColl = new List<Model.ClsKf_VirtualStockInBillSub_K3>();
|
public List<Model.ClsKf_VirtualStockInBillScheme_K3> DetailSubColl = new List<Model.ClsKf_VirtualStockInBillScheme_K3>();
|
public SQLHelper.ClsCNK3 oCnK3 = new SQLHelper.ClsCNK3();
|
|
public ClsKf_VirtualStockInBill_K3()
|
{
|
base.MvarItemKeySub = "ZPStockBillEntry";
|
base.MvarItemKeySub2 = "";
|
base.MvarItemKeySub3 = "";
|
base.MvarItemKeySub4 = "";
|
base.MvarItemKey = "ZPStockBill";
|
base.MvarReportTitle = "金蝶虚仓入库单";
|
base.BillType = "6";
|
}
|
|
#region 固定代码
|
|
~ClsKf_VirtualStockInBill_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.HBillerID = DBUtility.ClsPub.isLong(DsBiller.Tables[0].Rows[0][0]);
|
}
|
else
|
{
|
omodel.HBillerID = 16394;
|
}
|
omodel.HBillType = this.BillType;
|
//
|
//oCn.BeginTran();
|
oCnK3.BeginTran();
|
//删除关联
|
//删除主表
|
oCnK3.RunProc("Delete From ZPStockBill where FInterID=" + lngBillKey.ToString());
|
//删除子表
|
oCnK3.RunProc("Delete From ZPStockBillEntry where FInterID=" + lngBillKey.ToString());
|
omodel.HInterID = lngBillKey;
|
//更新主表
|
oCnK3.RunProc("INSERT INTO ZPStockBill" +
|
"(FInterID,FBillNo,FBrNo,FTranType,FCancellation" +
|
",FStatus,FUpStockWhenSave,FROB,Fdate,FRelateBillInterID" +
|
",FCheckDate,FBillerID,FMultiCheckDate1,FMultiCheckDate2,FMultiCheckDate3" +
|
",FMultiCheckDate4,FMultiCheckDate5,FMultiCheckDate6,FSelTranType" +
|
",FSupplyID,FCustID,FDeptID,FEmpID,FDCStockID" +
|
",FManagerID,FFManagerID,FSManagerID,FExplanation)" +
|
"VALUES " +
|
"(" + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','0','" + this.BillType + "',0" +
|
",0,1,1,'" + omodel.HDate.ToShortDateString() + "',0" +
|
",Null,'" + omodel.HMaker + "',Null,Null,Null" +
|
",Null,Null,Null,0" +
|
"," + omodel.HSupplyID.ToString() + "," + omodel.HCustID.ToString() + "," + omodel.HDeptID.ToString() + "," + omodel.HEmpID.ToString() + "," + omodel.HWHID.ToString() +
|
"," + omodel.HManagerID.ToString() + "," + omodel.HFManagerID.ToString() + "," + omodel.HSManagerID.ToString() + ",'" + omodel.HExplanation + "'" +
|
") ");
|
//插入子表
|
foreach (Model.ClsKf_VirtualStockInBillSub_K3 oSub in DetailColl)
|
{
|
oSub.HInterID = omodel.HInterID;
|
oCnK3.RunProc("INSERT INTO ZPStockBillEntry " +
|
"(FInterID,FEntryID,FBrNo,FMapNumber,FMapName" +
|
",FItemID,FAuxPropID,FUnitID,FBatchNo,FSecCoefficient" +
|
",Fauxqty,FQty,FSecQty,FKFDate,FKFPeriod" +
|
",FPeriodDate,FDCStockID,FDCSPID,Fnote" +
|
",FSourceBillNo,FSourceTranType,FSourceInterId,FSourceEntryID)" +
|
"VALUES " +
|
"(" + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",0,'',''" +
|
"," + oSub.HMaterID.ToString() + "," + oSub.HPropertyID.ToString() + "," + oSub.HUnitID.ToString() + ",'" + oSub.HBatchNo + "'," + oSub.HSecUnitRate.ToString() +
|
"," + oSub.HQty.ToString() + "," + oSub.HQty.ToString() + "," + oSub.HSecQty.ToString() + ",'" + oSub.HKFDate.ToShortDateString() + "'," + oSub.HKFPeriod.ToString() +
|
",'" + oSub.HPeriodDate.ToShortDateString() + "'," + oSub.HWHID.ToString() + "," + oSub.HSPID.ToString() + ",'" + oSub.HRemark + "'" +
|
",'',0,0,0)");
|
}
|
|
//更新K3关联数量
|
oCnK3.RunProc("EXEC p_UpdateBillRelateData " + this.BillType + "," + omodel.HInterID.ToString() + ",'ZPStockBill','ZPStockBillEntry'");
|
//更新单据NEWid
|
//oCnK3.RunProc("UPDATE ZPStockBill SET FUUID=NEWID() WHERE FInterID=" + omodel.HInterID.ToString());
|
////更新关联数量
|
|
sReturn = "修改单据成功!";
|
//oCn.Commit();
|
oCnK3.Commit();
|
return true;
|
}
|
catch (Exception e)
|
{
|
sReturn = e.Message;
|
//oCn.RollBack();
|
oCnK3.RollBack();
|
return false;
|
}
|
}
|
//新增单据
|
public override bool AddBill(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.HBillerID = DBUtility.ClsPub.isLong(DsBiller.Tables[0].Rows[0][0]);
|
}
|
else
|
{
|
omodel.HBillerID = 16394;
|
}
|
omodel.HBillType = this.BillType;
|
//
|
DataSet Ds;
|
//得到mainid
|
//Ds = oCnK3.RunProcReturn("declare @InterID int set @InterID=0 exec GetICMaxNum 'ZPStockBill', @InterID output, 1, 16400 select ltrim(@InterID)", "GetICMaxNum");
|
Ds = oCnK3.RunProcReturn("declare @InterID int set @InterID=0 exec GetICMaxNum 'ZPStockBill', @InterID output, 1 select ltrim(@InterID)", "GetICMaxNum");
|
omodel.HInterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0][0]);
|
|
//若MAINDI重复则重新获取
|
//oCn.BeginTran();
|
oCnK3.BeginTran();
|
//更新主表
|
oCnK3.RunProc("INSERT INTO ZPStockBill" +
|
"(FInterID,FBillNo,FBrNo,FTranType,FCancellation" +
|
",FStatus,FUpStockWhenSave,FROB,Fdate,FRelateBillInterID" +
|
",FCheckDate,FBillerID,FMultiCheckDate1,FMultiCheckDate2,FMultiCheckDate3" +
|
",FMultiCheckDate4,FMultiCheckDate5,FMultiCheckDate6,FSelTranType" +
|
",FSupplyID,FCustID,FDeptID,FEmpID,FDCStockID" +
|
",FManagerID,FFManagerID,FSManagerID,FExplanation)" +
|
"VALUES " +
|
"(" + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','0','" + this.BillType + "',0" +
|
",0,1,1,'" + omodel.HDate.ToShortDateString() + "',0" +
|
",Null,'" + omodel.HMaker + "',Null,Null,Null" +
|
",Null,Null,Null,0" +
|
"," + omodel.HSupplyID.ToString() + "," + omodel.HCustID.ToString() + "," + omodel.HDeptID.ToString() + "," + omodel.HEmpID.ToString() + "," + omodel.HWHID.ToString() +
|
"," + omodel.HManagerID.ToString() + "," + omodel.HFManagerID.ToString() + "," + omodel.HSManagerID.ToString() + ",'" + omodel.HExplanation + "'" +
|
") ");
|
//插入子表
|
foreach (Model.ClsKf_VirtualStockInBillSub_K3 oSub in DetailColl)
|
{
|
oSub.HInterID = omodel.HInterID;
|
oCnK3.RunProc("INSERT INTO ZPStockBillEntry " +
|
"(FInterID,FEntryID,FBrNo,FMapNumber,FMapName" +
|
",FItemID,FAuxPropID,FUnitID,FBatchNo,FSecCoefficient" +
|
",Fauxqty,FQty,FSecQty,FKFDate,FKFPeriod" +
|
",FPeriodDate,FDCStockID,FDCSPID,Fnote" +
|
",FSourceBillNo,FSourceTranType,FSourceInterId,FSourceEntryID)" +
|
"VALUES " +
|
"(" + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",0,'',''" +
|
"," + oSub.HMaterID.ToString() + "," + oSub.HPropertyID.ToString() + "," + oSub.HUnitID.ToString() + ",'" + oSub.HBatchNo + "'," + oSub.HSecUnitRate.ToString() +
|
"," + oSub.HQty.ToString() + "," + oSub.HQty.ToString() + "," + oSub.HSecQty.ToString() + ",'" + oSub.HKFDate.ToShortDateString() + "'," + oSub.HKFPeriod.ToString() +
|
",'" + oSub.HPeriodDate.ToShortDateString() + "'," + oSub.HWHID.ToString() + "," + oSub.HSPID.ToString() + ",'" + oSub.HRemark + "'" +
|
",'',0,0,0)");
|
}
|
|
//更新K3关联数量
|
oCnK3.RunProc("EXEC p_UpdateBillRelateData " + this.BillType + "," + omodel.HInterID.ToString() + ",'ZPStockBill','ZPStockBillEntry'");
|
//更新单据NEWid
|
//oCnK3.RunProc("UPDATE ZPStockBill SET FUUID=NEWID() WHERE FInterID=" + omodel.HInterID.ToString());
|
//
|
//更新关联数量
|
|
sReturn = "新增单据成功!";
|
//oCn.Commit();
|
oCnK3.Commit();
|
return true;
|
}
|
catch (Exception e)
|
{
|
sReturn = e.Message;
|
//oCn.RollBack();
|
oCnK3.RollBack();
|
return false;
|
}
|
}
|
//显示单据
|
public override bool ShowBill(Int64 lngBillKey, ref string sReturn)
|
{
|
try
|
{
|
//查询主表
|
DataSet Ds;
|
Ds = oCnK3.RunProcReturn("Select * from ZPStockBill Where FInterID=" + lngBillKey.ToString(), "ZPStockBill");
|
if (Ds.Tables[0].Rows.Count == 0)
|
{
|
sReturn = "单据未找到!";
|
return false;
|
}
|
//赋值
|
omodel.HInterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["FInterID"]);
|
omodel.HBillNo = Ds.Tables[0].Rows[0]["FBillNo"].ToString();
|
omodel.HDate = Convert.ToDateTime(Ds.Tables[0].Rows[0]["Fdate"]);
|
omodel.HSupplyID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["FSupplyID"]);
|
omodel.HCustID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["FCustID"]);
|
omodel.HDeptID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["FDeptID"]);
|
omodel.HEmpID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["FEmpID"]);
|
omodel.HWHID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["FDCStockID"]);
|
omodel.HManagerID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["FManagerID"]);
|
omodel.HFManagerID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["FFManagerID"]);
|
omodel.HSManagerID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["FSManagerID"]);
|
omodel.HExplanation = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FExplanation"]);
|
//
|
omodel.HCheckDate = Ds.Tables[0].Rows[0]["FCheckDate"].ToString();
|
//
|
//
|
DataSet Ds1;
|
Ds1 = oCnK3.RunProcReturn("select fname from t_User where fuserid=" + DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["FBillerID"]), "t_User");
|
if (Ds1.Tables[0].Rows.Count != 0)
|
{
|
omodel.HMaker = Ds1.Tables[0].Rows[0][0].ToString();
|
}
|
omodel.HCheckDate = Ds.Tables[0].Rows[0]["FCheckDate"].ToString().Trim();
|
if (DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["FCheckerID"]) != 0)
|
{
|
DataSet Ds2;
|
Ds2 = oCnK3.RunProcReturn("select fname from t_User where fuserid=" + DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["FCheckerID"]), "t_User");
|
if (Ds2.Tables[0].Rows.Count != 0)
|
{
|
omodel.HChecker = Ds2.Tables[0].Rows[0][0].ToString();
|
}
|
}
|
else
|
{
|
omodel.HChecker = "";
|
}
|
//循环
|
DataSet DsSub;
|
DsSub = oCnK3.RunProcReturn("Select * from ZPStockBillEntry Where FInterID=" + lngBillKey.ToString() + " order by HEntryID ", "ZPStockBillEntry");
|
DetailColl.Clear();//清空
|
for (int i = 0; i < DsSub.Tables[0].Rows.Count; i++)
|
{
|
Model.ClsKf_VirtualStockInBillSub_K3 oSub = new Model.ClsKf_VirtualStockInBillSub_K3();
|
oSub.HInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["FInterID"].ToString());
|
oSub.HEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["FEntryID"].ToString());
|
oSub.HMaterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["FItemID"].ToString());
|
oSub.HPropertyID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["FAuxPropID"].ToString());
|
oSub.HUnitID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["FUnitID"].ToString());
|
oSub.HBatchNo = DsSub.Tables[0].Rows[i]["FBatchNo"].ToString().Trim();
|
oSub.HSecUnitRate = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["FSecCoefficient"].ToString());
|
oSub.HQty = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["Fauxqty"].ToString());
|
oSub.HSecQty = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["FSecQty"].ToString());
|
oSub.HKFDate = DBUtility.ClsPub.isDate(DsSub.Tables[0].Rows[i]["FKFDate"].ToString());
|
oSub.HKFPeriod = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["FKFPeriod"].ToString());
|
oSub.HPeriodDate = DBUtility.ClsPub.isDate(DsSub.Tables[0].Rows[i]["FPeriodDate"].ToString());
|
oSub.HWHID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["FDCStockID"].ToString());
|
oSub.HSPID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["FDCSPID"].ToString());
|
oSub.HRemark = DsSub.Tables[0].Rows[i]["FNote"].ToString().Trim();
|
//
|
oSub.HSourceInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["FSourceInterId"].ToString());
|
oSub.HSourceEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["FSourceEntryID"].ToString());
|
oSub.HSourceBillType = DsSub.Tables[0].Rows[i]["FSourceTranType"].ToString().Trim();
|
oSub.HSourceBillNo = DsSub.Tables[0].Rows[i]["FSourceBillNo"].ToString().Trim();
|
DetailColl.Add(oSub);
|
}
|
sReturn = "显示单据成功!";
|
return true;
|
}
|
catch (Exception e)
|
{
|
sReturn = e.Message;
|
return false;
|
}
|
}
|
|
//单据号是否重复
|
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 ZPStockBill where FTranType='" + MvarItemKey + "' and FBillNo ='" + sBillNo + "'";
|
}
|
else
|
{
|
sSql = "Select FInterID from ZPStockBill where FTranType='" + MvarItemKey + "' and FBillNo ='" + sBillNo + "' and FInterID<>" + lngBillKey.ToString();
|
}
|
DataSet Ds;
|
Ds = oCnK3.RunProcReturn(sSql, "ZPStockBill");
|
if (Ds.Tables[0].Rows.Count != 0)
|
{
|
sReturn = "单号重复";
|
return true;
|
}
|
sReturn = "单号未重复";
|
return false;
|
}
|
catch (Exception e)
|
{
|
sReturn = e.Message;
|
return false;
|
}
|
}
|
|
|
|
//删除单据
|
public virtual bool DeleteBill(Int64 lngBillKey, ref string sReturn)
|
{
|
try
|
{
|
DataSet Ds;
|
oCnK3.BeginTran();
|
//
|
//Ds = oCnK3.RunProcReturn("select FSourceInterID from ZPStockBillEntry where finterid=" + lngBillKey, "ZPStockBillEntry");
|
//删除关联
|
//删除明细表
|
//oCnK3.RunProc("Delete From ZPStockBillEntry where FInterID=" + lngBillKey.ToString());
|
//删除主表
|
//DeleteBillMain(lngBillKey);
|
oCnK3.RunProc("Delete From ZPStockBill where FInterID=" + lngBillKey.ToString());
|
//删除关联
|
//for (int i = 0; i < Ds.Tables[0].Rows.Count; i++)
|
//{
|
// DeleteRelation(ref sReturn, DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[i][0]));
|
//}
|
sReturn = "删除单据成功!";
|
oCnK3.Commit();
|
return true;
|
}
|
catch (Exception e)
|
{
|
sReturn = e.Message;
|
oCnK3.RollBack();
|
throw (e);
|
}
|
}
|
//删除关联
|
public override void DeleteRelation(ref string sReturn, Int64 lngBillKey)
|
{
|
//oCn.RunProc("exec h_p_K3_MateOutRequestRelationQtyBack " + lngBillKey + ",'376001'");
|
//sReturn = "";
|
return;
|
}
|
|
|
//条码扫描记录,新增到金蝶虚仓入库单
|
public bool AddBill_PDA(ref string sReturn)
|
{
|
try
|
{
|
DataSet Ds;
|
oCnK3.BeginTran();
|
//删除主表
|
oCnK3.RunProc("Delete From ZPStockBill where FInterID=" + omodel.HInterID.ToString());
|
//插入子表
|
oCnK3.RunProc("EXEC h_p_Kf_VirtualStockInBillSub_Insert_K3 " + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "'");
|
//插入主表
|
oCnK3.RunProc("INSERT INTO ZPStockBill " +
|
"(FInterID,FBillNo,FBrNo,FTranType,FCancellation" +
|
",FStatus,FUpStockWhenSave,FROB,Fdate,FRelateBillInterID" +
|
",FCheckDate,FBillerID,FMultiCheckDate1,FMultiCheckDate2,FMultiCheckDate3" +
|
",FMultiCheckDate4,FMultiCheckDate5,FMultiCheckDate6,FSelTranType" +
|
",FSupplyID,FCustID,FDeptID,FEmpID,FDCStockID" +
|
",FManagerID,FFManagerID,FSManagerID,FExplanation)" +
|
"VALUES " +
|
"(" + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','0','" + this.BillType + "',0" +
|
",0,0,1,'" + omodel.HDate.ToShortDateString() + "',0" +
|
",Null,'" + omodel.HMaker + "',Null,Null,Null" +
|
",Null,Null,Null,0" +
|
"," + omodel.HSupplyID.ToString() + "," + omodel.HCustID.ToString() + "," + omodel.HDeptID.ToString() + "," + omodel.HEmpID.ToString() + "," + omodel.HWHID.ToString() +
|
"," + omodel.HManagerID.ToString() + "," + omodel.HFManagerID.ToString() + "," + omodel.HSManagerID.ToString() + ",'" + omodel.HExplanation + "'" +
|
") ");
|
//更新K3关联数量
|
//oCnK3.RunProc("EXEC p_UpdateBillRelateData " + this.BillType + "," + omodel.HInterID.ToString() + ",'ZPStockBill','ZPStockBillEntry'");
|
oCnK3.RunProc("EXEC h_p_K3_UpdateBillRelateData_MoveStock_New " + omodel.HInterID.ToString());
|
//更新单据NEWid
|
//oCnK3.RunProc("UPDATE ZPStockBill SET FUUID=NEWID() WHERE FInterID=" + omodel.HInterID.ToString());
|
//审核单据
|
oCnK3.RunProc("EXEC h_p_Kf_VirtualStockInBill_Check_K3 " + omodel.HInterID.ToString());
|
sReturn = "新增单据成功!";
|
oCnK3.Commit();
|
return true;
|
}
|
catch (Exception e)
|
{
|
sReturn = e.Message;
|
oCnK3.RollBack();
|
throw (e);
|
}
|
}
|
|
//条码扫描记录,新增到金蝶虚仓入库单 退货
|
public bool AddBill_PDA_Back(ref string sReturn)
|
{
|
try
|
{
|
DataSet Ds;
|
oCnK3.BeginTran();
|
//删除主表
|
oCnK3.RunProc("Delete From ZPStockBill where FInterID=" + omodel.HInterID.ToString());
|
//插入子表
|
oCnK3.RunProc("EXEC h_p_Kf_VirtualStockInBillSub_Insert_K3 " + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "'");
|
//插入主表
|
oCnK3.RunProc("INSERT INTO ZPStockBill " +
|
"(FInterID,FBillNo,FBrNo,FTranType,FCancellation" +
|
",FStatus,FUpStockWhenSave,FROB,Fdate,FRelateBillInterID" +
|
",FCheckDate,FBillerID,FMultiCheckDate1,FMultiCheckDate2,FMultiCheckDate3" +
|
",FMultiCheckDate4,FMultiCheckDate5,FMultiCheckDate6,FSelTranType" +
|
",FSupplyID,FCustID,FDeptID,FEmpID,FDCStockID" +
|
",FManagerID,FFManagerID,FSManagerID,FExplanation)" +
|
"VALUES " +
|
"(" + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','0','" + this.BillType + "',0" +
|
",0,0,1,'" + omodel.HDate.ToShortDateString() + "',0" +
|
",Null,'" + omodel.HMaker + "',Null,Null,Null" +
|
",Null,Null,Null,0" +
|
"," + omodel.HSupplyID.ToString() + "," + omodel.HCustID.ToString() + "," + omodel.HDeptID.ToString() + "," + omodel.HEmpID.ToString() + "," + omodel.HWHID.ToString() +
|
"," + omodel.HManagerID.ToString() + "," + omodel.HFManagerID.ToString() + "," + omodel.HSManagerID.ToString() + ",'" + omodel.HExplanation + "'" +
|
") ");
|
//更新K3关联数量
|
//oCnK3.RunProc("EXEC p_UpdateBillRelateData " + this.BillType + "," + omodel.HInterID.ToString() + ",'ZPStockBill','ZPStockBillEntry'");
|
oCnK3.RunProc("EXEC h_p_K3_UpdateBillRelateData_MoveStock_Back_New " + omodel.HInterID.ToString());
|
//更新单据NEWid
|
//oCnK3.RunProc("UPDATE ZPStockBill SET FUUID=NEWID() WHERE FInterID=" + omodel.HInterID.ToString());
|
//审核单据
|
oCnK3.RunProc("EXEC h_p_Kf_VirtualStockInBill_Check_K3 " + omodel.HInterID.ToString());
|
sReturn = "新增单据成功!";
|
oCnK3.Commit();
|
return true;
|
}
|
catch (Exception e)
|
{
|
sReturn = e.Message;
|
oCnK3.RollBack();
|
throw (e);
|
}
|
}
|
|
//条码扫描记录,新增到条码出入库表
|
public bool AddBill_WMS_PDA(ref string sReturn)
|
{
|
try
|
{
|
DataSet Ds;
|
oCn.BeginTran();
|
//删除主表
|
//oCn.RunProc("Delete From Kf_ZPStockBillSub_WMS where HInterID=" + omodel.HInterID.ToString());
|
//插入子表
|
oCn.RunProc("EXEC h_p_Kf_ZPStockBillSub_WMS_Insert " + omodel.HInterID.ToString() + ",'" + this.BillType + "','" + omodel.HBillNo + "'");
|
//
|
sReturn = "新增成功!";
|
oCn.Commit();
|
return true;
|
}
|
catch (Exception e)
|
{
|
sReturn = e.Message;
|
oCn.RollBack();
|
throw (e);
|
}
|
}
|
|
//条码扫描记录,新增到条码出入库表
|
public bool AddBill_WMS_PDA(Int64 sHSourceInterID, Int64 sHSourceEntryID, ref string sReturn)
|
{
|
try
|
{
|
DataSet Ds;
|
oCn.BeginTran();
|
//删除主表
|
//oCn.RunProc("Delete From Kf_ZPStockBillSub_WMS where HInterID=" + omodel.HInterID.ToString());
|
//插入子表
|
oCn.RunProc("EXEC h_p_Kf_ZPStockBillSub_WMS_RowInsert " + sHSourceEntryID.ToString() + "," + sHSourceEntryID.ToString() + ",'" + this.BillType + "'");
|
//更新 单据自定义字段(已提交)
|
oCn.RunProc("EXEC h_p_K3_MoveStock_Status_UPDate " + sHSourceEntryID.ToString() + "," + sHSourceEntryID.ToString() + ",'" + this.BillType + "'");
|
//
|
sReturn = "新增成功!";
|
oCn.Commit();
|
return true;
|
}
|
catch (Exception e)
|
{
|
sReturn = e.Message;
|
oCn.RollBack();
|
throw (e);
|
}
|
}
|
|
|
//显示单据条码信息
|
public bool ShowBill_Scheme(Int64 lngBillKey, ref string sReturn)
|
{
|
try
|
{
|
//循环子表2
|
DataSet DsSubSec;
|
DsSubSec = oCn.RunProcReturn("Select * from Kf_ZPStockBillSub_WMS with (nolock) Where HInterID=" + lngBillKey.ToString() + " and HBillType='" + this.BillType + "'", "Kf_ZPStockBillSub_WMS");
|
DetailSubColl.Clear();//清空
|
for (int i = 0; i < DsSubSec.Tables[0].Rows.Count; i++)
|
{
|
Model.ClsKf_VirtualStockInBillScheme_K3 oSubSec = new Model.ClsKf_VirtualStockInBillScheme_K3();
|
oSubSec.HInterID = DBUtility.ClsPub.isLong(DsSubSec.Tables[0].Rows[i]["HInterID"].ToString());
|
oSubSec.HEntryID = DBUtility.ClsPub.isLong(DsSubSec.Tables[0].Rows[i]["HEntryID"].ToString());
|
oSubSec.HItemID = DBUtility.ClsPub.isLong(DsSubSec.Tables[0].Rows[i]["HItemID"].ToString());
|
oSubSec.HBillType = DsSubSec.Tables[0].Rows[i]["HBillType"].ToString();
|
oSubSec.HMaterID = DBUtility.ClsPub.isLong(DsSubSec.Tables[0].Rows[i]["HMaterID"].ToString());
|
oSubSec.HProcID = DBUtility.ClsPub.isLong(DsSubSec.Tables[0].Rows[i]["HProcID"].ToString());
|
oSubSec.HWhID = DBUtility.ClsPub.isLong(DsSubSec.Tables[0].Rows[i]["HWhID"].ToString());
|
oSubSec.HGroupID = DBUtility.ClsPub.isLong(DsSubSec.Tables[0].Rows[i]["HGroupID"].ToString());
|
oSubSec.HQty = DBUtility.ClsPub.isDoule(DsSubSec.Tables[0].Rows[i]["HQty"].ToString());
|
oSubSec.HBarCode = DsSubSec.Tables[0].Rows[i]["HBarCode"].ToString();
|
oSubSec.HAddr = DsSubSec.Tables[0].Rows[i]["HAddr"].ToString();
|
oSubSec.HMaker = DsSubSec.Tables[0].Rows[i]["HMaker"].ToString();
|
oSubSec.HMakeDate = DBUtility.ClsPub.isDate(DsSubSec.Tables[0].Rows[i]["HMakeDate"].ToString());
|
oSubSec.HSourceInterID = DBUtility.ClsPub.isLong(DsSubSec.Tables[0].Rows[i]["HSourceInterID"].ToString());
|
oSubSec.HSourceEntryID = DBUtility.ClsPub.isLong(DsSubSec.Tables[0].Rows[i]["HSourceEntryID"].ToString());
|
oSubSec.HSourceBillType = DsSubSec.Tables[0].Rows[i]["HSourceBillType"].ToString();
|
oSubSec.HSourceBillNo = DsSubSec.Tables[0].Rows[i]["HSourceBillNo"].ToString();
|
oSubSec.HSourceItemID = DBUtility.ClsPub.isLong(DsSubSec.Tables[0].Rows[i]["HSourceItemID"].ToString());
|
//
|
DetailSubColl.Add(oSubSec);
|
}
|
sReturn = "显示单据成功!";
|
return true;
|
}
|
catch (Exception e)
|
{
|
sReturn = e.Message;
|
throw (e);
|
}
|
}
|
|
|
}
|
}
|