using System;
|
using System.Collections.Generic;
|
using System.Text;
|
using System.Data;
|
|
namespace DAL
|
{
|
public class ClsKf_EntrustInBill_K3:DBUtility.ClsXt_BaseBill
|
{
|
public Model.ClsKf_EntrustInBillMain_K3 omodel = new Model.ClsKf_EntrustInBillMain_K3();
|
public List<Model.ClsKf_EntrustInBillSub_K3> DetailColl = new List<Model.ClsKf_EntrustInBillSub_K3>();
|
public List<Model.ClsKf_EntrustInBillScheme_K3> DetailSubColl = new List<Model.ClsKf_EntrustInBillScheme_K3>();
|
public SQLHelper.ClsCNK3 oCnK3 = new SQLHelper.ClsCNK3();
|
|
public ClsKf_EntrustInBill_K3()
|
{
|
base.MvarItemKeySub = "ICStockBillEntry";
|
base.MvarItemKeySub2 = "";
|
base.MvarItemKeySub3 = "";
|
base.MvarItemKeySub4 = "";
|
base.MvarItemKey = "ICStockBill";
|
base.MvarReportTitle = "委外加工入库单";
|
base.BillType = "5";
|
}
|
|
#region 固定代码
|
|
~ClsKf_EntrustInBill_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;
|
//
|
DataSet Ds1;
|
oCnK3.BeginTran();
|
omodel.HInterID = lngBillKey;
|
//删除主表
|
oCnK3.RunProc("Delete From ICStockBill where FInterID=" + lngBillKey.ToString());
|
//插入子表
|
foreach (Model.ClsKf_EntrustInBillSub_K3 oSub in DetailColl)
|
{
|
//oCnK3.RunProc(K3_BaseFun.Fun_GetAddBillSubSQL_EntrustIn(oSub, DBUtility.ClsPub.VersionNum));
|
}
|
//更新主表
|
//oCnK3.RunProc(K3_BaseFun.Fun_GetAddBillMainSQL_EntrustIn(omodel, DBUtility.ClsPub.VersionNum));
|
//更新关联数量
|
//更新K3关联数量
|
oCnK3.RunProc("EXEC p_UpdateBillRelateData " + this.BillType + "," + omodel.HInterID.ToString() + ",'ICStockBill','ICStockBillEntry'");
|
//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.HBillerID = DBUtility.ClsPub.isLong(DsBiller.Tables[0].Rows[0][0]);
|
}
|
else
|
{
|
omodel.HBillerID = 16394;
|
}
|
omodel.HBillType = this.BillType;
|
//
|
DataSet Ds1;
|
//得到mainid
|
Ds1 = oCnK3.RunProcReturn("declare @InterID int set @InterID=0 exec GetICMaxNumOld 'ICStockBill',@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.ClsKf_EntrustInBillSub_K3 oSub in DetailColl)
|
{
|
oSub.HInterID = omodel.HInterID;
|
//oCnK3.RunProc(K3_BaseFun.Fun_GetAddBillSubSQL_EntrustIn(oSub, DBUtility.ClsPub.VersionNum));
|
HSourceBillType = oSub.HSourceBillType;
|
}
|
//更新主表
|
//oCnK3.RunProc(K3_BaseFun.Fun_GetAddBillMainSQL_EntrustIn(omodel, DBUtility.ClsPub.VersionNum));
|
//更新K3关联数量
|
oCnK3.RunProc("EXEC p_UpdateBillRelateData " + this.BillType + "," + omodel.HInterID.ToString() + ",'ICStockBill','ICStockBillEntry'");
|
//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 ;
|
Ds = oCnK3.RunProcReturn("Select * from ICStockBill Where FInterID=" + lngBillKey.ToString(), "ICStockBill");
|
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().Trim();
|
omodel.HDate = DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[0]["FDate"]);
|
//=================
|
omodel.HRemark = Ds.Tables[0].Rows[0]["FNote"].ToString().Trim();
|
//
|
//omodel.HEmpID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["FEmpID"].ToString());
|
//omodel.HManagerID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["FManagerID"].ToString());
|
//omodel.FDCStockID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["FDCStockID"]);
|
//omodel.FDeptID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["FDeptID"]);
|
//omodel.FFManagerID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["FFManagerID"]);
|
//omodel.FSManagerID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["FSManagerID"]);
|
//
|
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 ICStockBillEntry Where FInterID=" + lngBillKey.ToString() + " order by HEntryID ", "ICStockBillEntry");
|
DetailColl.Clear();//清空
|
for (int i = 0; i < DsSub.Tables[0].Rows.Count; i++)
|
{
|
Model.ClsKf_EntrustInBillSub_K3 oSub = new Model.ClsKf_EntrustInBillSub_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.Famount = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["Famount"].ToString());
|
//oSub.Fauxprice = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["Fauxprice"].ToString());
|
//oSub.Fauxqty = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["Fauxqty"].ToString());
|
//oSub.HSecUnitQty = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["FEntrySelfA0236"].ToString());
|
//oSub.FBatchNo = DsSub.Tables[0].Rows[i]["FBatchNo"].ToString().Trim();
|
//oSub.FDCStockID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["FDCStockID"].ToString());
|
//oSub.HSPID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["FDCSPID"].ToString());
|
//oSub.FItemID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["FItemID"].ToString());
|
//oSub.FUnitID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["FUnitID"].ToString());
|
//oSub.Fnote = DsSub.Tables[0].Rows[i]["Fnote"].ToString().Trim();
|
//oSub.FICMOInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["FICMOInterID"].ToString());
|
//oSub.FICMOBillNo = DsSub.Tables[0].Rows[i]["FICMOBillNo"].ToString().Trim();
|
////oSub.fentryselfa0240 = DsSub.Tables[0].Rows[i]["fentryselfa0240"].ToString().Trim();
|
////oSub.fentryselfa0241 = DsSub.Tables[0].Rows[i]["fentryselfa0241"].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();
|
//oSub.HRelationQty = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["FRelationQty"].ToString());
|
DetailColl.Add(oSub);
|
}
|
sReturn = "显示单据成功!";
|
return true;
|
}
|
catch (Exception e)
|
{
|
sReturn = e.Message;
|
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 ICStockBillEntry where FInterID=" + lngBillKey.ToString());
|
//删除主表
|
//DeleteBillMain(lngBillKey);
|
oCnK3.RunProc("Delete From icstockbill where FInterID=" + lngBillKey.ToString());
|
//删除关联
|
|
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_ProductInRequestRelationQtyBack " + lngBillKey + ",'3710'");
|
//sReturn = "";
|
return;
|
}
|
//单据号是否重复
|
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 ICStockBill where FTranType='" + MvarItemKey + "' and FBillNo ='" + sBillNo + "'";
|
}
|
else
|
{
|
sSql = "Select FInterID from ICStockBill where FTranType='" + MvarItemKey + "' and FBillNo ='" + sBillNo + "' and FInterID<>" + lngBillKey.ToString();
|
}
|
DataSet Ds;
|
Ds = oCnK3.RunProcReturn(sSql, "ICStockBill");
|
if (Ds.Tables[0].Rows.Count != 0)
|
{
|
sReturn = "单号重复";
|
return true;
|
}
|
sReturn = "单号未重复";
|
return false;
|
}
|
catch (Exception e)
|
{
|
sReturn = e.Message;
|
return false;
|
}
|
}
|
|
//根据条码档案获取信息
|
public Model.ClsKf_EntrustInBillSub_K3 get_EntrustInInfoByBarCode(string sBarCode)
|
{
|
try
|
{
|
Model.ClsKf_EntrustInBillSub_K3 oSub=new Model.ClsKf_EntrustInBillSub_K3();
|
DataSet Ds;
|
Ds = oCn.RunProcReturn("exec h_p_Kf_EntrustInInfoByBarCode '" + sBarCode + "'", "xt_xtgnb", ref DBUtility.ClsPub.sExeReturnInfo);
|
if (Ds == null || Ds.Tables[0].Rows.Count == 0)
|
{
|
return null;
|
}
|
//oSub.Famount = DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[0]["HAmount"]);
|
//oSub.Fauxprice = DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[0]["HPrice"]);
|
//oSub.Fauxqty = DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[0]["HQty"]);
|
//oSub.HBarCode = sBarCode;
|
//oSub.FBatchNo = Ds.Tables[0].Rows[0]["HBatchNo"].ToString();
|
//oSub.FItemID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HMaterID"]);
|
return oSub;
|
}
|
catch (Exception e)
|
{
|
DBUtility.ClsPub.sExeReturnInfo += "根据条码获取相应信息失败!" + e.Message;
|
return null;
|
}
|
}
|
|
//条码扫描记录,新增到委外入库
|
public bool AddBill_PDA(ref string sReturn)
|
{
|
try
|
{
|
DataSet Ds;
|
oCnK3.BeginTran();
|
//删除主表
|
//oCnK3.RunProc("Delete From ICStockBill where FInterID=" + omodel.HInterID.ToString());
|
//插入子表
|
oCnK3.RunProc("EXEC h_p_Kf_EntrustInBillSub_Insert_K3 " + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "'");
|
//插入主表
|
oCnK3.RunProc("INSERT INTO ICStockBill " +
|
"(FInterID,FBillNo,FBrNo,FTranType,FCancellation " +
|
",FStatus,FUpStockWhenSave,FROB,FHookStatus,Fdate " +
|
",FSupplyID,FDCStockID,FPurposeID,FCheckDate " +
|
",FFManagerID,FSManagerID,FBillerID " +
|
",FMultiCheckDate1,FMultiCheckDate2,FMultiCheckDate3 " +
|
",FMultiCheckDate4,FMultiCheckDate5,FMultiCheckDate6 " +
|
",FVchInterID,FSelTranType,FCussentAcctID,FManageType,FSettleDate " +
|
",FRelateBrID,FPOOrdBillNo,FBrID,FPrintCount,FPayCondition " +//FHeadSelfA0537
|
") VALUES (" +
|
omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','0','" + this.BillType + "',0" +
|
",0,0,1,0,convert(varchar(10),getdate(),120)" +
|
"," + omodel.HSupID + "," + omodel.HWHID + ",14190,null" +
|
"," + omodel.HSecManagerID + "," + omodel.HKeeperID + "," + omodel.HBillerID.ToString() +
|
",null,null,null" +
|
",null,null,null" +
|
",0,'" + omodel.HSourceTranType + "',0,0,convert(varchar(10),getdate(),120)" +
|
" ,0,'',0,0,0 )");//,convert(varchar(10),getdate(),120)
|
//更新K3关联数量
|
//oCnK3.RunProc("EXEC p_UpdateBillRelateData " + this.BillType + "," + omodel.HInterID.ToString() + ",'ICStockBill','ICStockBillEntry'");
|
oCnK3.RunProc("EXEC h_p_K3_UpdateBillRelateData_EntrustIn_New " + omodel.HInterID.ToString());
|
////审核单据
|
//oCnK3.RunProc("EXEC h_p_Kf_EntrustInBill_Check_K3 " + omodel.HInterID.ToString() + "," + omodel.HBillerID.ToString());
|
sReturn = "新增单据成功!";
|
oCnK3.Commit();
|
return true;
|
}
|
catch (Exception e)
|
{
|
sReturn = e.Message;
|
oCnK3.RollBack();
|
throw (e);
|
}
|
}
|
|
//条码扫描记录,新增到委外入库
|
public bool AddBill_PDA_ByWWOrder(ref string sReturn)
|
{
|
try
|
{
|
DataSet Ds;
|
oCnK3.BeginTran();
|
//删除主表
|
//oCnK3.RunProc("Delete From ICStockBill where FInterID=" + omodel.HInterID.ToString());
|
//插入子表
|
oCnK3.RunProc("EXEC h_p_Kf_EntrustInBillSub_Insert_K3 " + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "'");
|
//插入主表
|
oCnK3.RunProc("INSERT INTO ICStockBill " +
|
"(FInterID,FBillNo,FBrNo,FTranType,FCancellation " +
|
",FStatus,FUpStockWhenSave,FROB,FHookStatus,Fdate " +
|
",FSupplyID,FDCStockID,FPurposeID,FCheckDate " +
|
",FFManagerID,FSManagerID,FBillerID " +
|
",FMultiCheckDate1,FMultiCheckDate2,FMultiCheckDate3 " +
|
",FMultiCheckDate4,FMultiCheckDate5,FMultiCheckDate6 " +
|
",FVchInterID,FSelTranType,FCussentAcctID,FManageType,FSettleDate " +
|
",FRelateBrID,FPOOrdBillNo,FBrID,FPrintCount " +//FHeadSelfA0537,FPayCondition
|
") VALUES (" +
|
omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','0','" + this.BillType + "',0" +
|
",0,0,1,0,convert(varchar(10),getdate(),120)" +
|
"," + omodel.HSupID + "," + omodel.HWHID + ",14190,null" +
|
"," + omodel.HSecManagerID + "," + omodel.HKeeperID + "," + omodel.HBillerID.ToString() +
|
",null,null,null" +
|
",null,null,null" +
|
",0,'" + omodel.HSourceTranType + "',0,0,convert(varchar(10),getdate(),120)" +
|
" ,0,'',0,0" + ")"); //,convert(varchar(10),getdate(),120),0
|
//更新K3关联数量
|
//oCnK3.RunProc("EXEC p_UpdateBillRelateData " + this.BillType + "," + omodel.HInterID.ToString() + ",'ICStockBill','ICStockBillEntry'");
|
oCnK3.RunProc("EXEC h_p_K3_UpdateBillRelateData_EntrustIn_New " + omodel.HInterID.ToString());
|
//判断本会计期间是否已关账,已关账则单据日期变为下月一号,未关账则不变
|
oCnK3.RunProc("EXEC h_p_WMS_CheckYearPeriod_K3 " + omodel.HInterID.ToString());
|
////审核单据
|
//oCnK3.RunProc("EXEC h_p_Kf_EntrustInBill_Check_K3 " + omodel.HInterID.ToString() + "," + omodel.HBillerID.ToString());
|
//判断条码库存是否异常(负库存、库存大于条码初始化)
|
//Ds = oCnK3.RunProcReturn("EXEC h_p_KF_ICInventoryBarCodeQtyCtrl " + omodel.HInterID.ToString(), "h_p_KF_ICInventoryBarCodeQtyCtrl");
|
|
//if (DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0][0]) == 1)
|
//{
|
|
//}
|
//else
|
//{
|
// sReturn = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0][1]);
|
// oCnK3.RollBack();
|
// return false;
|
//}
|
sReturn = "新增单据成功!";
|
oCnK3.Commit();
|
return true;
|
}
|
catch (Exception e)
|
{
|
sReturn = e.Message;
|
oCnK3.RollBack();
|
throw (e);
|
}
|
}
|
|
//条码扫描记录,新增到委外入库 (红字)
|
public bool AddBill_PDA_Red_ByWWOrder(ref string sReturn)
|
{
|
try
|
{
|
DataSet Ds;
|
oCnK3.BeginTran();
|
//删除主表
|
//oCnK3.RunProc("Delete From ICStockBill where FInterID=" + omodel.HInterID.ToString());
|
//插入子表
|
oCnK3.RunProc("EXEC h_p_Kf_EntrustInBillSub_Red_Insert_K3 " + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "'");
|
//插入主表
|
oCnK3.RunProc("INSERT INTO ICStockBill " +
|
"(FInterID,FBillNo,FBrNo,FTranType,FCancellation " +
|
",FStatus,FUpStockWhenSave,FROB,FHookStatus,Fdate " +
|
",FSupplyID,FDCStockID,FPurposeID,FCheckDate " +
|
",FFManagerID,FSManagerID,FBillerID " +
|
",FMultiCheckDate1,FMultiCheckDate2,FMultiCheckDate3 " +
|
",FMultiCheckDate4,FMultiCheckDate5,FMultiCheckDate6 " +
|
",FVchInterID,FSelTranType,FCussentAcctID,FManageType,FSettleDate " +
|
",FRelateBrID,FPOOrdBillNo,FBrID,FPrintCount " +//FHeadSelfA0537,FPayCondition
|
") VALUES (" +
|
omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','0','" + this.BillType + "',0" +
|
",0,0,-1,0,convert(varchar(10),getdate(),120)" +
|
"," + omodel.HSupID + "," + omodel.HWHID + ",14190,null" +
|
"," + omodel.HSecManagerID + "," + omodel.HKeeperID + "," + omodel.HBillerID.ToString() +
|
",null,null,null" +
|
",null,null,null" +
|
",0,'" + omodel.HSourceTranType + "',0,0,convert(varchar(10),getdate(),120)" +
|
" ,0,'',0,0" + ")");//,convert(varchar(10),getdate(),120),0
|
//更新K3关联数量
|
//oCnK3.RunProc("EXEC p_UpdateBillRelateData " + this.BillType + "," + omodel.HInterID.ToString() + ",'ICStockBill','ICStockBillEntry'");
|
oCnK3.RunProc("EXEC h_p_K3_UpdateBillRelateData_EntrustIn_New " + omodel.HInterID.ToString());
|
//审核单据
|
oCnK3.RunProc("EXEC h_p_Kf_EntrustInBill_Check_K3 " + omodel.HInterID.ToString() + "," + omodel.HBillerID.ToString());
|
//判断条码库存是否异常(负库存、库存大于条码初始化)
|
//Ds = oCnK3.RunProcReturn("EXEC h_p_KF_ICInventoryBarCodeQtyCtrl " + omodel.HInterID.ToString(), "h_p_KF_ICInventoryBarCodeQtyCtrl");
|
|
//if (DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0][0]) == 1)
|
//{
|
|
//}
|
//else
|
//{
|
// sReturn = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0][1]);
|
// oCnK3.RollBack();
|
// return false;
|
//}
|
sReturn = "新增单据成功!";
|
oCnK3.Commit();
|
return true;
|
}
|
catch (Exception e)
|
{
|
sReturn = e.Message;
|
oCnK3.RollBack();
|
throw (e);
|
}
|
}
|
|
|
//条码扫描记录,新增到委外入库 (红字)
|
public bool AddBill_PDA_Red_ByWWOrder2(ref string sReturn)
|
{
|
try
|
{
|
DataSet Ds;
|
oCnK3.BeginTran();
|
//删除主表
|
//oCnK3.RunProc("Delete From ICStockBill where FInterID=" + omodel.HInterID.ToString());
|
//插入子表
|
oCnK3.RunProc("EXEC h_p_Kf_EntrustInBillSub_Red_Insert_K3_WWOrder " + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "'");
|
//插入主表
|
oCnK3.RunProc("INSERT INTO ICStockBill " +
|
"(FInterID,FBillNo,FBrNo,FTranType,FCancellation " +
|
",FStatus,FUpStockWhenSave,FROB,FHookStatus,Fdate " +
|
",FSupplyID,FDCStockID,FPurposeID,FCheckDate " +
|
",FFManagerID,FSManagerID,FBillerID " +
|
",FMultiCheckDate1,FMultiCheckDate2,FMultiCheckDate3 " +
|
",FMultiCheckDate4,FMultiCheckDate5,FMultiCheckDate6 " +
|
",FVchInterID,FSelTranType,FCussentAcctID,FManageType,FSettleDate " +
|
",FRelateBrID,FPOOrdBillNo,FBrID,FPrintCount,FPayCondition " +//FHeadSelfA0537
|
") VALUES (" +
|
omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','0','" + this.BillType + "',0" +
|
",0,0,-1,0,convert(varchar(10),getdate(),120)" +
|
"," + omodel.HSupID + "," + omodel.HWHID + ",14190,null" +
|
"," + omodel.HSecManagerID + "," + omodel.HKeeperID + "," + omodel.HBillerID.ToString() +
|
",null,null,null" +
|
",null,null,null" +
|
",0,'" + omodel.HSourceTranType + "',0,0,convert(varchar(10),getdate(),120)" +
|
" ,0,'',0,0,0" + ")");//,convert(varchar(10),getdate(),120)
|
//更新K3关联数量
|
//oCnK3.RunProc("EXEC p_UpdateBillRelateData " + this.BillType + "," + omodel.HInterID.ToString() + ",'ICStockBill','ICStockBillEntry'");
|
oCnK3.RunProc("EXEC h_p_K3_UpdateBillRelateData_EntrustIn_New_WWOrder " + omodel.HInterID.ToString());
|
//审核单据
|
oCnK3.RunProc("EXEC h_p_Kf_EntrustInBill_Check_K3 " + omodel.HInterID.ToString() + "," + omodel.HBillerID.ToString());
|
sReturn = "新增单据成功!";
|
oCnK3.Commit();
|
return true;
|
}
|
catch (Exception e)
|
{
|
sReturn = e.Message;
|
oCnK3.RollBack();
|
throw (e);
|
}
|
}
|
|
//条码扫描记录,核对生单(红字)
|
public bool CheckAddBill_RedPDA(ref string sReturn)
|
{
|
try
|
{
|
DataSet Ds;
|
oCnK3.BeginTran();
|
//插入子表
|
oCnK3.RunProc("EXEC h_p_Kf_EntrustInBillSub_Red_CheckInsert_K3 " + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "'");
|
//更新K3关联数量
|
oCnK3.RunProc("EXEC h_p_K3_UpdateBillRelateData_EntrustIn_Red_New " + omodel.HInterID.ToString());
|
//审核单据
|
oCnK3.RunProc("EXEC h_p_Kf_EntrustInBill_Check_K3 " + omodel.HInterID.ToString() + "," + omodel.HBillerID.ToString());
|
//判断条码库存是否异常(负库存、库存大于条码初始化)
|
//Ds = oCnK3.RunProcReturn("EXEC h_p_KF_ICInventoryBarCodeQtyCtrl " + omodel.HInterID.ToString(), "h_p_KF_ICInventoryBarCodeQtyCtrl");
|
|
//if (DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0][0]) == 1)
|
//{
|
|
//}
|
//else
|
//{
|
// sReturn = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0][1]);
|
// oCnK3.RollBack();
|
// return false;
|
//}
|
sReturn = "新增成功!";
|
oCnK3.Commit();
|
return true;
|
}
|
catch (Exception e)
|
{
|
sReturn = e.Message;
|
oCnK3.RollBack();
|
throw (e);
|
}
|
}
|
|
//条码扫描记录,审核单据
|
public bool CheckBill_PDA(ref string sReturn)
|
{
|
try
|
{
|
DataSet Ds;
|
oCnK3.BeginTran();
|
//新增条码出入库记录
|
oCnK3.RunProc("EXEC h_p_Kf_ICStockBillSub_WMS_Insert " + omodel.HInterID.ToString() + ",'" + this.BillType + "','" + omodel.HBillNo + "'");
|
//审核单据
|
oCnK3.RunProc("EXEC h_p_Kf_EntrustInBill_Check_K3 " + omodel.HInterID.ToString() + "," + omodel.HBillerID.ToString());
|
//判断条码库存是否异常(负库存、库存大于条码初始化)
|
//Ds = oCnK3.RunProcReturn("EXEC h_p_KF_ICInventoryBarCodeQtyCtrl " + omodel.HMainSourceInterID.ToString(), "h_p_KF_ICInventoryBarCodeQtyCtrl");
|
|
//if (DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0][0]) == 1)
|
//{
|
|
//}
|
//else
|
//{
|
// sReturn = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0][1]);
|
// oCnK3.RollBack();
|
// return false;
|
//}
|
sReturn = "新增成功!";
|
oCnK3.Commit();
|
return true;
|
}
|
catch (Exception e)
|
{
|
sReturn = e.Message;
|
oCnK3.RollBack();
|
throw (e);
|
}
|
}
|
|
|
//显示单据条码信息
|
public bool ShowBill_Scheme(Int64 lngBillKey, ref string sReturn)
|
{
|
try
|
{
|
//循环子表2
|
DataSet DsSubSec;
|
DsSubSec = oCn.RunProcReturn("Select * from Kf_ICStockBillSub_WMS with (nolock) Where HInterID=" + lngBillKey.ToString() + " and HBillType='" + this.BillType + "'", "Kf_ICStockBillSub_WMS");
|
DetailSubColl.Clear();//清空
|
for (int i = 0; i < DsSubSec.Tables[0].Rows.Count; i++)
|
{
|
Model.ClsKf_EntrustInBillScheme_K3 oSubSec = new Model.ClsKf_EntrustInBillScheme_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);
|
}
|
}
|
|
//条码扫描记录,稽核单据
|
public bool Audit_PDA(ref string sReturn)
|
{
|
try
|
{
|
DataSet Ds;
|
oCnK3.BeginTran();
|
//新增条码出入库记录
|
oCnK3.RunProc("EXEC h_p_Kf_ICStockBillSub_Audit_WMS_Insert " + omodel.HInterID.ToString() + ",'" + this.BillType + "','" + omodel.HBillNo + "'");
|
//稽核单据
|
oCnK3.RunProc("EXEC h_p_Kf_EntrustInBill_Check_K3 " + omodel.HInterID.ToString() + "," + omodel.HBillerID.ToString());
|
//判断条码库存是否异常(负库存、库存大于条码初始化)
|
//Ds = oCnK3.RunProcReturn("EXEC h_p_KF_ICInventoryBarCodeQtyCtrl " + omodel.HMainSourceInterID.ToString(), "h_p_KF_ICInventoryBarCodeQtyCtrl");
|
|
//if (DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0][0]) == 1)
|
//{
|
|
//}
|
//else
|
//{
|
// sReturn = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0][1]);
|
// oCnK3.RollBack();
|
// return false;
|
//}
|
sReturn = "稽核成功!";
|
oCnK3.Commit();
|
return true;
|
}
|
catch (Exception e)
|
{
|
sReturn = e.Message;
|
oCnK3.RollBack();
|
throw (e);
|
}
|
}
|
|
|
|
}
|
}
|