using System;
|
using System.Collections.Generic;
|
using System.Text;
|
using System.Data;
|
|
namespace SCM
|
{
|
public class ClsCg_POOrderBill_K3 : DBUtility.ClsXt_BaseBill
|
{
|
public SCM.ClsCg_POOrderBillMain_K3 omodel = new SCM.ClsCg_POOrderBillMain_K3();
|
public List<SCM.ClsCg_POOrderBillSub_K3> DetailColl = new List<SCM.ClsCg_POOrderBillSub_K3>();
|
public SCM.ClsCg_POOrderBillMain_K3_View omodel_View = new SCM.ClsCg_POOrderBillMain_K3_View();
|
public List<SCM.ClsCg_POOrderBillSub_K3_View> DetailColl_View = new List<SCM.ClsCg_POOrderBillSub_K3_View>();
|
|
WMSWeb.Service oWeb = new SCM.WMSWeb.Service();
|
|
public ClsCg_POOrderBill_K3()
|
{
|
base.MvarItemKeyForWeb = "h_v_K3_POOrderBillMain_ForWeb";
|
base.MvarItemKeySubForWeb = "h_v_K3_POOrderBillSub_ForWeb";
|
base.MvarItemKeySub = "POOrderEntry";
|
base.MvarItemKeySub2 = "";
|
base.MvarItemKeySub3 = "";
|
base.MvarItemKeySub4 = "";
|
base.MvarItemKey = "POOrder";
|
base.MvarReportTitle = "采购订单";
|
base.BillType = "71";
|
}
|
|
#region 固定代码
|
|
~ClsCg_POOrderBill_K3()
|
{
|
DetailColl = null;
|
}
|
|
#endregion 自定义方法
|
|
//单据号是否重复
|
public 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 POOrder where FTranType='" + BillType + "' and FBillNo ='" + sBillNo + "'";
|
}
|
else
|
{
|
sSql = "Select FInterID from POOrder where FTranType='" + BillType + "' and FBillNo ='" + sBillNo + "' and FInterID<>" + lngBillKey.ToString();
|
}
|
DataSet Ds;
|
Ds = oWeb.getDataSetByK3SQL(sSql, "POOrder", ref DBUtility.ClsPub.sExeReturnInfo);
|
//oK3Cn.RunProcReturn(sSql, "POOrder");
|
if (Ds.Tables[0].Rows.Count != 0)
|
{
|
sReturn = "单号重复";
|
return true;
|
}
|
sReturn = "单号未重复";
|
return false;
|
}
|
catch (Exception e)
|
{
|
sReturn = e.Message;
|
return false;
|
}
|
}
|
|
//删除子表
|
public void DeleteBillSub(Int64 lngBillKey)
|
{
|
//oK3Cn.RunProc("Delete From POOrderEntry where FInterID=" + lngBillKey.ToString());
|
oWeb.getK3RunProc("Delete From POOrderEntry where FInterID=" + lngBillKey.ToString(), ref DBUtility.ClsPub.sExeReturnInfo);
|
}
|
|
//删除主表
|
public void DeleteBillMain(Int64 lngBillKey)
|
{
|
//oK3Cn.RunProc("Delete From POOrder where FInterID=" + lngBillKey.ToString());
|
oWeb.getK3RunProc("Delete From POOrder where FInterID=" + lngBillKey.ToString(), ref DBUtility.ClsPub.sExeReturnInfo);
|
}
|
|
//删除单据
|
public bool DeleteBill(Int64 lngBillKey, ref string sReturn)
|
{
|
DataSet Ds = new DataSet();
|
try
|
{
|
//oK3Cn.BeginTran();
|
//删除关联
|
//DeleteRelation(ref sReturn, lngBillKey);
|
//删除明细表
|
DeleteBillSub(lngBillKey);
|
//删除主表
|
DeleteBillMain(lngBillKey);
|
//删除关联
|
sReturn = "删除单据成功!";
|
//oK3Cn.Commit();
|
return true;
|
}
|
catch (Exception e)
|
{
|
sReturn = e.Message;
|
//oK3Cn.RollBack();
|
return false;
|
}
|
}
|
|
//修改单据
|
public override bool ModifyBill(Int64 lngBillKey, ref string sReturn)
|
{
|
try
|
{
|
//oK3Cn.BeginTran();
|
//删除主表
|
DeleteBillMain(lngBillKey);
|
//删除子表
|
DeleteBillSub(lngBillKey);
|
//
|
//更新主表
|
//oK3Cn.RunProc("Insert Into POOrder " +
|
//"(FInterID,FBillNo,FBrNo,FTranType,FCancellation,FStatus" +
|
//",FSupplyID,Fdate,FCurrencyID" +
|
//",FCheckDate,FMangerID,FDeptID,FEmpID,FBillerID" +
|
//",FExchangeRate,FPOStyle,FRelateBrID,FMultiCheckDate1,FMultiCheckDate2" +
|
//",FMultiCheckDate3,FMultiCheckDate4,FMultiCheckDate5,FMultiCheckDate6" +
|
//",FSelTranType,FBrID,FExplanation" +
|
//",FSettleID,FSettleDate,FAreaPS,FPOOrdBillNo,FManageType,FSysStatus" +
|
//",FValidaterName,FConsignee,FVersionNo,FChangeDate,FChangeUser" +
|
//",FChangeCauses,FChangeMark,FPrintCount" +
|
//") " +
|
//" values(" + lngBillKey.ToString() + ",'" + omodel.HBillNo + "','0'," + this.BillType + ",0,0" +
|
//"," + omodel.HCusID.ToString() + ",'" + omodel.HDate.ToShortDateString() + "'," + omodel.HCurID.ToString() +
|
//",null," + omodel.HMangerID.ToString() + "," + omodel.HDeptID.ToString() + "," + omodel.HEmpID.ToString() + ",16394" +
|
//"," + omodel.HExRate.ToString() + "252,0,null,null" +
|
//",null,null,null,null" +
|
//",70,0," +omodel.HExplanation +
|
//",0,'" + DBUtility.ClsPub.GetServerDate(-1) + "',20302,'',0,0" +
|
//",'',0,'000',Null,0" +
|
//",'','',0" +
|
//") ");
|
oWeb.getK3RunProc("Insert Into POOrder " +
|
"(FInterID,FBillNo,FBrNo,FTranType,FCancellation,FStatus" +
|
",FSupplyID,Fdate,FCurrencyID" +
|
",FCheckDate,FMangerID,FDeptID,FEmpID,FBillerID" +
|
",FExchangeRate,FPOStyle,FRelateBrID,FMultiCheckDate1,FMultiCheckDate2" +
|
",FMultiCheckDate3,FMultiCheckDate4,FMultiCheckDate5,FMultiCheckDate6" +
|
",FSelTranType,FBrID,FExplanation" +
|
",FSettleID,FSettleDate,FAreaPS,FPOOrdBillNo,FManageType,FSysStatus" +
|
",FValidaterName,FConsignee,FVersionNo,FChangeDate,FChangeUser" +
|
",FChangeCauses,FChangeMark,FPrintCount" +
|
") " +
|
" values(" + lngBillKey.ToString() + ",'" + omodel.HBillNo + "','0'," + this.BillType + ",0,0" +
|
"," + omodel.HCusID.ToString() + ",'" + omodel.HDate.ToShortDateString() + "'," + omodel.HCurID.ToString() +
|
",null," + omodel.HMangerID.ToString() + "," + omodel.HDeptID.ToString() + "," + omodel.HEmpID.ToString() + ",16394" +
|
"," + omodel.HExRate.ToString() + "252,0,null,null" +
|
",null,null,null,null" +
|
",70,0," + omodel.HExplanation +
|
",0,'" + DBUtility.ClsPub.GetServerDate(-1) + "',20302,'',0,0" +
|
",'',0,'000',Null,0" +
|
",'','',0" +
|
") ",ref DBUtility.ClsPub.sExeReturnInfo);
|
//插入子表
|
foreach (SCM.ClsCg_POOrderBillSub_K3 oSub in DetailColl)
|
{
|
//oK3Cn.RunProc("Insert into POOrderEntry " +
|
// " (FInterID,FEntryID,FBrNo,FMapNumber,FMapName,FItemID" +
|
// ",FAuxPropID,FQty,FUnitID,Fauxqty,FSecCoefficient,FSecQty" +
|
// ",Fauxprice,FAuxTaxPrice,Famount,FTaxRate,FAuxPriceDiscount,FDescount,FCess" +
|
// ",FTaxAmount,FAllAmount,Fdate,Fnote" +
|
// ",FSourceBillNo,FSourceTranType,FSourceInterId,FSourceEntryID" +
|
// ",FContractBillNo,FContractInterID,FContractEntryID" +
|
// ",FAuxQtyInvoice,FSecInvoiceQty,FQtyInvoice,FMrpLockFlag" +
|
// ",FReceiveAmountFor_Commit,FPlanMode,FMTONo" +
|
// ") values("
|
// + lngBillKey.ToString() + "," + oSub.HEntryID.ToString() + ",'0','',''," + oSub.HMaterID.ToString() +
|
// ",0," + oSub.HQty.ToString() + "," + oSub.HUnitID.ToString() + "," + oSub.HQty.ToString() + ",0,0" +
|
// "," + oSub.HPrice.ToString() + "," + oSub.HTaxPrice.ToString() + "," + oSub.HMoney.ToString() + "," + oSub.HTaxRate.ToString() + ",0,0,17" +
|
// "," + oSub.HTaxMoney.ToString() + "," + oSub.HlineTotal.ToString() + ",'" + oSub.HDate.ToShortDateString() + "','" + oSub.HRemark +
|
// ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() +
|
// ",'',0,0" +
|
// ",0,0,0,0" +
|
// ",0,14036,''" +
|
// ") ");
|
oWeb.getK3RunProc("Insert into POOrderEntry " +
|
" (FInterID,FEntryID,FBrNo,FMapNumber,FMapName,FItemID" +
|
",FAuxPropID,FQty,FUnitID,Fauxqty,FSecCoefficient,FSecQty" +
|
",Fauxprice,FAuxTaxPrice,Famount,FTaxRate,FAuxPriceDiscount,FDescount,FCess" +
|
",FTaxAmount,FAllAmount,Fdate,Fnote" +
|
",FSourceBillNo,FSourceTranType,FSourceInterId,FSourceEntryID" +
|
",FContractBillNo,FContractInterID,FContractEntryID" +
|
",FAuxQtyInvoice,FSecInvoiceQty,FQtyInvoice,FMrpLockFlag" +
|
",FReceiveAmountFor_Commit,FPlanMode,FMTONo" +
|
") values("
|
+ lngBillKey.ToString() + "," + oSub.HEntryID.ToString() + ",'0','',''," + oSub.HMaterID.ToString() +
|
",0," + oSub.HQty.ToString() + "," + oSub.HUnitID.ToString() + "," + oSub.HQty.ToString() + ",0,0" +
|
"," + oSub.HPrice.ToString() + "," + oSub.HTaxPrice.ToString() + "," + oSub.HMoney.ToString() + "," + oSub.HTaxRate.ToString() + ",0,0,17" +
|
"," + oSub.HTaxMoney.ToString() + "," + oSub.HlineTotal.ToString() + ",'" + oSub.HDate.ToShortDateString() + "','" + oSub.HRemark +
|
",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() +
|
",'',0,0" +
|
",0,0,0,0" +
|
",0,14036,''" +
|
") ",ref DBUtility.ClsPub.sExeReturnInfo);
|
}
|
sReturn = "修改单据成功!";
|
//oK3Cn.Commit();
|
return true;
|
}
|
catch (Exception e)
|
{
|
sReturn = e.Message;
|
//oK3Cn.RollBack();
|
throw (e);
|
}
|
}
|
//新增单据
|
public override bool AddBill(ref string sReturn)
|
{
|
try
|
{
|
DataSet Ds;
|
//得到mainid
|
Ds = oWeb.getDataSetByK3SQL("declare @InterID int set @InterID=0 exec GetICMaxNum 'POOrder', @InterID output, 1, 16394 select ltrim(@InterID)", "GetICMaxNum", ref DBUtility.ClsPub.sExeReturnInfo);
|
//oK3Cn.RunProcReturn("declare @InterID int set @InterID=0 exec GetICMaxNum 'POOrder', @InterID output, 1, 16394 select ltrim(@InterID)", "GetICMaxNum");
|
omodel.HInterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0][0]);
|
//若MAINDI重复则重新获取
|
//oK3Cn.BeginTran();
|
//主表
|
//oK3Cn.RunProc("Insert Into POOrder " +
|
//"(FInterID,FBillNo,FBrNo,FTranType,FCancellation,FStatus" +
|
//",FSupplyID,Fdate,FCurrencyID" +
|
//",FCheckDate,FMangerID,FDeptID,FEmpID,FBillerID" +
|
//",FExchangeRate,FPOStyle,FRelateBrID,FMultiCheckDate1,FMultiCheckDate2" +
|
//",FMultiCheckDate3,FMultiCheckDate4,FMultiCheckDate5,FMultiCheckDate6" +
|
//",FSelTranType,FBrID,FExplanation" +
|
//",FSettleID,FSettleDate,FAreaPS,FPOOrdBillNo,FManageType,FSysStatus" +
|
//",FValidaterName,FConsignee,FVersionNo,FChangeDate,FChangeUser" +
|
//",FChangeCauses,FChangeMark,FPrintCount" +
|
//") " +
|
//" values(" + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','0'," + this.BillType + ",0,0" +
|
//"," + omodel.HCusID.ToString() + ",'" + omodel.HDate.ToShortDateString() + "'," + omodel.HCurID.ToString() +
|
//",null," + omodel.HMangerID.ToString() + "," + omodel.HDeptID.ToString() + "," + omodel.HEmpID.ToString() + ",16394" +
|
//"," + omodel.HExRate.ToString() + ",252,0,null,null" +
|
//",null,null,null,null" +
|
//",70,0,'自动导入'" +
|
//",0,'" + omodel.HDate.ToShortDateString() + "',20302,'',0,2" +
|
//",'',0,'000',Null,0" +
|
//",'','',0" +
|
//") ");
|
oWeb.getK3RunProc("Insert Into POOrder " +
|
"(FInterID,FBillNo,FBrNo,FTranType,FCancellation,FStatus" +
|
",FSupplyID,Fdate,FCurrencyID" +
|
",FCheckDate,FMangerID,FDeptID,FEmpID,FBillerID" +
|
",FExchangeRate,FPOStyle,FRelateBrID,FMultiCheckDate1,FMultiCheckDate2" +
|
",FMultiCheckDate3,FMultiCheckDate4,FMultiCheckDate5,FMultiCheckDate6" +
|
",FSelTranType,FBrID,FExplanation" +
|
",FSettleID,FSettleDate,FAreaPS,FPOOrdBillNo,FManageType,FSysStatus" +
|
",FValidaterName,FConsignee,FVersionNo,FChangeDate,FChangeUser" +
|
",FChangeCauses,FChangeMark,FPrintCount" +
|
") " +
|
" values(" + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','0'," + this.BillType + ",0,0" +
|
"," + omodel.HCusID.ToString() + ",'" + omodel.HDate.ToShortDateString() + "'," + omodel.HCurID.ToString() +
|
",null," + omodel.HMangerID.ToString() + "," + omodel.HDeptID.ToString() + "," + omodel.HEmpID.ToString() + ",16394" +
|
"," + omodel.HExRate.ToString() + ",252,0,null,null" +
|
",null,null,null,null" +
|
",70,0,'自动导入'" +
|
",0,'" + omodel.HDate.ToShortDateString() + "',20302,'',0,2" +
|
",'',0,'000',Null,0" +
|
",'','',0" +
|
") ", ref DBUtility.ClsPub.sExeReturnInfo);
|
//插入子表
|
foreach (SCM.ClsCg_POOrderBillSub_K3 oSub in DetailColl)
|
{
|
//oK3Cn.RunProc("Insert into POOrderEntry " +
|
// " (FInterID,FEntryID,FBrNo,FMapNumber,FMapName,FItemID" +
|
// ",FAuxPropID,FQty,FUnitID,Fauxqty,FSecCoefficient,FSecQty" +
|
// ",Fauxprice,FAuxTaxPrice,Famount,FTaxRate,FAuxPriceDiscount,FDescount,FCess" +
|
// ",FTaxAmount,FAllAmount,Fdate,Fnote" +
|
// ",FSourceBillNo,FSourceTranType,FSourceInterId,FSourceEntryID" +
|
// ",FContractBillNo,FContractInterID,FContractEntryID" +
|
// ",FAuxQtyInvoice,FSecInvoiceQty,FQtyInvoice,FMrpLockFlag" +
|
// ",FReceiveAmountFor_Commit,FPlanMode,FMTONo" +
|
// ") values("
|
// + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'0','',''," + oSub.HMaterID.ToString() +
|
// ",0," + oSub.HQty.ToString() + "," + oSub.HUnitID.ToString() + "," + oSub.HQty.ToString() + ",0,0" +
|
// "," + oSub.HPrice.ToString() + "," + oSub.HTaxPrice.ToString() + "," + oSub.HMoney.ToString() + "," + oSub.HTaxRate.ToString() + ",0,0,17" +
|
// "," + oSub.HTaxMoney.ToString() + "," + oSub.HlineTotal.ToString() + ",'" + oSub.HDate.ToShortDateString() + "','" + oSub.HRemark +
|
// "','" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() +
|
// ",'',0,0" +
|
// ",0,0,0,0" +
|
// ",0,14036,''" +
|
// ") ");
|
//
|
oWeb.getK3RunProc("Insert into POOrderEntry " +
|
" (FInterID,FEntryID,FBrNo,FMapNumber,FMapName,FItemID" +
|
",FAuxPropID,FQty,FUnitID,Fauxqty,FSecCoefficient,FSecQty" +
|
",Fauxprice,FAuxTaxPrice,Famount,FTaxRate,FAuxPriceDiscount,FDescount,FCess" +
|
",FTaxAmount,FAllAmount,Fdate,Fnote" +
|
",FSourceBillNo,FSourceTranType,FSourceInterId,FSourceEntryID" +
|
",FContractBillNo,FContractInterID,FContractEntryID" +
|
",FAuxQtyInvoice,FSecInvoiceQty,FQtyInvoice,FMrpLockFlag" +
|
",FReceiveAmountFor_Commit,FPlanMode,FMTONo" +
|
") values("
|
+ omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'0','',''," + oSub.HMaterID.ToString() +
|
",0," + oSub.HQty.ToString() + "," + oSub.HUnitID.ToString() + "," + oSub.HQty.ToString() + ",0,0" +
|
"," + oSub.HPrice.ToString() + "," + oSub.HTaxPrice.ToString() + "," + oSub.HMoney.ToString() + "," + oSub.HTaxRate.ToString() + ",0,0,17" +
|
"," + oSub.HTaxMoney.ToString() + "," + oSub.HlineTotal.ToString() + ",'" + oSub.HDate.ToShortDateString() + "','" + oSub.HRemark +
|
"','" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() +
|
",'',0,0" +
|
",0,0,0,0" +
|
",0,14036,''" +
|
") ", ref DBUtility.ClsPub.sExeReturnInfo);
|
//更新申请单关联数量
|
//oK3Cn.RunProc("EXEC p_UpdateBillRelateData " + this.BillType + "," + omodel.HInterID.ToString() + ",'POOrder','POOrderEntry'");
|
oWeb.getK3RunProc("EXEC p_UpdateBillRelateData " + this.BillType + "," + omodel.HInterID.ToString() + ",'POOrder','POOrderEntry'", ref DBUtility.ClsPub.sExeReturnInfo);
|
//oK3Cn.RunProc("update porequestentry set fcommitqty=Fqty,fauxcommitqty=Fauxqty,FMRPClosed=1 where FMRPClosed<>1 and Fitemid=" + oSub.HMaterID);
|
oWeb.getK3RunProc("update porequestentry set fcommitqty=Fqty,fauxcommitqty=Fauxqty,FMRPClosed=1 where FMRPClosed<>1 and Fitemid=" + oSub.HMaterID, ref DBUtility.ClsPub.sExeReturnInfo);
|
}
|
//更新申请单关闭标志
|
|
//oK3Cn.RunProc("EXEC h_p_Cg_POOrderToUpdate_K3 "+ omodel.HInterID.ToString());
|
|
oWeb.getK3RunProc("EXEC h_p_Cg_POOrderToUpdate_K3 " + omodel.HInterID.ToString(), ref DBUtility.ClsPub.sExeReturnInfo);
|
//oK3Cn.RunProc("UPDATE T1 SET T1.FStatus=CASE WHEN NOT EXISTS(SELECT 1 FROM POrequestEntry WHERE FInterID=T1.FInterID AND FCommitQty<>0) THEN 1 " +
|
// "WHEN NOT EXISTS (SELECT 1 FROM POrequestEntry WHERE FInterID=T1.FInterID AND FQty>FCommitQty) THEN 3 ELSE 2 END," +
|
// "T1.FCLOSED=CASE WHEN NOT EXISTS (SELECT 1 FROM POrequestEntry WHERE FInterID=T1.FInterID AND FQty>FCommitQty) THEN 1 ELSE 0 END " +
|
// "FROM POrequest T1 where T1.FStatus in (1,2)");
|
|
|
sReturn = "新增单据成功!";
|
//oK3Cn.Commit();
|
return true;
|
}
|
catch (Exception e)
|
{
|
sReturn = e.Message;
|
//oK3Cn.RollBack();
|
throw (e);
|
}
|
}
|
|
//Web接受
|
public void WebAccept(Int64 lngBillKey, Int64 HBillType, ref string sReturn)
|
{
|
|
try
|
{
|
//oCn.RunProc(" exec h_p_Web_WebAccept " + lngBillKey + "," + HBillType);
|
oWeb.getRunProc(" exec h_p_Web_WebAccept " + lngBillKey + "," + HBillType, ref DBUtility.ClsPub.sExeReturnInfo);
|
sReturn = "";
|
}
|
catch (Exception e)
|
{
|
sReturn = e.Message;
|
throw (e);
|
}
|
}
|
|
//Web拒绝
|
public void WebRefuse(Int64 lngBillKey, Int64 HBillType, ref string sReturn)
|
{
|
|
try
|
{
|
//oCn.RunProc(" exec h_p_Web_WebRefuse " + lngBillKey + "," + HBillType);
|
oWeb.getRunProc(" exec h_p_Web_WebRefuse " + lngBillKey + "," + HBillType, ref DBUtility.ClsPub.sExeReturnInfo);
|
sReturn = "";
|
}
|
catch (Exception e)
|
{
|
sReturn = e.Message;
|
throw (e);
|
}
|
}
|
|
//显示单据
|
public override bool ShowBill(Int64 lngBillKey, ref string sReturn)
|
{
|
try
|
{
|
//查询主表
|
DataSet Ds;
|
Ds = oWeb.getDataSetByK3SQL("Select * from POOrder Where FInterID=" + lngBillKey.ToString(), "POOrder", ref DBUtility.ClsPub.sExeReturnInfo);
|
//oK3Cn.RunProcReturn("Select * from POOrder Where FInterID=" + lngBillKey.ToString(), "POOrder");
|
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 = Convert.ToDateTime(Ds.Tables[0].Rows[0]["Fdate"].ToString().Trim());
|
omodel.HExplanation = Ds.Tables[0].Rows[0]["FExplanation"].ToString().Trim();
|
//
|
omodel.HCusID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["FSupplyID"]);
|
omodel.HCurID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["FCurrencyID"]);
|
omodel.HDeptID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["FDeptID"]);
|
omodel.HEmpID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["FEmpID"]);
|
omodel.HMangerID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["FMangerID"]);
|
omodel.HSSID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["FSettleID"]);
|
//
|
omodel.HExRate = DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[0]["FExchangeRate"]);
|
omodel.HAddress = Ds.Tables[0].Rows[0]["FFetchAdd"].ToString().Trim();
|
//
|
omodel.HBillerID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["FBillerID"]);
|
omodel.HMakeDate = Ds.Tables[0].Rows[0]["Fdate"].ToString().Trim();
|
//omodel.HUpDater = Ds.Tables[0].Rows[0]["FOperatorID"].ToString().Trim();
|
//omodel.HUpDateDate = Ds.Tables[0].Rows[0]["FEntertime"].ToString().Trim();
|
//omodel.HBackDate = Ds.Tables[0].Rows[0]["HBackDate"].ToString().Trim();
|
//omodel.HBacker = Ds.Tables[0].Rows[0]["HBacker"].ToString().Trim();
|
omodel.HCheckerID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["FCheckerID"]);
|
omodel.HCheckDate = Ds.Tables[0].Rows[0]["FCheckDate"].ToString().Trim();
|
//omodel.HCloseDate = Ds.Tables[0].Rows[0]["HCloseDate"].ToString().Trim();
|
//omodel.HCloseMan = Ds.Tables[0].Rows[0]["HCloseMan"].ToString().Trim();
|
//omodel.HDeleteDate = Ds.Tables[0].Rows[0]["HDeleteDate"].ToString().Trim();
|
//omodel.HDeleteMan = Ds.Tables[0].Rows[0]["HDeleteMan"].ToString().Trim();
|
//循环
|
DataSet DsSub;
|
DsSub = oWeb.getDataSetByK3SQL("Select * from POOrderEntry Where FInterID=" + lngBillKey.ToString() + " order by FEntryID ", "POOrderEntry", ref DBUtility.ClsPub.sExeReturnInfo);
|
//oK3Cn.RunProcReturn("Select * from POOrderEntry Where FInterID=" + lngBillKey.ToString() + " order by FEntryID ", "POOrderEntry");
|
|
|
DetailColl.Clear();//清空
|
for (int i = 0; i < DsSub.Tables[0].Rows.Count; i++)
|
{
|
SCM.ClsCg_POOrderBillSub_K3 oSub = new SCM.ClsCg_POOrderBillSub_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.HUnitID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["FUnitID"].ToString());
|
|
oSub.HQty = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["Fauxqty"].ToString());
|
oSub.HPrice = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["Fauxprice"].ToString());
|
oSub.HTaxPrice = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["FAuxTaxPrice"].ToString());
|
oSub.HMoney = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["Famount"].ToString());
|
oSub.HTaxRate = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["FCess"].ToString());
|
oSub.HTaxMoney = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["FTaxAmount"].ToString());
|
oSub.HlineTotal = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["FAllAmount"].ToString());
|
|
//oSub.HCloseMan = DsSub.Tables[0].Rows[i]["HCloseMan"].ToString().Trim();
|
//oSub.HCloseType = (bool)DsSub.Tables[0].Rows[i]["HCloseType"];
|
oSub.HDate = Convert.ToDateTime(DsSub.Tables[0].Rows[i]["FDate"].ToString().Trim());
|
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();
|
//oSub.HRelationQty = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HRelationQty"].ToString());
|
//oSub.HRelationMoney = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HRelationMoney"].ToString());
|
DetailColl.Add(oSub);
|
}
|
sReturn = "显示单据成功!";
|
return true;
|
}
|
catch (Exception e)
|
{
|
sReturn = e.Message;
|
throw (e);
|
}
|
}
|
//显示单据
|
public bool ShowBill_View(Int64 lngBillKey, ref string sReturn)
|
{
|
try
|
{
|
//查询主表
|
DataSet Ds;
|
Ds = oWeb.getDataSetBySQL("Select * from h_v_K3_POOrderBillMain_View Where HInterID=" + lngBillKey.ToString(), "h_v_K3_POOrderBillMain_View", ref DBUtility.ClsPub.sExeReturnInfo);
|
//oCn.RunProcReturn("Select * from h_v_K3_POOrderBillMain_View Where HInterID=" + lngBillKey.ToString(), "h_v_K3_POOrderBillMain_View");
|
if (Ds.Tables[0].Rows.Count == 0)
|
{
|
sReturn = "单据未找到!";
|
return false;
|
}
|
//赋值
|
omodel_View.HInterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HInterID"]);
|
omodel_View.HBillNo = Ds.Tables[0].Rows[0]["HBillNo"].ToString().Trim();
|
omodel_View.HDate = Convert.ToDateTime(Ds.Tables[0].Rows[0]["HDate"].ToString().Trim());
|
omodel_View.HExplanation = Ds.Tables[0].Rows[0]["HExplanation"].ToString().Trim();
|
//
|
omodel_View.HCusID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HCusID"]);
|
omodel_View.HCusName = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HCusName"]);
|
omodel_View.HCurID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HCurID"]);
|
omodel_View.HCurName = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HCurName"]);
|
omodel_View.HDeptID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HDeptID"]);
|
omodel_View.HDeptName = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HDeptName"]);
|
omodel_View.HEmpID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HEmpID"]);
|
omodel_View.HEmpName = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HEmpName"]);
|
omodel_View.HMangerID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HMangerID"]);
|
omodel_View.HMangerName = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HMangerName"]);
|
omodel_View.HSSID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HSSID"]);
|
omodel_View.HSSName = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HSSName"]);
|
omodel_View.HExRate = DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[0]["HExRate"]);
|
omodel_View.HAddress = Ds.Tables[0].Rows[0]["HAddress"].ToString().Trim();
|
//
|
omodel_View.HBillerID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HBillerID"]);
|
omodel_View.HBillerName = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBillerName"]);
|
omodel_View.HMakeDate = Ds.Tables[0].Rows[0]["HDate"].ToString().Trim();
|
omodel_View.HCheckerID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HCheckerID"]);
|
omodel_View.HCheckerName = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HCheckerName"]);
|
omodel_View.HCheckDate = Ds.Tables[0].Rows[0]["HCheckDate"].ToString().Trim();
|
//循环
|
DataSet DsSub;
|
DsSub = oWeb.getDataSetBySQL("Select * from h_v_K3_POOrderBillSub_View Where HInterID=" + lngBillKey.ToString() + " order by HEntryID ", "h_v_K3_POOrderBillSub_View", ref DBUtility.ClsPub.sExeReturnInfo);
|
//oCn.RunProcReturn("Select * from h_v_K3_POOrderBillSub_View Where HInterID=" + lngBillKey.ToString() + " order by HEntryID ", "h_v_K3_POOrderBillSub_View");
|
DetailColl_View.Clear();//清空
|
for (int i = 0; i < DsSub.Tables[0].Rows.Count; i++)
|
{
|
SCM.ClsCg_POOrderBillSub_K3_View oSub = new SCM.ClsCg_POOrderBillSub_K3_View();
|
oSub.HInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HInterID"].ToString());
|
oSub.HEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HEntryID"].ToString());
|
oSub.HMaterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HMaterID"].ToString());
|
oSub.HMaterNumber = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HMaterNumber"].ToString());
|
oSub.HMaterName = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HMaterName"].ToString());
|
oSub.HMaterModel = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HMaterModel"].ToString());
|
oSub.HUnitID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HUnitID"].ToString());
|
oSub.HUnitNumber = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HUnitNumber"].ToString());
|
oSub.HUnitName = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HUnitName"].ToString());
|
oSub.HQty = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HQty"].ToString());
|
oSub.HPrice = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HPrice"].ToString());
|
oSub.HTaxPrice = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HTaxPrice"].ToString());
|
oSub.HMoney = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HMoney"].ToString());
|
oSub.HTaxRate = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HTaxRate"].ToString());
|
oSub.HTaxMoney = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HTaxMoney"].ToString());
|
oSub.HlineTotal = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HlineTotal"].ToString());
|
oSub.HDate = Convert.ToDateTime(DsSub.Tables[0].Rows[i]["HDate"].ToString().Trim());
|
oSub.HRemark = DsSub.Tables[0].Rows[i]["HRemark"].ToString().Trim();
|
//
|
oSub.HSourceInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSourceInterID"].ToString());
|
oSub.HSourceEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSourceEntryID"].ToString());
|
oSub.HSourceBillType = DsSub.Tables[0].Rows[i]["HSourceBillType"].ToString().Trim();
|
oSub.HSourceBillNo = DsSub.Tables[0].Rows[i]["HSourceBillNo"].ToString().Trim();
|
DetailColl_View.Add(oSub);
|
}
|
sReturn = "显示单据成功!";
|
return true;
|
}
|
catch (Exception e)
|
{
|
sReturn = e.Message;
|
throw (e);
|
}
|
}
|
|
|
|
//确认
|
public bool AcceptFlagBill(Int64 lngBillKey, Int64 lngBillSubKey, ref string sReturn)
|
{
|
|
try
|
{
|
//oK3Cn.RunProc(" Update POOrderEntry set FEntrySelfP0274=1,FEntrySelfP0275='' Where FInterID=" + lngBillKey.ToString() + "and FEntryID=" + lngBillSubKey.ToString());
|
oWeb.getK3RunProc(" Update POOrderEntry set FEntrySelfP0274=1,FEntrySelfP0275='' Where FInterID=" + lngBillKey.ToString() + "and FEntryID=" + lngBillSubKey.ToString(),ref DBUtility.ClsPub.sExeReturnInfo);
|
sReturn = "";
|
return true;
|
}
|
catch (Exception e)
|
{
|
sReturn = e.Message;
|
return false;
|
}
|
}
|
|
//拒绝
|
public bool RefuseFlagBill(Int64 lngBillKey, Int64 lngBillSubKey, string HRefuseRemark, ref string sReturn)
|
{
|
|
try
|
{
|
//oK3Cn.RunProc(" Update POOrderEntry set FEntrySelfP0274=2,FEntrySelfP0275='" + HRefuseRemark + "' Where FInterID=" + lngBillKey.ToString() + "and FEntryID=" + lngBillSubKey.ToString());
|
oWeb.getK3RunProc(" Update POOrderEntry set FEntrySelfP0274=2,FEntrySelfP0275='" + HRefuseRemark + "' Where FInterID=" + lngBillKey.ToString() + "and FEntryID=" + lngBillSubKey.ToString(),ref DBUtility.ClsPub.sExeReturnInfo);
|
sReturn = "";
|
return true;
|
}
|
catch (Exception e)
|
{
|
sReturn = e.Message;
|
return false;
|
}
|
}
|
|
|
|
|
}
|
|
}
|