using System; using System.Collections.Generic; using System.Text; using System.Data; using DBUtility; namespace DAL { public class ClsCg_POInStockBill_K3 : DBUtility.ClsXt_BaseBill { public Model.ClsCg_POInStockBillMain_K3 omodel = new Model.ClsCg_POInStockBillMain_K3(); public List DetailColl = new List(); public Model.ClsCg_POInStockBillMain_K3_View omodel_View = new Model.ClsCg_POInStockBillMain_K3_View(); public List DetailColl_View = new List(); public ClsCg_POInStockBill_K3() { base.MvarItemKeyForWeb = "h_v_K3_POInStockBillMain_ForWeb"; base.MvarItemKeySubForWeb = "h_v_K3_POInStockBillSub_ForWeb"; base.MvarItemKeySub = "POInStockEntry"; base.MvarItemKeySub2 = ""; base.MvarItemKeySub3 = ""; base.MvarItemKeySub4 = ""; base.MvarItemKey = "POInStock"; base.MvarReportTitle = "收料通知单"; base.BillType = "72"; } #region 固定代码 ~ClsCg_POInStockBill_K3() { //DetailColl = null; //base.oCn.CnDispose(); } #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 POInStock where FTranType='" + BillType + "' and FBillNo ='" + sBillNo + "'"; } else { sSql = "Select FInterID from POInStock where FTranType='" + BillType + "' and FBillNo ='" + sBillNo + "' and FInterID<>" + lngBillKey.ToString(); } DataSet Ds; Ds = oK3Cn.RunProcReturn(sSql, "POInStock"); 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 POInStockEntry where FInterID=" + lngBillKey.ToString()); } //删除主表 public void DeleteBillMain(Int64 lngBillKey) { oK3Cn.RunProc("Delete From POInStock where FInterID=" + lngBillKey.ToString()); } //删除单据 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 POInStock " + "(FInterID,FBillNo,FBrNo,FTranType,FCancellation,FStatus" + ",FUpStockWhenSave,Fdate,FSupplyID,FCheckDate,FFManagerID,FDeptID" + ",FEmpID,FBillerID,FCurrencyID,FBizType,FExchangeRate" +//,FExchangeRateType ",FPOStyle,FWWType,FRelateBrID,FMultiCheckDate1,FMultiCheckDate2,FMultiCheckDate3" + ",FMultiCheckDate4,FMultiCheckDate5,FMultiCheckDate6,FSelTranType,FFetchAdd,FExplanation" + ",FAreaPS,FManageType,FPrintCount,FPOMode,FStockID,FNote" + ") " + " values(" + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','0'," + this.BillType + ",0,0" + ",0,'" + omodel.HDate.ToShortDateString() + "'," + omodel.HSupID.ToString() + ",null," + omodel.HMangerID.ToString() + "," + omodel.HDeptID.ToString() + "," + omodel.HEmpID.ToString() + ",16394," + omodel.HCurID.ToString() + ",12510," + omodel.HExRate.ToString() +//",1" + "," + omodel.HPSStyleID.ToString() + ",0,0,Null,Null,Null" + ",Null,Null,Null,71,'" + omodel.HAddress + "','" + omodel.HExplanation + "'" + ",20302,0,0,36680," + omodel.HWHID.ToString() + ",'" + omodel.HRemark + "'" + ") "); //插入子表 foreach (Model.ClsCg_POInStockBillSub_K3 oSub in DetailColl) { oK3Cn.RunProc("Insert into POInStockEntry " + " (FInterID,FEntryID,FBrNo,FMapNumber,FMapName,FItemID" + ",FAuxPropID,FBatchNo,FQty,FUnitID,Fauxqty,FSecCoefficient" + ",FSecQty,Fauxprice,Famount,Fnote,FDischarged,FCheckMethod" + ",FKFDate,FKFPeriod,FPeriodDate,FStockID,FDCSPID,FSourceBillNo" + ",FSourceTranType,FSourceInterId,FSourceEntryID,FContractBillNo,FContractInterID,FContractEntryID" + ",FOrderBillNo,FOrderInterID,FOrderEntryID,FPlanMode,FMTONo,FOrderType" + ",FAuxQtyPass,FQtyPass,FAuxConPassQty,FConPassQty" +//,FSecQtyPass,FSecConPassQty ",FAuxNotPassQty,FNotPassQty,FAuxSampleBreakQty,FSampleBreakQty" +//,FSecNotPassQty,FSecSampleBreakQty ",FAuxRelateQty,FRelateQty" +//,FScrapQty,FAuxScrapQty,FSecScrapQty,FSecRelateQty ",FAuxQCheckQty,FQCheckQty,FAuxBackQty,FBackQty,FSecBackQty,FPrice" +//,FSecQCheckQty //",FScrapInCommitQty,FAuxScrapInCommitQty,FSecScrapInCommitQty,FDeliveryNoticeFID,FDeliveryNoticeEntryID,FTime" + //",FSamBillNo,FSamInterID,FSamEntryID" + ") values(" + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'0','',''," + oSub.HMaterID.ToString() + ",0,'" + oSub.HBatchNo + "'," + oSub.HQty.ToString() + "," + oSub.HUnitID.ToString() + "," + oSub.HQty.ToString() + ",0" + ",0," + oSub.HPrice.ToString() + "," + oSub.HMoney.ToString() + ",'" + oSub.HRemark + "',1059,352" + ",'" + oSub.HDate.ToShortDateString() + "',0,Null," + oSub.HWHID.ToString() + "," + oSub.HSPID.ToString() + ",'" + oSub.HSourceBillNo + "'" + ",'" + oSub.HSourceBillType + "'," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'',0,0" + ",'" + oSub.HSourceBillNo + "'," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",14036,'','" + oSub.HSourceBillType + "'" + ", " + oSub.HQty.ToString() + "," + oSub.HQty.ToString() + ",0,0" +//,0,0 ",0,0,0,0" +//,0,0 ",0,0" +//,0,0,0,0 ",0,0,0,0,0," + oSub.HPrice.ToString() +//,0 //",0,0,0,0,0,0" + //",'',0,0" + ") "); } 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 = oK3Cn.RunProcReturn("declare @InterID int set @InterID=0 exec GetICMaxNum 'POInStock', @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 POInStock " + "(FInterID,FBillNo,FBrNo,FTranType,FCancellation,FStatus" + ",FUpStockWhenSave,Fdate,FSupplyID,FCheckDate,FFManagerID,FDeptID" + ",FEmpID,FBillerID,FCurrencyID,FBizType,FExchangeRate" +//,FExchangeRateType ",FPOStyle,FWWType,FRelateBrID,FMultiCheckDate1,FMultiCheckDate2,FMultiCheckDate3" + ",FMultiCheckDate4,FMultiCheckDate5,FMultiCheckDate6,FSelTranType,FFetchAdd,FExplanation" + ",FAreaPS,FManageType,FPrintCount,FPOMode,FStockID,FNote" + ") " + " values(" + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','0'," + this.BillType + ",0,0" + ",0,'" + omodel.HDate.ToShortDateString() + "'," + omodel.HSupID.ToString() + ",null," + omodel.HMangerID.ToString() + "," + omodel.HDeptID.ToString() + "," + omodel.HEmpID.ToString() + ",16394," + omodel.HCurID.ToString() + ",12510," + omodel.HExRate.ToString() +//",1" + "," + omodel.HPSStyleID.ToString() + ",0,0,Null,Null,Null" + ",Null,Null,Null,71,'" + omodel.HAddress + "','" + omodel.HExplanation + "'" + ",20302,0,0,36680," + omodel.HWHID.ToString() + ",'" + omodel.HRemark + "'" + ") "); //插入子表 foreach (Model.ClsCg_POInStockBillSub_K3 oSub in DetailColl) { oK3Cn.RunProc("Insert into POInStockEntry " + " (FInterID,FEntryID,FBrNo,FMapNumber,FMapName,FItemID" + ",FAuxPropID,FBatchNo,FQty,FUnitID,Fauxqty,FSecCoefficient" + ",FSecQty,Fauxprice,Famount,Fnote,FDischarged,FCheckMethod" + ",FKFDate,FKFPeriod,FPeriodDate,FStockID,FDCSPID,FSourceBillNo" + ",FSourceTranType,FSourceInterId,FSourceEntryID,FContractBillNo,FContractInterID,FContractEntryID" + ",FOrderBillNo,FOrderInterID,FOrderEntryID,FPlanMode,FMTONo,FOrderType" + ",FAuxQtyPass,FQtyPass,FAuxConPassQty,FConPassQty" +//,FSecQtyPass,FSecConPassQty ",FAuxNotPassQty,FNotPassQty,FAuxSampleBreakQty,FSampleBreakQty" +//,FSecNotPassQty,FSecSampleBreakQty ",FAuxRelateQty,FRelateQty" +//,FScrapQty,FAuxScrapQty,FSecScrapQty,FSecRelateQty ",FAuxQCheckQty,FQCheckQty,FAuxBackQty,FBackQty,FSecBackQty,FPrice" +//,FSecQCheckQty //",FScrapInCommitQty,FAuxScrapInCommitQty,FSecScrapInCommitQty,FDeliveryNoticeFID,FDeliveryNoticeEntryID,FTime" + //",FSamBillNo,FSamInterID,FSamEntryID" + ") values(" + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'0','',''," + oSub.HMaterID.ToString() + ",0,'" + oSub.HBatchNo + "'," + oSub.HQty.ToString() + "," + oSub.HUnitID.ToString() + "," + oSub.HQty.ToString() + ",0" + ",0," + oSub.HPrice.ToString() + "," + oSub.HMoney.ToString() + ",'" + oSub.HRemark + "',1059,352" + ",'" + oSub.HDate.ToShortDateString() + "',0,Null," + oSub.HWHID.ToString() + "," + oSub.HSPID.ToString() + ",'" + oSub.HSourceBillNo + "'" + ",'" + oSub.HSourceBillType + "'," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'',0,0" + ",'" + oSub.HSourceBillNo + "'," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",14036,'','" + oSub.HSourceBillType + "'" + ", " + oSub.HQty.ToString() + "," + oSub.HQty.ToString() + ",0,0" +//,0,0 ",0,0,0,0" +//,0,0 ",0,0" +//,0,0,0,0 ",0,0,0,0,0," + oSub.HPrice.ToString() +//,0 //",0,0,0,0,0,0" + //",'',0,0" + ") "); ////更新申请单关联数量 //oK3Cn.RunProc("EXEC p_UpdateBillRelateData " + this.BillType + "," + omodel.HInterID.ToString() + ",'POInStock','POInStockEntry'"); //oK3Cn.RunProc("update porequestentry set fcommitqty=Fqty,fauxcommitqty=Fauxqty,FMRPClosed=1 where FMRPClosed<>1 and Fitemid=" + oSub.HMaterID); } ////更新申请单关闭标志 //oK3Cn.RunProc("EXEC h_p_Cg_POInStockToUpdate_K3 " + omodel.HInterID.ToString()); //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); } } //显示单据 public override bool ShowBill(Int64 lngBillKey, ref string sReturn) { try { //查询主表 DataSet Ds; Ds = oK3Cn.RunProcReturn("Select * from POInStock Where FInterID=" + lngBillKey.ToString(), "POInStock"); 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.HRemark = Ds.Tables[0].Rows[0]["Fnote"].ToString().Trim(); omodel.HExplanation = Ds.Tables[0].Rows[0]["FExplanation"].ToString().Trim(); // omodel.HSupID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["FSupplyID"]); omodel.HMangerID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["FFManagerID"]); omodel.HDeptID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["FDeptID"]); omodel.HEmpID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["FEmpID"]); omodel.HCurID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["FCurrencyID"]); omodel.HPSStyleID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["FPOStyle"]); // omodel.HExRate = DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[0]["FExchangeRate"]); omodel.HAddress = Ds.Tables[0].Rows[0]["FFetchAdd"].ToString().Trim(); omodel.HWHID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["FStockID"]); // 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 = oK3Cn.RunProcReturn("Select * from POInStockEntry Where FInterID=" + lngBillKey.ToString() + " order by FEntryID ", "POInStockEntry"); DetailColl.Clear();//清空 for (int i = 0; i < DsSub.Tables[0].Rows.Count; i++) { Model.ClsCg_POInStockBillSub_K3 oSub = new Model.ClsCg_POInStockBillSub_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.HBatchNo = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["FBatchNo"].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.HWHID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["FStockID"].ToString()); oSub.HSPID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["FDCSPID"].ToString()); oSub.HMoney = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["Famount"].ToString()); oSub.HDate = DBUtility.ClsPub.isDate(DsSub.Tables[0].Rows[i]["FKFDate"].ToString()); oSub.HRemark = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["Fnote"].ToString()); // 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 = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["FSourceTranType"].ToString()); oSub.HSourceBillNo = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["FSourceBillNo"].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 = oCn.RunProcReturn("Select * from h_v_K3_POInStockBillMain_View Where HInterID=" + lngBillKey.ToString(), "h_v_K3_POInStockBillMain_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.HRemark = Ds.Tables[0].Rows[0]["HRemark"].ToString().Trim(); omodel_View.HExplanation = Ds.Tables[0].Rows[0]["HExplanation"].ToString().Trim(); // omodel_View.HSupID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HSupID"]); omodel_View.HSupName = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HSupName"]); 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.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.HCurID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HCurID"]); omodel_View.HCurName = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HCurName"]); omodel_View.HPSStyleID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HPSStyleID"]); omodel_View.HPSStyleName = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HPSStyleName"]); 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.HWHID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HWHID"]); omodel_View.HWHName = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HWHName"]); // 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 = oCn.RunProcReturn("Select * from h_v_K3_POInStockBillSub_View Where HInterID=" + lngBillKey.ToString() + " order by HEntryID ", "h_v_K3_POInStockBillSub_View"); DetailColl_View.Clear();//清空 for (int i = 0; i < DsSub.Tables[0].Rows.Count; i++) { Model.ClsCg_POInStockBillSub_K3_View oSub = new Model.ClsCg_POInStockBillSub_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.HBatchNo = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HBatchNo"].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.HWHID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HWHID"].ToString()); oSub.HWHNumber = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HWHNumber"].ToString()); oSub.HWHName = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HWHName"].ToString()); oSub.HSPID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSPID"].ToString()); oSub.HSPNumber = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HSPNumber"].ToString()); oSub.HSPName = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HSPName"].ToString()); oSub.HMoney = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HMoney"].ToString()); oSub.HDate = DBUtility.ClsPub.isDate(DsSub.Tables[0].Rows[i]["HDate"].ToString()); oSub.HRemark = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HRemark"].ToString()); // 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 = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HSourceBillType"].ToString()); oSub.HSourceBillNo = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HSourceBillNo"].ToString()); DetailColl_View.Add(oSub); } sReturn = "显示单据成功!"; return true; } catch (Exception e) { sReturn = e.Message; throw (e); } } //审核单据 public bool CheckBill(Int64 lngBillKey, Int64 HBillerID, ref string sReturn) { SQLHelper.ClsCNK3 oCnK3 = new SQLHelper.ClsCNK3(); try { DataSet Ds; oCnK3.BeginTran(); // oCnK3.RunProc("exec h_p_K3_Cg_POInStockBill_Check " + lngBillKey.ToString() + "," + HBillerID.ToString()); sReturn = "审核单据成功!"; oCnK3.Commit(); oCnK3.CnDispose(); return true; } catch (Exception e) { sReturn = e.Message; oCnK3.RollBack(); throw (e); } } //反审核单据 public bool AbandonCheck(Int64 lngBillKey, ref string sReturn) { SQLHelper.ClsCNK3 oCnK3 = new SQLHelper.ClsCNK3(); try { DataSet Ds; oCnK3.BeginTran(); // oCnK3.RunProc("exec h_p_K3_Cg_POInStockBill_AbandonCheck " + lngBillKey.ToString()); sReturn = "反审核单据成功!"; oCnK3.Commit(); oCnK3.CnDispose(); return true; } catch (Exception e) { sReturn = e.Message; oCnK3.RollBack(); throw (e); } } //确认 public bool AcceptFlagBill(Int64 lngBillKey, ref string sReturn) { try { oK3Cn.RunProc(" Update POInStock set FStatus=1,FExplanation='' Where FInterID=" + lngBillKey.ToString()); sReturn = ""; return true; } catch (Exception e) { sReturn = e.Message; return false; } } //拒绝 public bool RefuseFlagBill(Int64 lngBillKey, string HRefuseRemark, ref string sReturn) { try { oK3Cn.RunProc(" Update POInStock set FStatus=3,FExplanation='" + HRefuseRemark + "' Where FInterID=" + lngBillKey.ToString()); sReturn = ""; return true; } catch (Exception e) { sReturn = e.Message; return false; } } } }