using System;
|
using System.Collections.Generic;
|
using System.Text;
|
using System.Data;
|
using System.Windows.Forms;
|
|
namespace BLL
|
{
|
public class ClsGy_BarCodeEdit_Ctl
|
{
|
SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
|
public ClsGy_BarCodeEdit_Model omodel = new ClsGy_BarCodeEdit_Model();
|
|
//新增
|
public bool AddNew()
|
{
|
|
try
|
{
|
oCn.BeginTran();
|
oCn.RunProc("INSERT INTO [Kf_ICStockBillSub_WMS] " +
|
"([HInterID],[HEntryID],[HBillType],[HMaterID],[HProcID] " +
|
",[HWhID],[HSCWhID],[HStockPlaceID],[HOutStockPlaceID],[HGroupID] " +
|
",[HQty],[HBarCode],[HAddr],[HBatchNo],[HMaker],[HMakeDate] " +
|
",[HSourceInterID],[HSourceEntryID],[HSourceBillType],[HSourceItemID]) " +
|
" Values ('" + omodel.HInterID + "'," + omodel.HEntryID.ToString() + ",'" + omodel.HBillType + "'," + omodel.HMaterID.ToString() + "," + omodel.HProcID.ToString() +
|
"," + omodel.HWhID.ToString() + "," + omodel.HSCWhID.ToString() + "," + omodel.HStockPlaceID.ToString() + "," + omodel.HOutStockPlaceID.ToString() + "," + omodel.HGroupID.ToString() +
|
"," + omodel.HQty.ToString() + ",'" + omodel.HBarCode + "','" + omodel.HAddr + "','" + omodel.HBatchNo + "','" + DBUtility.ClsPub.CurUserName + "',getdate()" +
|
"," + omodel.HSourceInterID.ToString() + "," + omodel.HSourceEntryID.ToString() + ",'" + omodel.HSourceBillType + "'," + omodel.HSourceItemID.ToString() + ")", ref DBUtility.ClsPub.sExeReturnInfo);
|
//修改上级为非末级代码
|
//oCn.RunProc("Update " + MvarItemKey + " set HEndflag=0 where HItemID=" + omodel.HParentID, ref DBUtility.ClsPub.sExeReturnInfo);
|
oCn.Commit();
|
return true;
|
}
|
catch (Exception e)
|
{
|
oCn.RollBack();
|
throw (e);
|
}
|
}
|
|
//删除
|
public bool DeleteByID(Int64 sItemID)
|
{
|
try
|
{
|
oCn.RunProc("Delete from Kf_ICStockBillSub_WMS where HItemID='" + sItemID + "'", ref Pub_Class.ClsPub.sExeReturnInfo);
|
return true;
|
}
|
catch (Exception e)
|
{
|
throw (e);
|
}
|
}
|
|
//设置单据网络信息
|
public DataSet SetGridViewByBillNo(string sBillNo)
|
{
|
DataSet DS;
|
try
|
{
|
DS = oCn.RunProcReturn("Select * from h_v_Kf_StockBarCodeList Where HBillType='" + sBillNo + "'", "Gy_BarCodeBill", ref Pub_Class.ClsPub.sExeReturnInfo);
|
if (DS.Tables[0].Rows.Count == 0)
|
return null;
|
else
|
{
|
return DS;
|
}
|
}
|
catch (Exception e)
|
{
|
return null;
|
}
|
}
|
|
//根据条码判断信息
|
public bool HavParentCarCode(string sCode)
|
{
|
DataSet DS;
|
try
|
{
|
DS = oCn.RunProcReturn("Select * from Gy_BarCodeBill Where hbarcode='" + sCode + "'", "Gy_BarCodeBill", ref Pub_Class.ClsPub.sExeReturnInfo);
|
if (DS.Tables[0].Rows.Count == 0)
|
return false;
|
else
|
{
|
omodel.HMaterID = DBUtility.ClsPub.isLong(DS.Tables[0].Rows[0]["HMaterID"]);
|
//omodel.HProcID =0;
|
//omodel.HWhID = 0;
|
//omodel.HSCWhID = 0;
|
//omodel.HStockPlaceID =0;
|
//omodel.HOutStockPlaceID = 0;
|
//omodel.HGroupID =0;
|
omodel.HQty = DBUtility.ClsPub.isDoule(DS.Tables[0].Rows[0]["HQty"]);
|
omodel.HBarCode = DBUtility.ClsPub.isStrNull(DS.Tables[0].Rows[0]["HBarCode"]);
|
omodel.HBatchNo = DBUtility.ClsPub.isStrNull(DS.Tables[0].Rows[0]["HBatchNo"]);
|
//omodel.HAddr = "";
|
//omodel.HMaker = "";
|
//omodel.HMakeDate = ;
|
omodel.HSourceInterID = DBUtility.ClsPub.isLong(DS.Tables[0].Rows[0]["HSourceInterID"]);
|
omodel.HSourceEntryID = DBUtility.ClsPub.isLong(DS.Tables[0].Rows[0]["HSourceEntryID"]);
|
omodel.HSourceBillType = DBUtility.ClsPub.isStrNull(DS.Tables[0].Rows[0]["HSourceBillType"]);
|
//omodel.HSourceItemID = DBUtility.ClsPub.isLong(DS.Tables[0].Rows[0]["HSourceItemID"]);
|
return true;
|
}
|
}
|
catch (Exception e)
|
{
|
throw (e);
|
}
|
}
|
|
}
|
}
|