using System;
|
using System.Collections.Generic;
|
using System.Text;
|
using System.Data;
|
using System.Windows.Forms;
|
|
namespace DAL
|
{
|
public class ClsA3_SellOutBill_CheckExtend_Ctl : DBUtility.ClsXt_BaseBill
|
{
|
SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
|
public ClsA3_SellOutBill_CheckExtend_Model omodel = new ClsA3_SellOutBill_CheckExtend_Model();
|
|
public ClsA3_SellOutBill_CheckExtend_Ctl()
|
{
|
base.MvarItemKeySub = "";
|
base.MvarItemKeySub2 = "";
|
base.MvarItemKeySub3 = "";
|
base.MvarItemKeySub4 = "";
|
base.MvarItemKey = "A3_SellOutBill_CheckExtend";
|
base.MvarReportTitle = "发货评审会签表";
|
base.BillType = "";
|
base.HBillSubType = "";
|
|
}
|
|
//修改单据
|
public override bool ModifyBill(Int64 lngBillKey, ref string sReturn)
|
{
|
return true;
|
//try
|
//{
|
// //
|
// oCn.BeginTran();
|
// //更新主表
|
// oCn.RunProc("UpDate Kf_ICStockBillMain set " +
|
// " HBillNo='" + omodel.HBillNo + "'" + //固定赋值===============
|
// ",HDate='" + omodel.HDate + "'" +
|
// ",HYear='" + omodel.HYear.ToString() + "'" +
|
// ",HPeriod='" + omodel.HPeriod.ToString() + "'" +
|
// ",HRemark='" + omodel.HRemark + "'" +
|
// ",HUpDater='" + DBUtility.ClsPub.CurUserName + "'" +
|
// ",HUpDateDate=getdate()" +
|
// //========================================
|
// ",HSupID=" + omodel.HSupID.ToString() +
|
// ",HWHID=" + omodel.HWHID.ToString() +
|
// ",HSCWHID=" + omodel.HSCWHID.ToString() +
|
// ",HManagerID=" + omodel.HMangerID.ToString() +
|
// ",HSecManagerID=" + omodel.HSecManagerID.ToString() +
|
// ",HKeeperID=" + omodel.HKeeperID.ToString() +
|
// ",HDeptID=" + omodel.HDeptID.ToString() +
|
// ",HExplanation='" + omodel.HExplanation + "'" +
|
// ",HInnerBillNo='" + omodel.HInnerBillNo + "'" +
|
// ",HRedBlueFlag=" + DBUtility.ClsPub.BoolToString(omodel.HRedBlueFlag) +
|
// " where HInterID=" + lngBillKey.ToString());
|
// //删除关联
|
// DeleteRelation(ref sReturn, lngBillKey);
|
// //删除子表
|
// DeleteBillSub(lngBillKey);
|
// //插入子表
|
// omodel.HInterID = lngBillKey;
|
// foreach (Model.ClsKf_EntrustInBillSub oSub in DetailColl)
|
// {
|
// oCn.RunProc("Insert into Kf_ICStockBillSub " +
|
// " (HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark" +
|
// ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" +
|
// ",HMaterID,HPropertyID,HSecUnitID,HSecUnitRate,HUnitID,HQtyMust" +
|
// ",HQty,HPrice,HMoney,HWHID,HSCWHID,HSPID" +
|
// ",HSCSPID,HSPGroupID,HBatchNo,HPOOrderInterID,HPOOrderEntryID,HPOOrderBillNo" +
|
// ",HSeOrderInterID,HSeOrderEntryID,HSeOrderBillNo" +
|
// ") values("
|
// + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HCloseMan + "','" + oSub.HEntryCloseDate.ToShortDateString() + "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'" +
|
// "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() +
|
// "," + oSub.HMaterID.ToString() + "," + oSub.HPropertyID.ToString() + "," + oSub.HSecUnitID.ToString() + "," + oSub.HSecUnitRate.ToString() + "," + oSub.HUnitID.ToString() + "," + oSub.HQtyMust.ToString() +
|
// "," + oSub.HQty.ToString() + "," + oSub.HPrice.ToString() + "," + oSub.HMoney.ToString() + "," + oSub.HWHID.ToString() + "," + oSub.HSCWHID.ToString() + "," + oSub.HSPID.ToString() +
|
// "," + oSub.HSCSPID.ToString() + "," + oSub.HSPGroupID.ToString() + ",'" + oSub.HBatchNo + "'," + oSub.HPOOrderInterID.ToString() + "," + oSub.HPOOrderEntryID.ToString() + ",'" + oSub.HPOOrderBillNo + "'" +
|
// "," + oSub.HSeOrderInterID.ToString() + "," + oSub.HSeOrderEntryID.ToString() + ",'" + oSub.HSeOrderBillNo + "'" +
|
// ") ");
|
// }
|
// //
|
// //foreach (Model.ClsKf_EntrustInBillSub oSub in DetailColl)
|
// //{
|
// // Ds = oCn.RunProcReturn("exec h_p_Kf_EntrustInBill_Qty " + oSub.HICMOInterID, "");
|
// // if (Ds.Tables[0].Rows.Count == 0)
|
// // return;
|
// // if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBool"]) == "Y")
|
// // {
|
// // sReturn = "汇报数量超过计划数量!不允许保存";
|
// // return false;
|
// // }
|
// //}
|
// sReturn = "修改单据成功!";
|
// oCn.Commit();
|
// return true;
|
//}
|
//catch (Exception e)
|
//{
|
// sReturn = e.Message;
|
// oCn.RollBack();
|
// throw (e);
|
//}
|
}
|
//新增单据
|
public override bool AddBill(ref string sReturn)
|
{
|
try
|
{
|
//得到mainid
|
//omodel.HItemID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo);
|
//若MAINDI重复则重新获取
|
DataSet Ds;
|
oCn.BeginTran();
|
//主表
|
oCn.RunProc("Insert Into A3_SellOutBill_CheckExtend " +
|
"(HBillNo,HCusNumber,HReceiveStatus" +
|
",HReceiveType,HReceiveMoney" +
|
",HRequester,HRequesterDate,HRequesterNote,HStatus" +
|
") " +
|
" values('" + omodel.HBillNo + "','" + omodel.HCusNumber + "','" + omodel.HReceiveStatus + "'" +
|
",'" + omodel.HReceiveType + "'," + omodel.HReceiveMoney.ToString() +
|
",'" + omodel.HRequester + "','" + omodel.HRequesterDate + "','" + omodel.HRequesterNote + "'," + omodel.HStatus.ToString() +
|
") ");
|
//
|
Ds = oCn.RunProcReturn("exec h_p_GetNextChecker_SellOut '" + omodel.HBillNo + "'", "Gy_Czygl");
|
if (Ds.Tables[0].Rows.Count == 0)
|
{
|
sReturn = "创建审核流失败!";
|
oCn.RollBack();
|
return false;
|
}
|
if (DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0][0]) != 99)
|
{
|
sReturn = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0][1]);
|
oCn.RollBack();
|
return false;
|
}
|
sReturn = "新增单据成功!";
|
oCn.Commit();
|
return true;
|
}
|
catch (Exception e)
|
{
|
sReturn = e.Message;
|
oCn.RollBack();
|
throw (e);
|
}
|
}
|
//显示单据
|
public bool ShowBill(string lngBillKey, ref string sReturn)
|
{
|
try
|
{
|
//查询主表
|
DataSet Ds;
|
Ds = oCn.RunProcReturn("Select * from A3_SellOutBill_CheckExtend Where HBillNo='" + lngBillKey + "' and isnull(HBacker,'')=''", "A3_SellOutBill_CheckExtend");
|
if (Ds.Tables[0].Rows.Count == 0)
|
{
|
sReturn = "单据未找到!";
|
return false;
|
}
|
//固定赋值===========================================
|
omodel.HItemID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HItemID"]);
|
omodel.HBillNo = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBillNo"]);
|
omodel.HCusNumber = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HCusNumber"]);
|
omodel.HBacker = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBacker"]);
|
omodel.HBackDate = DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[0]["HBackDate"]);
|
|
omodel.HReceiveMoney = DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[0]["HReceiveMoney"]);
|
omodel.HReceiveType = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HReceiveType"]);
|
omodel.HReceiveStatus = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HReceiveStatus"]);
|
omodel.HRequester = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HRequester"]);
|
omodel.HRequesterDate = DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[0]["HRequesterDate"]).ToShortDateString();
|
omodel.HRequesterNote = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HRequesterNote"]);
|
omodel.HAccManager = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HAccManager"]);
|
omodel.HAccManagerDate = DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[0]["HAccManagerDate"]).ToShortDateString();
|
omodel.HAccManagerNote = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HAccManagerNote"]);
|
omodel.HLstManager = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HLstManager"]);
|
omodel.HLstManagerDate = DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[0]["HLstManagerDate"]).ToShortDateString();
|
omodel.HLstManagerNote = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HLstManagerNote"]);
|
omodel.HStatus = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HStatus"]);
|
//========================================================
|
sReturn = "显示单据成功!";
|
return true;
|
}
|
catch (Exception e)
|
{
|
sReturn = e.Message;
|
throw (e);
|
}
|
}
|
|
public override bool DeleteBill(long lngBillKey, ref string sReturn)
|
{
|
try
|
{
|
oCn.BeginTran();
|
//删除主表
|
oCn.RunProc("Delete From A3_SellOutBill_CheckExtend where HItemID=" + lngBillKey.ToString());
|
sReturn = "删除单据成功!";
|
oCn.Commit();
|
return true;
|
}
|
catch (Exception e)
|
{
|
sReturn = e.Message;
|
oCn.RollBack();
|
throw (e);
|
}
|
}
|
|
//审核
|
public bool CheckBill(string lngBillKey, DateTime sDate, string sHCheckItem, string sNote, ref string sReturn)
|
{
|
|
try
|
{
|
DataSet DsA;
|
DataSet Ds;
|
string HChecker = DBUtility.ClsPub.CurUserName;
|
Ds = oCn.RunProcReturn("exec h_p_A3_SellOutBillExtend_Check '" + lngBillKey + "','" + sDate.ToShortDateString() + "','" + sHCheckItem + "','" + sNote + "','" + HChecker + "'", "Gy_Czygl");
|
if (Ds.Tables[0].Rows.Count == 0)
|
{
|
sReturn = "审核失败!";
|
return false;
|
}
|
sReturn = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0][0]);
|
//
|
DsA = oCn.RunProcReturn("exec h_p_GetNextChecker_SellOut '" + lngBillKey + "'", "Gy_Czygl");
|
if (DsA.Tables[0].Rows.Count == 0 || DsA == null)
|
{
|
sReturn = "创建审核流失败!";
|
return false;
|
}
|
if (DBUtility.ClsPub.isLong(DsA.Tables[0].Rows[0][0]) != 99)
|
{
|
sReturn = DBUtility.ClsPub.isStrNull(DsA.Tables[0].Rows[0][1]);
|
return false;
|
}
|
return true;
|
}
|
catch (Exception e)
|
{
|
sReturn = e.Message;
|
throw (e);
|
}
|
}
|
|
//关闭
|
public bool CloseBill(string lngBillKey, ref string sReturn)
|
{
|
|
try
|
{
|
string HCloseMan = DBUtility.ClsPub.CurUserName;
|
string HCloseDate = DBUtility.ClsPub.GetServerDate(-1);
|
oCn.RunProc(" Update A3_SellOutBill_CheckExtend set HBacker='" + HCloseMan + "',HBackDate='" + HCloseDate + "' Where HBillNo='" + lngBillKey + "'");
|
//oCn.RunProc(" Delete from A3_SellOutBill_CheckExtend Where HBillNo='" + lngBillKey + "'");
|
DBUtility.ClsPub.Add_Log("", "退回发货单:" + lngBillKey, DBUtility.ClsPub.CurUserName);
|
sReturn = "";
|
return true;
|
}
|
catch (Exception e)
|
{
|
sReturn = e.Message;
|
throw (e);
|
}
|
}
|
|
|
|
|
|
}
|
}
|