using System;
|
using System.Collections.Generic;
|
using System.Text;
|
using System.Data;
|
|
namespace DAL
|
{
|
public class ClsKF_PonderationBillMain_Audit_Temp_Ctl : DBUtility.ClsGy_Base_Ctl
|
{
|
|
//原代码 用于 替换子项目
|
public string HOldNumber;
|
public Model.ClsKF_PonderationBillMain_Audit_Temp oModel = new Model.ClsKF_PonderationBillMain_Audit_Temp();
|
|
|
//删除 根据内码全部清除
|
public bool DeleteByInterID(Int64 sHInterID, string sHBillType)
|
{
|
try
|
{
|
oCn.RunProc("Delete from " + MvarItemKey + " where HInterID=" + sHInterID.ToString() + " and HBillType='" + sHBillType + "'", ref DBUtility.ClsPub.sExeReturnInfo);
|
return true;
|
}
|
catch (Exception e)
|
{
|
throw (e);
|
}
|
}
|
|
//删除 根据内码+条码清除该条码记录
|
public bool DeleteByBarCode(Int64 sHInterID, string sBarCode, string sHBillType)
|
{
|
try
|
{
|
oCn.RunProc("Delete from " + MvarItemKey + " where HInterID=" + sHInterID.ToString() + " and HBillType='" + sHBillType + "' and HBarCode='" + sBarCode + "'", ref DBUtility.ClsPub.sExeReturnInfo);
|
return true;
|
}
|
catch (Exception e)
|
{
|
throw (e);
|
}
|
}
|
|
//删除 根据内码+物料清除该物料记录
|
public bool DeleteByInterIDAndSource(Int64 sHInterID, Int64 sMaterID, Int64 sHAuxPropID, Int64 sSInterID, Int64 sSEntryID, string sHBillType)
|
{
|
try
|
{
|
oCn.RunProc("Delete from " + MvarItemKey + " where HInterID=" + sHInterID.ToString() + " and HMaterID= " + sMaterID.ToString() + " and HAuxPropID= " + sHAuxPropID.ToString() + " and HBillType='" + sHBillType + "' and HSourceInterID=" + sSInterID.ToString() + " and HSourceEntryID=" + sSEntryID.ToString() + " and HQty<>0 ", ref DBUtility.ClsPub.sExeReturnInfo);
|
return true;
|
}
|
catch (Exception e)
|
{
|
throw (e);
|
}
|
}
|
|
//删除(源单主ID,源单子ID)
|
public bool DeleteByInterID(Int64 sHInterID, Int64 sHEntryID, string sHBillType)
|
{
|
try
|
{
|
oCn.RunProc("Delete from " + MvarItemKey + " where HSourceInterID=" + sHInterID.ToString() + " and HSourceEntryID=" + sHEntryID.ToString() + " and HBillType='" + sHBillType + "'", ref DBUtility.ClsPub.sExeReturnInfo);
|
return true;
|
}
|
catch (Exception e)
|
{
|
throw (e);
|
}
|
}
|
|
//删除(先进先出数据)更新 HlineStatus =1
|
public bool DeleteFIFOByInterID(Int64 sHInterID, string sHBillType)
|
{
|
try
|
{
|
oCn.RunProc("update Kf_ICInventory_FIFO_Tmp set HlineStatus =1 where HInterID=" + sHInterID.ToString() + " and HBillType='" + sHBillType + "'", ref DBUtility.ClsPub.sExeReturnInfo);
|
return true;
|
}
|
catch (Exception e)
|
{
|
throw (e);
|
}
|
}
|
|
//删除缓存列表单据
|
public bool DeleteBillList(Int64 sHInterID)
|
{
|
try
|
{
|
oCn.RunProc("Delete from " + MvarItemKey + " where HInterID=" + sHInterID.ToString() , ref DBUtility.ClsPub.sExeReturnInfo);
|
return true;
|
}
|
catch (Exception e)
|
{
|
throw (e);
|
}
|
}
|
|
//新增
|
public bool AddNew(ref string sReturn)
|
{
|
//SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
|
//try
|
//{
|
// DataSet oDs = new DataSet();
|
// DataSet oDs1 = new DataSet();
|
// DataSet oDs2 = new DataSet();
|
// //
|
// long sSourceInterID = 0;
|
// long sSourceEntryID = 0;
|
// long sTMSourceInterID = oModel.HSourceInterID;
|
// long sTMSourceEntryID = oModel.HSourceEntryID;
|
// bool iBool = false;
|
// oCn.BeginTran();
|
// //产品入库,外购入库,其他入库,委外入库 有源单单据只能扫描对应源单条码,无源单单据只能扫描无源单条码(不包括红字单据)
|
// if (oModel.HBillType == "2" || oModel.HBillType == "10" || oModel.HBillType == "5" || oModel.HBillType == "1")
|
// {
|
// if (oModel.HRedBlueFlag == false)
|
// {
|
// oDs1 = oCn.RunProcReturn("select distinct HSourceInterID,HSourceEntryID from " + MvarItemKey + " where HInterID=" + oModel.HInterID.ToString() + " and HQty=0 ", "KF_PonderationBillMain_Audit_Temp");
|
// if (oDs1 != null && oDs1.Tables[0].Rows.Count > 0)
|
// {
|
// for (int i = 0; i <= oDs1.Tables[0].Rows.Count - 1; i++)
|
// {
|
// sSourceInterID = DBUtility.ClsPub.isLong(oDs1.Tables[0].Rows[i]["HSourceInterID"]);
|
// sSourceEntryID = DBUtility.ClsPub.isLong(oDs1.Tables[0].Rows[i]["HSourceEntryID"]);
|
|
// //有源单 (扫描条码 无源单信息)
|
// if (sSourceInterID + sSourceEntryID != 0 && sTMSourceInterID + sTMSourceEntryID == 0)
|
// {
|
// oCn.Commit();
|
// oCn.CnClose();
|
// oCn.CnDispose();
|
// sReturn = "有源单单据,不允许扫描无源单条码!";
|
// return false;
|
// }
|
// //有源单(但是扫描条码 源单信息, 与所选源单信息 不匹配)
|
// else if (sSourceInterID + sSourceEntryID != 0 && sTMSourceInterID.ToString() + sTMSourceEntryID.ToString() != sSourceInterID.ToString() + sSourceEntryID.ToString())
|
// {
|
// iBool = false;
|
// continue;
|
// }
|
// //有源单(但是扫描条码 源单信息, 与所选源单信息 匹配) ***
|
// else if (sSourceInterID + sSourceEntryID != 0 && sTMSourceInterID.ToString() + sTMSourceEntryID.ToString() == sSourceInterID.ToString() + sSourceEntryID.ToString())
|
// {
|
// iBool = true;
|
// break;
|
// }
|
// ////无源单 (扫描条码 有源单信息 )
|
// //else if (sSourceInterID + sSourceEntryID == 0 && sTMSourceInterID + sTMSourceEntryID != 0)
|
// //{
|
// // oCn.Commit();
|
// // oCn.CnClose();
|
// // oCn.CnDispose();
|
// // sReturn = "无源单单据,不允许扫描有源单条码!";
|
// // return false;
|
// //}
|
// ////无源单 (扫描条码 无源单信息 )
|
// //else if (sSourceInterID + sSourceEntryID == 0 && sTMSourceInterID + sTMSourceEntryID == 0)
|
// //{
|
// // iBool = true;
|
// // break;
|
// //}
|
// }
|
// if (iBool == false)
|
// {
|
// oCn.Commit();
|
// oCn.CnClose();
|
// oCn.CnDispose();
|
// sReturn = "扫描条码源单,与所选源单不匹配!";
|
// return false;
|
// }
|
// }
|
// //else if (oDs1.Tables[0].Rows.Count == 0)
|
// //{
|
// // //无源单 (扫描条码 有源单信息 )
|
// // if (sSourceInterID + sSourceEntryID == 0 && sTMSourceInterID + sTMSourceEntryID != 0)
|
// // {
|
// // oCn.Commit();
|
// // oCn.CnClose();
|
// // oCn.CnDispose();
|
// // sReturn = "无源单单据,不允许扫描有源单条码!";
|
// // return false;
|
// // }
|
// //}
|
// }
|
// }
|
// //
|
// oDs = oCn.RunProcReturn("select HQtyMust,HSourceInterID,HSourceEntryID,HSourceBillType,HSourceBillNo from " + MvarItemKey + " where HInterID=" + oModel.HInterID.ToString() + " and HBillType='" + oModel.HBillType + "' and HMaterID=" + oModel.HMaterID.ToString() + " and HQty=0 ", "KF_PonderationBillMain_Audit_Temp");
|
// //
|
// if (oDs != null && oDs.Tables[0].Rows.Count > 0)
|
// {
|
// oDs2 = oCn.RunProcReturn("select HBarCodeType from Gy_BarCodeBill where HBarCode='" + oModel.HBarCode + "'", "Gy_BarCodeBill");
|
// if(DBUtility.ClsPub.isStrNull(oDs2.Tables[0].Rows[0]["HBarCodeType"])!="唯一条码")
|
// {
|
// oModel.HQty = DBUtility.ClsPub.isLong(oDs.Tables[0].Rows[0]["HQtyMust"]);
|
// }
|
// oModel.HQtyMust = 0;
|
// oModel.HSourceInterID = DBUtility.ClsPub.isLong(oDs.Tables[0].Rows[0]["HSourceInterID"]);
|
// oModel.HSourceEntryID = DBUtility.ClsPub.isLong(oDs.Tables[0].Rows[0]["HSourceEntryID"]);
|
// oModel.HSourceBillType = DBUtility.ClsPub.isStrNull(oDs.Tables[0].Rows[0]["HSourceBillType"]);
|
// oModel.HSourceBillNo = DBUtility.ClsPub.isStrNull(oDs.Tables[0].Rows[0]["HSourceBillNo"]);
|
// }
|
// else
|
// {
|
// oModel.HQtyMust = 0;
|
// }
|
|
// oCn.RunProc("Insert into " + MvarItemKey + " " +
|
// " (HInterID,HBillNo,HBillType,HMaterID,HProcID,HWhID,HSCWHID" +
|
// ",HStockPlaceID,HOutStockPlaceID,HGroupID,HQty,HQtyMust,HPieceQty " +
|
// ",HBatchNo,HBarCode,HAddr,HMaker,HMakeDate " +
|
// //",HVDAPack,HVDAMaterNum,HVDAQty " +
|
// ",HSourceInterID,HSourceEntryID,HSourceBillType,HSourceBillNo" +
|
// ",HRelationInterID,HRelationEntryID,HRelationBillNo,HRedBlueFlag) " +
|
// " Values(" + oModel.HInterID.ToString() + ",'" + oModel.HBillNo + "','" + 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.HQtyMust.ToString() + "," + oModel.HPieceQty.ToString() +
|
// ",'" + oModel.HBatchNo + "','" + oModel.HBarCode + "','" + oModel.HAddr + "','" + oModel.HMaker + "',getdate()" +
|
// //",'','',0 "+
|
// "," + oModel.HSourceInterID.ToString() + "," + oModel.HSourceEntryID.ToString() + ",'" + oModel.HSourceBillType + "','" + oModel.HSourceBillNo + "'" +
|
// "," + oModel.HRelationInterID.ToString() + "," + oModel.HRelationEntryID.ToString() + ",'" + oModel.HRelationBillNo + "'," + Convert.ToString(oModel.HRedBlueFlag ? 1 : 0) + ")", ref DBUtility.ClsPub.sExeReturnInfo);
|
// //修改上级为非末级代码
|
// //oCn.RunProc("Update " + MvarItemKey + " set HEndflag=0 where HItemID=" + oModel.HParentID, ref DBUtility.ClsPub.sExeReturnInfo);
|
// oCn.Commit();
|
// oCn.CnClose();
|
// oCn.CnDispose();
|
// sReturn = "保存成功!";
|
return true;
|
//}
|
//catch (Exception e)
|
//{
|
// sReturn = e.Message;
|
// oCn.RollBack();
|
// throw (e);
|
//}
|
}
|
|
//新增(出入库单据已经生成,核对生单时)
|
public bool AddNew_CheckAdd(ref string sReturn)
|
{
|
SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
|
try
|
{
|
DataSet oDs = new DataSet();
|
oCn.BeginTran();
|
oDs = oCn.RunProcReturn("select HQtyMust,HSourceInterID,HSourceEntryID,HSourceBillType,HSourceBillNo from " + MvarItemKey + " where HInterID=" + oModel.HInterID.ToString() + " and HBillType='" + oModel.HBillType + "' and HBarCode='" + oModel.HBarCode.ToString() + "' and HSourceLine=1 ", "KF_PonderationBillMain_Audit_Temp");
|
//
|
if (oDs != null && oDs.Tables[0].Rows.Count > 0)
|
{
|
oModel.HQtyMust = 0;
|
oModel.HSourceInterID = DBUtility.ClsPub.isLong(oDs.Tables[0].Rows[0]["HSourceInterID"]);
|
oModel.HSourceEntryID = DBUtility.ClsPub.isLong(oDs.Tables[0].Rows[0]["HSourceEntryID"]);
|
oModel.HSourceBillType = DBUtility.ClsPub.isStrNull(oDs.Tables[0].Rows[0]["HSourceBillType"]);
|
oModel.HSourceBillNo = DBUtility.ClsPub.isStrNull(oDs.Tables[0].Rows[0]["HSourceBillNo"]);
|
}
|
else
|
{
|
oModel.HQtyMust = 0;
|
}
|
|
oCn.RunProc("Insert into " + MvarItemKey + " " +
|
" (HInterID,HBillNo,HBillType,HMaterID,HAuxPropID,HProcID,HWhID,HSCWHID" +
|
",HStockPlaceID,HOutStockPlaceID,HGroupID,HQty,HQtyMust,HPieceQty " +
|
",HBatchNo,HBarCode,HAddr,HMaker,HMakeDate " +
|
",HSourceInterID,HSourceEntryID,HSourceBillType,HSourceBillNo" +
|
",HRelationInterID,HRelationEntryID,HRelationBillNo,HRedBlueFlag,HSourceLine) " +
|
" Values(" + oModel.HInterID.ToString() + ",'" + oModel.HBillNo + "','" + oModel.HBillType + "'," + oModel.HMaterID.ToString() + "," + oModel.HAuxPropID.ToString() + "," + oModel.HProcID.ToString() + "," + oModel.HWhID.ToString() + "," + oModel.HSCWHID.ToString() +
|
"," + oModel.HStockPlaceID.ToString() + "," + oModel.HOutStockPlaceID.ToString() + "," + oModel.HGroupID.ToString() + "," + oModel.HQty.ToString() + "," + oModel.HQtyMust.ToString() + "," + oModel.HPieceQty.ToString() +
|
",'" + oModel.HBatchNo + "','" + oModel.HBarCode + "','" + oModel.HAddr + "','" + oModel.HMaker + "',getdate()" +
|
//",'','',0 "+
|
"," + oModel.HSourceInterID.ToString() + "," + oModel.HSourceEntryID.ToString() + ",'" + oModel.HSourceBillType + "','" + oModel.HSourceBillNo + "'" +
|
"," + oModel.HRelationInterID.ToString() + "," + oModel.HRelationEntryID.ToString() + ",'" + oModel.HRelationBillNo + "'," + Convert.ToString(oModel.HRedBlueFlag ? 1 : 0) + ",0)", ref DBUtility.ClsPub.sExeReturnInfo);
|
//修改上级为非末级代码
|
//oCn.RunProc("Update " + MvarItemKey + " set HEndflag=0 where HItemID=" + oModel.HParentID, ref DBUtility.ClsPub.sExeReturnInfo);
|
oCn.Commit();
|
oCn.CnClose();
|
oCn.CnDispose();
|
sReturn = "保存成功!";
|
return true;
|
}
|
catch (Exception e)
|
{
|
sReturn = e.Message;
|
oCn.RollBack();
|
throw (e);
|
}
|
}
|
|
//新增(出入库单据已经生成,核对生单时)
|
public bool AddNew_CheckAdd(double sQty, ref string sReturn)
|
{
|
//SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
|
//try
|
//{
|
// DataSet oDs = new DataSet();
|
// DataSet oDs2 = new DataSet();
|
// oCn.BeginTran();
|
// oDs = oCn.RunProcReturn("select HQtyMust,HSourceInterID,HSourceEntryID,HSourceBillType,HSourceBillNo from " + MvarItemKey + " where HInterID=" + oModel.HInterID.ToString() + " and HBillType='" + oModel.HBillType + "' and HMaterID=" + oModel.HMaterID.ToString() + " and HQty=0 ", "KF_PonderationBillMain_Audit_Temp");
|
// //
|
// if (oDs != null && oDs.Tables[0].Rows.Count > 0)
|
// {
|
// oModel.HQtyMust = 0;
|
// oModel.HSourceInterID = DBUtility.ClsPub.isLong(oDs.Tables[0].Rows[0]["HSourceInterID"]);
|
// oModel.HSourceEntryID = DBUtility.ClsPub.isLong(oDs.Tables[0].Rows[0]["HSourceEntryID"]);
|
// oModel.HSourceBillType = DBUtility.ClsPub.isStrNull(oDs.Tables[0].Rows[0]["HSourceBillType"]);
|
// oModel.HSourceBillNo = DBUtility.ClsPub.isStrNull(oDs.Tables[0].Rows[0]["HSourceBillNo"]);
|
// long sHSumQty = DBUtility.ClsPub.isLong(oDs.Tables[0].Rows[0]["HQtyMust"]);
|
|
// oDs2 = oCn.RunProcReturn("select sum(HQty) HQty from " + MvarItemKey + " where HSourceInterID=" + oModel.HSourceInterID.ToString() + " and HSourceEntryID=" + oModel.HSourceEntryID.ToString() + " and HQty > 0 ", "KF_PonderationBillMain_Audit_Temp");
|
|
// if (sQty == 0)
|
// {
|
// oModel.HQty = sHSumQty - DBUtility.ClsPub.isDoule(oDs2.Tables[0].Rows[0]["HQty"]);
|
// if (oModel.HQty <= 0)
|
// {
|
// sReturn = "扫描数量总和不能大于实际数量!";
|
// return false;
|
// }
|
// }
|
// else
|
// {
|
// oModel.HQty = DBUtility.ClsPub.isDoule(sQty);
|
// if (oModel.HQty < 0)
|
// {
|
// sReturn = "输入的数量不能小于0!";
|
// return false;
|
// }
|
// if (oModel.HQtyMust <= DBUtility.ClsPub.isDoule(oDs2.Tables[0].Rows[0]["HQty"]))
|
// {
|
// sReturn = "扫描数量总和不能大于实际数量!";
|
// return false;
|
// }
|
// }
|
// }
|
// else
|
// {
|
// oModel.HQtyMust = 0;
|
// }
|
|
// oCn.RunProc("Insert into " + MvarItemKey + " " +
|
// " (HInterID,HBillNo,HBillType,HMaterID,HProcID,HWhID,HSCWHID" +
|
// ",HStockPlaceID,HOutStockPlaceID,HGroupID,HQty,HQtyMust,HPieceQty " +
|
// ",HBatchNo,HBarCode,HAddr,HMaker,HMakeDate " +
|
// //",HVDAPack,HVDAMaterNum,HVDAQty " +
|
// ",HSourceInterID,HSourceEntryID,HSourceBillType,HSourceBillNo" +
|
// ",HRelationInterID,HRelationEntryID,HRelationBillNo,HRedBlueFlag) " +
|
// " Values(" + oModel.HInterID.ToString() + ",'" + oModel.HBillNo + "','" + 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.HQtyMust.ToString() + "," + oModel.HPieceQty.ToString() +
|
// ",'" + oModel.HBatchNo + "','" + oModel.HBarCode + "','" + oModel.HAddr + "','" + oModel.HMaker + "',getdate()" +
|
// //",'','',0 "+
|
// "," + oModel.HSourceInterID.ToString() + "," + oModel.HSourceEntryID.ToString() + ",'" + oModel.HSourceBillType + "','" + oModel.HSourceBillNo + "'" +
|
// "," + oModel.HRelationInterID.ToString() + "," + oModel.HRelationEntryID.ToString() + ",'" + oModel.HRelationBillNo + "'," + Convert.ToString(oModel.HRedBlueFlag ? 1 : 0) + ")", ref DBUtility.ClsPub.sExeReturnInfo);
|
// //修改上级为非末级代码
|
// //oCn.RunProc("Update " + MvarItemKey + " set HEndflag=0 where HItemID=" + oModel.HParentID, ref DBUtility.ClsPub.sExeReturnInfo);
|
// oCn.Commit();
|
// oCn.CnClose();
|
// oCn.CnDispose();
|
// sReturn = "保存成功!";
|
return true;
|
//}
|
//catch (Exception e)
|
//{
|
// sReturn = e.Message;
|
// oCn.RollBack();
|
// throw (e);
|
//}
|
}
|
|
//新增
|
public bool AddNew_FIFO(ref string sReturn)
|
{
|
//SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
|
//try
|
//{
|
// DataSet oDs = new DataSet();
|
// //
|
// oCn.BeginTran();
|
// //领料出库
|
// if (oModel.HBillType == "24")
|
// {
|
// oDs = oCn.RunProcReturn("select HWHID,HSPID,HQty,HSumQtyMust,HSourceInterID,HSourceEntryID,HSourceBillType,HSourceBillNo from Kf_ICInventory_FIFO_Tmp where HInterID=" + oModel.HInterID.ToString() + " and HBillType='" + oModel.HBillType + "' and HBatchNo='" + oModel.HBatchNo + "' and HBarCode='" + oModel.HBarCode + "'", "Kf_ICInventory_FIFO_Tmp");
|
// //
|
// if (oDs != null && oDs.Tables[0].Rows.Count > 0)
|
// {
|
// double sKFQty = DBUtility.ClsPub.isDoule(oDs.Tables[0].Rows[0]["HQty"]);
|
// if (oModel.HQty > sKFQty)
|
// {
|
// oModel.HQty = sKFQty;
|
// }
|
// oModel.HWhID = DBUtility.ClsPub.isLong(oDs.Tables[0].Rows[0]["HWHID"]);
|
// oModel.HStockPlaceID = DBUtility.ClsPub.isLong(oDs.Tables[0].Rows[0]["HSPID"]);
|
// oModel.HQtyMust = DBUtility.ClsPub.isDoule(oDs.Tables[0].Rows[0]["HSumQtyMust"]);
|
// oModel.HSourceInterID = DBUtility.ClsPub.isLong(oDs.Tables[0].Rows[0]["HSourceInterID"]);
|
// oModel.HSourceEntryID = DBUtility.ClsPub.isLong(oDs.Tables[0].Rows[0]["HSourceEntryID"]);
|
// oModel.HSourceBillType = DBUtility.ClsPub.isStrNull(oDs.Tables[0].Rows[0]["HSourceBillType"]);
|
// oModel.HSourceBillNo = DBUtility.ClsPub.isStrNull(oDs.Tables[0].Rows[0]["HSourceBillNo"]);
|
// }
|
// else
|
// {
|
// oCn.Commit();
|
// oCn.CnClose();
|
// oCn.CnDispose();
|
// sReturn = "请根据先进先出清单扫码!";
|
// return false;
|
// }
|
// }
|
// //调拨
|
// else if (oModel.HBillType == "41")
|
// {
|
// oDs = oCn.RunProcReturn("select HWHID,HSPID,HQty,HSumQtyMust,HSourceInterID,HSourceEntryID,HSourceBillType,HSourceBillNo from Kf_ICInventory_FIFO_Tmp where HInterID=" + oModel.HInterID.ToString() + " and HBillType='" + oModel.HBillType + "' and HBatchNo='" + oModel.HBatchNo + "' and HBarCode='" + oModel.HBarCode + "'", "Kf_ICInventory_FIFO_Tmp");
|
// //
|
// if (oDs != null && oDs.Tables[0].Rows.Count > 0)
|
// {
|
// double sKFQty = DBUtility.ClsPub.isDoule(oDs.Tables[0].Rows[0]["HQty"]);
|
// if (oModel.HQty > sKFQty)
|
// {
|
// oModel.HQty = sKFQty;
|
// }
|
// oModel.HSCWHID = DBUtility.ClsPub.isLong(oDs.Tables[0].Rows[0]["HWHID"]);
|
// oModel.HOutStockPlaceID = DBUtility.ClsPub.isLong(oDs.Tables[0].Rows[0]["HSPID"]);
|
// oModel.HQtyMust = DBUtility.ClsPub.isDoule(oDs.Tables[0].Rows[0]["HSumQtyMust"]);
|
// oModel.HSourceInterID = DBUtility.ClsPub.isLong(oDs.Tables[0].Rows[0]["HSourceInterID"]);
|
// oModel.HSourceEntryID = DBUtility.ClsPub.isLong(oDs.Tables[0].Rows[0]["HSourceEntryID"]);
|
// oModel.HSourceBillType = DBUtility.ClsPub.isStrNull(oDs.Tables[0].Rows[0]["HSourceBillType"]);
|
// oModel.HSourceBillNo = DBUtility.ClsPub.isStrNull(oDs.Tables[0].Rows[0]["HSourceBillNo"]);
|
// }
|
// else
|
// {
|
// oCn.Commit();
|
// oCn.CnClose();
|
// oCn.CnDispose();
|
// sReturn = "请根据先进先出清单扫码!";
|
// return false;
|
// }
|
// }
|
// oCn.RunProc("Insert into " + MvarItemKey + " " +
|
// " (HInterID,HBillNo,HBillType,HMaterID,HProcID,HWhID,HSCWHID" +
|
// ",HStockPlaceID,HOutStockPlaceID,HGroupID,HQty,HQtyMust,HPieceQty " +
|
// ",HBatchNo,HBarCode,HAddr,HMaker,HMakeDate " +
|
// //",HVDAPack,HVDAMaterNum,HVDAQty " +
|
// ",HSourceInterID,HSourceEntryID,HSourceBillType,HSourceBillNo" +
|
// ",HRelationInterID,HRelationEntryID,HRelationBillNo,HRedBlueFlag) " +
|
// " Values(" + oModel.HInterID.ToString() + ",'" + oModel.HBillNo + "','" + 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.HQtyMust.ToString() + "," + oModel.HPieceQty.ToString() +
|
// ",'" + oModel.HBatchNo + "','" + oModel.HBarCode + "','" + oModel.HAddr + "','" + oModel.HMaker + "',getdate()" +
|
// //",'','',0" +
|
// "," + oModel.HSourceInterID.ToString() + "," + oModel.HSourceEntryID.ToString() + ",'" + oModel.HSourceBillType + "','" + oModel.HSourceBillNo + "'" +
|
// "," + oModel.HRelationInterID.ToString() + "," + oModel.HRelationEntryID.ToString() + ",'" + oModel.HRelationBillNo + "'," + Convert.ToString(oModel.HRedBlueFlag ? 1 : 0) + ")", ref DBUtility.ClsPub.sExeReturnInfo);
|
// //修改上级为非末级代码
|
// //oCn.RunProc("Update " + MvarItemKey + " set HEndflag=0 where HItemID=" + oModel.HParentID, ref DBUtility.ClsPub.sExeReturnInfo);
|
// oCn.Commit();
|
// oCn.CnClose();
|
// oCn.CnDispose();
|
// sReturn = "保存成功!";
|
return true;
|
//}
|
//catch (Exception e)
|
//{
|
// sReturn = e.Message;
|
// oCn.RollBack();
|
// throw (e);
|
//}
|
}
|
|
|
//新增
|
public bool AddNew_More(ref string sReturn)
|
{
|
//SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
|
//try
|
//{
|
// oCn.BeginTran();
|
// //箱号条码,批量新增
|
// oCn.RunProc("exec h_p_KF_PonderationBillMain_Audit_Temp_Add_Sell " + oModel.HInterID.ToString() + ",'" + oModel.HBillNo + "','" + oModel.HBillType + "','" + oModel.HBarCode + "'," + oModel.HWhID.ToString() + "," + oModel.HStockPlaceID.ToString() + "," + oModel.HSCWHID.ToString() + "," + oModel.HOutStockPlaceID.ToString() + ",'" + oModel.HMaker + "'," + Convert.ToString(oModel.HRedBlueFlag ? 1 : 0), ref DBUtility.ClsPub.sExeReturnInfo);
|
// oCn.Commit();
|
// oCn.CnClose();
|
// oCn.CnDispose();
|
// sReturn = "保存成功!";
|
return true;
|
//}
|
//catch (Exception e)
|
//{
|
// sReturn = e.Message;
|
// oCn.RollBack();
|
// throw (e);
|
//}
|
}
|
|
//新增(源单)
|
public bool AddNew_Source(ref string sReturn)
|
{
|
SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
|
try
|
{
|
DataSet oDs = new DataSet();
|
oCn.BeginTran();
|
oCn.RunProc("Insert into " + MvarItemKey + " " +
|
" (HInterID,HBillNo,HBillType,HMaterID,HProcID,HWhID,HSCWHID" +
|
",HStockPlaceID,HOutStockPlaceID,HGroupID,HQty,HQtyMust,HPieceQty " +
|
",HBatchNo,HBarCode,HAddr,HMaker,HMakeDate " +
|
",HSourceInterID,HSourceEntryID,HSourceBillType,HSourceBillNo" +
|
",HRelationInterID,HRelationEntryID,HRelationBillNo,HRedBlueFlag) " +
|
" Values(" + oModel.HInterID.ToString() + ",'" + oModel.HBillNo + "','" + 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.HQtyMust.ToString() + "," + oModel.HPieceQty.ToString() +
|
",'" + oModel.HBatchNo + "','" + oModel.HBarCode + "','" + oModel.HAddr + "','" + oModel.HMaker + "',getdate()" +
|
"," + oModel.HSourceInterID.ToString() + "," + oModel.HSourceEntryID.ToString() + ",'" + oModel.HSourceBillType + "','" + oModel.HSourceBillNo + "'" +
|
"," + oModel.HRelationInterID.ToString() + "," + oModel.HRelationEntryID.ToString() + ",'" + oModel.HRelationBillNo + "'," + Convert.ToString(oModel.HRedBlueFlag ? 1 : 0) + ")", ref DBUtility.ClsPub.sExeReturnInfo);
|
//修改上级为非末级代码
|
//oCn.RunProc("Update " + MvarItemKey + " set HEndflag=0 where HItemID=" + oModel.HParentID, ref DBUtility.ClsPub.sExeReturnInfo);
|
oCn.Commit();
|
oCn.CnClose();
|
oCn.CnDispose();
|
sReturn = "保存成功!";
|
return true;
|
}
|
catch (Exception e)
|
{
|
sReturn = e.Message;
|
oCn.RollBack();
|
throw (e);
|
}
|
}
|
|
//新增(源单)
|
public bool AddNew_Source(double sQty,ref string sReturn)
|
{
|
SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
|
try
|
{
|
DataSet oDs = new DataSet();
|
DataSet oDs2 = new DataSet();
|
oCn.BeginTran();
|
oDs2 = oCn.RunProcReturn("select sum(HQty) HQty from " + MvarItemKey + " where HSourceInterID=" + oModel.HSourceInterID.ToString() + " and HSourceEntryID=" + oModel.HSourceEntryID.ToString() + " and HQty > 0 ", "KF_PonderationBillMain_Audit_Temp");
|
|
if (sQty == 0)
|
{
|
oModel.HQty = oModel.HQtyMust - DBUtility.ClsPub.isDoule(oDs2.Tables[0].Rows[0]["HQty"]);
|
if (oModel.HQty <= 0)
|
{
|
sReturn = "扫描数量总和不能大于实际数量!";
|
return false;
|
}
|
}
|
else
|
{
|
oModel.HQty = DBUtility.ClsPub.isDoule(sQty);
|
if (oModel.HQty < 0)
|
{
|
sReturn = "输入的数量不能小于0!";
|
return false;
|
}
|
if (oModel.HQtyMust <= DBUtility.ClsPub.isDoule(oDs2.Tables[0].Rows[0]["HQty"]))
|
{
|
sReturn = "扫描数量总和不能大于实际数量!";
|
return false;
|
}
|
}
|
|
oModel.HQtyMust = 0;
|
|
oCn.RunProc("Insert into " + MvarItemKey + " " +
|
" (HInterID,HBillNo,HBillType,HMaterID,HProcID,HWhID,HSCWHID" +
|
",HStockPlaceID,HOutStockPlaceID,HGroupID,HQty,HQtyMust,HPieceQty " +
|
",HBatchNo,HBarCode,HAddr,HMaker,HMakeDate " +
|
",HSourceInterID,HSourceEntryID,HSourceBillType,HSourceBillNo" +
|
",HRelationInterID,HRelationEntryID,HRelationBillNo,HRedBlueFlag) " +
|
" Values(" + oModel.HInterID.ToString() + ",'" + oModel.HBillNo + "','" + 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.HQtyMust.ToString() + "," + oModel.HPieceQty.ToString() +
|
",'" + oModel.HBatchNo + "','" + oModel.HBarCode + "','" + oModel.HAddr + "','" + oModel.HMaker + "',getdate()" +
|
"," + oModel.HSourceInterID.ToString() + "," + oModel.HSourceEntryID.ToString() + ",'" + oModel.HSourceBillType + "','" + oModel.HSourceBillNo + "'" +
|
"," + oModel.HRelationInterID.ToString() + "," + oModel.HRelationEntryID.ToString() + ",'" + oModel.HRelationBillNo + "'," + Convert.ToString(oModel.HRedBlueFlag ? 1 : 0) + ")", ref DBUtility.ClsPub.sExeReturnInfo);
|
//修改上级为非末级代码
|
//oCn.RunProc("Update " + MvarItemKey + " set HEndflag=0 where HItemID=" + oModel.HParentID, ref DBUtility.ClsPub.sExeReturnInfo);
|
oCn.Commit();
|
oCn.CnClose();
|
oCn.CnDispose();
|
sReturn = "保存成功!";
|
return true;
|
}
|
catch (Exception e)
|
{
|
sReturn = e.Message;
|
oCn.RollBack();
|
throw (e);
|
}
|
}
|
|
//新增(源单) 根据源单单号 批量新增源单信息
|
public bool AddNew_Source(long sNewInterID, string sNewBillNo, string sNewBillType, string sSourceBillNo, string sSourceBillType, string sRedBlueflag, ref string sReturn)
|
{
|
SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
|
try
|
{
|
DataSet oDs = new DataSet();
|
oCn.BeginTran();
|
oDs = oCn.RunProcReturn("exec h_p_K3_SourceBill_Check_Add " + sNewInterID.ToString() + ",'" + sNewBillNo + "','" + sNewBillType + "','" + sSourceBillNo + "','" + sSourceBillType + "','" + sRedBlueflag + "'", "h_p_K3_SourceBill_Check_Add");
|
if (oDs.Tables[0].Rows.Count == 0 || oDs == null)
|
{
|
oCn.Commit();
|
oCn.CnClose();
|
oCn.CnDispose();
|
sReturn = "null未知错误!";
|
return false;
|
}
|
if (DBUtility.ClsPub.isLong(oDs.Tables[0].Rows[0][0]) == 1)
|
{
|
//输入源单信息不准确,请输入较完整的单据号
|
oCn.Commit();
|
oCn.CnClose();
|
oCn.CnDispose();
|
sReturn = "输入源单信息不准确,请输入较完整的单据号!";
|
return false;
|
}
|
else if (DBUtility.ClsPub.isLong(oDs.Tables[0].Rows[0][0]) == 9)
|
{
|
//保存成功
|
oCn.Commit();
|
oCn.CnClose();
|
oCn.CnDispose();
|
sReturn = "保存成功!";
|
return true;
|
}
|
else
|
{
|
oCn.Commit();
|
oCn.CnClose();
|
oCn.CnDispose();
|
sReturn = "else未知错误!";
|
return false;
|
}
|
//
|
}
|
catch (Exception e)
|
{
|
sReturn = e.Message;
|
oCn.RollBack();
|
throw (e);
|
}
|
}
|
|
|
//新增(源单) 根据源单单号 批量新增源单信息
|
public bool AddNew_Aduit_Source(long sNewInterID, string sNewBillNo, string sNewBillType, string sSourceBillNo, string sSourceBillType, string sRedBlueflag, ref string sReturn)
|
{
|
SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
|
try
|
{
|
DataSet oDs = new DataSet();
|
oCn.BeginTran();
|
oDs = oCn.RunProcReturn("exec h_p_K3_SourceBill_Audit_Add " + sNewInterID.ToString() + ",'" + sNewBillNo + "','" + sNewBillType + "','" + sSourceBillNo + "','" + sSourceBillType + "','" + sRedBlueflag + "'", "h_p_K3_SourceBill_Audit_Add");
|
if (oDs.Tables[0].Rows.Count == 0 || oDs == null)
|
{
|
oCn.Commit();
|
oCn.CnClose();
|
oCn.CnDispose();
|
sReturn = "null未知错误!";
|
return false;
|
}
|
if (DBUtility.ClsPub.isLong(oDs.Tables[0].Rows[0][0]) == 1)
|
{
|
//输入源单信息不准确,请输入较完整的单据号
|
oCn.Commit();
|
oCn.CnClose();
|
oCn.CnDispose();
|
sReturn = "输入源单信息不准确,请输入较完整的单据号!";
|
return false;
|
}
|
else if (DBUtility.ClsPub.isLong(oDs.Tables[0].Rows[0][0]) == 9)
|
{
|
//保存成功
|
oCn.Commit();
|
oCn.CnClose();
|
oCn.CnDispose();
|
sReturn = "保存成功!";
|
return true;
|
}
|
else
|
{
|
oCn.Commit();
|
oCn.CnClose();
|
oCn.CnDispose();
|
sReturn = "else未知错误!";
|
return false;
|
}
|
//
|
}
|
catch (Exception e)
|
{
|
sReturn = e.Message;
|
oCn.RollBack();
|
throw (e);
|
}
|
}
|
|
//新增(源单) 根据源单单号 批量新增源单信息(倒箱单)
|
public bool AddNew_Source_ChangeBox(long sNewInterID, string sNewBillNo, string sNewBillType, string sSourceBillNo, string sSourceBillType, string sRedBlueflag, long sInterID, string sBillNo, string sMaker, ref string sReturn)
|
{
|
//SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
|
//try
|
//{
|
// DataSet oDs = new DataSet();
|
// oCn.BeginTran();
|
// oDs = oCn.RunProcReturn("exec h_p_K3_SourceBill_Check_ChangeBox_Add " + sNewInterID.ToString() + ",'" + sNewBillNo + "','" + sNewBillType + "','" + sSourceBillNo + "','" + sSourceBillType + "','" + sRedBlueflag + "'," + sInterID.ToString() + ",'" + sBillNo + "','" + sMaker + "'", "h_p_K3_SourceBill_Check_ChangeBox_Add");
|
// if (oDs.Tables[0].Rows.Count == 0 || oDs == null)
|
// {
|
// oCn.Commit();
|
// oCn.CnClose();
|
// oCn.CnDispose();
|
// sReturn = "null未知错误!";
|
// return false;
|
// }
|
// if (DBUtility.ClsPub.isLong(oDs.Tables[0].Rows[0][0]) == 1)
|
// {
|
// //输入源单信息不准确,请输入较完整的单据号
|
// oCn.Commit();
|
// oCn.CnClose();
|
// oCn.CnDispose();
|
// sReturn = "输入源单信息不准确,请输入较完整的单据号!";
|
// return false;
|
// }
|
// else if (DBUtility.ClsPub.isLong(oDs.Tables[0].Rows[0][0]) == 9)
|
// {
|
// //保存成功
|
// oCn.Commit();
|
// oCn.CnClose();
|
// oCn.CnDispose();
|
// sReturn = "保存成功!";
|
return true;
|
// }
|
// else
|
// {
|
// oCn.Commit();
|
// oCn.CnClose();
|
// oCn.CnDispose();
|
// sReturn = "else未知错误!";
|
// return false;
|
// }
|
// //
|
//}
|
//catch (Exception e)
|
//{
|
// sReturn = e.Message;
|
// oCn.RollBack();
|
// throw (e);
|
//}
|
}
|
|
//新增(源单) 根据源单单号 批量新增源单信息 (先进先出)
|
public bool AddNew_Source_FIFO(long sNewInterID, string sNewBillNo, string sNewBillType, string sSourceBillNo, string sSourceBillType, long sHWHID, string sRedBlueflag, ref string sReturn)
|
{
|
//SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
|
//try
|
//{
|
// DataSet oDs = new DataSet();
|
// oCn.BeginTran();
|
// oDs = oCn.RunProcReturn("exec h_p_K3_SourceBill_Check_FIFO_Add " + sNewInterID.ToString() + ",'" + sNewBillNo + "','" + sNewBillType + "','" + sSourceBillNo + "','" + sSourceBillType + "'," + sHWHID.ToString(), "h_p_K3_SourceBill_Check_FIFO_Add");
|
// if (oDs.Tables[0].Rows.Count == 0 || oDs == null)
|
// {
|
// oCn.Commit();
|
// oCn.CnClose();
|
// oCn.CnDispose();
|
// sReturn = "null未知错误!";
|
// return false;
|
// }
|
// if (DBUtility.ClsPub.isLong(oDs.Tables[0].Rows[0][0]) == 1)
|
// {
|
// //输入源单信息不准确,请输入较完整的单据号
|
// oCn.Commit();
|
// oCn.CnClose();
|
// oCn.CnDispose();
|
// sReturn = "输入源单信息不准确,请输入较完整的单据号!";
|
// return false;
|
// }
|
// else if (DBUtility.ClsPub.isLong(oDs.Tables[0].Rows[0][0]) == 9)
|
// {
|
// //保存成功
|
// oCn.Commit();
|
// oCn.CnClose();
|
// oCn.CnDispose();
|
// sReturn = "保存成功!";
|
return true;
|
// }
|
// else
|
// {
|
// oCn.Commit();
|
// oCn.CnClose();
|
// oCn.CnDispose();
|
// sReturn = "else未知错误!";
|
// return false;
|
// }
|
// //
|
//}
|
//catch (Exception e)
|
//{
|
// sReturn = e.Message;
|
// oCn.RollBack();
|
// throw (e);
|
//}
|
}
|
|
|
//新增(一张单据,存在相同物料)
|
public bool AddNew_Select_Check(ref string sReturn)
|
{
|
//SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
|
//try
|
//{
|
// DataSet oDs = new DataSet();
|
// oCn.BeginTran();
|
// oDs = oCn.RunProcReturn("select HQtyMust,HWhID,HStockPlaceID,HSCWHID,HOutStockPlaceID from " + MvarItemKey + " where HInterID=" + oModel.HInterID.ToString() + " and HMaterID=" + oModel.HMaterID.ToString() + " and HSourceInterID=" + oModel.HSourceInterID + " and HSourceEntryID=" + oModel.HSourceEntryID, "KF_PonderationBillMain_Audit_Temp");
|
// if (oDs != null && oDs.Tables[0].Rows.Count > 0)
|
// {
|
// oModel.HQtyMust =0;
|
// oModel.HWhID = DBUtility.ClsPub.isLong(oDs.Tables[0].Rows[0]["HWhID"]);
|
// oModel.HStockPlaceID = DBUtility.ClsPub.isLong(oDs.Tables[0].Rows[0]["HStockPlaceID"]);
|
// oModel.HSCWHID = DBUtility.ClsPub.isLong(oDs.Tables[0].Rows[0]["HSCWHID"]);
|
// oModel.HOutStockPlaceID = DBUtility.ClsPub.isLong(oDs.Tables[0].Rows[0]["HOutStockPlaceID"]);
|
// oModel.HBatchNo = DBUtility.ClsPub.isStrNull(oDs.Tables[0].Rows[0]["HBatchNo"]);
|
// }
|
// oCn.RunProc("Insert into " + MvarItemKey + " " +
|
// " (HInterID,HBillNo,HBillType,HMaterID,HProcID,HWhID,HSCWHID" +
|
// ",HStockPlaceID,HOutStockPlaceID,HGroupID,HQty,HQtyMust,HPieceQty " +
|
// ",HBatchNo,HBarCode,HAddr,HMaker,HMakeDate " +
|
// //",HVDAPack,HVDAMaterNum,HVDAQty " +
|
// ",HSourceInterID,HSourceEntryID,HSourceBillType,HSourceBillNo" +
|
// ",HRelationInterID,HRelationEntryID,HRelationBillNo,HRedBlueFlag) " +
|
// " Values(" + oModel.HInterID.ToString() + ",'" + oModel.HBillNo + "','" + 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.HQtyMust.ToString() + "," + oModel.HPieceQty.ToString() +
|
// ",'" + oModel.HBatchNo + "','" + oModel.HBarCode + "','" + oModel.HAddr + "','" + oModel.HMaker + "',getdate()" +
|
// //",'','',0 " +
|
// "," + oModel.HSourceInterID.ToString() + "," + oModel.HSourceEntryID.ToString() + ",'" + oModel.HSourceBillType + "','" + oModel.HSourceBillNo + "'" +
|
// "," + oModel.HRelationInterID.ToString() + "," + oModel.HRelationEntryID.ToString() + ",'" + oModel.HRelationBillNo + "'," + Convert.ToString(oModel.HRedBlueFlag ? 1 : 0) + ")", ref DBUtility.ClsPub.sExeReturnInfo);
|
// //修改上级为非末级代码
|
// //oCn.RunProc("Update " + MvarItemKey + " set HEndflag=0 where HItemID=" + oModel.HParentID, ref DBUtility.ClsPub.sExeReturnInfo);
|
// oCn.Commit();
|
// oCn.CnClose();
|
// oCn.CnDispose();
|
// sReturn = "保存成功!";
|
return true;
|
//}
|
//catch (Exception e)
|
//{
|
// sReturn = e.Message;
|
// oCn.RollBack();
|
// throw (e);
|
//}
|
}
|
|
//新增(一张单据,存在相同物料)
|
public bool AddNew_Select(ref string sReturn)
|
{
|
//SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
|
//try
|
//{
|
// DataSet oDs = new DataSet();
|
// oCn.BeginTran();
|
// oDs = oCn.RunProcReturn("select HQtyMust from " + MvarItemKey + " where HInterID=" + oModel.HInterID.ToString() + " and HMaterID=" + oModel.HMaterID.ToString() + " and HSourceInterID=" + oModel.HSourceInterID + " and HSourceEntryID=" + oModel.HSourceEntryID, "KF_PonderationBillMain_Audit_Temp");
|
// if (oDs != null && oDs.Tables[0].Rows.Count > 0)
|
// {
|
// oModel.HQtyMust = DBUtility.ClsPub.isDoule(oDs.Tables[0].Rows[0]["HQtyMust"]);
|
// }
|
// oCn.RunProc("Insert into " + MvarItemKey + " " +
|
// " (HInterID,HBillNo,HBillType,HMaterID,HProcID,HWhID,HSCWHID" +
|
// ",HStockPlaceID,HOutStockPlaceID,HGroupID,HQty,HQtyMust,HPieceQty " +
|
// ",HBatchNo,HBarCode,HAddr,HMaker,HMakeDate " +
|
// //",HVDAPack,HVDAMaterNum,HVDAQty " +
|
// ",HSourceInterID,HSourceEntryID,HSourceBillType,HSourceBillNo" +
|
// ",HRelationInterID,HRelationEntryID,HRelationBillNo,HRedBlueFlag) " +
|
// " Values(" + oModel.HInterID.ToString() + ",'" + oModel.HBillNo + "','" + 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.HQtyMust.ToString() + "," + oModel.HPieceQty.ToString() +
|
// ",'" + oModel.HBatchNo + "','" + oModel.HBarCode + "','" + oModel.HAddr + "','" + oModel.HMaker + "',getdate()" +
|
// //",'','', 0 " +
|
// "," + oModel.HSourceInterID.ToString() + "," + oModel.HSourceEntryID.ToString() + ",'" + oModel.HSourceBillType + "','" + oModel.HSourceBillNo + "'" +
|
// "," + oModel.HRelationInterID.ToString() + "," + oModel.HRelationEntryID.ToString() + ",'" + oModel.HRelationBillNo + "'," + Convert.ToString(oModel.HRedBlueFlag ? 1 : 0) + ")", ref DBUtility.ClsPub.sExeReturnInfo);
|
// //修改上级为非末级代码
|
// //oCn.RunProc("Update " + MvarItemKey + " set HEndflag=0 where HItemID=" + oModel.HParentID, ref DBUtility.ClsPub.sExeReturnInfo);
|
// oCn.Commit();
|
// oCn.CnClose();
|
// oCn.CnDispose();
|
// sReturn = "保存成功!";
|
return true;
|
//}
|
//catch (Exception e)
|
//{
|
// sReturn = e.Message;
|
// oCn.RollBack();
|
// throw (e);
|
//}
|
}
|
|
|
//新增(一张单据,存在相同物料)
|
public bool AddNew_More_Select(ref string sReturn)
|
{
|
//SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
|
//try
|
//{
|
// oCn.BeginTran();
|
// //箱号条码,批量新增
|
// oCn.RunProc("exec h_p_KF_PonderationBillMain_Audit_Temp_Add_Select " + oModel.HInterID.ToString() + ",'" + oModel.HBillNo + "','" + oModel.HBillType + "','" + oModel.HBarCode + "','" + oModel.HMaker + "'," + oModel.HSourceInterID + "," + oModel.HSourceEntryID, ref DBUtility.ClsPub.sExeReturnInfo);
|
// oCn.Commit();
|
// oCn.CnClose();
|
// oCn.CnDispose();
|
// sReturn = "保存成功!";
|
return true;
|
//}
|
//catch (Exception e)
|
//{
|
// sReturn = e.Message;
|
// oCn.RollBack();
|
// throw (e);
|
//}
|
}
|
|
//新增(盘点 扫仓库带出该仓库所有库存信息)
|
public bool AddNew_CheckStock(long HInterID, string HBillNo, string sBillType, long HWHID, long HSPID, ref string sReturn)
|
{
|
//SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
|
//try
|
//{
|
// oCn.BeginTran();
|
// //批量新增
|
// oCn.RunProc("exec h_p_Kf_CheckStock_Add " + HInterID.ToString() + ",'" + HBillNo + "','" + sBillType + "'," + HWHID.ToString() + "," + HSPID.ToString(), ref DBUtility.ClsPub.sExeReturnInfo);
|
// oCn.Commit();
|
// oCn.CnClose();
|
// oCn.CnDispose();
|
// sReturn = "保存成功!";
|
return true;
|
//}
|
//catch (Exception e)
|
//{
|
// sReturn = e.Message;
|
// oCn.RollBack();
|
// throw (e);
|
//}
|
}
|
|
//新增(常规物料条码记录)
|
public bool AddNew_More_ChangGui(long HInterID, long HMaterID, string sBillType, double sQty, ref string sReturn)
|
{
|
//SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
|
//try
|
//{
|
// oCn.BeginTran();
|
// //批量新增
|
// oCn.RunProc("exec h_p_KF_PonderationBillMain_Audit_Temp_Add_ChangGui " + HInterID + ",'" + sBillType + "'," + HMaterID + "," + sQty, ref DBUtility.ClsPub.sExeReturnInfo);
|
// oCn.Commit();
|
// oCn.CnClose();
|
// oCn.CnDispose();
|
// sReturn = "保存成功!";
|
return true;
|
//}
|
//catch (Exception e)
|
//{
|
// sReturn = e.Message;
|
// oCn.RollBack();
|
// throw (e);
|
//}
|
}
|
|
//新增(常规物料条码记录)
|
public bool AddNew_More_ChangGui(long HInterID, long HMaterID, Int64 HWhID, Int64 HSPID, Int64 HSCWhID, Int64 HSCSPID, string HBatchNo, Int64 HSourceInterID, Int64 HSourceEntryID, string sBarCode, string sBillType, double sQty, ref string sReturn)
|
{
|
//SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
|
//try
|
//{
|
// oCn.BeginTran();
|
// //批量新增
|
// oCn.RunProc("exec h_p_KF_PonderationBillMain_Audit_Temp_Add_BatchNo " + HInterID + ",'" + sBillType + "'" +
|
// "," + HMaterID +
|
// "," + HWhID +
|
// "," + HSPID +
|
// "," + HSCWhID +
|
// "," + HSCSPID +
|
// ",'" + HBatchNo + "'" +
|
// "," + HSourceInterID +
|
// "," + HSourceEntryID +
|
// ",'" + sBarCode + "'" +
|
// "," + sQty, ref DBUtility.ClsPub.sExeReturnInfo);
|
// oCn.Commit();
|
// oCn.CnClose();
|
// oCn.CnDispose();
|
// sReturn = "保存成功!";
|
return true;
|
//}
|
//catch (Exception e)
|
//{
|
// sReturn = e.Message;
|
// oCn.RollBack();
|
// throw (e);
|
//}
|
}
|
|
//减少(常规物料条码记录)
|
public bool AddNew_Clear_ChangGui(long HInterID, long HMaterID, Int64 HWhID, Int64 HSPID, Int64 HSCWhID, Int64 HSCSPID, string HBatchNo, Int64 HSourceInterID, Int64 HSourceEntryID, string sBarCode, string sBillType, double sQty, ref string sReturn)
|
{
|
//SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
|
//try
|
//{
|
// oCn.BeginTran();
|
// //批量新增
|
// oCn.RunProc("exec h_p_KF_PonderationBillMain_Audit_Temp_Clear_BatchNo " + HInterID + ",'" + sBillType + "'" +
|
// "," + HMaterID +
|
// "," + HWhID +
|
// "," + HSPID +
|
// "," + HSCWhID +
|
// "," + HSCSPID +
|
// ",'" + HBatchNo + "'" +
|
// "," + HSourceInterID +
|
// "," + HSourceEntryID +
|
// ",'" + sBarCode + "'" +
|
// "," + sQty, ref DBUtility.ClsPub.sExeReturnInfo);
|
// oCn.Commit();
|
// oCn.CnClose();
|
// oCn.CnDispose();
|
// sReturn = "减少成功!";
|
return true;
|
//}
|
//catch (Exception e)
|
//{
|
// sReturn = e.Message;
|
// oCn.RollBack();
|
// throw (e);
|
//}
|
}
|
|
|
|
//新增
|
public override bool AddNew()
|
{
|
SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
|
try
|
{
|
oCn.BeginTran();
|
oCn.RunProc("Insert into " + MvarItemKey + " " +
|
" (HInterID,HBillNo,HBillType,HMaterID,HProcID,HWhID,HSCWHID" +
|
",HStockPlaceID,HOutStockPlaceID,HGroupID,HQty,HQtyMust,HPieceQty " +
|
",HBarCode,HAddr,HMaker,HMakeDate " +
|
",HSourceInterID,HSourceEntryID,HSourceBillType,HSourceBillNo" +
|
",HRelationInterID,HRelationEntryID,HRelationBillNo) " +
|
" Values(" + oModel.HInterID.ToString() + ",'" + oModel.HBillNo + "','" + 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.HQtyMust.ToString() + "," + oModel.HPieceQty.ToString() +
|
",'" + oModel.HBarCode + "','" + oModel.HAddr + "','" + oModel.HMaker + "',getdate()" +
|
"," + oModel.HSourceInterID.ToString() + "," + oModel.HSourceEntryID.ToString() + ",'" + oModel.HSourceBillType + "','" +oModel.HSourceBillNo+"'"+
|
"," + oModel.HRelationInterID.ToString() + "," + oModel.HRelationEntryID.ToString() + ",'" + oModel.HRelationBillNo + "')", ref DBUtility.ClsPub.sExeReturnInfo);
|
//修改上级为非末级代码
|
//oCn.RunProc("Update " + MvarItemKey + " set HEndflag=0 where HItemID=" + oModel.HParentID, ref DBUtility.ClsPub.sExeReturnInfo);
|
oCn.Commit();
|
oCn.CnClose();
|
oCn.CnDispose();
|
return true;
|
}
|
catch (Exception e)
|
{
|
oCn.RollBack();
|
throw (e);
|
}
|
}
|
|
//新增
|
public bool AddNew_More()
|
{
|
//SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
|
//try
|
//{
|
// oCn.BeginTran();
|
// //箱号条码,批量新增
|
// oCn.RunProc("exec h_p_KF_PonderationBillMain_Audit_Temp_Add " + oModel.HInterID.ToString() + "," + oModel.HWhID.ToString() + ",'" + oModel.HBillType + "','" + oModel.HBarCode + "'," + oModel.HSourceInterID.ToString() + "," + oModel.HSourceEntryID.ToString() + ",'" + oModel.HSourceBillType + "','" + oModel.HMaker + "'", ref DBUtility.ClsPub.sExeReturnInfo);
|
// oCn.Commit();
|
// oCn.CnClose();
|
// oCn.CnDispose();
|
return true;
|
//}
|
//catch (Exception e)
|
//{
|
// oCn.RollBack();
|
// throw (e);
|
//}
|
}
|
|
public bool AddNew_Sell()
|
{
|
//SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
|
//try
|
//{
|
// DataSet oDs = new DataSet();
|
// oCn.BeginTran();
|
// oDs = oCn.RunProcReturn("select * from " + MvarItemKey + " where HInterID=" + oModel.HInterID.ToString() + " and HMaterID=" + oModel.HMaterID.ToString(), "KF_PonderationBillMain_Audit_Temp");
|
// if (oDs == null || oDs.Tables[0].Rows.Count == 0)
|
// {
|
// return false;
|
// }
|
// else
|
// {
|
// //if (oModel.HBillType == "21")
|
// //{
|
// // oModel.HWhID = DBUtility.ClsPub.isLong(oDs.Tables[0].Rows[0]["HWhID"]);
|
// //}
|
// //else if (oModel.HBillType == "41")
|
// //{
|
// // oModel.HSCWHID = DBUtility.ClsPub.isLong(oDs.Tables[0].Rows[0]["HSCWhID"]);
|
// //}
|
// oModel.HQtyMust = DBUtility.ClsPub.isLong(oDs.Tables[0].Rows[0]["HQtyMust"]);
|
// oModel.HSourceInterID = DBUtility.ClsPub.isLong(oDs.Tables[0].Rows[0]["HSourceInterID"]);
|
// oModel.HSourceEntryID = DBUtility.ClsPub.isLong(oDs.Tables[0].Rows[0]["HSourceEntryID"]);
|
// oModel.HSourceBillType = DBUtility.ClsPub.isStrNull(oDs.Tables[0].Rows[0]["HSourceBillType"]);
|
// oModel.HSourceBillNo = DBUtility.ClsPub.isStrNull(oDs.Tables[0].Rows[0]["HSourceBillNo"]);
|
// }
|
// oCn.RunProc("Insert into " + MvarItemKey + " " +
|
// " (HInterID,HBillNo,HBillType,HMaterID,HProcID,HWhID,HSCWHID" +
|
// ",HStockPlaceID,HOutStockPlaceID,HGroupID,HQty,HQtyMust,HPieceQty " +
|
// ",HBarCode,HAddr,HMaker,HMakeDate " +
|
// ",HSourceInterID,HSourceEntryID,HSourceBillType,HSourceBillNo" +
|
// ",HRelationInterID,HRelationEntryID,HRelationBillNo) " +
|
// " Values(" + oModel.HInterID.ToString() + ",'" + oModel.HBillNo + "','" + 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.HQtyMust.ToString() + "," + oModel.HPieceQty.ToString() +
|
// ",'" + oModel.HBarCode + "','" + oModel.HAddr + "','" + oModel.HMaker + "',getdate()" +
|
// "," + oModel.HSourceInterID.ToString() + "," + oModel.HSourceEntryID.ToString() + ",'" + oModel.HSourceBillType + "','" + oModel.HSourceBillNo + "'" +
|
// "," + oModel.HRelationInterID.ToString() + "," + oModel.HRelationEntryID.ToString() + ",'" + oModel.HRelationBillNo + "')", ref DBUtility.ClsPub.sExeReturnInfo);
|
// //修改上级为非末级代码
|
// //oCn.RunProc("Update " + MvarItemKey + " set HEndflag=0 where HItemID=" + oModel.HParentID, ref DBUtility.ClsPub.sExeReturnInfo);
|
// oCn.Commit();
|
// oCn.CnClose();
|
// oCn.CnDispose();
|
return true;
|
//}
|
//catch (Exception e)
|
//{
|
// oCn.RollBack();
|
// throw (e);
|
//}
|
}
|
|
//新增
|
public bool AddNew_More_Sell()
|
{
|
//SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
|
//try
|
//{
|
// oCn.BeginTran();
|
// //箱号条码,批量新增
|
// oCn.RunProc("exec h_p_KF_PonderationBillMain_Audit_Temp_Add_Sell " + oModel.HInterID.ToString() + ",'" + oModel.HBillNo + "','" + oModel.HBillType + "','" + oModel.HBarCode + "'," + oModel.HWhID.ToString() + "," + oModel.HSCWHID.ToString() + ",'" + oModel.HMaker + "'", ref DBUtility.ClsPub.sExeReturnInfo);
|
// oCn.Commit();
|
// oCn.CnClose();
|
// oCn.CnDispose();
|
return true;
|
//}
|
//catch (Exception e)
|
//{
|
// oCn.RollBack();
|
// throw (e);
|
//}
|
}
|
|
//新增(一张单据,存在相同物料)
|
public bool AddNew_Select()
|
{
|
//SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
|
//try
|
//{
|
// DataSet oDs = new DataSet();
|
// oCn.BeginTran();
|
// oDs = oCn.RunProcReturn("select * from " + MvarItemKey + " where HInterID=" + oModel.HInterID.ToString() + " and HMaterID=" + oModel.HMaterID.ToString() + " and HSourceInterID=" + oModel.HSourceInterID + " and HSourceEntryID=" + oModel.HSourceEntryID, "KF_PonderationBillMain_Audit_Temp");
|
// if (oDs == null || oDs.Tables[0].Rows.Count == 0)
|
// {
|
// return false;
|
// }
|
// else
|
// {
|
// //if (oModel.HBillType == "21")
|
// //{
|
// // oModel.HWhID = DBUtility.ClsPub.isLong(oDs.Tables[0].Rows[0]["HWhID"]);
|
// //}
|
// //else if (oModel.HBillType == "41")
|
// //{
|
// // oModel.HSCWHID = DBUtility.ClsPub.isLong(oDs.Tables[0].Rows[0]["HSCWhID"]);
|
// //}
|
// oModel.HQtyMust = DBUtility.ClsPub.isLong(oDs.Tables[0].Rows[0]["HQtyMust"]);
|
// oModel.HSourceInterID = DBUtility.ClsPub.isLong(oDs.Tables[0].Rows[0]["HSourceInterID"]);
|
// oModel.HSourceEntryID = DBUtility.ClsPub.isLong(oDs.Tables[0].Rows[0]["HSourceEntryID"]);
|
// oModel.HSourceBillType = DBUtility.ClsPub.isStrNull(oDs.Tables[0].Rows[0]["HSourceBillType"]);
|
// oModel.HSourceBillNo = DBUtility.ClsPub.isStrNull(oDs.Tables[0].Rows[0]["HSourceBillNo"]);
|
// }
|
// oCn.RunProc("Insert into " + MvarItemKey + " " +
|
// " (HInterID,HBillNo,HBillType,HMaterID,HProcID,HWhID,HSCWHID" +
|
// ",HStockPlaceID,HOutStockPlaceID,HGroupID,HQty,HQtyMust,HPieceQty " +
|
// ",HBarCode,HAddr,HMaker,HMakeDate " +
|
// ",HSourceInterID,HSourceEntryID,HSourceBillType,HSourceBillNo" +
|
// ",HRelationInterID,HRelationEntryID,HRelationBillNo) " +
|
// " Values(" + oModel.HInterID.ToString() + ",'" + oModel.HBillNo + "','" + 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.HQtyMust.ToString() + "," + oModel.HPieceQty.ToString() +
|
// ",'" + oModel.HBarCode + "','" + oModel.HAddr + "','" + oModel.HMaker + "',getdate()" +
|
// "," + oModel.HSourceInterID.ToString() + "," + oModel.HSourceEntryID.ToString() + ",'" + oModel.HSourceBillType + "','" + oModel.HSourceBillNo + "'" +
|
// "," + oModel.HRelationInterID.ToString() + "," + oModel.HRelationEntryID.ToString() + ",'" + oModel.HRelationBillNo + "')", ref DBUtility.ClsPub.sExeReturnInfo);
|
// //修改上级为非末级代码
|
// //oCn.RunProc("Update " + MvarItemKey + " set HEndflag=0 where HItemID=" + oModel.HParentID, ref DBUtility.ClsPub.sExeReturnInfo);
|
// oCn.Commit();
|
// oCn.CnClose();
|
// oCn.CnDispose();
|
return true;
|
//}
|
//catch (Exception e)
|
//{
|
// oCn.RollBack();
|
// throw (e);
|
//}
|
}
|
|
//新增(一张单据,存在相同物料)
|
public bool AddNew_More_Select()
|
{
|
//SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
|
//try
|
//{
|
// oCn.BeginTran();
|
// //箱号条码,批量新增
|
// oCn.RunProc("exec h_p_KF_PonderationBillMain_Audit_Temp_Add_Select " + oModel.HInterID.ToString() + ",'" + oModel.HBillNo + "','" + oModel.HBillType + "','" + oModel.HBarCode + "','" + oModel.HMaker + "'," + oModel.HSourceInterID + "," + oModel.HSourceEntryID, ref DBUtility.ClsPub.sExeReturnInfo);
|
// oCn.Commit();
|
// oCn.CnClose();
|
// oCn.CnDispose();
|
return true;
|
//}
|
//catch (Exception e)
|
//{
|
// oCn.RollBack();
|
// throw (e);
|
//}
|
}
|
|
//新增(出入库单据已经生成,需要关联条码记录时)
|
public bool AddNew_Check(ref string sReturn)
|
{
|
//SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
|
//try
|
//{
|
// oCn.BeginTran();
|
// //箱号条码,批量新增
|
// oCn.RunProc("exec h_p_KF_PonderationBillMain_Audit_Temp_Add_Check " + oModel.HInterID.ToString() + ",'" + oModel.HBillNo + "','" + oModel.HBillType + "'," + oModel.HMaterID.ToString() + "," + oModel.HQty.ToString() + ",'" + oModel.HBarCode + "','" + oModel.HMaker + "'," + Convert.ToString(oModel.HRedBlueFlag ? 1 : 0), ref DBUtility.ClsPub.sExeReturnInfo);
|
// oCn.Commit();
|
// oCn.CnClose();
|
// oCn.CnDispose();
|
// sReturn = "保存成功!";
|
return true;
|
//}
|
//catch (Exception e)
|
//{
|
// sReturn = e.Message;
|
// oCn.RollBack();
|
// throw (e);
|
//}
|
}
|
|
//新增(常规物料条码记录)
|
public bool AddNew_More_ChangGui(long HInterID, long HMaterID, string sBillType, int sQty)
|
{
|
//SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
|
//try
|
//{
|
// oCn.BeginTran();
|
// //批量新增
|
// oCn.RunProc("exec h_p_KF_PonderationBillMain_Audit_Temp_Add_ChangGui " + HInterID + ",'" + sBillType + "'," + HMaterID + "," + sQty, ref DBUtility.ClsPub.sExeReturnInfo);
|
// oCn.Commit();
|
// oCn.CnClose();
|
// oCn.CnDispose();
|
return true;
|
//}
|
//catch (Exception e)
|
//{
|
// oCn.RollBack();
|
// throw (e);
|
//}
|
}
|
|
//新增(常规物料条码记录)
|
public bool AddNew_More_ChangGui(long HInterID, long HMaterID, Int64 HWhID, Int64 HSPID, Int64 HSCWhID, Int64 HSCSPID, string HBatchNo, Int64 HSourceInterID, Int64 HSourceEntryID, string sBarCode, string sBillType, int sQty)
|
{
|
//SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
|
//try
|
//{
|
// oCn.BeginTran();
|
// //批量新增
|
// oCn.RunProc("exec h_p_KF_PonderationBillMain_Audit_Temp_Add_BatchNo " + HInterID + ",'" + sBillType + "'" +
|
// "," + HMaterID +
|
// "," + HWhID +
|
// "," + HSPID +
|
// "," + HSCWhID +
|
// "," + HSCSPID +
|
// ",'" + HBatchNo + "'" +
|
// "," + HSourceInterID +
|
// "," + HSourceEntryID +
|
// ",'" + sBarCode + "'" +
|
// "," + sQty, ref DBUtility.ClsPub.sExeReturnInfo);
|
// oCn.Commit();
|
// oCn.CnClose();
|
// oCn.CnDispose();
|
return true;
|
//}
|
//catch (Exception e)
|
//{
|
// oCn.RollBack();
|
// throw (e);
|
//}
|
}
|
|
//减少(常规物料条码记录)
|
public bool AddNew_Clear_ChangGui(long HInterID, long HMaterID, Int64 HWhID, Int64 HSPID, Int64 HSCWhID, Int64 HSCSPID, string HBatchNo, Int64 HSourceInterID, Int64 HSourceEntryID, string sBarCode, string sBillType, int sQty)
|
{
|
//SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
|
//try
|
//{
|
// oCn.BeginTran();
|
// //批量新增
|
// oCn.RunProc("exec h_p_KF_PonderationBillMain_Audit_Temp_Clear_BatchNo " + HInterID + ",'" + sBillType + "'" +
|
// "," + HMaterID +
|
// "," + HWhID +
|
// "," + HSPID +
|
// "," + HSCWhID +
|
// "," + HSCSPID +
|
// ",'" + HBatchNo + "'" +
|
// "," + HSourceInterID +
|
// "," + HSourceEntryID +
|
// ",'" + sBarCode + "'" +
|
// "," + sQty, ref DBUtility.ClsPub.sExeReturnInfo);
|
// oCn.Commit();
|
// oCn.CnClose();
|
// oCn.CnDispose();
|
return true;
|
//}
|
//catch (Exception e)
|
//{
|
// oCn.RollBack();
|
// throw (e);
|
//}
|
}
|
|
|
//修改
|
public override bool ModifyByID(Int64 sItemID)
|
{
|
SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
|
try
|
{
|
oCn.BeginTran();
|
//oCn.RunProc("Update " + MvarItemKey + " set " +
|
// " HNumber='" + oModel.HNumber + "'" +
|
// ",HName='" + oModel.HName + "'" +
|
// ",HShortNumber='" + oModel.HShortNumber + "'" +
|
// ",HHelpCode='" + oModel.HHelpCode + "'" +
|
// ",HLevel=" + oModel.HLevel.ToString() +
|
// ",HParentID=" + oModel.HParentID.ToString() +
|
// ",HEndflag=" + Convert.ToString(oModel.HEndFlag ? 1 : 0) +
|
// ",HStopflag=" + Convert.ToString(oModel.HStopflag ? 1 : 0) +
|
// ",HEnglishName='" + oModel.HEnglishName + "'" +
|
// ",HRemark= '" + oModel.HRemark + "' Where HItemID=" + sItemID, ref DBUtility.ClsPub.sExeReturnInfo);
|
//修改子项目代码
|
//oCn.RunProc("exec h_p_Gy_UpdateNumber '" + MvarItemKey + "','" + oModel.HNumber + ".','" + this.HOldNumber + ".'", ref DBUtility.ClsPub.sExeReturnInfo);
|
////将上级 为非末级
|
//oCn.RunProc("Update " + MvarItemKey + " set HEndflag=0 where HItemID=" + oModel.HParentID, ref DBUtility.ClsPub.sExeReturnInfo);
|
//
|
oCn.CnClose();
|
oCn.CnDispose();
|
oCn.Commit();
|
return true;
|
}
|
catch (Exception e)
|
{
|
oCn.RollBack();
|
throw (e);
|
}
|
}
|
//根据代码判断信息
|
public override bool HavParentCode(string sCode, Int64 sItemID)
|
{
|
DataSet DS;
|
try
|
{
|
//DS = oCn.RunProcReturn("Select * from " + MvarItemKey + " Where HStopflag=0 and HNumber='" + sCode + "' and HItemID<>" + sItemID, MvarItemKey, ref Pub_Class.ClsPub.sExeReturnInfo);
|
//if (DS.Tables[0].Rows.Count == 0)
|
// return false;
|
//else
|
//{
|
// oModel.HItemID = Convert.ToInt64(DS.Tables[0].Rows[0]["HItemID"]);
|
return true;
|
//}
|
}
|
catch (Exception e)
|
{
|
throw (e);
|
}
|
}
|
|
//判断条码 入库数量是否超过条码本身额定数量
|
public bool IsBarCode(string sBarCode, string sBillType, bool sRedBlueFlag, ref double sQty, ref string sReturn)
|
{
|
//SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
|
//DataSet DS;
|
//try
|
//{
|
// DS = oCn.RunProcReturn("exec h_p_K3_IsBarCode '" + sBarCode + "'," + sQty.ToString(), "h_p_K3_IsBarCode", ref DBUtility.ClsPub.sExeReturnInfo);
|
// if (DS.Tables[0].Rows.Count == 0)
|
// {
|
// sQty = sQty;
|
// oCn.CnClose();
|
// oCn.CnDispose();
|
// sReturn = "正常!";
|
// return true; //不存在 入库数量超过条码本身额定数量 条码
|
// }
|
// else
|
// {
|
// if (DBUtility.ClsPub.isDoule(DS.Tables[0].Rows[0]["HQty"]) <= 0)
|
// {
|
// sQty = 0;
|
// oCn.CnClose();
|
// oCn.CnDispose();
|
// sReturn = "此条码已被其他单据扫描!";
|
// return false;
|
// }
|
// else
|
// {
|
// sQty = DBUtility.ClsPub.isDoule(DS.Tables[0].Rows[0]["HQty"]);
|
// oCn.CnClose();
|
// oCn.CnDispose();
|
// sReturn = "已获取未扫描数量!";
|
return true;
|
// }
|
// }
|
//}
|
//catch (Exception e)
|
//{
|
// sReturn = e.Message;
|
// throw (e);
|
//}
|
}
|
|
//判断条码临时表中是否存在
|
public bool IsBarCode(string sBarCode, long HInterID, long HErpClsID, string sBillType)
|
{
|
SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
|
DataSet DS;
|
try
|
{
|
//if (HErpClsID == 2)
|
//{
|
// return true;
|
//}
|
DS = oCn.RunProcReturn("Select 1 from KF_PonderationBillMain_Audit_Temp Where HInterID=" + HInterID.ToString() + " and HSourceLine=0 and HBarCode='" + sBarCode + "' and HBillType='" + sBillType + "'", "KF_PonderationBillMain_Audit_Temp", ref DBUtility.ClsPub.sExeReturnInfo);
|
if (DS.Tables[0].Rows.Count == 0)
|
{
|
|
oCn.CnClose();
|
oCn.CnDispose();
|
return true; //不存在相同条码
|
}
|
else
|
{
|
oCn.CnClose();
|
oCn.CnDispose();
|
return false;
|
}
|
}
|
catch (Exception e)
|
{
|
throw (e);
|
}
|
}
|
|
|
//判断条码临时表中是否存在
|
public bool IsBarCode(string sBarCode, long HInterID, string sBillType)
|
{
|
SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
|
DataSet DS;
|
try
|
{
|
DS = oCn.RunProcReturn("Select * from KF_PonderationBillMain_Audit_Temp Where HInterID=" + HInterID.ToString() + " and HBarCode='" + sBarCode + "' and HBillType='" + sBillType + "'", "KF_PonderationBillMain_Audit_Temp", ref DBUtility.ClsPub.sExeReturnInfo);
|
if (DS.Tables[0].Rows.Count == 0)
|
{
|
|
oCn.CnClose();
|
oCn.CnDispose();
|
return true; //不存在相同条码
|
}
|
else
|
{
|
oCn.CnClose();
|
oCn.CnDispose();
|
return false;
|
}
|
}
|
catch (Exception e)
|
{
|
throw (e);
|
}
|
}
|
|
//判断箱号条码临时表中是否存在
|
public bool IsBarCode_Pack(string sBarCode_Pack, long HInterID, string sBillType)
|
{
|
SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
|
DataSet DS;
|
try
|
{
|
DS = oCn.RunProcReturn("Select * from KF_PonderationBillMain_Audit_Temp Where HInterID=" + HInterID.ToString() + " and HBarCode_Pack='" + sBarCode_Pack + "' and HBillType='" + sBillType + "'", "KF_PonderationBillMain_Audit_Temp", ref DBUtility.ClsPub.sExeReturnInfo);
|
if (DS.Tables[0].Rows.Count == 0)
|
{
|
oCn.CnClose();
|
oCn.CnDispose();
|
return true; //不存在相同箱号条码
|
}
|
else
|
{
|
oCn.CnClose();
|
oCn.CnDispose();
|
return false;
|
}
|
}
|
catch (Exception e)
|
{
|
throw (e);
|
}
|
}
|
|
////判断明细表中条码扫描数量是否超过条码本身额定数量
|
//public bool IsBarCode_Sub(long HInterID, string sBillType, long HMaterID, string HBatchNo, Int64 HSourceInterID, Int64 HSourceEntryID, ref string sReturn)
|
//{
|
// SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
|
// DataSet DS;
|
// DataSet DS2;
|
// string sBarCode;
|
// double sQty;
|
// string sWhere = "";
|
// try
|
// {
|
// DS = oCn.RunProcReturn("Select HBarCode,sum(HQty) HQty from KF_PonderationBillMain_Audit_Temp Where HQty<>0 and HInterID=" + HInterID.ToString() +
|
// " and HBillType='" + sBillType + "'" +
|
// " and HMaterID=" + HMaterID +
|
// " and (HBatchNo='" + HBatchNo + "' or '" + HBatchNo + "' ='')" +
|
// " and HSourceInterID=" + HSourceInterID +
|
// " and HSourceEntryID=" + HSourceEntryID +
|
// sWhere +
|
// " Group by HBarCode", "KF_PonderationBillMain_Audit_Temp", ref DBUtility.ClsPub.sExeReturnInfo);
|
|
// if (DS == null || DS.Tables[0].Rows.Count == 0)
|
// {
|
// oCn.CnClose();
|
// oCn.CnDispose();
|
// sReturn = "正常!";
|
// return true;
|
// }
|
// for (int i = 0; i <= DS.Tables[0].Rows.Count - 1; i++)
|
// {
|
// sBarCode = DBUtility.ClsPub.isStrNull(DS.Tables[0].Rows[i]["HBarCode"].ToString());
|
// sQty = DBUtility.ClsPub.isDoule(DS.Tables[0].Rows[i]["HQty"].ToString());
|
|
// DS2 = oCn.RunProcReturn("exec h_p_K3_IsBarCodeQty '" + sBarCode + "'," + sQty.ToString(), "h_p_K3_IsBarCodeQty", ref DBUtility.ClsPub.sExeReturnInfo);
|
// if (DS2.Tables[0].Rows.Count == 0 && DBUtility.ClsPub.isDoule(DS2.Tables[1].Rows[0]["HQty"]) >= sQty)
|
// {
|
// oCn.CnClose();
|
// oCn.CnDispose();
|
// sReturn = "正常!";
|
// return true;
|
// }
|
// else if (DBUtility.ClsPub.isDoule(DS2.Tables[0].Rows[0]["HQty"]) <= 0)
|
// {
|
// oCn.CnClose();
|
// oCn.CnDispose();
|
// sReturn = "条码" + sBarCode + "已被其他单据扫描!";
|
// return false;
|
// }
|
// else if (sQty > DBUtility.ClsPub.isDoule(DS2.Tables[0].Rows[0]["HQty"]))
|
// {
|
// oCn.CnClose();
|
// oCn.CnDispose();
|
// sReturn = "条码" + sBarCode + "的扫描数量" + sQty + "大于该条码未扫描数量" + DBUtility.ClsPub.isDoule(DS.Tables[0].Rows[0]["HQty"]) + "!";
|
// return false;
|
// }
|
// else
|
// {
|
|
// }
|
// }
|
// }
|
// catch (Exception e)
|
// {
|
// sReturn = e.Message;
|
// throw (e);
|
// }
|
// return false;
|
//}
|
|
|
//判断源单是否已稽核过
|
public bool IsAuditBill(long sHInterID, string sHBillType)
|
{
|
SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
|
DataSet DS;
|
try
|
{
|
DS = oCn.RunProcReturn("Select * from Kf_ICStockBillSub_Audit_WMS Where HInterID=" + sHInterID.ToString() + " and HBillType='" + sHBillType + "'", "Kf_ICStockBillSub_Audit_WMS", ref DBUtility.ClsPub.sExeReturnInfo);
|
if (DS.Tables[0].Rows.Count == 0)
|
{
|
|
oCn.CnClose();
|
oCn.CnDispose();
|
return true; //未稽核过
|
}
|
else
|
{
|
oCn.CnClose();
|
oCn.CnDispose();
|
return false;
|
}
|
}
|
catch (Exception e)
|
{
|
throw (e);
|
}
|
}
|
|
|
//删除条码出入库记录
|
public bool DeleteByICStockBill(Int64 sHInterID, string sHBillType)
|
{
|
try
|
{
|
oCn.RunProc("Delete from Kf_ICStockBillSub_Audit_WMS where HInterID=" + sHInterID.ToString() + " and HBillType='" + sHBillType + "'", ref DBUtility.ClsPub.sExeReturnInfo);
|
return true;
|
}
|
catch (Exception e)
|
{
|
throw (e);
|
}
|
}
|
|
|
//生成盘点单时 判断实际条码盘点数量和条码库存数量是否一致
|
public bool IsCheckStock_ICInventory(long sHInterID)
|
{
|
SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
|
DataSet DS;
|
try
|
{
|
DS = oCn.RunProcReturn(" exec h_p_Kf_CheckStockBill_ICInventory " + sHInterID, "h_p_Kf_CheckStockBill_ICInventory", ref DBUtility.ClsPub.sExeReturnInfo);
|
if (DBUtility.ClsPub.isDoule(DS.Tables[0].Rows[0][0]) == 0)
|
{
|
oCn.CnClose();
|
oCn.CnDispose();
|
return true;
|
}
|
else
|
{
|
oCn.CnClose();
|
oCn.CnDispose();
|
return false; //实际条码盘点数量和条码库存数量不一致
|
}
|
}
|
catch (Exception e)
|
{
|
throw (e);
|
}
|
}
|
|
// 回填条码临时表字段 HRelationInterID=1(条码出入库记录生成成功后回填)
|
public bool UpDateByRelationInterID(Int64 sHInterID, string sHBillType)
|
{
|
try
|
{
|
oCn.RunProc("UpDate KF_PonderationBillMain_Audit_Temp set HRelationInterID=1 Where HInterID=" + sHInterID.ToString() + " and HBillType='" + sHBillType + "'", ref DBUtility.ClsPub.sExeReturnInfo);
|
return true;
|
}
|
catch (Exception e)
|
{
|
throw (e);
|
}
|
}
|
|
|
|
|
//构造函数
|
public ClsKF_PonderationBillMain_Audit_Temp_Ctl()
|
{
|
MvarItemKey = "KF_PonderationBillMain_Audit_Temp";
|
MvarReportTitle = "出入库条码稽核临时表";
|
oModel = new Model.ClsKF_PonderationBillMain_Audit_Temp();
|
}
|
}
|
}
|