using System;
|
using System.Collections.Generic;
|
using System.Text;
|
using System.Data;
|
|
namespace BLL
|
{
|
public class ClsKF_PonderationBillMain_Temp
|
{
|
|
|
|
|
//ɾ³ý³öÈë¿âÌõÂëÁÙʱ±í Ô´µ¥É¨Ãè¼Ç¼
|
public bool set_DelPonderationBillMain_Temp_SourceInterID(long HInterID, long HSourceInterID, string sHBillType, ref string sErrMsg)
|
{
|
SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
|
try
|
{
|
oCn.RunProc("Delete from KF_PonderationBillMain_Temp where HInterID=" + HInterID.ToString() + " and HBillType='" + sHBillType + "' and HSourceInterID=" + HSourceInterID, ref DBUtility.ClsPub.sExeReturnInfo);
|
return true;
|
}
|
catch (Exception e)
|
{
|
sErrMsg = "ɾ³ýʧ°Ü£¡" + e.Message;
|
return false;
|
}
|
}
|
|
|
//±£´æµ½³öÈë¿âÌõÂëÁÙʱ±í
|
public bool set_SavePonderationBillMain_Temp_Qty(Model.ClsKF_PonderationBillMain_Temp oMain, Double sQty, ref string sErrMsg)
|
{
|
DAL.ClsKF_PonderationBillMain_Temp_Ctl dal = new DAL.ClsKF_PonderationBillMain_Temp_Ctl();
|
DAL.ClsGy_BarCodeBill_View oBar = new DAL.ClsGy_BarCodeBill_View();
|
dal.oModel = oMain;
|
if (!oBar.GetInfoByNumber_View(oMain.HBarCode))
|
{
|
sErrMsg = "ÎÞЧÌõÂë";
|
return false;
|
}
|
else
|
{
|
if (oBar.omodel_View.HBarCodeType == "ÍÐÅÌÌõÂë")
|
{
|
if (!dal.IsBarCode_Pack(oMain.HBarCode, oMain.HInterID, oMain.HBillType))
|
{
|
sErrMsg = "´æÔÚÏàͬÌõÂ룬ÇëÎðÖØ¸´É¨Ã裡";
|
return false;
|
}
|
if (dal.AddNew_More(ref sErrMsg))
|
{
|
//sErrMsg = "±£´æ³É¹¦£¡";
|
return true;
|
}
|
else
|
{
|
//sErrMsg = "±£´æÊ§°Ü£¡";
|
return false;
|
}
|
}
|
else
|
{
|
if (oBar.omodel_View.HBarCodeType == "ΨһÌõÂë")
|
{
|
if (!dal.IsBarCode(oMain.HBarCode, oMain.HInterID, oMain.HErpClsID, oMain.HBillType))
|
{
|
sErrMsg = "´æÔÚÏàͬÌõÂ룬ÇëÎðÖØ¸´É¨Ã裡";
|
return false;
|
}
|
//ÅжÏÌõÂëÁÙʱ±íÖÐÊÇ·ñ´æÔÚ(µ÷²¦µ¥Í¬Ò»ÌõÂëÏàͬµ÷Èëµ÷³ö²Ö¿â²ÖλֻÔÊÐíɨÃèÒ»´Î£¬ÏúÊÛ³ö¿âͬһÌõÂëͬһ²Ö¿â²ÖλֻÔÊÐíɨÃèÒ»´Î) Íè¾®
|
//if (!dal.IsBarCode(oMain.HBarCode, oMain.HInterID, oMain.HErpClsID, oMain.HBillType,oMain.HWhID,oMain.HStockPlaceID,oMain.HSCWHID,oMain.HOutStockPlaceID,oMain.))
|
//{
|
// sErrMsg = "´æÔÚÏàͬÌõÂ룬ÇëÎðÖØ¸´É¨Ã裡";
|
// return false;
|
//}
|
}
|
if (dal.AddNew_sQty(sQty, ref sErrMsg))
|
{
|
//sErrMsg = "±£´æ³É¹¦£¡";
|
return true;
|
}
|
else
|
{
|
//sErrMsg = "±£´æÊ§°Ü£¡";
|
return false;
|
}
|
}
|
}
|
//dal.oCn.CnClose();
|
//dal.oCn.CnDispose();
|
//oBar.
|
}
|
|
//·µ»Ø¼´Ê±¿â´æÁбí
|
/// <summary>
|
/// ·µ»Ø¼´Ê±¿â´æÁбí
|
/// </summary>
|
/// <param name="sWhere">¹ýÂËÌõ¼þ</param>
|
/// <returns></returns>
|
public DataSet Get_ICInventoryByBarCodeList(string sBarCode, long HWHID, long HSPID, string sWhere)
|
{
|
DAL.ClsKF_PonderationBillMain_Temp_View dal = new DAL.ClsKF_PonderationBillMain_Temp_View();
|
return dal.Get_ICInventoryByBarCodeList(sBarCode, HWHID, HSPID, sWhere);
|
}
|
|
|
|
//»ØÌîÌõÂëÁÙʱ±í×Ö¶Î HRelationInterID=1£¨ÌõÂë³öÈë¿â¼Ç¼Éú³É³É¹¦ºó»ØÌî Å̵㣩
|
public bool set_UpDatePonderationBillMain_Temp_HRelationInterID(long sHInterID, string sHBillType, ref string sErrMsg)
|
{
|
DAL.ClsKF_PonderationBillMain_Temp_Ctl dal = new DAL.ClsKF_PonderationBillMain_Temp_Ctl();
|
//
|
if (dal.UpDateByRelationInterID(sHInterID, sHBillType))
|
{
|
//sErrMsg = "¸üгɹ¦£¡";
|
return true;
|
}
|
else
|
{
|
//sErrMsg = "¸üÐÂʧ°Ü£¡";
|
return false;
|
}
|
}
|
|
|
//±£´æµ½³öÈë¿âÌõÂëÁÙʱ±í
|
public bool set_SavePonderationBillMain_Temp(Model.ClsKF_PonderationBillMain_Temp oMain, ref string sErrMsg)
|
{
|
DAL.ClsKF_PonderationBillMain_Temp_Ctl dal = new DAL.ClsKF_PonderationBillMain_Temp_Ctl();
|
DAL.ClsGy_BarCodeBill_View oBar = new DAL.ClsGy_BarCodeBill_View();
|
dal.oModel = oMain;
|
if (!oBar.GetInfoByNumber_View(oMain.HBarCode))
|
{
|
sErrMsg = "ÎÞЧÌõÂë";
|
return false;
|
}
|
else
|
{
|
if (oBar.omodel_View.HBarCodeType == "ÍÐÅÌÌõÂë")
|
{
|
if (!dal.IsBarCode_Pack(oMain.HBarCode, oMain.HInterID, oMain.HBillType))
|
{
|
sErrMsg = "´æÔÚÏàͬÌõÂ룬ÇëÎðÖØ¸´É¨Ã裡";
|
return false;
|
}
|
if (dal.AddNew_More(ref sErrMsg))
|
{
|
//sErrMsg = "±£´æ³É¹¦£¡";
|
return true;
|
}
|
else
|
{
|
//sErrMsg = "±£´æÊ§°Ü£¡";
|
return false;
|
}
|
}
|
else
|
{
|
if (oBar.omodel_View.HBarCodeType == "ΨһÌõÂë")
|
{
|
if (!dal.IsBarCode(oMain.HBarCode, oMain.HInterID, oMain.HErpClsID, oMain.HBillType))
|
{
|
sErrMsg = "´æÔÚÏàͬÌõÂ룬ÇëÎðÖØ¸´É¨Ã裡";
|
return false;
|
}
|
//ÅжÏÌõÂëÁÙʱ±íÖÐÊÇ·ñ´æÔÚ(µ÷²¦µ¥Í¬Ò»ÌõÂëÏàͬµ÷Èëµ÷³ö²Ö¿â²ÖλֻÔÊÐíɨÃèÒ»´Î£¬ÏúÊÛ³ö¿âͬһÌõÂëͬһ²Ö¿â²ÖλֻÔÊÐíɨÃèÒ»´Î) Íè¾®
|
//if (!dal.IsBarCode(oMain.HBarCode, oMain.HInterID, oMain.HErpClsID, oMain.HBillType,oMain.HWhID,oMain.HStockPlaceID,oMain.HSCWHID,oMain.HOutStockPlaceID,oMain.))
|
//{
|
// sErrMsg = "´æÔÚÏàͬÌõÂ룬ÇëÎðÖØ¸´É¨Ã裡";
|
// return false;
|
//}
|
}
|
if (dal.AddNew(ref sErrMsg))
|
{
|
//sErrMsg = "±£´æ³É¹¦£¡";
|
return true;
|
}
|
else
|
{
|
//sErrMsg = "±£´æÊ§°Ü£¡";
|
return false;
|
}
|
}
|
}
|
//dal.oCn.CnClose();
|
//dal.oCn.CnDispose();
|
//oBar.
|
}
|
|
|
//·µ»Ø³öÈë¿âÌõÂëÁÙʱ±í(Å̵ã)
|
/// <summary>
|
/// ·µ»Ø³öÈë¿âÌõÂëÁÙʱ±í(Å̵ã)
|
/// </summary>
|
/// <param name="sWhere">¹ýÂËÌõ¼þ</param>
|
/// <returns></returns>
|
public DataSet GetKf_PonderationBillMain_Temp_CheckStcok(long HInterID, string sBillType, string sWhere, ref string sErrMsg)
|
{
|
DAL.ClsKF_PonderationBillMain_Temp_View dal = new DAL.ClsKF_PonderationBillMain_Temp_View();
|
return dal.GetInfoByID_View_CheckStcok(HInterID, sBillType, sWhere);
|
}
|
|
|
//±£´æµ½³öÈë¿âÌõÂëÁÙʱ±í(Å̵ã ɨ²Ö¿â´ø³ö¸Ã²Ö¿âËùÓÐ¿â´æÐÅÏ¢)
|
public bool set_SavePonderationBillMain_Temp_CheckStcok(long HInterID, string HBillNo, string sBillType, long HWHID, long HSPID, ref string sErrMsg)
|
{
|
DAL.ClsKF_PonderationBillMain_Temp_Ctl dal = new DAL.ClsKF_PonderationBillMain_Temp_Ctl();
|
if (dal.AddNew_CheckStock(HInterID, HBillNo, sBillType, HWHID, HSPID, ref sErrMsg))
|
{
|
//sErrMsg = "±£´æ³É¹¦£¡";
|
return true;
|
}
|
else
|
{
|
//sErrMsg = "±£´æÊ§°Ü£¡";
|
return false;
|
}
|
}
|
|
|
//±£´æµ½³öÈë¿âÌõÂëÁÙʱ±í(ÎïÁÏÌõÂë) ÃâɨÂë×Ô¶¯ÅúÁ¿Éú³ÉÎïÁÏÌõÂë
|
public bool set_SavePonderationBillMain_Temp_NoCode(long HInterID, long HWHID, long HSPID, long HSCWHID, long HOutSPID, string[] sSourceID, ref string sErrMsg)
|
{
|
//»ñȡϵͳ²ÎÊý
|
Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
|
if (oSystemParameter.ShowBill(ref sErrMsg) == false)
|
{
|
sErrMsg = "»ñȡϵͳ²ÎÊýʧ°Ü£¡ " + sErrMsg;
|
return false;
|
}
|
|
//
|
if (oSystemParameter.omodel.Kf_MateOutBill_AutoBarCode.ToUpper() == "Y") //ϵͳ²ÎÊý Éú²úÁìÁϵ¥-ÃâɨÂë
|
{
|
SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
|
bool sBool = false;
|
try
|
{
|
oCN.RunProc("Delete from KF_PonderationBillMain_Temp where HQtyMust=0 and HInterID=" + HInterID.ToString(), ref DBUtility.ClsPub.sExeReturnInfo);
|
for (int i = 0; i < sSourceID.Length; i++)
|
{
|
if (sSourceID[i] != "")
|
{
|
sBool = true;
|
string[] se = sSourceID[i].Split(Convert.ToChar(","));
|
Int64 sInterID = DBUtility.ClsPub.isLong(se[0]);
|
Int64 sEntryID = DBUtility.ClsPub.isLong(se[1]);
|
//µ÷Ó÷½·¨
|
DataSet ds = oCN.RunProcReturn("exec h_p_WMS_AutoPonderationBill " + HInterID + "," + HWHID + "," + HSPID + "," + sInterID + "," + sEntryID, "h_p_WMS_AutoPonderationBill");
|
if (ds == null || ds.Tables[0].Rows.Count == 0)
|
{
|
sErrMsg = "×Ô¶¯ÅúÁ¿Éú³ÉÎïÁÏÌõÂë³öÈë¿â¼Ç¼£¬Î´Öª´íÎó£¡";
|
return false;
|
}
|
else
|
{
|
if (DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0][0]) == 1)
|
{
|
sErrMsg = "²Ö¿âûÓÐÑ¡Ôñ£¬ÇëÏÈÑ¡Ôñ²Ö¿â£¡";
|
return false;
|
}
|
else if (DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0][0]) == 2)
|
{
|
sErrMsg = "ÌõÂëµµ°¸Öв»´æÔÚ×Ô¶¯Éú³ÉµÄÌõÂ룬ÅúÁ¿Éú³ÉÎïÁÏÌõÂë³öÈë¿â¼Ç¼ʧ°Ü£¡";
|
return false;
|
}
|
else
|
{
|
sErrMsg = "Éú³ÉÎïÁÏÌõÂë³öÈë¿â¼Ç¼³É¹¦";
|
}
|
}
|
}
|
}
|
if (!sBool)
|
{
|
sErrMsg = "ûÓÐÑ¡ÔñÈκÎÒ»ÐÐÎïÁÏ£¬ÎÞÐëÅúÁ¿Éú³ÉÎïÁÏÌõÂë³öÈë¿â¼Ç¼£¡";
|
return false;
|
}
|
return true;
|
}
|
catch (Exception e)
|
{
|
sErrMsg = "×Ô¶¯ÅúÁ¿Éú³ÉÎïÁÏÌõÂëʧ°Ü£¡" + e.Message;
|
return false;
|
}
|
}
|
else
|
{
|
sErrMsg = "ΨһÌõÂë²»Ö§³ÖÃâɨÂ빦ÄÜ£¬ÅúÁ¿Éú³Éʧ°Ü£¬ÇëɨÂë³ö¿â£¡";
|
return false;
|
}
|
}
|
|
|
//±£´æµ½³öÈë¿âÌõÂëÁÙʱ±í(Ôµ¥) ÁìÁϳö¿â ¸ù¾Ý¼Æ»®Ä£Ê½¡¢ÅäÌ×ÊýÁ¿ ÅúÁ¿ÐÂÔöÔ´µ¥ÐÅÏ¢
|
public bool set_SavePonderationBillMain_Temp_Source_MateOut(long sNewInterID, string sNewBillNo, string sNewBillType, string sSourceBillNo, string sSourceBillType, string sRedBlueflag, string sMaker, Double sPPQty, Int64 sPlanMode, ref string sErrMsg)
|
{
|
DAL.ClsKF_PonderationBillMain_Temp_Ctl dal = new DAL.ClsKF_PonderationBillMain_Temp_Ctl();
|
if (dal.AddNew_Source_MateOut(sNewInterID, sNewBillNo, sNewBillType, sSourceBillNo, sSourceBillType, sRedBlueflag, sMaker, sPPQty, sPlanMode, ref sErrMsg))
|
{
|
//sErrMsg = "±£´æ³É¹¦£¡";
|
return true;
|
}
|
else
|
{
|
return false;
|
}
|
}
|
|
//·µ»Ø»º´æÁбíÐÅÏ¢ ͬ²½×ÊÁÏ
|
public DataSet GetKf_PonderationBillMain_TempList(string sHBillType, string sWhere)
|
{
|
DAL.ClsKF_PonderationBillMain_Temp_View dal = new DAL.ClsKF_PonderationBillMain_Temp_View();
|
return dal.GetKf_PonderationBillMain_TempList(sHBillType, sWhere);
|
}
|
|
//·µ»Ø»º´æÁбíÐÅÏ¢ ͬ²½×ÊÁÏ£¨µ¹Ïäµ¥£©
|
public DataSet GetKf_PonderationBillMain_TempList_ChangeBox(string sHBillType, string sWhere)
|
{
|
DAL.ClsKF_PonderationBillMain_Temp_View dal = new DAL.ClsKF_PonderationBillMain_Temp_View();
|
return dal.GetKf_PonderationBillMain_TempList_ChangeBox(sHBillType, sWhere);
|
}
|
|
/// <summary>
|
/// ¸ù¾Ýµ¥¾ÝÄÚÂ룬Çå¿ÕTEMP±íÀïµÄÈ«²¿ÁÙʱÊý¾Ý
|
/// </summary>
|
/// <param name="sHInterID"></param>
|
/// <param name="sErrMsg"></param>
|
/// <returns></returns>
|
public bool DeleteBillList(Int64 sHInterID, ref string sErrMsg)
|
{
|
try
|
{
|
DAL.ClsKF_PonderationBillMain_Temp_Ctl dal = new DAL.ClsKF_PonderationBillMain_Temp_Ctl();
|
if (dal.DeleteBillList(sHInterID))
|
{
|
sErrMsg = "ɾ³ý³É¹¦£¡";
|
return true;
|
}
|
else
|
{
|
sErrMsg = "ɾ³ýʧ°Ü£¡";
|
return false;
|
}
|
}
|
catch (Exception e)
|
{
|
sErrMsg = sErrMsg + "," + e.Message;
|
return false;
|
}
|
}
|
|
|
//²éѯÌõÂë¿â´æ
|
public bool Get_CheckQtyByBarCode(string sBarcode, long HWHID, long HSPID, long HAuxPropID, string sBatchNo, string HMTONo, double sQty, ref double sRelQty)
|
{
|
DAL.ClsKF_PonderationBillMain_Temp_View dal = new DAL.ClsKF_PonderationBillMain_Temp_View();
|
if (dal.CheckQtyByBarCode(sBarcode, HWHID, HSPID, HAuxPropID, sBatchNo, HMTONo, sQty, ref sRelQty))
|
{
|
return true;
|
}
|
else
|
{
|
return false;
|
}
|
}
|
|
|
//²éѯÌõÂë¿â´æ ²¢ÇÒ´ø³ö ²Ö¿â²Öλ
|
public bool Get_CheckQtyByBarCode_GetWhAndSP(long InterID, string sBillType, string sBarcode, ref long HWHID, ref long HSPID, double sQty, ref double sRelQty)
|
{
|
DAL.ClsKF_PonderationBillMain_Temp_View dal = new DAL.ClsKF_PonderationBillMain_Temp_View();
|
if (dal.CheckQtyByBarCode(InterID, sBillType, sBarcode, ref HWHID, ref HSPID, sQty, ref sRelQty))
|
{
|
return true;
|
}
|
else
|
{
|
return false;
|
}
|
}
|
|
|
//¸ù¾ÝɨÃèÌõÂë ÊýÁ¿ ÅжÏÌõÂëµµ°¸ÊýÁ¿
|
public bool Get_CheckQtyByBarCodeBill(long InterID, string sBillType, string sBatchNo, string sBarCode, ref double sRelQty)
|
{
|
DAL.ClsKF_PonderationBillMain_Temp_View dal = new DAL.ClsKF_PonderationBillMain_Temp_View();
|
if (dal.CheckQtyByBarCodeBill(InterID, sBillType, sBatchNo, sBarCode, ref sRelQty))
|
{
|
return true;
|
}
|
else
|
{
|
return false;
|
}
|
}
|
|
//ÅжÏÌõÂë Èë¿âÊýÁ¿ÊÇ·ñ³¬¹ýÌõÂë±¾Éí¶î¶¨ÊýÁ¿
|
public bool Get_IsBarCodeQty(string sBarcode, string sBillType, bool sRedBlueFlag, ref double sQty, ref string sErrMsg)
|
{
|
DAL.ClsKF_PonderationBillMain_Temp_Ctl dal = new DAL.ClsKF_PonderationBillMain_Temp_Ctl();
|
if (dal.IsBarCode(sBarcode, sBillType, sRedBlueFlag, ref sQty, ref sErrMsg))
|
{
|
return true;
|
}
|
else
|
{
|
return false;
|
}
|
}
|
|
public DataSet GetICInventoryByBarCode_View(string sWhere, ref string sErr) //°´ÌõÂë½øÐÐ¿â´æ²éѯ
|
{
|
DAL.ClsKF_PonderationBillMain_Temp_View dal = new DAL.ClsKF_PonderationBillMain_Temp_View();
|
return dal.GetICInventoryByBarCode_View(sWhere);
|
}
|
|
public DataSet GetMaterByBarCode_View(string sWhere, ref string sErr) //°´ÌõÂë½øÐÐÎïÁϲéѯ
|
{
|
DAL.ClsKF_PonderationBillMain_Temp_View dal = new DAL.ClsKF_PonderationBillMain_Temp_View();
|
return dal.GetMaterByBarCode_View(sWhere);
|
}
|
|
public DataSet GetICInventoryByBarCodeSP_View(string sWhere, ref string sErr) //°´²Öλ ²éѯ¿â´æ
|
{
|
DAL.ClsKF_PonderationBillMain_Temp_View dal = new DAL.ClsKF_PonderationBillMain_Temp_View();
|
return dal.GetICInventoryByBarCodeSP_View(sWhere);
|
}
|
|
public DataSet GetMaterByBarCodeSP_View(string sWhere, ref string sErr) //°´²Öλ½øÐÐ ÎïÁϲéѯ
|
{
|
DAL.ClsKF_PonderationBillMain_Temp_View dal = new DAL.ClsKF_PonderationBillMain_Temp_View();
|
return dal.GetMaterByBarCodeSP_View(sWhere);
|
}
|
|
/// <summary>
|
/// ½«Ô´µ¥ÐÅÏ¢´æÈë TEMP±í
|
/// </summary>
|
/// <param name="oMain">¶ÔÏó</param>
|
/// <param name="sErrMsg">´íÎóÐÅÏ¢</param>
|
/// <returns></returns>
|
public bool set_SavePonderationBillMain_Temp_Source(Model.ClsKF_PonderationBillMain_Temp oMain, ref string sErrMsg)
|
{
|
try
|
{
|
DAL.ClsKF_PonderationBillMain_Temp_Ctl dal = new DAL.ClsKF_PonderationBillMain_Temp_Ctl();
|
dal.oModel = oMain;
|
if (dal.AddNew_Source(ref sErrMsg))
|
{
|
//sErrMsg = "±£´æ³É¹¦£¡";
|
return true;
|
}
|
else
|
{
|
//sErrMsg = "±£´æÊ§°Ü£¡";
|
return false;
|
}
|
}
|
catch (Exception e)
|
{
|
sErrMsg = sErrMsg + "," + e.Message;
|
return false;
|
}
|
}
|
|
/// <summary>
|
/// ¸ù¾ÝÏà¹ØÐÅÏ¢Ô´µ¥ÐÅÏ¢´æÈëTEMP±í£¬²¢¶ÔÔ´µ¥ÐÅÏ¢½øÐÐÅжϼ°Í¬²½ERPÔ´µ¥
|
/// </summary>
|
/// <param name="sNewInterID"></param>
|
/// <param name="sNewBillNo"></param>
|
/// <param name="sNewBillType"></param>
|
/// <param name="sSourceBillNo"></param>
|
/// <param name="sSourceBillType"></param>
|
/// <param name="sRedBlueflag"></param>
|
/// <param name="sErrMsg"></param>
|
/// <returns></returns>
|
public bool set_SavePonderationBillMain_Temp_Source_Fast(long sNewInterID, string sNewBillNo, string sNewBillType, string sSourceBillNo, string sSourceBillType, string sRedBlueflag, ref string sErrMsg)
|
{
|
try
|
{
|
DAL.ClsKF_PonderationBillMain_Temp_Ctl dal = new DAL.ClsKF_PonderationBillMain_Temp_Ctl();
|
if (dal.AddNew_Source(sNewInterID, sNewBillNo, sNewBillType, sSourceBillNo, sSourceBillType, sRedBlueflag, ref sErrMsg))
|
{
|
//sErrMsg = "±£´æ³É¹¦£¡";
|
return true;
|
}
|
else
|
{
|
//sErrMsg = "ÊäÈëÔ´µ¥ÐÅÏ¢²»×¼È·£¬ÇëÊäÈë½ÏÍêÕûµÄµ¥¾ÝºÅ£¡";
|
return false;
|
}
|
}
|
catch (Exception e)
|
{
|
sErrMsg = sErrMsg + "," + e.Message;
|
return false;
|
}
|
}
|
|
/// <summary>
|
/// ¸ù¾ÝÏà¹Øµ¹Ïäµ¥ÐÅÏ¢ Ô´µ¥ÐÅÏ¢´æÈëTEMP±í£¬²¢¶ÔÔ´µ¥ÐÅÏ¢½øÐÐÅжϼ°Í¬²½ERPÔ´µ¥
|
/// </summary>
|
/// <param name="sNewInterID"></param>
|
/// <param name="sNewBillNo"></param>
|
/// <param name="sNewBillType"></param>
|
/// <param name="sSourceBillNo"></param>
|
/// <param name="sSourceBillType"></param>
|
/// <param name="sRedBlueflag"></param>
|
/// <param name="sInterID"></param>
|
/// <param name="sBillNo"></param>
|
/// <param name="sMaker"></param>
|
/// <param name="sErrMsg"></param>
|
/// <returns></returns>
|
public bool set_SavePonderationBillMain_Temp_Source_Fast_ChangeBox(long sNewInterID, string sNewBillNo, string sNewBillType, string sSourceBillNo, string sSourceBillType, string sRedBlueflag, long sInterID, string sBillNo, string sMaker, ref string sErrMsg)
|
{
|
try
|
{
|
DAL.ClsKF_PonderationBillMain_Temp_Ctl dal = new DAL.ClsKF_PonderationBillMain_Temp_Ctl();
|
if (dal.AddNew_Source_ChangeBox(sNewInterID, sNewBillNo, sNewBillType, sSourceBillNo, sSourceBillType, sRedBlueflag, sInterID, sBillNo, sMaker, ref sErrMsg))
|
{
|
//sErrMsg = "±£´æ³É¹¦£¡";
|
return true;
|
}
|
else
|
{
|
//sErrMsg = "ÊäÈëÔ´µ¥ÐÅÏ¢²»×¼È·£¬ÇëÊäÈë½ÏÍêÕûµÄµ¥¾ÝºÅ£¡";
|
return false;
|
}
|
}
|
catch (Exception e)
|
{
|
sErrMsg = sErrMsg + "," + e.Message;
|
return false;
|
}
|
}
|
|
|
|
|
/// <summary>
|
/// ¸ù¾ÝÏà¹ØÐÅÏ¢ ¼ÆËãÐèÒª¼õÉÙµÄÌõÂëÊýÁ¿ ²¢´æÈëTEMP±í
|
/// </summary>
|
/// <param name="HInterID"></param>
|
/// <param name="HMaterID"></param>
|
/// <param name="HAuxPropID"></param>
|
/// <param name="HMTONo"></param>
|
/// <param name="HWhID"></param>
|
/// <param name="HSPID"></param>
|
/// <param name="HSCWhID"></param>
|
/// <param name="HSCSPID"></param>
|
/// <param name="HBatchNo"></param>
|
/// <param name="HSourceInterID"></param>
|
/// <param name="HSourceEntryID"></param>
|
/// <param name="sBarCode"></param>
|
/// <param name="sBillType"></param>
|
/// <param name="sQty"></param>
|
/// <param name="sErrMsg"></param>
|
/// <returns></returns>
|
public bool set_ClearPonderationBillMain_Temp_ChangGui(long HInterID, long HMaterID, Int64 HAuxPropID, string HMTONo, Int64 HWhID, Int64 HSPID, Int64 HSCWhID, Int64 HSCSPID, string HBatchNo, Int64 HSourceInterID, Int64 HSourceEntryID, string sBarCode, string sBillType, double sQty, ref string sErrMsg)
|
{
|
try
|
{
|
DAL.ClsKF_PonderationBillMain_Temp_Ctl dal = new DAL.ClsKF_PonderationBillMain_Temp_Ctl();
|
if (dal.AddNew_Clear_ChangGui(HInterID, HMaterID, HAuxPropID, HMTONo, HWhID, HSPID, HSCWhID, HSCSPID, HBatchNo, HSourceInterID, HSourceEntryID, sBarCode, sBillType, sQty, ref sErrMsg))
|
{
|
//sErrMsg = "¼õÉٳɹ¦£¡";
|
return true;
|
}
|
else
|
{
|
//sErrMsg = "¼õÉÙʧ°Ü£¡";
|
return false;
|
}
|
}
|
catch (Exception e)
|
{
|
sErrMsg = sErrMsg + "," + e.Message;
|
return false;
|
}
|
}
|
|
/// <summary>
|
/// ¸ù¾ÝÏà¹ØÐÅÏ¢ ¼ÆËãÐèÒªÔö¼ÓµÄÌõÂëÊýÁ¿ ²¢´æÈëTEMP±í
|
/// </summary>
|
/// <param name="HInterID"></param>
|
/// <param name="HMaterID"></param>
|
/// <param name="HAuxPropID"></param>
|
/// <param name="HMTONo"></param>
|
/// <param name="HWhID"></param>
|
/// <param name="HSPID"></param>
|
/// <param name="HSCWhID"></param>
|
/// <param name="HSCSPID"></param>
|
/// <param name="HBatchNo"></param>
|
/// <param name="HSourceInterID"></param>
|
/// <param name="HSourceEntryID"></param>
|
/// <param name="sBarCode"></param>
|
/// <param name="sBillType"></param>
|
/// <param name="sQty"></param>
|
/// <param name="sErrMsg"></param>
|
/// <returns></returns>
|
public bool set_SavePonderationBillMain_Temp_ChangGui(long HInterID, long HMaterID, Int64 HAuxPropID, string HMTONo, Int64 HWhID, Int64 HSPID, Int64 HSCWhID, Int64 HSCSPID, string HBatchNo, Int64 HSourceInterID, Int64 HSourceEntryID, string sBarCode, string sBillType, double sQty, ref string sErrMsg)
|
{
|
try
|
{
|
DAL.ClsKF_PonderationBillMain_Temp_Ctl dal = new DAL.ClsKF_PonderationBillMain_Temp_Ctl();
|
if (dal.AddNew_More_ChangGui(HInterID, HMaterID, HAuxPropID, HMTONo, HWhID, HSPID, HSCWhID, HSCSPID, HBatchNo, HSourceInterID, HSourceEntryID, sBarCode, sBillType, sQty, ref sErrMsg))
|
{
|
//"±£´æ³É¹¦£¡";
|
return true;
|
}
|
else
|
{
|
//"±£´æÊ§°Ü£¡";
|
return false;
|
}
|
}
|
catch (Exception e)
|
{
|
sErrMsg = sErrMsg + "," + e.Message;
|
return false;
|
}
|
}
|
|
/// <summary>
|
/// ¸ù¾ÝÌõÂëºÍÄÚÂ룬ɾ³ý³öÈë¿âÌõÂëÁÙʱ±í(¸ù¾ÝÌõÂë)
|
/// </summary>
|
/// <param name="HInterID"></param>
|
/// <param name="sBarCode"></param>
|
/// <param name="sHBillType"></param>
|
/// <param name="sErrMsg"></param>
|
/// <returns></returns>
|
public bool set_DelPonderationBillMain_Temp_BarCode(long HInterID, string sBarCode, string sHBillType, ref string sErrMsg)
|
{
|
try
|
{
|
DAL.ClsKF_PonderationBillMain_Temp_Ctl dal = new DAL.ClsKF_PonderationBillMain_Temp_Ctl();
|
if (dal.DeleteByBarCode(HInterID, sBarCode, sHBillType))
|
{
|
sErrMsg = "ɾ³ý³É¹¦£¡";
|
return true;
|
}
|
else
|
{
|
sErrMsg = "ɾ³ýʧ°Ü£¡";
|
return false;
|
}
|
}
|
catch (Exception e)
|
{
|
sErrMsg = sErrMsg + "," + e.Message;
|
return false;
|
}
|
}
|
|
/// <summary>
|
/// ¸ù¾ÝÎïÁÏÄÚÂ룬¸¨ÖúÊôÐÔ£¬MTO£¬Ô´µ¥Ö÷ÄÚÂë×ÓÄÚÂëºÍµ¥¾ÝÄÚÂ룬ɾ³ý³öÈë¿âÌõÂëÁÙʱ±í(¸ù¾ÝÌõÂë)
|
/// </summary>
|
/// <param name="HInterID"></param>
|
/// <param name="HMaterID"></param>
|
/// <param name="HAuxPropID"></param>
|
/// <param name="HMTONo"></param>
|
/// <param name="HSourceInterID"></param>
|
/// <param name="HSourceEntryID"></param>
|
/// <param name="sHBillType"></param>
|
/// <param name="sErrMsg"></param>
|
/// <returns></returns>
|
public bool set_DelPonderationBillMain_Temp_InterIDAndSource(long HInterID, long HMaterID, long HAuxPropID, string HMTONo, long HSourceInterID, long HSourceEntryID, string sHBillType, ref string sErrMsg)
|
{
|
try
|
{
|
DAL.ClsKF_PonderationBillMain_Temp_Ctl dal = new DAL.ClsKF_PonderationBillMain_Temp_Ctl();
|
if (dal.DeleteByInterIDAndSource(HInterID, HMaterID, HAuxPropID, HMTONo, HSourceInterID, HSourceEntryID, sHBillType))
|
{
|
sErrMsg = "ɾ³ý³É¹¦£¡";
|
return true;
|
}
|
else
|
{
|
sErrMsg = "ɾ³ýʧ°Ü£¡";
|
return false;
|
}
|
}
|
catch (Exception e)
|
{
|
sErrMsg = sErrMsg + "," + e.Message;
|
return false;
|
}
|
}
|
|
/// <summary>
|
/// ¸ù¾ÝÄÚÂë¼°¹ýÂËÌõ¼þ·µ»ØÌõÂëTEMPÁÙʱ±í¼Ç¼
|
/// </summary>
|
/// <param name="HInterID"></param>
|
/// <param name="sBillType"></param>
|
/// <param name="sWhere"></param>
|
/// <returns></returns>
|
public DataSet GetKf_PonderationBillMain_Temp(long HInterID, string sBillType, string sWhere, ref string sErrMsg)
|
{
|
try
|
{
|
DAL.ClsKF_PonderationBillMain_Temp_View dal = new DAL.ClsKF_PonderationBillMain_Temp_View();
|
return dal.GetInfoByID_View(HInterID, sBillType, sWhere);
|
}
|
catch (Exception e)
|
{
|
sErrMsg = sErrMsg + "," + e.Message;
|
return null;
|
}
|
}
|
|
/// <summary>
|
/// ¸ù¾ÝÄÚÂë¼°¹ýÂËÌõ¼þ·µ»ØÌõÂëTEMPÁÙʱ±í¼Ç¼-°´Ã¿É¨ÃèÒ»´ÎÒ»Ìõ¼Ç¼ÏÔʾ
|
/// </summary>
|
/// <param name="HInterID"></param>
|
/// <param name="sBillType"></param>
|
/// <param name="sWhere"></param>
|
/// <returns></returns>
|
public DataSet GetKf_PonderationBillMainDetails_Temp(long HInterID, string sBillType, string sWhere, ref string sErrMsg)
|
{
|
try
|
{
|
DAL.ClsKF_PonderationBillMain_Temp_View dal = new DAL.ClsKF_PonderationBillMain_Temp_View();
|
return dal.GetInfoByIDDetails_View(HInterID, sBillType, sWhere);
|
}
|
catch (Exception e)
|
{
|
sErrMsg = sErrMsg + "," + e.Message;
|
return null;
|
}
|
}
|
|
/// <summary>
|
/// ¸ù¾ÝÄÚÂë¼°¹ýÂËÌõ¼þ·µ»ØÌõÂëTEMPÁÙʱ±í¼Ç¼-°´»ã×ÜÎïÁÏÏÔʾ
|
/// </summary>
|
/// <param name="HInterID"></param>
|
/// <param name="sBillType"></param>
|
/// <param name="sWhere"></param>
|
/// <param name="sErrMsg"></param>
|
/// <returns></returns>
|
public DataSet GetKf_PonderationBillMain_Temp_Sum(long HInterID, string sBillType, string sWhere, ref string sErrMsg)
|
{
|
try
|
{
|
DAL.ClsKF_PonderationBillMain_Temp_View dal = new DAL.ClsKF_PonderationBillMain_Temp_View();
|
return dal.GetInfoByID_View_Sum(HInterID, sBillType, sWhere);
|
}
|
catch (Exception e)
|
{
|
sErrMsg = sErrMsg + "," + e.Message;
|
return null;
|
}
|
}
|
|
/// <summary>
|
/// ¸ù¾ÝÎïÁÏÄÚÂë¡¢²Ö¿âÄÚÂë¼°¹ýÂËÌõ¼þ·µ»Ø¸ÃÎïÁϵļ´Ê¹¿â´æ
|
/// </summary>
|
/// <param name="HMaterID"></param>
|
/// <param name="HWhID"></param>
|
/// <param name="sWhere"></param>
|
/// <param name="sErrMsg"></param>
|
/// <returns></returns>
|
public DataSet Get_ICInventoryByMaterID(long HMaterID, long HWhID, string sWhere, ref string sErrMsg)
|
{
|
try
|
{
|
DAL.ClsKF_PonderationBillMain_Temp_View dal = new DAL.ClsKF_PonderationBillMain_Temp_View();
|
return dal.Get_ICInventoryByMaterID(HMaterID, HWhID, sWhere);
|
}
|
catch (Exception e)
|
{
|
sErrMsg = sErrMsg + "," + e.Message;
|
return null;
|
}
|
}
|
|
/// <summary>
|
/// ¸ù¾Ýµ¥¾ÝÄÚÂëµÈÐÅÏ¢£¬·µ»ØÉ¨Ãè¼Ç¼£»²¢½øÐб༣¨ÔÚÌõÂë±à¼Ä£¿éÖУ©
|
/// </summary>
|
/// <param name="HInterID"></param>
|
/// <param name="HMaterID"></param>
|
/// <param name="HAuxPropID"></param>
|
/// <param name="HMTONo"></param>
|
/// <param name="HWhID"></param>
|
/// <param name="HSPID"></param>
|
/// <param name="HSCWhID"></param>
|
/// <param name="HSCSPID"></param>
|
/// <param name="HBatchNo"></param>
|
/// <param name="HSourceInterID"></param>
|
/// <param name="HSourceEntryID"></param>
|
/// <param name="sBillType"></param>
|
/// <param name="sWhere"></param>
|
/// <param name="sErrMsg"></param>
|
/// <returns></returns>
|
public DataSet GetBarCode_Temp(long HInterID, long HMaterID, Int64 HAuxPropID, string HMTONo, Int64 HWhID, Int64 HSPID, Int64 HSCWhID, Int64 HSCSPID, string HBatchNo, Int64 HSourceInterID, Int64 HSourceEntryID, string sBillType, string sWhere, ref string sErrMsg)
|
{
|
try
|
{
|
DAL.ClsKF_PonderationBillMain_Temp_View dal = new DAL.ClsKF_PonderationBillMain_Temp_View();
|
return dal.GetBarCodeByID_View(HInterID, sBillType, HMaterID, HAuxPropID, HMTONo, HWhID, HSPID, HSCWhID, HSCSPID, HBatchNo, HSourceInterID, HSourceEntryID, sWhere);
|
}
|
catch (Exception e)
|
{
|
sErrMsg = sErrMsg + "," + e.Message;
|
return null;
|
}
|
}
|
|
/// <summary>
|
/// ¸ù¾Ýµ¥¾ÝÀàÐͼ°¹ýÂËÌõ¼þ£¬ÏÔʾ¸Ãµ¥¾ÝµÄ»º´æÁбí
|
/// </summary>
|
/// <param name="sHBillType"></param>
|
/// <param name="sWhere"></param>
|
/// <returns></returns>
|
public DataSet GetKf_PonderationBillMain_TempList(string sHBillType, string sWhere, ref string sErrMsg)
|
{
|
try
|
{
|
DAL.ClsKF_PonderationBillMain_Temp_View dal = new DAL.ClsKF_PonderationBillMain_Temp_View();
|
return dal.GetKf_PonderationBillMain_TempList(sHBillType, sWhere);
|
}
|
catch (Exception e)
|
{
|
sErrMsg = sErrMsg + "," + e.Message;
|
return null;
|
}
|
}
|
|
/// <summary>
|
/// ¸ù¾Ýµ¥¾ÝÀàÐͼ°¹ýÂËÌõ¼þ£¬ÏÔʾ¸Ãµ¥¾ÝµÄ»º´æÁÐ±í£¨µ¹Ïäµ¥£©
|
/// </summary>
|
/// <param name="sHBillType"></param>
|
/// <param name="sWhere"></param>
|
/// <returns></returns>
|
public DataSet GetKf_PonderationBillMain_TempList_ChangeBox(string sHBillType, string sWhere, ref string sErrMsg)
|
{
|
try
|
{
|
DAL.ClsKF_PonderationBillMain_Temp_View dal = new DAL.ClsKF_PonderationBillMain_Temp_View();
|
return dal.GetKf_PonderationBillMain_TempList_ChangeBox(sHBillType, sWhere);
|
}
|
catch (Exception e)
|
{
|
sErrMsg = sErrMsg + "," + e.Message;
|
return null;
|
}
|
}
|
|
|
/// <summary>
|
/// ¸ù¾ÝÏà¹ØÐÅÏ¢£¬ÅÐ¶Ï¿â´æÊÇ·ñ³ä×㣬²¢·µ»ØÊµ¼Ê¿â´æÊýÁ¿
|
/// </summary>
|
/// <param name="sBarcode"></param>
|
/// <param name="HWHID"></param>
|
/// <param name="HSPID"></param>
|
/// <param name="HAuxPropID"></param>
|
/// <param name="sBatchNo"></param>
|
/// <param name="HMTONo"></param>
|
/// <param name="sQty"></param>
|
/// <param name="sRelQty"></param>
|
/// <param name="sErrMsg"></param>
|
/// <returns></returns>
|
public bool Get_CheckQtyByBarCode(string sBarcode, long HWHID, long HSPID, long HAuxPropID, string sBatchNo, string HMTONo, double sQty, ref double sRelQty, ref string sErrMsg)
|
{
|
try
|
{
|
DAL.ClsKF_PonderationBillMain_Temp_View dal = new DAL.ClsKF_PonderationBillMain_Temp_View();
|
if (dal.CheckQtyByBarCode(sBarcode, HWHID, HSPID, HAuxPropID, sBatchNo, HMTONo, sQty, ref sRelQty))
|
{
|
return true;
|
}
|
else
|
{
|
return false;
|
}
|
}
|
catch (Exception e)
|
{
|
sErrMsg = sErrMsg + "," + e.Message;
|
return false;
|
}
|
}
|
|
/// <summary>
|
/// Åжϵ÷ÕûµÄÌõÂëÊýÁ¿ÓëÌõÂë³õʼ»¯ÊýÁ¿ÊÇ·ñ³åÍ»£¨ÌõÂë±àÖÆÄ£¿é£©
|
/// </summary>
|
/// <param name="InterID"></param>
|
/// <param name="sBillType"></param>
|
/// <param name="sBatchNo"></param>
|
/// <param name="sBarCode"></param>
|
/// <param name="sRelQty"></param>
|
/// <param name="sErrMsg"></param>
|
/// <returns></returns>
|
public bool Get_CheckQtyByBarCodeBill(long InterID, string sBillType, string sBatchNo, string sBarCode, ref double sRelQty, ref string sErrMsg)
|
{
|
try
|
{
|
DAL.ClsKF_PonderationBillMain_Temp_View dal = new DAL.ClsKF_PonderationBillMain_Temp_View();
|
if (dal.CheckQtyByBarCodeBill(InterID, sBillType, sBatchNo, sBarCode, ref sRelQty))
|
{
|
return true;
|
}
|
else
|
{
|
return false;
|
}
|
}
|
catch (Exception e)
|
{
|
sErrMsg = sErrMsg + "," + e.Message;
|
return false;
|
}
|
}
|
|
|
#region Ò»¼üɨÂë
|
|
|
/// <summary>
|
/// ¸ù¾ÝÌõÐÎÂë´¦Àí²¢·µ»ØÊý¾Ý
|
/// </summary>
|
/// <param name="sBarCode"></param>
|
/// <param name="HBillID"></param>
|
/// <param name="HBillType"></param>
|
/// <param name="HBillNo"></param>
|
/// <param name="HMaker"></param>
|
/// <param name="HWhID"></param>
|
/// <param name="HSPID"></param>
|
/// <param name="HQty"></param>
|
/// <param name="HRedBlueFlag"></param>
|
/// <param name="SourceFlag"></param>
|
/// <param name="HSourceBillNo"></param>
|
/// <param name="HSourceBillType"></param>
|
/// <param name="HOWNERID"></param>
|
/// <param name="sHSourceBillNo"></param>
|
/// <param name="sHSourceBillType"></param>
|
/// <param name="sHSupID"></param>
|
/// <param name="sHSupName"></param>
|
/// <param name="sHDeptID"></param>
|
/// <param name="sHDeptName"></param>
|
/// <param name="sErrMsg"></param>
|
/// <returns></returns>
|
public bool set_SavePonderationBillMain_Temp_BarCode(string sBarCode, Int64 HBillID, string HBillType, string HBillNo, string HMaker, Int64 HWhID, Int64 HSPID, Double HQty, bool HRedBlueFlag, bool SourceFlag, string HSourceBillNo, string HSourceBillType, Int64 HOWNERID, ref string sHSourceBillNo, ref string sHSourceBillType, ref long sHSupID, ref string sHSupName, ref long sHDeptID, ref string sHDeptName, ref string sErrMsg)
|
{
|
try
|
{
|
SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
|
DAL.ClsKF_PonderationBillMain_Temp_Ctl tem = new DAL.ClsKF_PonderationBillMain_Temp_Ctl();
|
Model.ClsKF_PonderationBillMain_Temp model = new Model.ClsKF_PonderationBillMain_Temp();
|
double sRelQty = 0;
|
string sRedBlue = "À¶×Ö";
|
if (HRedBlueFlag)
|
{
|
sRedBlue = "ºì×Ö";
|
}
|
else
|
{
|
sRedBlue = "À¶×Ö";
|
}
|
//ÅжÏÌõÂëÊÇ·ñº¬ÌØÊâ·ûºÅ # £¬Èç¹ûº¬ÓÐÔò ²ð·Ö
|
string[] NewBarCode;
|
if (sBarCode.CompareTo("#") > 0)
|
{
|
NewBarCode = sBarCode.Split(Convert.ToChar("#"));
|
sBarCode = NewBarCode[0];
|
}
|
//À¶×Ö²úÆ·Èë¿â¡¢Í⹺Èë¿â¡¢Î¯ÍâÈë¿â£¬¸ù¾ÝÎïÁÏÌõÂëµÃµ½¶ÔÓ¦Ô´µ¥ÐÅÏ¢£¬·Ç¶àÔ´µ¥Ä£Ê½
|
//δɨÃèÔ´µ¥µÄÇé¿öÏ£¬µÚÒ»´ÎɨÃèÎïÁÏÌõÂë»ñȡԴµ¥ÐÅÏ¢²¢´æÈëÁÙʱ±í
|
//²É¹ºÈë¿â£¨1201£©¡¢²úÆ·Èë¿â£¨1202£©¡¢Î¯ÍâÈë¿â£¨1210£©
|
if (SourceFlag == false && (HBillType == "1201" || HBillType == "1202" || HBillType == "1210"))
|
{
|
//¸ù¾ÝÎïÁÏÌõÂëµÃµ½¶ÔÓ¦Ô´µ¥ÐÅÏ¢²¢½«Ô´µ¥ÐÅÏ¢ÐÂÔöµ½ÌõÂë³öÈë¿âÁÙʱ±í£¬´ø³ö±íÍ·²¿ÃÅ¡¢¹©Ó¦ÉÌ
|
DataSet ds1 = oCn.RunProcReturn("exec h_p_WMS_BarCode_SourceBillType " + HBillID.ToString() + ",'" + HBillType + "','" + sBarCode + "'", "h_p_WMS_BarCode_SourceBillType");
|
if (ds1 == null || ds1.Tables[0].Rows.Count == 0)
|
{
|
sErrMsg = "ɨÃèÎïÁÏÌõÂëºóÅжÏÌõÂëÔ´µ¥ÐÅÏ¢£¬Î´Öª´íÎó£¡";
|
return false;
|
}
|
else
|
{
|
if (DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0][0]) == 0)
|
{
|
sHSourceBillType = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HSourceBillType"]);
|
sHSourceBillNo = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HSourceBillNo"]);
|
sHSupID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HSupID"]);
|
sHSupName = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HSupName"]);
|
sHDeptID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HDeptID"]);
|
sHDeptName = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HDeptName"]);
|
HSourceBillType = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HSourceBillType"]);
|
//´æÔÚÔ´µ¥ÐÅÏ¢£¬½«Ô´µ¥ÐÅϢдÈëÌõÂëÁÙʱ±í
|
if (sHSourceBillNo != "")
|
{
|
// ½«Ô´µ¥ÐÅϢдÈë ÁÙʱ»º´æ±í
|
if (tem.AddNew_Source(HBillID, HBillNo, HBillType, sHSourceBillNo, sHSourceBillType, sRedBlue, ref sErrMsg))
|
{
|
|
}
|
else
|
{
|
sErrMsg = "ɨÃèÎïÁÏÌõÂëºó±£´æÔ´µ¥ÐÅϢʧ°Ü£¡" + sErrMsg;
|
return false;
|
}
|
}
|
}
|
else
|
{
|
sErrMsg = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HRemark"]);
|
return false;
|
}
|
}
|
}
|
else
|
{
|
//ÎÞÔ´µ¥×´Ì¬£¬ÉèÖÃÔ´µ¥ÀàÐÍΪ-1
|
if (SourceFlag == false)
|
{
|
//ÏúÊÛ³ö¿â²»ÔÊÐíÎÞÔ´µ¥³ö¿â
|
if (HBillType == "1205")
|
{
|
sErrMsg = "²»ÔÊÐíÎÞÔ´µ¥³ö¿â£¬ÇëÏÈɨÃèÔ´µ¥£¡";
|
return false;
|
}
|
HSourceBillType = "-1";
|
}
|
}
|
//¸ù¾ÝÌõÂë»ñÈ¡ÌõÂëÐÅÏ¢£¬´æÔÚÏàͬÎïÁÏʱ×Ô¶¯»ñȡһÐÐÔ´µ¥ÐÅÏ¢
|
DAL.ClsGy_BarCodeBill_View dal = new DAL.ClsGy_BarCodeBill_View();
|
if (dal.GetInfoByNumber_View(sBarCode))
|
{
|
//»ñÈ¡TMPÖеÄÔµ¥Ö÷ÄÚÂëºÍ×ÓÄÚÂë
|
DataSet ds2 = oCn.RunProcReturn("exec h_p_WMS_GetBarCodeSourceInterID " + HBillID.ToString() + ",'" + sBarCode + "' ", "h_p_WMS_GetBarCodeSourceInterID");
|
if (ds2 == null || ds2.Tables[0].Rows.Count == 0)
|
{
|
sErrMsg = "ɨÃèÎïÁÏÌõÂëºóÓÐÔ´µ¥×Ô¶¯»ñȡһÐÐÔ´µ¥ÐÅÏ¢£¬Î´Öª´íÎó£¡";
|
return false;
|
}
|
else
|
{
|
dal.omodel_View.HSourceBillNo = DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HSourceBillNo"]);
|
dal.omodel_View.HSourceEntryID = DBUtility.ClsPub.isLong(ds2.Tables[0].Rows[0]["HSourceEntryID"]);
|
dal.omodel_View.HSourceInterID = DBUtility.ClsPub.isLong(ds2.Tables[0].Rows[0]["HSourceInterID"]);
|
dal.omodel_View.HinitQty = DBUtility.ClsPub.isDoule(ds2.Tables[0].Rows[0]["HQtyMust"]);
|
//ËùɨÃèÎïÁÏÌõÂëµÄÎïÁϲ»ÊôÓÚ¸ÃÔ´µ¥ÏÂ
|
if (DBUtility.ClsPub.isLong(ds2.Tables[0].Rows[0][0]) != 0)
|
{
|
if (HSourceBillNo != "" && SourceFlag == true)
|
{
|
sErrMsg = "¸ÃÎïÁϲ¢²»´æÔÚÓÚ´ËÃ÷ϸÐÅÏ¢ÖУ¬ÇëÈ·ÈÏÎïÁÏÎÞÎóºóÖØÐÂɨÃ裡";
|
return false;
|
}
|
}
|
}
|
}
|
else
|
{
|
sErrMsg = "ÎÞЧÌõÂë";
|
return false;
|
}
|
|
//»ñÈ¡ÌõÂëÊýÁ¿
|
if (dal.omodel_View.HBarCodeType != "ÍÐÅÌÌõÂë")
|
{
|
if (dal.omodel_View.HBarCodeType == "ΨһÌõÂë" && HQty > 0 && dal.omodel_View.HQty < HQty)
|
{
|
sRelQty = dal.omodel_View.HQty;
|
}
|
else if (HQty > 0)
|
{
|
sRelQty = HQty;
|
}
|
else
|
{
|
sRelQty = dal.omodel_View.HQty;
|
}
|
//²É¹ºÈë¿â£¨1201£©¡¢²úÆ·Èë¿â£¨1202£©¡¢ÆäËûÈë¿âÀ¶×Ö£¨1203£©¡¢Î¯ÍâÈë¿â£¨1210£©
|
//Éú²úÍËÁÏ£¨1244£©¡¢ÏúÊÛÍ˿⣨1247£©¡¢ÆäËû³ö¿âºì×Ö£¨1249£©¡¢Î¯ÍâÍËÁÏ£¨1238£©
|
//Éú²úÁìÁÏ£¨1204£©¡¢ÏúÊÛ³ö¿â£¨1205£©¡¢ÆäËû³ö¿âÀ¶×Ö£¨1206£©¡¢Î¯Íâ³ö¿â£¨1211£©
|
//Í⹺ÍËÁÏ£¨1239£©¡¢²úÆ·Í˿⣨1245£©¡¢ÆäËûÈë¿âºì×Ö£¨1248£©¡¢Î¯ÍâÍ˿⣨1246£©
|
if (HBillType == "1204" || HBillType == "1205" || HBillType == "1206" || HBillType == "1211"
|
|| HBillType == "1239" || HBillType == "1245" || HBillType == "1248" || HBillType == "1246")
|
{
|
//·ÇΨһÌõÂëɨÃèʱÅжϲֿâ²ÖλÊÇ·ñÒÑÑ¡Ôñ
|
if (dal.omodel_View.HBarCodeType != "ΨһÌõÂë")
|
{
|
if (HWhID == 0)
|
{
|
sErrMsg = "²Ö¿âûÓÐÑ¡Ôñ£¡";
|
return false;
|
}
|
else
|
{
|
//¸ù¾Ý²Ö¿âID£¬ÅжÏÊÇ·ñÆôÓòÖλ
|
DataSet ds3 = oCn.RunProcReturn(" select HSPFlag from Gy_Warehouse where HItemID= " + HWhID.ToString(), "Gy_Warehouse");
|
//ÎÞ·µ»ØÊý¾ÝÔòΪÎïÁÏÌõÂë
|
if (ds3 == null || ds3.Tables[0].Rows.Count == 0)
|
{
|
sErrMsg = "²Ö¿âÄÚÂë´íÎó£¡";
|
return false;
|
}
|
else if (HSPID == 0 && DBUtility.ClsPub.isBool(ds3.Tables[0].Rows[0]["HSPFlag"]) == true)
|
{
|
sErrMsg = "²ÖλûÓÐÑ¡Ôñ£¡";
|
return false;
|
}
|
}
|
}
|
else
|
{
|
//ÅжÏÌõÂë¿â´æ ·µ»Ø¿â´æÊýÁ¿ ²Ö¿â ²Öλ
|
DAL.ClsKF_PonderationBillMain_Temp_View Tempdal = new DAL.ClsKF_PonderationBillMain_Temp_View();
|
if (Tempdal.CheckQtyByBarCode(HBillID, HBillType, sBarCode, ref HWhID, ref HSPID, sRelQty, ref sRelQty))
|
{
|
|
}
|
else
|
{
|
if (sRelQty == 0)
|
{
|
sErrMsg = "ÎÞ¿â´æ£¡";
|
return false;
|
}
|
else
|
{
|
sErrMsg = "¿â´æ²»×㣬ÒÑ»ñȡʵ¼Ê¿â´æÊýÁ¿£¡";
|
}
|
}
|
}
|
}
|
else
|
{
|
//Åжϲ¢»ñÈ¡ ²Ö¿â ²ÖλÐÅÏ¢
|
DataSet ds4 = oCn.RunProcReturn("exec h_p_WMS_GetBillWHID " + HBillID.ToString() + ",'" + HBillType + "','" + sBarCode + "'," + HWhID.ToString() + "," + HSPID.ToString(), "h_p_WMS_GetBillWHID");
|
if (ds4 == null || ds4.Tables[0].Rows.Count == 0)
|
{
|
sErrMsg = "Åжϲ¢»ñÈ¡²Ö¿â²ÖλÐÅÏ¢£¬Î´Öª´íÎó£¡";
|
return false;
|
}
|
else
|
{
|
if (DBUtility.ClsPub.isLong(ds4.Tables[0].Rows[0][0]) == 0)
|
{
|
HWhID = DBUtility.ClsPub.isLong(ds4.Tables[0].Rows[0]["HWHID"]);
|
HSPID = DBUtility.ClsPub.isLong(ds4.Tables[0].Rows[0]["HSPID"]);
|
}
|
else
|
{
|
sErrMsg = DBUtility.ClsPub.isStrNull(ds4.Tables[0].Rows[0]["HRemark"]);
|
return false;
|
}
|
}
|
//ÅжÏÌõÂëɨÃèÊýÁ¿ ·µ»ØÊ£ÓàδɨÃèÊýÁ¿
|
if (tem.IsBarCode(sBarCode, HBillType, HRedBlueFlag, ref sRelQty, ref sErrMsg))
|
{
|
|
}
|
else
|
{
|
sErrMsg = sErrMsg;
|
return false;
|
}
|
}
|
}
|
|
model.HInterID = HBillID;
|
model.HBillNo = HBillNo;
|
model.HBillType = HBillType;
|
model.HMaker = HMaker;
|
//
|
model.HMaterID = dal.omodel_View.HMaterID;
|
model.HAuxPropID = dal.omodel_View.HAuxPropID;
|
model.HErpClsID = dal.omodel_View.HErpClsID;
|
model.HQty = sRelQty;
|
model.HQtyMust = dal.omodel_View.HinitQty;
|
model.HBarCode = dal.omodel_View.HBarCode;
|
model.HBatchNo = dal.omodel_View.HBatchNo;
|
model.HMTONo = dal.omodel_View.HMTONo;
|
|
model.HWhID = HWhID;
|
model.HStockPlaceID = HSPID;
|
model.HSourceInterID = dal.omodel_View.HSourceInterID;
|
model.HSourceEntryID = dal.omodel_View.HSourceEntryID;
|
model.HSourceBillNo = dal.omodel_View.HSourceBillNo;
|
model.HSourceBillType = HSourceBillType;
|
model.HRedBlueFlag = HRedBlueFlag;
|
model.HPieceQty = 1;
|
model.HSTOCKORGID = HOWNERID;
|
model.HOWNERID = HOWNERID;
|
|
//ÎïÁÏÌõÂëдÈëÁÙʱ±íʱ£¬Åжϲֿâ²ÖλÊÇ·ñÕýÈ·
|
DataSet ds5 = oCn.RunProcReturn("exec h_p_WMS_CheckWHandSP " + HWhID.ToString() + "," + HSPID.ToString(), "h_p_WMS_CheckWHandSP");
|
if (ds5 == null || ds5.Tables[0].Rows.Count == 0)
|
{
|
sErrMsg = "ɨÃèÎïÁÏÌõÂë´æÈëÁÙʱ±íʱÅжϲֿâ²ÖλÊÇ·ñÕýÈ·,δ֪´íÎó£¡";
|
return false;
|
}
|
else
|
{
|
if (DBUtility.ClsPub.isLong(ds5.Tables[0].Rows[0][0]) == 1)
|
{
|
sErrMsg = DBUtility.ClsPub.isStrNull(ds5.Tables[0].Rows[0]["HRemark"]);
|
return false;
|
}
|
}
|
|
//½«ÎïÁÏÌõÂëÐÅϢдÈë³öÈë¿âÌõÂëÁÙʱ±í
|
if (set_SavePonderationBillMain_Temp_Select_Qty(model, HQty, ref sErrMsg))
|
{
|
|
}
|
else
|
{
|
sErrMsg = "ɨÃèʧ°Ü£¡" + sErrMsg;
|
return false;
|
}
|
return true;
|
}
|
catch (Exception e)
|
{
|
sErrMsg = sErrMsg + "," + e.Message;
|
return false;
|
}
|
}
|
|
/// <summary>
|
/// ½«Êý¾ÝдÈëTMP±í ²¢½øÐÐÅжÏ
|
/// </summary>
|
/// <param name="oMain"></param>
|
/// <param name="sQty"></param>
|
/// <param name="sErrMsg"></param>
|
/// <returns></returns>
|
public bool set_SavePonderationBillMain_Temp_Select_Qty(Model.ClsKF_PonderationBillMain_Temp oMain, Double sQty, ref string sErrMsg)
|
{
|
try
|
{
|
DAL.ClsKF_PonderationBillMain_Temp_Ctl dal = new DAL.ClsKF_PonderationBillMain_Temp_Ctl();
|
DAL.ClsGy_BarCodeBill_View oBar = new DAL.ClsGy_BarCodeBill_View();
|
dal.oModel = oMain;
|
if (!oBar.GetInfoByNumber_View(oMain.HBarCode))
|
{
|
sErrMsg = "ÎÞЧÌõÂë";
|
return false;
|
}
|
else
|
{
|
if (oBar.omodel_View.HBarCodeType == "ÍÐÅÌÌõÂë")
|
{
|
if (!dal.IsBarCode_Pack(oMain.HBarCode, oMain.HInterID, oMain.HBillType))
|
{
|
sErrMsg = "´æÔÚÏàͬÌõÂ룬ÇëÎðÖØ¸´É¨Ã裡";
|
return false;
|
}
|
if (dal.AddNew_More_Select(ref sErrMsg))
|
{
|
//sErrMsg = "±£´æ³É¹¦£¡";
|
return true;
|
}
|
else
|
{
|
//sErrMsg = "±£´æÊ§°Ü£¡";
|
return false;
|
}
|
}
|
else
|
{
|
if (oBar.omodel_View.HBarCodeType == "ΨһÌõÂë")
|
{
|
if (!dal.IsBarCode(oMain.HBarCode, oMain.HInterID, oMain.HErpClsID, oMain.HBillType))
|
{
|
sErrMsg = "´æÔÚÏàͬÌõÂ룬ÇëÎðÖØ¸´É¨Ã裡";
|
return false;
|
}
|
//ÅжÏÌõÂëÁÙʱ±íÖÐÊÇ·ñ´æÔÚ(µ÷²¦µ¥Í¬Ò»ÌõÂëÏàͬµ÷Èëµ÷³ö²Ö¿â²ÖλֻÔÊÐíɨÃèÒ»´Î£¬ÏúÊÛ³ö¿âͬһÌõÂëͬһ²Ö¿â²ÖλֻÔÊÐíɨÃèÒ»´Î) Íè¾®
|
//if (!dal.IsBarCode(oMain.HBarCode, oMain.HInterID, oMain.HErpClsID, oMain.HBillType,oMain.HWhID,oMain.HStockPlaceID,oMain.HSCWHID,oMain.HOutStockPlaceID,oMain.))
|
//{
|
// sErrMsg = "´æÔÚÏàͬÌõÂ룬ÇëÎðÖØ¸´É¨Ã裡";
|
// return false;
|
//}
|
}
|
if (dal.AddNew_Source(sQty, ref sErrMsg))
|
{
|
//sErrMsg = "±£´æ³É¹¦£¡";
|
return true;
|
}
|
else
|
{
|
//sErrMsg = "±£´æÊ§°Ü£¡";
|
return false;
|
}
|
}
|
}
|
}
|
catch (Exception e)
|
{
|
sErrMsg = sErrMsg + "," + e.Message;
|
return false;
|
}
|
}
|
|
|
//ɨÃèÎïÁÏÌõÂë ±£´æµ½³öÈë¿âÌõÂëÁÙʱ±í(ÎïÁÏ) Èë¿âÄ£¿é
|
public bool set_SavePonderationBillMain_Temp_BarCode_Fast(string sBarCode, Int64 HBillID, string HBillType, string HBillNo, string HMaker, Int64 HWhID, Int64 HSPID, Double HQty, bool HRedBlueFlag, bool SourceFlag, string HSourceBillNo, string HSourceBillType, Int64 HOWNERID, ref string sHSourceBillNo, ref string sHSourceBillType, ref long sHSupID, ref string sHSupName, ref long sHDeptID, ref string sHDeptName, ref string sErrMsg)
|
{
|
SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
|
DAL.ClsKF_PonderationBillMain_Temp_Ctl tem = new DAL.ClsKF_PonderationBillMain_Temp_Ctl();
|
Model.ClsKF_PonderationBillMain_Temp model = new Model.ClsKF_PonderationBillMain_Temp();
|
double sRelQty = 0;
|
string sRedBlue = "À¶×Ö";
|
if (HRedBlueFlag)
|
{
|
sRedBlue = "ºì×Ö";
|
}
|
else
|
{
|
sRedBlue = "À¶×Ö";
|
}
|
//ÅжÏÌõÂëÊÇ·ñº¬ÌØÊâ·ûºÅ # £¬Èç¹ûº¬ÓÐÔò ²ð·Ö
|
string[] NewBarCode;
|
if (sBarCode.CompareTo("#") > 0)
|
{
|
NewBarCode = sBarCode.Split(Convert.ToChar("#"));
|
sBarCode = NewBarCode[0];
|
}
|
//¸ù¾ÝÎïÁÏÌõÂëµÃµ½¶ÔÓ¦Ô´µ¥ÐÅÏ¢£¬·Ç¶àÔ´µ¥Ä£Ê½£¬ÅжÏÊÇ·ñÒÑÓÐÔ´µ¥¼Ç¼(µ¥¾ÝÀàÐÍ=1203£¬ÆäËûÈë¿âµ¥³ýÍâ)
|
if (SourceFlag || HBillType == "1203")
|
{
|
}
|
else
|
{
|
//¸ù¾ÝÎïÁÏÌõÂëµÃµ½¶ÔÓ¦Ô´µ¥ÐÅÏ¢²¢½«Ô´µ¥ÐÅÏ¢ÐÂÔöµ½ÌõÂë³öÈë¿âÁÙʱ±í£¬´ø³ö±íÍ·²¿ÃÅ¡¢¹©Ó¦ÉÌ
|
DataSet ds = oCn.RunProcReturn("exec h_p_WMS_BarCode_SourceBillType " + HBillID.ToString() + ",'" + HBillType + "','" + sBarCode + "'", "h_p_WMS_BarCode_SourceBillType");
|
if (ds == null || ds.Tables[0].Rows.Count == 0)
|
{
|
sErrMsg = "ɨÃèÎïÁÏÌõÂëºóÅжÏÌõÂëÔ´µ¥ÐÅÏ¢£¬Î´Öª´íÎó£¡";
|
return false;
|
}
|
else
|
{
|
if (DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0][0]) == 0)
|
{
|
sHSourceBillType = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HSourceBillType"]);
|
sHSourceBillNo = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HSourceBillNo"]);
|
sHSupID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0]["HSupID"]);
|
sHSupName = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HSupName"]);
|
sHDeptID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0]["HDeptID"]);
|
sHDeptName = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HDeptName"]);
|
HSourceBillType = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HSourceBillType"]);
|
//´æÔÚÔ´µ¥ÐÅÏ¢£¬½«Ô´µ¥ÐÅϢдÈëÌõÂëÁÙʱ±í
|
if (sHSourceBillNo != "")
|
{
|
// ½«Ô´µ¥ÐÅϢдÈë ÁÙʱ»º´æ±í
|
if (tem.AddNew_Source(HBillID, HBillNo, HBillType, sHSourceBillNo, sHSourceBillType, sRedBlue, ref sErrMsg))
|
{
|
|
}
|
else
|
{
|
sErrMsg = "ɨÃèÎïÁÏÌõÂëºó±£´æÔ´µ¥ÐÅϢʧ°Ü£¡" + sErrMsg;
|
return false;
|
}
|
}
|
}
|
else
|
{
|
sErrMsg = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HRemark"]);
|
return false;
|
}
|
}
|
}
|
//¸ù¾ÝÌõÂë»ñÈ¡ÌõÂëÐÅÏ¢£¬´æÔÚÏàͬÎïÁÏʱ×Ô¶¯»ñȡһÐÐÔ´µ¥ÐÅÏ¢
|
DAL.ClsGy_BarCodeBill_View dal = new DAL.ClsGy_BarCodeBill_View();
|
if (dal.GetInfoByNumber_View(sBarCode))
|
{
|
//»ñÈ¡TMPÖеÄÔµ¥Ö÷ÄÚÂëºÍ×ÓÄÚÂë
|
DataSet ds2 = oCn.RunProcReturn("exec h_p_WMS_GetBarCodeSourceInterID " + HBillID.ToString() + ",'" + sBarCode + "' ", "h_p_WMS_GetBarCodeSourceInterID");
|
if (ds2 == null || ds2.Tables[0].Rows.Count == 0)
|
{
|
sErrMsg = "ɨÃèÎïÁÏÌõÂëºóÓÐÔ´µ¥×Ô¶¯»ñȡһÐÐÔ´µ¥ÐÅÏ¢£¬Î´Öª´íÎó£¡";
|
return false;
|
}
|
else
|
{
|
dal.omodel_View.HSourceBillNo = DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HSourceBillNo"]);
|
dal.omodel_View.HSourceEntryID = DBUtility.ClsPub.isLong(ds2.Tables[0].Rows[0]["HSourceEntryID"]);
|
dal.omodel_View.HSourceInterID = DBUtility.ClsPub.isLong(ds2.Tables[0].Rows[0]["HSourceInterID"]);
|
dal.omodel_View.HinitQty = DBUtility.ClsPub.isDoule(ds2.Tables[0].Rows[0]["HQtyMust"]);
|
//ËùɨÃèÎïÁÏÌõÂëµÄÎïÁϲ»ÊôÓÚ¸ÃÔ´µ¥ÏÂ
|
if (DBUtility.ClsPub.isLong(ds2.Tables[0].Rows[0][0]) != 0)
|
{
|
if (HSourceBillNo != "" && SourceFlag == true)
|
{
|
sErrMsg = "¸ÃÎïÁϲ¢²»´æÔÚÓÚ´ËÃ÷ϸÐÅÏ¢ÖУ¬ÇëÈ·ÈÏÎïÁÏÎÞÎóºóÖØÐÂɨÃ裡";
|
return false;
|
}
|
}
|
}
|
}
|
else
|
{
|
sErrMsg = "ÎÞЧÌõÂë";
|
return false;
|
}
|
|
//Åжϲ¢»ñÈ¡ ²Ö¿â ²ÖλÐÅÏ¢
|
DataSet ds3 = oCn.RunProcReturn("exec h_p_WMS_GetBillWHID " + HBillID.ToString() + ",'" + HBillType + "','" + sBarCode + "'," + HWhID.ToString() + "," + HSPID.ToString(), "h_p_WMS_GetBillWHID");
|
if (ds3 == null || ds3.Tables[0].Rows.Count == 0)
|
{
|
sErrMsg = "Åжϲ¢»ñÈ¡²Ö¿â²ÖλÐÅÏ¢£¬Î´Öª´íÎó£¡";
|
return false;
|
}
|
else
|
{
|
if (DBUtility.ClsPub.isLong(ds3.Tables[0].Rows[0][0]) == 0)
|
{
|
HWhID = DBUtility.ClsPub.isLong(ds3.Tables[0].Rows[0]["HWHID"]);
|
HSPID = DBUtility.ClsPub.isLong(ds3.Tables[0].Rows[0]["HSPID"]);
|
}
|
else
|
{
|
sErrMsg = DBUtility.ClsPub.isStrNull(ds3.Tables[0].Rows[0]["HRemark"]);
|
return false;
|
}
|
}
|
|
//»ñÈ¡ÌõÂëÊýÁ¿
|
if (dal.omodel_View.HBarCodeType != "ÍÐÅÌÌõÂë")
|
{
|
if (dal.omodel_View.HBarCodeType == "ΨһÌõÂë" && HQty > 0 && dal.omodel_View.HQty < HQty)
|
{
|
sRelQty = dal.omodel_View.HQty;
|
}
|
else if (HQty > 0)
|
{
|
sRelQty = HQty;
|
}
|
else
|
{
|
sRelQty = dal.omodel_View.HQty;
|
}
|
|
if (HRedBlueFlag)
|
{
|
//ÅжÏÌõÂë¿â´æ ·µ»Ø¿â´æÊýÁ¿ ²Ö¿â ²Öλ
|
DAL.ClsKF_PonderationBillMain_Temp_View Tempdal = new DAL.ClsKF_PonderationBillMain_Temp_View();
|
if (Tempdal.CheckQtyByBarCode(HBillID, HBillType, sBarCode, ref HWhID, ref HSPID, sRelQty, ref sRelQty))
|
{
|
|
}
|
else
|
{
|
if (sRelQty == 0)
|
{
|
sErrMsg = "ÎÞ¿â´æ£¡";
|
return false;
|
}
|
else
|
{
|
sErrMsg = "¿â´æ²»×㣬ÒÑ»ñȡʵ¼Ê¿â´æÊýÁ¿£¡";
|
}
|
}
|
}
|
else
|
{
|
//ÅжÏÌõÂëɨÃèÊýÁ¿ ·µ»ØÊ£ÓàδɨÃèÊýÁ¿
|
if (tem.IsBarCode(sBarCode, HBillType, HRedBlueFlag, ref sRelQty, ref sErrMsg))
|
{
|
|
}
|
else
|
{
|
sErrMsg = sErrMsg;
|
return false;
|
}
|
}
|
}
|
|
model.HInterID = HBillID;
|
model.HBillNo = HBillNo;
|
model.HBillType = HBillType;
|
model.HMaker = HMaker;
|
//
|
model.HMaterID = dal.omodel_View.HMaterID;
|
model.HAuxPropID = dal.omodel_View.HAuxPropID;
|
model.HErpClsID = dal.omodel_View.HErpClsID;
|
model.HQty = sRelQty;
|
model.HQtyMust = dal.omodel_View.HinitQty;
|
model.HBarCode = dal.omodel_View.HBarCode;
|
model.HBatchNo = dal.omodel_View.HBatchNo;
|
model.HMTONo = dal.omodel_View.HMTONo;
|
|
model.HWhID = HWhID;
|
model.HStockPlaceID = HSPID;
|
model.HSourceInterID = dal.omodel_View.HSourceInterID;
|
model.HSourceEntryID = dal.omodel_View.HSourceEntryID;
|
model.HSourceBillNo = dal.omodel_View.HSourceBillNo;
|
model.HSourceBillType = HSourceBillType;
|
model.HRedBlueFlag = HRedBlueFlag;
|
model.HPieceQty = 1;
|
model.HSTOCKORGID = HOWNERID;
|
model.HOWNERID = HOWNERID;
|
//½«ÎïÁÏÌõÂëÐÅϢдÈë³öÈë¿âÌõÂëÁÙʱ±í
|
if (set_SavePonderationBillMain_Temp_Select_Qty(model, HQty, ref sErrMsg))
|
{
|
|
}
|
else
|
{
|
sErrMsg = "ɨÃèʧ°Ü£¡" + sErrMsg;
|
return false;
|
}
|
return true;
|
}
|
|
|
|
//Ò»¼üɨÂëģʽ£¬¸ù¾ÝÌõÂëǰ׺×ß ²»Í¬·½·¨£¨²Ö¿â¡¢²Öλ¡¢²¿ÃÅ£©£¨Ô´µ¥¡¢ÎïÁÏÌõÂ룩 Èë¿âÄ£¿é
|
public Model.ClsKf_ICStockBill_WMS get_CheckTypeByBarCode(string sBarCode, Int64 HBillID, string HBillType, string HBillNo, string HMaker, Int64 HWhID, Int64 HSPID, Double HQty, bool HRedBlueFlag, bool SourceFlag, string HSourceBillNo, string HSourceBillType, Int64 HOWNERID, ref string sErrMsg)
|
{
|
SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
|
Model.ClsKf_ICStockBill_WMS oBar = new Model.ClsKf_ICStockBill_WMS();
|
DAL.ClsKF_PonderationBillMain_Temp_Ctl tem = new DAL.ClsKF_PonderationBillMain_Temp_Ctl();
|
Model.ClsKF_PonderationBillMain_Temp model = new Model.ClsKF_PonderationBillMain_Temp();
|
string sHSourceBillType = "";
|
string sHSourceBillNo = "";
|
Int64 sHSupID = 0;
|
string sHSupName = "";
|
Int64 sHDeptID = 0;
|
string sHDeptName = "";
|
|
//»ñȡϵͳ²ÎÊý
|
Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
|
if (oSystemParameter.ShowBill(ref sErrMsg) == false)
|
{
|
sErrMsg = "»ñȡϵͳ²ÎÊýʧ°Ü£¡ " + sErrMsg;
|
return null;
|
}
|
//ÅжÏÊÇ·ñÆôÓÃÒ»¼üɨÂëģʽ£¬YΪÆôÓã¬Î´ÆôÓÃʱֻɨÃèÎïÁÏÌõÂë
|
if (oSystemParameter.omodel.WMS_OneKeyMode.ToUpper() == "N")
|
{
|
//½«ÎïÁÏÌõÂëÐÅϢдÈë³öÈë¿âÌõÂëÁÙʱ±í
|
if (set_SavePonderationBillMain_Temp_BarCode_Fast(sBarCode, HBillID, HBillType, HBillNo, HMaker, HWhID, HSPID, HQty, HRedBlueFlag, SourceFlag, HSourceBillNo, HSourceBillType, HOWNERID, ref sHSourceBillNo, ref sHSourceBillType, ref sHSupID, ref sHSupName, ref sHDeptID, ref sHDeptName, ref sErrMsg))
|
{
|
oBar.HSourceBillType = sHSourceBillType;
|
oBar.HSourceBillNo = sHSourceBillNo;
|
oBar.HSupID = sHSupID;
|
oBar.HSupName = sHSupName;
|
oBar.HDeptID = sHDeptID;
|
oBar.HDeptName = sHDeptName;
|
}
|
else
|
{
|
sErrMsg = "ɨÃèʧ°Ü£¡" + sErrMsg;
|
return null;
|
}
|
return oBar;
|
}
|
//Ò»¼üɨÂëģʽ£¬¸ù¾ÝÌõÂëǰ׺×ß ²»Í¬·½·¨£¨²Ö¿â¡¢²Öλ¡¢²¿ÃÅ£©£¨Ô´µ¥¡¢ÎïÁÏÌõÂ룩
|
else
|
{
|
string sRedBlue = "À¶×Ö";
|
if (HRedBlueFlag)
|
{
|
sRedBlue = "ºì×Ö";
|
}
|
else
|
{
|
sRedBlue = "À¶×Ö";
|
}
|
DataSet Dss;
|
//¸ù¾ÝµÝÈëµÄÌõÂëǰÈý룬ÅжÏÌõÂëÀàÐÍ£¨²Ö¿â¡¢²Öλ¡¢²¿ÃÅ¡¢Ô´µ¥¡¢ÎïÁÏÌõÂ룩
|
Dss = oCn.RunProcReturn(" select HSourceName,BarCodeType from Xt_BarCodeType where HSourceNumber= '" + sBarCode.Substring(0, 3) + "'", "Xt_BarCodeType");
|
|
//ÎÞ·µ»ØÊý¾ÝÔòΪÎïÁÏÌõÂë
|
if (Dss == null || Dss.Tables[0].Rows.Count == 0)
|
{
|
//½«ÎïÁÏÌõÂëÐÅϢдÈë³öÈë¿âÌõÂëÁÙʱ±í
|
if (set_SavePonderationBillMain_Temp_BarCode_Fast(sBarCode, HBillID, HBillType, HBillNo, HMaker, HWhID, HSPID, HQty, HRedBlueFlag, SourceFlag, HSourceBillNo, HSourceBillType, HOWNERID, ref sHSourceBillNo, ref sHSourceBillType, ref sHSupID, ref sHSupName, ref sHDeptID, ref sHDeptName, ref sErrMsg))
|
{
|
oBar.HSourceBillType = sHSourceBillType;
|
oBar.HSourceBillNo = sHSourceBillNo;
|
oBar.HSupID = sHSupID;
|
oBar.HSupName = sHSupName;
|
oBar.HDeptID = sHDeptID;
|
oBar.HDeptName = sHDeptName;
|
}
|
else
|
{
|
sErrMsg = "ɨÃèʧ°Ü£¡" + sErrMsg;
|
return null;
|
}
|
return oBar;
|
}
|
else
|
{
|
string sBarBillName = Pub_Class.ClsPub.isStrNull(Dss.Tables[0].Rows[0]["HSourceName"]);
|
string sBarBillType = Pub_Class.ClsPub.isStrNull(Dss.Tables[0].Rows[0]["BarCodeType"]);
|
|
//ÅжÏÌõÂëÀàÐÍΪ »ù´¡×ÊÁÏÌõÂë »ò Ô´µ¥ÌõÂë
|
if (sBarBillType == "»ù´¡×ÊÁÏÌõÂë")
|
{
|
//²Ö¿âÌõÂë
|
if (sBarBillName == "²Ö¿â")
|
{
|
DAL.ClsIF_Warehouse_View dal = new DAL.ClsIF_Warehouse_View();
|
//½«µÝÈëµÄÌõÂëÈ¥µôǰÈýλºóת»¯³ÉÕûÐÎ,TryParse²»ÄÜת»»³ÉÕûÊýʱ·µ»Øfalse£¬²¢·µ»ØID=0
|
int ID;
|
if (int.TryParse(sBarCode.Remove(0, 3), out ID))
|
{
|
if (dal.GetInfoByID(ID))
|
{
|
oBar.HBarType = "²Ö¿âÌõÂë";
|
oBar.HWhID = dal.omodel.HItemID;
|
oBar.HWhNumber = dal.omodel.HNumber;
|
oBar.HWhName = dal.omodel.HName;
|
oBar.HSPFlag = dal.omodel.HIsStockMgr;
|
return oBar;
|
}
|
else
|
{
|
sErrMsg = "ÎÞЧ²Ö¿âÌõÂ룡";
|
return null;
|
}
|
}
|
else
|
{
|
sErrMsg = "´íÎóµÄ²Ö¿âÌõÂ룡";
|
return null;
|
}
|
}
|
//²ÖλÌõÂë
|
else if (sBarBillName == "²Öλ")
|
{
|
DAL.ClsIF_StockPlace_View dal = new DAL.ClsIF_StockPlace_View();
|
//½«µÝÈëµÄÌõÂëÈ¥µôǰÈýλºóת»¯³ÉÕûÐÎ
|
int ID;
|
if (int.TryParse(sBarCode.Remove(0, 3), out ID))
|
{
|
if (dal.GetInfoByID(ID))
|
{
|
oBar.HBarType = "²ÖλÌõÂë";
|
oBar.HSPID = dal.omodel.HItemID;
|
oBar.HSPNumber = dal.omodel.HNumber;
|
oBar.HSPName = dal.omodel.HName;
|
oBar.HWhID = dal.omodel.HWHID;
|
oBar.HWhNumber = dal.omodel.HWhNumber;
|
oBar.HWhName = dal.omodel.HWhName;
|
return oBar;
|
}
|
else
|
{
|
sErrMsg = "ÎÞЧ²ÖλÌõÂ룡";
|
return null;
|
}
|
}
|
else
|
{
|
sErrMsg = "´íÎóµÄ²ÖλÌõÂ룡";
|
return null;
|
}
|
}
|
//²¿ÃÅÌõÂë
|
else if (sBarBillName == "²¿ÃÅ")
|
{
|
DAL.ClsIF_Department_View dal = new DAL.ClsIF_Department_View();
|
//½«µÝÈëµÄÌõÂëÈ¥µôǰÈýλºóת»¯³ÉÕûÐÎ
|
int ID;
|
if (int.TryParse(sBarCode.Remove(0, 3), out ID))
|
{
|
if (dal.GetInfoByID(ID))
|
{
|
oBar.HBarType = "²¿ÃÅÌõÂë";
|
oBar.HDeptID = dal.omodel.HItemID;
|
oBar.HDeptNumber = dal.omodel.HNumber;
|
oBar.HDeptName = dal.omodel.HName;
|
return oBar;
|
}
|
else
|
{
|
sErrMsg = "ÎÞЧ²¿ÃÅÌõÂ룡";
|
return null;
|
}
|
}
|
else
|
{
|
sErrMsg = "´íÎóµÄ²¿ÃÅÌõÂ룡";
|
return null;
|
}
|
}
|
else
|
{
|
sErrMsg = "ÎÞЧ»ù´¡×ÊÁÏÌõÂ룡";
|
return null;
|
}
|
}
|
//Ô´µ¥ÌõÂë
|
else if (sBarBillType == "Ô´µ¥ÌõÂë")
|
{
|
DataSet Ds = oCn.RunProcReturn(" select HSourceName from Xt_BarCodeType where HSourceNumber= '" + sBarCode.Substring(0, 3) + "' and HBillType= '" + HBillType + "'", "Xt_BarCodeType");
|
|
if (Ds == null || Ds.Tables[0].Rows.Count == 0)
|
{
|
sErrMsg = "ËùɨԴµ¥ÌõÂë²»ÊôÓÚ´ËÄ£¿éÔ´µ¥·¶Î§£¡";
|
return null;
|
}
|
else
|
{
|
sBarBillName = Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HSourceName"]);
|
//ɨÃèÔ´µ¥ÌõÂëʱÅжÏÊÇ·ñÒѾɨÃè¹ýÔ´µ¥ÐÅÏ¢
|
if (SourceFlag)
|
{
|
sErrMsg = "Ã÷ϸÐÅÏ¢ÁбíÒÑÓÐɨÂë¼Ç¼£¬²»ÔÊÐí¶à´ÎɨÃèÔ´µ¥ÌõÂ룡";
|
return null;
|
}
|
else
|
{
|
//²úÆ·Èë¿âµ¥ Ô´µ¥£ºÉú²úÈÎÎñµ¥
|
if (sBarBillName == "Éú²úÈÎÎñµ¥" && HBillType == "1202")
|
{
|
DAL.Cls_S_IF_ICMOBill_Lite dal = new DAL.Cls_S_IF_ICMOBill_Lite();
|
DataSet DS;
|
//¸ù¾Ýµ¥¾ÝºÅ»ñÈ¡¹ýÂËÌõ¼þ
|
string sWhere = " Where µ¥¾ÝºÅ like '%" + sBarCode + "'";
|
DS = dal.DisSourceBillList(sWhere);
|
if (DS == null || DS.Tables[0].Rows.Count <= 0)
|
{
|
sErrMsg = "ûÓзµ»ØÈκμǼ£¡";
|
return null;
|
}
|
oBar.HBarType = "Ô´µ¥ÌõÂë";
|
oBar.HSourceBillNo = Convert.ToString(DS.Tables[0].Rows[0]["HBillNo"]);
|
oBar.HSourceBillType = Convert.ToString(DS.Tables[0].Rows[0]["HBillType"]);
|
oBar.HSupID = Convert.ToInt64(DS.Tables[0].Rows[0]["HSupID"]);
|
oBar.HSupName = Convert.ToString(DS.Tables[0].Rows[0]["HSupName"]);
|
oBar.HDeptID = Convert.ToInt64(DS.Tables[0].Rows[0]["HDeptID"]);
|
oBar.HDeptName = Convert.ToString(DS.Tables[0].Rows[0]["HDeptName"]);
|
}
|
//Í⹺Èë¿âµ¥ Ô´µ¥£º²É¹º¶©µ¥
|
else if (sBarBillName == "²É¹º¶©µ¥" && HBillType == "1201")
|
{
|
DAL.Cls_S_IF_POOrderBill_Lite dal = new DAL.Cls_S_IF_POOrderBill_Lite();
|
DataSet DS;
|
//¸ù¾Ýµ¥¾ÝºÅ»ñÈ¡¹ýÂËÌõ¼þ
|
string sWhere = " Where µ¥¾ÝºÅ like '%" + sBarCode + "'";
|
DS = dal.DisSourceBillList(sWhere);
|
if (DS == null || DS.Tables[0].Rows.Count <= 0)
|
{
|
sErrMsg = "ûÓзµ»ØÈκμǼ£¡";
|
return null;
|
}
|
oBar.HBarType = "Ô´µ¥ÌõÂë";
|
oBar.HSourceBillNo = Convert.ToString(DS.Tables[0].Rows[0]["HBillNo"]);
|
oBar.HSourceBillType = Convert.ToString(DS.Tables[0].Rows[0]["HBillType"]);
|
oBar.HSupID = Convert.ToInt64(DS.Tables[0].Rows[0]["HSupID"]);
|
oBar.HSupName = Convert.ToString(DS.Tables[0].Rows[0]["HSupName"]);
|
oBar.HDeptID = Convert.ToInt64(DS.Tables[0].Rows[0]["HDeptID"]);
|
oBar.HDeptName = Convert.ToString(DS.Tables[0].Rows[0]["HDeptName"]);
|
}
|
//Í⹺Èë¿âµ¥ Ô´µ¥£ºÊÕÁÏ֪ͨµ¥
|
else if (sBarBillName == "ÊÕÁÏ֪ͨµ¥" && HBillType == "1201")
|
{
|
DAL.Cls_S_IF_POStockInBill_Lite dal = new DAL.Cls_S_IF_POStockInBill_Lite();
|
DataSet DS;
|
//¸ù¾Ýµ¥¾ÝºÅ»ñÈ¡¹ýÂËÌõ¼þ
|
string sWhere = " Where µ¥¾ÝºÅ like '%" + sBarCode + "' and isnull(HBillSubType,0)=12510 ";
|
DS = dal.DisSourceBillList(sWhere);
|
if (DS == null || DS.Tables[0].Rows.Count <= 0)
|
{
|
sErrMsg = "ûÓзµ»ØÈκμǼ£¡";
|
return null;
|
}
|
oBar.HBarType = "Ô´µ¥ÌõÂë";
|
oBar.HSourceBillNo = Convert.ToString(DS.Tables[0].Rows[0]["HBillNo"]);
|
oBar.HSourceBillType = Convert.ToString(DS.Tables[0].Rows[0]["HBillType"]);
|
oBar.HSupID = Convert.ToInt64(DS.Tables[0].Rows[0]["HSupID"]);
|
oBar.HSupName = Convert.ToString(DS.Tables[0].Rows[0]["HSupName"]);
|
oBar.HDeptID = Convert.ToInt64(DS.Tables[0].Rows[0]["HDeptID"]);
|
oBar.HDeptName = Convert.ToString(DS.Tables[0].Rows[0]["HDeptName"]);
|
}
|
//ίÍâÈë¿âµ¥ Ô´µ¥£ºÎ¯Íâ¶©µ¥
|
else if (sBarBillName == "ίÍâ¶©µ¥" && HBillType == "1210")
|
{
|
DAL.Cls_S_IF_WWOrderBill_Lite dal = new DAL.Cls_S_IF_WWOrderBill_Lite();
|
DataSet DS;
|
//¸ù¾Ýµ¥¾ÝºÅ»ñÈ¡¹ýÂËÌõ¼þ
|
string sWhere = " Where µ¥¾ÝºÅ like '%" + sBarCode + "'";
|
DS = dal.DisSourceBillList(sWhere);
|
if (DS == null || DS.Tables[0].Rows.Count <= 0)
|
{
|
sErrMsg = "ûÓзµ»ØÈκμǼ£¡";
|
return null;
|
}
|
oBar.HBarType = "Ô´µ¥ÌõÂë";
|
oBar.HSourceBillNo = Convert.ToString(DS.Tables[0].Rows[0]["HBillNo"]);
|
oBar.HSourceBillType = Convert.ToString(DS.Tables[0].Rows[0]["HBillType"]);
|
oBar.HSupID = Convert.ToInt64(DS.Tables[0].Rows[0]["HSupID"]);
|
oBar.HSupName = Convert.ToString(DS.Tables[0].Rows[0]["HSupName"]);
|
oBar.HDeptID = Convert.ToInt64(DS.Tables[0].Rows[0]["HDeptID"]);
|
oBar.HDeptName = Convert.ToString(DS.Tables[0].Rows[0]["HDeptName"]);
|
}
|
//ίÍâÈë¿âµ¥ Ô´µ¥£ºÊÕÁÏ֪ͨµ¥-ίÍâ
|
else if (sBarBillName == "ÊÕÁÏ֪ͨµ¥-ίÍâ" && HBillType == "1210")
|
{
|
DAL.Cls_S_IF_POStockInBill_Lite dal = new DAL.Cls_S_IF_POStockInBill_Lite();
|
DataSet DS;
|
//¸ù¾Ýµ¥¾ÝºÅ»ñÈ¡¹ýÂËÌõ¼þ
|
string sWhere = " Where µ¥¾ÝºÅ like '%" + sBarCode + "' and isnull(HBillSubType,0)=12511 ";
|
DS = dal.DisSourceBillList(sWhere);
|
if (DS == null || DS.Tables[0].Rows.Count <= 0)
|
{
|
sErrMsg = "ûÓзµ»ØÈκμǼ£¡";
|
return null;
|
}
|
oBar.HBarType = "Ô´µ¥ÌõÂë";
|
oBar.HSourceBillNo = Convert.ToString(DS.Tables[0].Rows[0]["HBillNo"]);
|
oBar.HSourceBillType = Convert.ToString(DS.Tables[0].Rows[0]["HBillType"]);
|
oBar.HSupID = Convert.ToInt64(DS.Tables[0].Rows[0]["HSupID"]);
|
oBar.HSupName = Convert.ToString(DS.Tables[0].Rows[0]["HSupName"]);
|
oBar.HDeptID = Convert.ToInt64(DS.Tables[0].Rows[0]["HDeptID"]);
|
oBar.HDeptName = Convert.ToString(DS.Tables[0].Rows[0]["HDeptName"]);
|
}
|
else
|
{
|
sErrMsg = "Ô´µ¥ÀàÐÍÃû³ÆÉèÖò»ÕýÈ·£¡";
|
return null;
|
}
|
// ½«Ô´µ¥ÐÅϢдÈë ÁÙʱ»º´æ±í
|
if (tem.AddNew_Source(HBillID, HBillNo, HBillType, oBar.HSourceBillNo, oBar.HSourceBillType, sRedBlue, ref sErrMsg))
|
{
|
return oBar;
|
}
|
else
|
{
|
sErrMsg = "±£´æÔ´µ¥ÐÅϢʧ°Ü£¡" + sErrMsg;
|
return null;
|
}
|
}
|
}
|
}
|
else
|
{
|
sErrMsg = "ÎÞЧÌõÂëÀàÐÍ£¡";
|
return null;
|
}
|
}
|
}
|
}
|
|
|
//ɨÃèÎïÁÏÌõÂë ±£´æµ½³öÈë¿âÌõÂëÁÙʱ±í(ÎïÁÏ) ³ö¿âÄ£¿é
|
public bool set_SavePonderationBillMain_Temp_BarCode_OutFast(string sBarCode, Int64 HBillID, string HBillType, string HBillNo, string HMaker, Int64 HWhID, Int64 HSPID, Double HQty, bool HRedBlueFlag, bool SourceFlag, string HSourceBillNo, string HSourceBillType, Int64 HOWNERID, ref string sErrMsg)
|
{
|
SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
|
DAL.ClsKF_PonderationBillMain_Temp_Ctl tem = new DAL.ClsKF_PonderationBillMain_Temp_Ctl();
|
Model.ClsKF_PonderationBillMain_Temp model = new Model.ClsKF_PonderationBillMain_Temp();
|
double sRelQty = 0;
|
|
//ÎÞÔ´µ¥×´Ì¬£¬ÉèÖÃÔ´µ¥ÀàÐÍΪ-1
|
if (SourceFlag == false)
|
{
|
if (HBillType == "1205")
|
{
|
sErrMsg = "²»ÔÊÐíÎÞÔ´µ¥³ö¿â£¬ÇëÏÈɨÃèÔ´µ¥£¡";
|
return false;
|
}
|
HSourceBillType = "-1";
|
}
|
//ÅжÏÌõÂëÊÇ·ñº¬ÌØÊâ·ûºÅ # £¬Èç¹ûº¬ÓÐÔò ²ð·Ö
|
string[] NewBarCode;
|
if (sBarCode.CompareTo("#") > 0)
|
{
|
NewBarCode = sBarCode.Split(Convert.ToChar("#"));
|
sBarCode = NewBarCode[0];
|
}
|
//¸ù¾ÝÌõÂë»ñÈ¡ÌõÂëÐÅÏ¢£¬´æÔÚÏàͬÎïÁÏʱ×Ô¶¯»ñȡһÐÐÔ´µ¥ÐÅÏ¢
|
DAL.ClsGy_BarCodeBill_View dal = new DAL.ClsGy_BarCodeBill_View();
|
if (dal.GetInfoByNumber_View(sBarCode))
|
{
|
//»ñÈ¡TMPÖеÄÔµ¥Ö÷ÄÚÂëºÍ×ÓÄÚÂë
|
DataSet ds1 = oCn.RunProcReturn("exec h_p_WMS_GetBarCodeSourceInterID " + HBillID.ToString() + ",'" + sBarCode + "' ", "h_p_WMS_GetBarCodeSourceInterID");
|
if (ds1 == null || ds1.Tables[0].Rows.Count == 0)
|
{
|
sErrMsg = "ɨÃèÎïÁÏÌõÂëºóÓÐÔ´µ¥×Ô¶¯»ñȡһÐÐÔ´µ¥ÐÅÏ¢£¬Î´Öª´íÎó£¡";
|
return false;
|
}
|
else
|
{
|
dal.omodel_View.HSourceBillNo = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HSourceBillNo"]);
|
dal.omodel_View.HSourceEntryID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HSourceEntryID"]);
|
dal.omodel_View.HSourceInterID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HSourceInterID"]);
|
dal.omodel_View.HinitQty = DBUtility.ClsPub.isDoule(ds1.Tables[0].Rows[0]["HQtyMust"]);
|
//ËùɨÃèÎïÁÏÌõÂëµÄÎïÁϲ»ÊôÓÚ¸ÃÔ´µ¥ÏÂ
|
if (DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0][0]) != 0)
|
{
|
if (HSourceBillNo != "" && SourceFlag == true)
|
{
|
sErrMsg = "¸ÃÎïÁϲ¢²»´æÔÚÓÚ´ËÃ÷ϸÐÅÏ¢ÖУ¬ÇëÈ·ÈÏÎïÁÏÎÞÎóºóÖØÐÂɨÃ裡";
|
return false;
|
}
|
}
|
}
|
}
|
else
|
{
|
sErrMsg = "ÎÞЧÌõÂë";
|
return false;
|
}
|
|
//»ñÈ¡ÌõÂëÊýÁ¿
|
if (dal.omodel_View.HBarCodeType != "ÍÐÅÌÌõÂë")
|
{
|
if (dal.omodel_View.HBarCodeType == "ΨһÌõÂë" && HQty > 0 && dal.omodel_View.HQty < HQty)
|
{
|
sRelQty = dal.omodel_View.HQty;
|
}
|
else if (HQty > 0)
|
{
|
sRelQty = HQty;
|
}
|
else
|
{
|
sRelQty = dal.omodel_View.HQty;
|
}
|
|
if (HRedBlueFlag == false)
|
{
|
//·ÇΨһÌõÂëɨÃèʱÅжϲֿâ²ÖλÊÇ·ñÒÑÑ¡Ôñ
|
if (dal.omodel_View.HBarCodeType != "ΨһÌõÂë")
|
{
|
if (HWhID == 0)
|
{
|
sErrMsg = "²Ö¿âûÓÐÑ¡Ôñ£¡";
|
return false;
|
}
|
else
|
{
|
//¸ù¾Ý²Ö¿âID£¬ÅжÏÊÇ·ñÆôÓòÖλ
|
DataSet Ds2 = oCn.RunProcReturn(" select HSPFlag from Gy_Warehouse where HItemID= " + HWhID.ToString(), "Gy_Warehouse");
|
//ÎÞ·µ»ØÊý¾ÝÔòΪÎïÁÏÌõÂë
|
if (Ds2 == null || Ds2.Tables[0].Rows.Count == 0)
|
{
|
sErrMsg = "²Ö¿âÄÚÂë´íÎó£¡";
|
return false;
|
}
|
else if (HSPID == 0 && DBUtility.ClsPub.isBool(Ds2.Tables[0].Rows[0]["HSPFlag"]) == true)
|
{
|
sErrMsg = "²ÖλûÓÐÑ¡Ôñ£¡";
|
return false;
|
}
|
}
|
}
|
else
|
{
|
//ÅжÏÌõÂë¿â´æ ·µ»Ø¿â´æÊýÁ¿ ²Ö¿â ²Öλ
|
DAL.ClsKF_PonderationBillMain_Temp_View Tempdal = new DAL.ClsKF_PonderationBillMain_Temp_View();
|
if (Tempdal.CheckQtyByBarCode(HBillID, HBillType, sBarCode, ref HWhID, ref HSPID, sRelQty, ref sRelQty))
|
{
|
|
}
|
else
|
{
|
if (sRelQty == 0)
|
{
|
sErrMsg = "ÎÞ¿â´æ£¡";
|
return false;
|
}
|
else
|
{
|
sErrMsg = "¿â´æ²»×㣬ÒÑ»ñȡʵ¼Ê¿â´æÊýÁ¿£¡";
|
}
|
}
|
}
|
}
|
else
|
{
|
//Åжϲ¢»ñÈ¡ ²Ö¿â ²ÖλÐÅÏ¢
|
DataSet ds3 = oCn.RunProcReturn("exec h_p_WMS_GetBillWHID " + HBillID.ToString() + ",'" + HBillType + "','" + sBarCode + "'," + HWhID.ToString() + "," + HSPID.ToString(), "h_p_WMS_GetBillWHID");
|
if (ds3 == null || ds3.Tables[0].Rows.Count == 0)
|
{
|
sErrMsg = "Åжϲ¢»ñÈ¡²Ö¿â²ÖλÐÅÏ¢£¬Î´Öª´íÎó£¡";
|
return false;
|
}
|
else
|
{
|
if (DBUtility.ClsPub.isLong(ds3.Tables[0].Rows[0][0]) == 0)
|
{
|
HWhID = DBUtility.ClsPub.isLong(ds3.Tables[0].Rows[0]["HWHID"]);
|
HSPID = DBUtility.ClsPub.isLong(ds3.Tables[0].Rows[0]["HSPID"]);
|
}
|
else
|
{
|
sErrMsg = DBUtility.ClsPub.isStrNull(ds3.Tables[0].Rows[0]["HRemark"]);
|
return false;
|
}
|
}
|
//ÅжÏÌõÂëɨÃèÊýÁ¿ ·µ»ØÊ£ÓàδɨÃèÊýÁ¿
|
if (tem.IsBarCode(sBarCode, HBillType, HRedBlueFlag, ref sRelQty, ref sErrMsg))
|
{
|
|
}
|
else
|
{
|
sErrMsg = sErrMsg;
|
return false;
|
}
|
}
|
}
|
|
model.HInterID = HBillID;
|
model.HBillNo = HBillNo;
|
model.HBillType = HBillType;
|
model.HMaker = HMaker;
|
//
|
model.HMaterID = dal.omodel_View.HMaterID;
|
model.HAuxPropID = dal.omodel_View.HAuxPropID;
|
model.HErpClsID = dal.omodel_View.HErpClsID;
|
model.HQty = sRelQty;
|
model.HQtyMust = dal.omodel_View.HinitQty;
|
model.HBarCode = dal.omodel_View.HBarCode;
|
model.HBatchNo = dal.omodel_View.HBatchNo;
|
model.HMTONo = dal.omodel_View.HMTONo;
|
|
model.HWhID = HWhID;
|
model.HStockPlaceID = HSPID;
|
model.HSourceInterID = dal.omodel_View.HSourceInterID;
|
model.HSourceEntryID = dal.omodel_View.HSourceEntryID;
|
model.HSourceBillNo = dal.omodel_View.HSourceBillNo;
|
model.HSourceBillType = HSourceBillType;
|
model.HRedBlueFlag = HRedBlueFlag;
|
model.HPieceQty = 1;
|
model.HSTOCKORGID = HOWNERID;
|
model.HOWNERID = HOWNERID;
|
|
//ÎïÁÏÌõÂëдÈëÁÙʱ±íʱ£¬Åжϲֿâ²ÖλÊÇ·ñÕýÈ·
|
DataSet ds4 = oCn.RunProcReturn("exec h_p_WMS_CheckWHandSP " + HWhID.ToString() + "," + HSPID.ToString(), "h_p_WMS_CheckWHandSP");
|
if (ds4 == null || ds4.Tables[0].Rows.Count == 0)
|
{
|
sErrMsg = "ɨÃèÎïÁÏÌõÂë´æÈëÁÙʱ±íʱÅжϲֿâ²ÖλÊÇ·ñÕýÈ·,δ֪´íÎó£¡";
|
return false;
|
}
|
else
|
{
|
if (DBUtility.ClsPub.isLong(ds4.Tables[0].Rows[0][0]) == 1)
|
{
|
sErrMsg = DBUtility.ClsPub.isStrNull(ds4.Tables[0].Rows[0]["HRemark"]);
|
return false;
|
}
|
}
|
|
//½«ÎïÁÏÌõÂëÐÅϢдÈë³öÈë¿âÌõÂëÁÙʱ±í
|
if (set_SavePonderationBillMain_Temp_Select_Qty(model, HQty, ref sErrMsg))
|
{
|
|
}
|
else
|
{
|
sErrMsg = "ɨÃèʧ°Ü£¡" + sErrMsg;
|
return false;
|
}
|
return true;
|
}
|
|
|
//Ò»¼üɨÂëģʽ£¬¸ù¾ÝÌõÂëǰ׺×ß ²»Í¬·½·¨£¨²Ö¿â¡¢²Öλ¡¢²¿ÃÅ£©£¨Ô´µ¥¡¢ÎïÁÏÌõÂ룩 ³ö¿âÄ£¿é
|
public Model.ClsKf_ICStockBill_WMS get_CheckTypeByBarCode_Out(string sBarCode, Int64 HBillID, string HBillType, string HBillNo, string HMaker, Int64 HWhID, Int64 HSPID, Double HQty, bool HRedBlueFlag, bool SourceFlag, string HSourceBillNo, string HSourceBillType, Int64 HOWNERID, ref string sErrMsg)
|
{
|
SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
|
Model.ClsKf_ICStockBill_WMS oBar = new Model.ClsKf_ICStockBill_WMS();
|
DAL.ClsKF_PonderationBillMain_Temp_Ctl tem = new DAL.ClsKF_PonderationBillMain_Temp_Ctl();
|
Model.ClsKF_PonderationBillMain_Temp model = new Model.ClsKF_PonderationBillMain_Temp();
|
|
//»ñȡϵͳ²ÎÊý
|
Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
|
if (oSystemParameter.ShowBill(ref sErrMsg) == false)
|
{
|
sErrMsg = "»ñȡϵͳ²ÎÊýʧ°Ü£¡ " + sErrMsg;
|
return null;
|
}
|
//ÅжÏÊÇ·ñÆôÓÃÒ»¼üɨÂëģʽ£¬YΪÆôÓã¬Î´ÆôÓÃʱֻɨÃèÎïÁÏÌõÂë
|
if (oSystemParameter.omodel.WMS_OneKeyMode.ToUpper() == "N")
|
{
|
//½«ÎïÁÏÌõÂëÐÅϢдÈë³öÈë¿âÌõÂëÁÙʱ±í
|
if (set_SavePonderationBillMain_Temp_BarCode_OutFast(sBarCode, HBillID, HBillType, HBillNo, HMaker, HWhID, HSPID, HQty, HRedBlueFlag, SourceFlag, HSourceBillNo, HSourceBillType, HOWNERID, ref sErrMsg))
|
{
|
|
}
|
else
|
{
|
sErrMsg = "ɨÃèʧ°Ü£¡" + sErrMsg;
|
return null;
|
}
|
return oBar;
|
}
|
//Ò»¼üɨÂëģʽ£¬¸ù¾ÝÌõÂëǰ׺×ß ²»Í¬·½·¨£¨²Ö¿â¡¢²Öλ¡¢²¿ÃÅ£©£¨Ô´µ¥¡¢ÎïÁÏÌõÂ룩
|
else
|
{
|
string sRedBlue = "À¶×Ö";
|
if (HRedBlueFlag)
|
{
|
sRedBlue = "ºì×Ö";
|
}
|
else
|
{
|
sRedBlue = "À¶×Ö";
|
}
|
DataSet Dss;
|
//¸ù¾ÝµÝÈëµÄÌõÂëǰÈý룬ÅжÏÌõÂëÀàÐÍ£¨²Ö¿â¡¢²Öλ¡¢²¿ÃÅ¡¢Ô´µ¥¡¢ÎïÁÏÌõÂ룩
|
Dss = oCn.RunProcReturn(" select HSourceName,BarCodeType from Xt_BarCodeType where HSourceNumber= '" + sBarCode.Substring(0, 3) + "'", "Xt_BarCodeType");
|
|
//ÎÞ·µ»ØÊý¾ÝÔòΪÎïÁÏÌõÂë
|
if (Dss == null || Dss.Tables[0].Rows.Count == 0)
|
{
|
//½«ÎïÁÏÌõÂëÐÅϢдÈë³öÈë¿âÌõÂëÁÙʱ±í
|
if (set_SavePonderationBillMain_Temp_BarCode_OutFast(sBarCode, HBillID, HBillType, HBillNo, HMaker, HWhID, HSPID, HQty, HRedBlueFlag, SourceFlag, HSourceBillNo, HSourceBillType, HOWNERID, ref sErrMsg))
|
{
|
|
}
|
else
|
{
|
sErrMsg = "ɨÃèʧ°Ü£¡" + sErrMsg;
|
return null;
|
}
|
return oBar;
|
}
|
else
|
{
|
string sBarBillName = Pub_Class.ClsPub.isStrNull(Dss.Tables[0].Rows[0]["HSourceName"]);
|
string sBarBillType = Pub_Class.ClsPub.isStrNull(Dss.Tables[0].Rows[0]["BarCodeType"]);
|
|
//ÅжÏÌõÂëÀàÐÍΪ »ù´¡×ÊÁÏÌõÂë »ò Ô´µ¥ÌõÂë
|
if (sBarBillType == "»ù´¡×ÊÁÏÌõÂë")
|
{
|
//²Ö¿âÌõÂë
|
if (sBarBillName == "²Ö¿â")
|
{
|
DAL.ClsIF_Warehouse_View dal = new DAL.ClsIF_Warehouse_View();
|
//½«µÝÈëµÄÌõÂëÈ¥µôǰÈýλºóת»¯³ÉÕûÐÎ,TryParse²»ÄÜת»»³ÉÕûÊýʱ·µ»Øfalse£¬²¢·µ»ØID=0
|
int ID;
|
if (int.TryParse(sBarCode.Remove(0, 3), out ID))
|
{
|
if (dal.GetInfoByID(ID))
|
{
|
oBar.HBarType = "²Ö¿âÌõÂë";
|
oBar.HWhID = dal.omodel.HItemID;
|
oBar.HWhNumber = dal.omodel.HNumber;
|
oBar.HWhName = dal.omodel.HName;
|
oBar.HSPFlag = dal.omodel.HIsStockMgr;
|
return oBar;
|
}
|
else
|
{
|
sErrMsg = "ÎÞЧ²Ö¿âÌõÂ룡";
|
return null;
|
}
|
}
|
else
|
{
|
sErrMsg = "´íÎóµÄ²Ö¿âÌõÂ룡";
|
return null;
|
}
|
}
|
//²ÖλÌõÂë
|
else if (sBarBillName == "²Öλ")
|
{
|
DAL.ClsIF_StockPlace_View dal = new DAL.ClsIF_StockPlace_View();
|
//½«µÝÈëµÄÌõÂëÈ¥µôǰÈýλºóת»¯³ÉÕûÐÎ
|
int ID;
|
if (int.TryParse(sBarCode.Remove(0, 3), out ID))
|
{
|
if (dal.GetInfoByID(ID))
|
{
|
oBar.HBarType = "²ÖλÌõÂë";
|
oBar.HSPID = dal.omodel.HItemID;
|
oBar.HSPNumber = dal.omodel.HNumber;
|
oBar.HSPName = dal.omodel.HName;
|
oBar.HWhID = dal.omodel.HWHID;
|
oBar.HWhNumber = dal.omodel.HWhNumber;
|
oBar.HWhName = dal.omodel.HWhName;
|
return oBar;
|
}
|
else
|
{
|
sErrMsg = "ÎÞЧ²ÖλÌõÂ룡";
|
return null;
|
}
|
}
|
else
|
{
|
sErrMsg = "´íÎóµÄ²ÖλÌõÂ룡";
|
return null;
|
}
|
}
|
//²¿ÃÅÌõÂë
|
else if (sBarBillName == "²¿ÃÅ")
|
{
|
DAL.ClsIF_Department_View dal = new DAL.ClsIF_Department_View();
|
//½«µÝÈëµÄÌõÂëÈ¥µôǰÈýλºóת»¯³ÉÕûÐÎ
|
int ID;
|
if (int.TryParse(sBarCode.Remove(0, 3), out ID))
|
{
|
if (dal.GetInfoByID(ID))
|
{
|
oBar.HBarType = "²¿ÃÅÌõÂë";
|
oBar.HDeptID = dal.omodel.HItemID;
|
oBar.HDeptNumber = dal.omodel.HNumber;
|
oBar.HDeptName = dal.omodel.HName;
|
return oBar;
|
}
|
else
|
{
|
sErrMsg = "ÎÞЧ²¿ÃÅÌõÂ룡";
|
return null;
|
}
|
}
|
else
|
{
|
sErrMsg = "´íÎóµÄ²¿ÃÅÌõÂ룡";
|
return null;
|
}
|
}
|
else
|
{
|
sErrMsg = "ÎÞЧ»ù´¡×ÊÁÏÌõÂ룡";
|
return null;
|
}
|
}
|
//Ô´µ¥ÌõÂë
|
else if (sBarBillType == "Ô´µ¥ÌõÂë")
|
{
|
DataSet Ds = oCn.RunProcReturn(" select HSourceName from Xt_BarCodeType where HSourceNumber= '" + sBarCode.Substring(0, 3) + "' and HBillType= '" + HBillType + "'", "Xt_BarCodeType");
|
|
if (Ds == null || Ds.Tables[0].Rows.Count == 0)
|
{
|
sErrMsg = "ËùɨԴµ¥ÌõÂë²»ÊôÓÚ´ËÄ£¿éÔ´µ¥·¶Î§£¡";
|
return null;
|
}
|
else
|
{
|
sBarBillName = Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HSourceName"]);
|
//ɨÃèÔ´µ¥ÌõÂëʱÅжÏÊÇ·ñÒѾɨÃè¹ýÔ´µ¥ÐÅÏ¢
|
if (SourceFlag)
|
{
|
sErrMsg = "Ã÷ϸÐÅÏ¢ÁбíÒÑÓÐɨÂë¼Ç¼£¬²»ÔÊÐí¶à´ÎɨÃèÔ´µ¥ÌõÂ룡";
|
return null;
|
}
|
else
|
{
|
//ÁìÁϳö¿â Ô´µ¥£ºÉú²úÈÎÎñµ¥-ͶÁÏ
|
if (sBarBillName == "Éú²úÈÎÎñµ¥-ͶÁÏ" && HBillType == "1204")
|
{
|
DAL.Cls_S_IF_PPBomBillList_Lite dal = new DAL.Cls_S_IF_PPBomBillList_Lite();
|
DataSet DS;
|
//¸ù¾Ýµ¥¾ÝºÅ»ñÈ¡¹ýÂËÌõ¼þ
|
string sWhere = " Where µ¥¾ÝºÅ like '%" + sBarCode + "'";
|
DS = dal.DisSourceBillList(sWhere);
|
if (DS == null || DS.Tables[0].Rows.Count <= 0)
|
{
|
sErrMsg = "ûÓзµ»ØÈκμǼ£¡";
|
return null;
|
}
|
oBar.HBarType = "Ô´µ¥ÌõÂë";
|
oBar.HSourceBillNo = Convert.ToString(DS.Tables[0].Rows[0]["HBillNo"]);
|
oBar.HSourceBillType = Convert.ToString(DS.Tables[0].Rows[0]["HBillType"]);
|
oBar.HSupID = Convert.ToInt64(DS.Tables[0].Rows[0]["HSupID"]);
|
oBar.HSupName = Convert.ToString(DS.Tables[0].Rows[0]["HSupName"]);
|
oBar.HDeptID = Convert.ToInt64(DS.Tables[0].Rows[0]["HDeptID"]);
|
oBar.HDeptName = Convert.ToString(DS.Tables[0].Rows[0]["HDeptName"]);
|
}
|
//ÏúÊÛ³ö¿â Ô´µ¥£ºÏúÊÛ¶©µ¥
|
else if (sBarBillName == "ÏúÊÛ¶©µ¥" && HBillType == "1205")
|
{
|
DAL.Cls_S_IF_SEOrderBill_Lite dal = new DAL.Cls_S_IF_SEOrderBill_Lite();
|
DataSet DS;
|
//¸ù¾Ýµ¥¾ÝºÅ»ñÈ¡¹ýÂËÌõ¼þ
|
string sWhere = " Where µ¥¾ÝºÅ like '%" + sBarCode + "'";
|
DS = dal.DisSourceBillList(sWhere);
|
if (DS == null || DS.Tables[0].Rows.Count <= 0)
|
{
|
sErrMsg = "ûÓзµ»ØÈκμǼ£¡";
|
return null;
|
}
|
oBar.HBarType = "Ô´µ¥ÌõÂë";
|
oBar.HSourceBillNo = Convert.ToString(DS.Tables[0].Rows[0]["HBillNo"]);
|
oBar.HSourceBillType = Convert.ToString(DS.Tables[0].Rows[0]["HBillType"]);
|
oBar.HSupID = Convert.ToInt64(DS.Tables[0].Rows[0]["HSupID"]);
|
oBar.HSupName = Convert.ToString(DS.Tables[0].Rows[0]["HSupName"]);
|
oBar.HDeptID = Convert.ToInt64(DS.Tables[0].Rows[0]["HDeptID"]);
|
oBar.HDeptName = Convert.ToString(DS.Tables[0].Rows[0]["HDeptName"]);
|
}
|
//ÏúÊÛ³ö¿â Ô´µ¥£º·¢»õ֪ͨµ¥
|
else if (sBarBillName == "·¢»õ֪ͨµ¥" && HBillType == "1205")
|
{
|
DAL.Cls_S_IF_SeOutStockBill_Lite dal = new DAL.Cls_S_IF_SeOutStockBill_Lite();
|
DataSet DS;
|
//¸ù¾Ýµ¥¾ÝºÅ»ñÈ¡¹ýÂËÌõ¼þ
|
string sWhere = " Where µ¥¾ÝºÅ like '%" + sBarCode + "'";
|
DS = dal.DisSourceBillList(sWhere);
|
if (DS == null || DS.Tables[0].Rows.Count <= 0)
|
{
|
sErrMsg = "ûÓзµ»ØÈκμǼ£¡";
|
return null;
|
}
|
oBar.HBarType = "Ô´µ¥ÌõÂë";
|
oBar.HSourceBillNo = Convert.ToString(DS.Tables[0].Rows[0]["HBillNo"]);
|
oBar.HSourceBillType = Convert.ToString(DS.Tables[0].Rows[0]["HBillType"]);
|
oBar.HSupID = Convert.ToInt64(DS.Tables[0].Rows[0]["HSupID"]);
|
oBar.HSupName = Convert.ToString(DS.Tables[0].Rows[0]["HSupName"]);
|
oBar.HDeptID = Convert.ToInt64(DS.Tables[0].Rows[0]["HDeptID"]);
|
oBar.HDeptName = Convert.ToString(DS.Tables[0].Rows[0]["HDeptName"]);
|
}
|
//ίÍâ³ö¿âµ¥ Ô´µ¥£ºÎ¯Íâ¶©µ¥-ͶÁÏ
|
else if (sBarBillName == "ίÍâ¶©µ¥-ͶÁÏ" && HBillType == "1211")
|
{
|
DAL.Cls_S_IF_WWPPBomBill_Lite dal = new DAL.Cls_S_IF_WWPPBomBill_Lite();
|
DataSet DS;
|
//¸ù¾Ýµ¥¾ÝºÅ»ñÈ¡¹ýÂËÌõ¼þ
|
string sWhere = " Where µ¥¾ÝºÅ like '%" + sBarCode + "'";
|
DS = dal.DisSourceBillList(sWhere);
|
if (DS == null || DS.Tables[0].Rows.Count <= 0)
|
{
|
sErrMsg = "ûÓзµ»ØÈκμǼ£¡";
|
return null;
|
}
|
oBar.HBarType = "Ô´µ¥ÌõÂë";
|
oBar.HSourceBillNo = Convert.ToString(DS.Tables[0].Rows[0]["HBillNo"]);
|
oBar.HSourceBillType = Convert.ToString(DS.Tables[0].Rows[0]["HBillType"]);
|
oBar.HSupID = Convert.ToInt64(DS.Tables[0].Rows[0]["HSupID"]);
|
oBar.HSupName = Convert.ToString(DS.Tables[0].Rows[0]["HSupName"]);
|
oBar.HDeptID = Convert.ToInt64(DS.Tables[0].Rows[0]["HDeptID"]);
|
oBar.HDeptName = Convert.ToString(DS.Tables[0].Rows[0]["HDeptName"]);
|
}
|
else
|
{
|
sErrMsg = "Ô´µ¥ÀàÐÍÃû³ÆÉèÖò»ÕýÈ·£¡";
|
return null;
|
}
|
// ½«Ô´µ¥ÐÅϢдÈë ÁÙʱ»º´æ±í
|
if (tem.AddNew_Source(HBillID, HBillNo, HBillType, oBar.HSourceBillNo, oBar.HSourceBillType, sRedBlue, ref sErrMsg))
|
{
|
return oBar;
|
}
|
else
|
{
|
sErrMsg = "±£´æÔ´µ¥ÐÅϢʧ°Ü£¡" + sErrMsg;
|
return null;
|
}
|
}
|
}
|
}
|
else
|
{
|
sErrMsg = "ÎÞЧÌõÂëÀàÐÍ£¡";
|
return null;
|
}
|
}
|
}
|
}
|
|
|
//Ò»¼üɨÂëģʽ£¬¸ù¾ÝÌõÂëǰ׺×ß ²»Í¬·½·¨£¨²Ö¿â¡¢²Öλ¡¢²¿ÃÅ£©£¨Ô´µ¥¡¢ÎïÁÏÌõÂ룩 ²úÆ·Èë¿â¶àÔ´µ¥Ä£¿é
|
public Model.ClsKf_ICStockBill_WMS get_CheckTypeByBarCode_MulSource(string sBarCode, Int64 HBillID, string HBillType, string HBillNo, string HMaker, Int64 HWhID, Int64 HSPID, Double HQty, bool HRedBlueFlag, string HSourceBillType, Int64 HOWNERID, bool sXFFlag, bool sJDPFlag, ref string sErrMsg)
|
{
|
SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
|
Model.ClsKf_ICStockBill_WMS oBar = new Model.ClsKf_ICStockBill_WMS();
|
|
//»ñȡϵͳ²ÎÊý
|
Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
|
if (oSystemParameter.ShowBill(ref sErrMsg) == false)
|
{
|
sErrMsg = "»ñȡϵͳ²ÎÊýʧ°Ü£¡ " + sErrMsg;
|
return null;
|
}
|
//ÅжÏÊÇ·ñÆôÓÃÒ»¼üɨÂëģʽ£¬YΪÆôÓã¬Î´ÆôÓÃʱֻɨÃèÎïÁÏÌõÂë
|
if (oSystemParameter.omodel.WMS_OneKeyMode.ToUpper() == "N")
|
{
|
//½«ÎïÁÏÌõÂëÐÅϢдÈë³öÈë¿âÌõÂëÁÙʱ±í
|
if (set_SavePonderationBillMain_Temp_BarCode_MulSource(sBarCode, HBillID, HBillType, HBillNo, HMaker, HWhID, HSPID, HQty, HRedBlueFlag, HSourceBillType, HOWNERID, sXFFlag, sJDPFlag, ref sErrMsg))
|
{
|
if (sXFFlag)
|
{
|
//Ïä·¢
|
sBarCode = sBarCode + "-XF";
|
}
|
//´ÓÌõÂë³öÈë¿âÁÙʱ±í ÖлñÈ¡¸Ãµ¥¾ÝϸÃÌõÂëµÄ²Ö¿â²ÖλÐÅÏ¢
|
DataSet dsWS = oCn.RunProcReturn("exec h_p_Kf_GetOrgandWHSPByTemp_CLD " + HBillID.ToString() + ",'" + sBarCode + "'", "h_p_Kf_GetOrgandWHSPByTemp_CLD");
|
if (dsWS == null || dsWS.Tables[0].Rows.Count == 0)
|
{
|
sErrMsg = "»ñÈ¡ËùɨÃèÌõÂëÈë¿â²Ö¿â²ÖλÐÅϢʧ°Ü£¡";
|
return null;
|
}
|
else
|
{
|
oBar.HOWNERID = DBUtility.ClsPub.isLong(dsWS.Tables[0].Rows[0]["HOWNERID"]);
|
oBar.HOWNERNAME = DBUtility.ClsPub.isStrNull(dsWS.Tables[0].Rows[0]["HOWNERNAME"]);
|
oBar.HWhID = DBUtility.ClsPub.isLong(dsWS.Tables[0].Rows[0]["HWhID"]);
|
oBar.HWhName = DBUtility.ClsPub.isStrNull(dsWS.Tables[0].Rows[0]["HWhName"]);
|
oBar.HSPID = DBUtility.ClsPub.isLong(dsWS.Tables[0].Rows[0]["HSPID"]);
|
oBar.HSPName = DBUtility.ClsPub.isStrNull(dsWS.Tables[0].Rows[0]["HSPName"]);
|
}
|
}
|
else
|
{
|
sErrMsg = "ɨÃèʧ°Ü£¡" + sErrMsg;
|
return null;
|
}
|
return oBar;
|
}
|
//Ò»¼üɨÂëģʽ£¬¸ù¾ÝÌõÂëǰ׺×ß ²»Í¬·½·¨£¨²Ö¿â¡¢²Öλ¡¢²¿ÃÅ£©£¨Ô´µ¥¡¢ÎïÁÏÌõÂ룩
|
else
|
{
|
DataSet Dss;
|
//¸ù¾ÝµÝÈëµÄÌõÂëǰÈý룬ÅжÏÌõÂëÀàÐÍ£¨²Ö¿â¡¢²Öλ¡¢²¿ÃÅ¡¢Ô´µ¥¡¢ÎïÁÏÌõÂ룩
|
Dss = oCn.RunProcReturn(" select HSourceName,BarCodeType from Xt_BarCodeType where HSourceNumber= '" + sBarCode.Substring(0, 3) + "'", "Xt_BarCodeType");
|
|
//ÎÞ·µ»ØÊý¾ÝÔòΪÎïÁÏÌõÂë
|
if (Dss == null || Dss.Tables[0].Rows.Count == 0)
|
{
|
//½«ÎïÁÏÌõÂëÐÅϢдÈë³öÈë¿âÌõÂëÁÙʱ±í
|
if (set_SavePonderationBillMain_Temp_BarCode_MulSource(sBarCode, HBillID, HBillType, HBillNo, HMaker, HWhID, HSPID, HQty, HRedBlueFlag, HSourceBillType, HOWNERID, sXFFlag, sJDPFlag, ref sErrMsg))
|
{
|
if (sXFFlag)
|
{
|
//Ïä·¢
|
sBarCode = sBarCode + "-XF";
|
}
|
//´ÓÌõÂë³öÈë¿âÁÙʱ±í ÖлñÈ¡¸Ãµ¥¾ÝϸÃÌõÂëµÄ²Ö¿â²ÖλÐÅÏ¢
|
DataSet dsWS = oCn.RunProcReturn("exec h_p_Kf_GetOrgandWHSPByTemp_CLD " + HBillID.ToString() + ",'" + sBarCode + "'", "h_p_Kf_GetOrgandWHSPByTemp_CLD");
|
if (dsWS == null || dsWS.Tables[0].Rows.Count == 0)
|
{
|
sErrMsg = "»ñÈ¡ËùɨÃèÌõÂëÈë¿â²Ö¿â²ÖλÐÅϢʧ°Ü£¡";
|
return null;
|
}
|
else
|
{
|
oBar.HOWNERID = DBUtility.ClsPub.isLong(dsWS.Tables[0].Rows[0]["HOWNERID"]);
|
oBar.HOWNERNAME = DBUtility.ClsPub.isStrNull(dsWS.Tables[0].Rows[0]["HOWNERNAME"]);
|
oBar.HWhID = DBUtility.ClsPub.isLong(dsWS.Tables[0].Rows[0]["HWhID"]);
|
oBar.HWhName = DBUtility.ClsPub.isStrNull(dsWS.Tables[0].Rows[0]["HWhName"]);
|
oBar.HSPID = DBUtility.ClsPub.isLong(dsWS.Tables[0].Rows[0]["HSPID"]);
|
oBar.HSPName = DBUtility.ClsPub.isStrNull(dsWS.Tables[0].Rows[0]["HSPName"]);
|
}
|
}
|
else
|
{
|
sErrMsg = "ɨÃèʧ°Ü£¡" + sErrMsg;
|
return null;
|
}
|
return oBar;
|
}
|
else
|
{
|
string sBarBillName = Pub_Class.ClsPub.isStrNull(Dss.Tables[0].Rows[0]["HSourceName"]);
|
string sBarBillType = Pub_Class.ClsPub.isStrNull(Dss.Tables[0].Rows[0]["BarCodeType"]);
|
|
//ÅжÏÌõÂëÀàÐÍΪ »ù´¡×ÊÁÏÌõÂë »ò Ô´µ¥ÌõÂë
|
if (sBarBillType == "»ù´¡×ÊÁÏÌõÂë")
|
{
|
//²Ö¿âÌõÂë
|
if (sBarBillName == "²Ö¿â")
|
{
|
DAL.ClsIF_Warehouse_View dal = new DAL.ClsIF_Warehouse_View();
|
//½«µÝÈëµÄÌõÂëÈ¥µôǰÈýλºóת»¯³ÉÕûÐÎ,TryParse²»ÄÜת»»³ÉÕûÊýʱ·µ»Øfalse£¬²¢·µ»ØID=0
|
int ID;
|
if (int.TryParse(sBarCode.Remove(0, 3), out ID))
|
{
|
if (dal.GetInfoByID(ID))
|
{
|
oBar.HBarType = "²Ö¿âÌõÂë";
|
oBar.HWhID = dal.omodel.HItemID;
|
oBar.HWhNumber = dal.omodel.HNumber;
|
oBar.HWhName = dal.omodel.HName;
|
oBar.HSPFlag = dal.omodel.HIsStockMgr;
|
return oBar;
|
}
|
else
|
{
|
sErrMsg = "ÎÞЧ²Ö¿âÌõÂ룡";
|
return null;
|
}
|
}
|
else
|
{
|
sErrMsg = "´íÎóµÄ²Ö¿âÌõÂ룡";
|
return null;
|
}
|
}
|
//²ÖλÌõÂë
|
else if (sBarBillName == "²Öλ")
|
{
|
DAL.ClsIF_StockPlace_View dal = new DAL.ClsIF_StockPlace_View();
|
//½«µÝÈëµÄÌõÂëÈ¥µôǰÈýλºóת»¯³ÉÕûÐÎ
|
int ID;
|
if (int.TryParse(sBarCode.Remove(0, 3), out ID))
|
{
|
if (dal.GetInfoByID(ID))
|
{
|
oBar.HBarType = "²ÖλÌõÂë";
|
oBar.HSPID = dal.omodel.HItemID;
|
oBar.HSPNumber = dal.omodel.HNumber;
|
oBar.HSPName = dal.omodel.HName;
|
oBar.HWhID = dal.omodel.HWHID;
|
oBar.HWhNumber = dal.omodel.HWhNumber;
|
oBar.HWhName = dal.omodel.HWhName;
|
return oBar;
|
}
|
else
|
{
|
sErrMsg = "ÎÞЧ²ÖλÌõÂ룡";
|
return null;
|
}
|
}
|
else
|
{
|
sErrMsg = "´íÎóµÄ²ÖλÌõÂ룡";
|
return null;
|
}
|
}
|
//²¿ÃÅÌõÂë
|
else if (sBarBillName == "²¿ÃÅ")
|
{
|
DAL.ClsIF_Department_View dal = new DAL.ClsIF_Department_View();
|
//½«µÝÈëµÄÌõÂëÈ¥µôǰÈýλºóת»¯³ÉÕûÐÎ
|
int ID;
|
if (int.TryParse(sBarCode.Remove(0, 3), out ID))
|
{
|
if (dal.GetInfoByID(ID))
|
{
|
oBar.HBarType = "²¿ÃÅÌõÂë";
|
oBar.HDeptID = dal.omodel.HItemID;
|
oBar.HDeptNumber = dal.omodel.HNumber;
|
oBar.HDeptName = dal.omodel.HName;
|
return oBar;
|
}
|
else
|
{
|
sErrMsg = "ÎÞЧ²¿ÃÅÌõÂ룡";
|
return null;
|
}
|
}
|
else
|
{
|
sErrMsg = "´íÎóµÄ²¿ÃÅÌõÂ룡";
|
return null;
|
}
|
}
|
else
|
{
|
sErrMsg = "ÎÞЧ»ù´¡×ÊÁÏÌõÂ룡";
|
return null;
|
}
|
}
|
//Ô´µ¥ÌõÂë
|
else if (sBarBillType == "Ô´µ¥ÌõÂë")
|
{
|
sErrMsg = "¶àÔ´µ¥Ä£¿é£¬ÎÞÐëɨÃèÔ´µ¥ÌõÂ룡";
|
return null;
|
}
|
else
|
{
|
sErrMsg = "ÎÞЧÌõÂëÀàÐÍ£¡";
|
return null;
|
}
|
}
|
}
|
}
|
|
//Ò»¼üɨÂëģʽ£¬¸ù¾ÝÌõÂëǰ׺×ß ²»Í¬·½·¨£¨²Ö¿â¡¢²Öλ¡¢²¿ÃÅ£©£¨Ô´µ¥¡¢ÎïÁÏÌõÂ룩 2
|
public Model.ClsKf_ICStockBill_WMS get_CheckTypeByBarCode_All(string sBarCode, Int64 HBillID, string HBillType, string HBillNo, string HMaker, Int64 HWhID, Int64 HSPID, Double HQty, bool HRedBlueFlag, bool SourceFlag, string HSourceBillNo, string HSourceBillType, Int64 HOWNERID, string HExpressNumber, ref string sErrMsg)
|
{
|
SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
|
Model.ClsKf_ICStockBill_WMS oBar = new Model.ClsKf_ICStockBill_WMS();
|
DAL.ClsKF_PonderationBillMain_Temp_Ctl tem = new DAL.ClsKF_PonderationBillMain_Temp_Ctl();
|
Model.ClsKF_PonderationBillMain_Temp model = new Model.ClsKF_PonderationBillMain_Temp();
|
string sHSourceBillType = "";
|
string sHSourceBillNo = "";
|
Int64 sHSupID = 0;
|
string sHSupName = "";
|
Int64 sHDeptID = 0;
|
string sHDeptName = "";
|
string sHBarType = "";
|
|
//»ñȡϵͳ²ÎÊý
|
Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
|
if (oSystemParameter.ShowBill(ref sErrMsg) == false)
|
{
|
sErrMsg = "»ñȡϵͳ²ÎÊýʧ°Ü£¡ " + sErrMsg;
|
return null;
|
}
|
//ÏúÊÛ³ö¿â¡¢ÏúÊÛÍË¿âÄ£¿éɨÂëÁ÷³Ì ·ÉÁúרÓÃ
|
if ((HBillType == "1205" || HBillType == "1247") && oSystemParameter.omodel.WMS_CampanyName == "·ÉÁú") //ϵͳ²ÎÊý ¿Í»§¶¨ÖÆ»¯Ãû³Æ ¿Õ°×ΪͨÓÃ
|
{
|
//½«ÎïÁÏÌõÂëÐÅϢдÈë³öÈë¿âÌõÂëÁÙʱ±í
|
if (set_SavePonderationBillMain_Temp_FeiLong(sBarCode, HBillID, HBillType, HBillNo, HMaker, HWhID, HSPID, HQty, HRedBlueFlag, SourceFlag, HSourceBillNo, HSourceBillType, HOWNERID, HExpressNumber, ref sHSourceBillNo, ref sHSourceBillType, ref sHSupID, ref sHSupName, ref sHDeptID, ref sHDeptName, ref sHBarType, ref sErrMsg))
|
{
|
oBar.HBarType = sHBarType;
|
oBar.HSourceBillType = sHSourceBillType;
|
oBar.HSourceBillNo = sHSourceBillNo;
|
oBar.HSupID = sHSupID;
|
oBar.HSupName = sHSupName;
|
oBar.HDeptID = sHDeptID;
|
oBar.HDeptName = sHDeptName;
|
}
|
else
|
{
|
sErrMsg = "£¡" + sErrMsg;
|
return null;
|
}
|
return oBar;
|
}
|
else
|
{
|
//ÅжÏÊÇ·ñÆôÓÃÒ»¼üɨÂëģʽ£¬YΪÆôÓã¬Î´ÆôÓÃʱֻɨÃèÎïÁÏÌõÂë
|
if (oSystemParameter.omodel.WMS_OneKeyMode.ToUpper() == "N")
|
{
|
//½«ÎïÁÏÌõÂëÐÅϢдÈë³öÈë¿âÌõÂëÁÙʱ±í
|
if (set_SavePonderationBillMain_Temp_BarCode(sBarCode, HBillID, HBillType, HBillNo, HMaker, HWhID, HSPID, HQty, HRedBlueFlag, SourceFlag, HSourceBillNo, HSourceBillType, HOWNERID, ref sHSourceBillNo, ref sHSourceBillType, ref sHSupID, ref sHSupName, ref sHDeptID, ref sHDeptName, ref sErrMsg))
|
{
|
oBar.HSourceBillType = sHSourceBillType;
|
oBar.HSourceBillNo = sHSourceBillNo;
|
oBar.HSupID = sHSupID;
|
oBar.HSupName = sHSupName;
|
oBar.HDeptID = sHDeptID;
|
oBar.HDeptName = sHDeptName;
|
}
|
else
|
{
|
sErrMsg = "ɨÃèʧ°Ü£¡" + sErrMsg;
|
return null;
|
}
|
return oBar;
|
}
|
//Ò»¼üɨÂëģʽ£¬¸ù¾ÝÌõÂëǰ׺×ß ²»Í¬·½·¨£¨²Ö¿â¡¢²Öλ¡¢²¿ÃÅ£©£¨Ô´µ¥¡¢ÎïÁÏÌõÂ룩
|
else
|
{
|
string sRedBlue = "À¶×Ö";
|
if (HRedBlueFlag)
|
{
|
sRedBlue = "ºì×Ö";
|
}
|
else
|
{
|
sRedBlue = "À¶×Ö";
|
}
|
DataSet Dss;
|
//¸ù¾ÝµÝÈëµÄÌõÂëǰÈý룬ÅжÏÌõÂëÀàÐÍ£¨²Ö¿â¡¢²Öλ¡¢²¿ÃÅ¡¢Ô´µ¥¡¢ÎïÁÏÌõÂ룩
|
Dss = oCn.RunProcReturn(" select HSourceName,BarCodeType from Xt_BarCodeType where HSourceNumber= '" + sBarCode.Substring(0, 3) + "'", "Xt_BarCodeType");
|
|
//ÎÞ·µ»ØÊý¾ÝÔòΪÎïÁÏÌõÂë
|
if (Dss == null || Dss.Tables[0].Rows.Count == 0)
|
{
|
//½«ÎïÁÏÌõÂëÐÅϢдÈë³öÈë¿âÌõÂëÁÙʱ±í
|
if (set_SavePonderationBillMain_Temp_BarCode(sBarCode, HBillID, HBillType, HBillNo, HMaker, HWhID, HSPID, HQty, HRedBlueFlag, SourceFlag, HSourceBillNo, HSourceBillType, HOWNERID, ref sHSourceBillNo, ref sHSourceBillType, ref sHSupID, ref sHSupName, ref sHDeptID, ref sHDeptName, ref sErrMsg))
|
{
|
oBar.HSourceBillType = sHSourceBillType;
|
oBar.HSourceBillNo = sHSourceBillNo;
|
oBar.HSupID = sHSupID;
|
oBar.HSupName = sHSupName;
|
oBar.HDeptID = sHDeptID;
|
oBar.HDeptName = sHDeptName;
|
}
|
else
|
{
|
sErrMsg = "ɨÃèʧ°Ü£¡" + sErrMsg;
|
return null;
|
}
|
return oBar;
|
}
|
else
|
{
|
string sBarBillName = Pub_Class.ClsPub.isStrNull(Dss.Tables[0].Rows[0]["HSourceName"]);
|
string sBarBillType = Pub_Class.ClsPub.isStrNull(Dss.Tables[0].Rows[0]["BarCodeType"]);
|
|
//ÅжÏÌõÂëÀàÐÍΪ »ù´¡×ÊÁÏÌõÂë »ò Ô´µ¥ÌõÂë
|
if (sBarBillType == "»ù´¡×ÊÁÏÌõÂë")
|
{
|
//²Ö¿âÌõÂë
|
if (sBarBillName == "²Ö¿â")
|
{
|
DAL.ClsIF_Warehouse_View dal = new DAL.ClsIF_Warehouse_View();
|
//½«µÝÈëµÄÌõÂëÈ¥µôǰÈýλºóת»¯³ÉÕûÐÎ,TryParse²»ÄÜת»»³ÉÕûÊýʱ·µ»Øfalse£¬²¢·µ»ØID=0
|
int ID;
|
if (int.TryParse(sBarCode.Remove(0, 3), out ID))
|
{
|
if (dal.GetInfoByID(ID))
|
{
|
oBar.HBarType = "²Ö¿âÌõÂë";
|
oBar.HWhID = dal.omodel.HItemID;
|
oBar.HWhNumber = dal.omodel.HNumber;
|
oBar.HWhName = dal.omodel.HName;
|
oBar.HSPFlag = dal.omodel.HIsStockMgr;
|
return oBar;
|
}
|
else
|
{
|
sErrMsg = "ÎÞЧ²Ö¿âÌõÂ룡";
|
return null;
|
}
|
}
|
else
|
{
|
sErrMsg = "´íÎóµÄ²Ö¿âÌõÂ룡";
|
return null;
|
}
|
}
|
//²ÖλÌõÂë
|
else if (sBarBillName == "²Öλ")
|
{
|
DAL.ClsIF_StockPlace_View dal = new DAL.ClsIF_StockPlace_View();
|
//½«µÝÈëµÄÌõÂëÈ¥µôǰÈýλºóת»¯³ÉÕûÐÎ
|
int ID;
|
if (int.TryParse(sBarCode.Remove(0, 3), out ID))
|
{
|
if (dal.GetInfoByID(ID))
|
{
|
oBar.HBarType = "²ÖλÌõÂë";
|
oBar.HSPID = dal.omodel.HItemID;
|
oBar.HSPNumber = dal.omodel.HNumber;
|
oBar.HSPName = dal.omodel.HName;
|
oBar.HWhID = dal.omodel.HWHID;
|
oBar.HWhNumber = dal.omodel.HWhNumber;
|
oBar.HWhName = dal.omodel.HWhName;
|
return oBar;
|
}
|
else
|
{
|
sErrMsg = "ÎÞЧ²ÖλÌõÂ룡";
|
return null;
|
}
|
}
|
else
|
{
|
sErrMsg = "´íÎóµÄ²ÖλÌõÂ룡";
|
return null;
|
}
|
}
|
//²¿ÃÅÌõÂë
|
else if (sBarBillName == "²¿ÃÅ")
|
{
|
DAL.ClsIF_Department_View dal = new DAL.ClsIF_Department_View();
|
//½«µÝÈëµÄÌõÂëÈ¥µôǰÈýλºóת»¯³ÉÕûÐÎ
|
int ID;
|
if (int.TryParse(sBarCode.Remove(0, 3), out ID))
|
{
|
if (dal.GetInfoByID(ID))
|
{
|
oBar.HBarType = "²¿ÃÅÌõÂë";
|
oBar.HDeptID = dal.omodel.HItemID;
|
oBar.HDeptNumber = dal.omodel.HNumber;
|
oBar.HDeptName = dal.omodel.HName;
|
return oBar;
|
}
|
else
|
{
|
sErrMsg = "ÎÞЧ²¿ÃÅÌõÂ룡";
|
return null;
|
}
|
}
|
else
|
{
|
sErrMsg = "´íÎóµÄ²¿ÃÅÌõÂ룡";
|
return null;
|
}
|
}
|
else
|
{
|
sErrMsg = "ÎÞЧ»ù´¡×ÊÁÏÌõÂ룡";
|
return null;
|
}
|
}
|
//Ô´µ¥ÌõÂë
|
else if (sBarBillType == "Ô´µ¥ÌõÂë")
|
{
|
DataSet Ds = oCn.RunProcReturn(" select HSourceName from Xt_BarCodeType where HSourceNumber= '" + sBarCode.Substring(0, 3) + "' and HBillType= '" + HBillType + "'", "Xt_BarCodeType");
|
|
if (Ds == null || Ds.Tables[0].Rows.Count == 0)
|
{
|
sErrMsg = "ËùɨԴµ¥ÌõÂë²»ÊôÓÚ´ËÄ£¿éÔ´µ¥·¶Î§£¡";
|
return null;
|
}
|
else
|
{
|
sBarBillName = Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HSourceName"]);
|
//ɨÃèÔ´µ¥ÌõÂëʱÅжÏÊÇ·ñÒѾɨÃè¹ýÔ´µ¥ÐÅÏ¢
|
if (SourceFlag)
|
{
|
sErrMsg = "Ã÷ϸÐÅÏ¢ÁбíÒÑÓÐɨÂë¼Ç¼£¬²»ÔÊÐí¶à´ÎɨÃèÔ´µ¥ÌõÂ룡";
|
return null;
|
}
|
else
|
{
|
//²úÆ·Èë¿âµ¥ Ô´µ¥£ºÉú²úÈÎÎñµ¥
|
if (sBarBillName == "Éú²úÈÎÎñµ¥" && HBillType == "1202")
|
{
|
DAL.Cls_S_IF_ICMOBill_Lite dal = new DAL.Cls_S_IF_ICMOBill_Lite();
|
DataSet DS;
|
//¸ù¾Ýµ¥¾ÝºÅ»ñÈ¡¹ýÂËÌõ¼þ
|
string sWhere = " Where µ¥¾ÝºÅ like '%" + sBarCode + "'";
|
DS = dal.DisSourceBillList(sWhere);
|
if (DS == null || DS.Tables[0].Rows.Count <= 0)
|
{
|
sErrMsg = "ûÓзµ»ØÈκμǼ£¡";
|
return null;
|
}
|
oBar.HBarType = "Ô´µ¥ÌõÂë";
|
oBar.HSourceBillNo = Convert.ToString(DS.Tables[0].Rows[0]["HBillNo"]);
|
oBar.HSourceBillType = Convert.ToString(DS.Tables[0].Rows[0]["HBillType"]);
|
oBar.HSupID = Convert.ToInt64(DS.Tables[0].Rows[0]["HSupID"]);
|
oBar.HSupName = Convert.ToString(DS.Tables[0].Rows[0]["HSupName"]);
|
oBar.HDeptID = Convert.ToInt64(DS.Tables[0].Rows[0]["HDeptID"]);
|
oBar.HDeptName = Convert.ToString(DS.Tables[0].Rows[0]["HDeptName"]);
|
}
|
//Í⹺Èë¿âµ¥ Ô´µ¥£º²É¹º¶©µ¥
|
else if (sBarBillName == "²É¹º¶©µ¥" && HBillType == "1201")
|
{
|
DAL.Cls_S_IF_POOrderBill_Lite dal = new DAL.Cls_S_IF_POOrderBill_Lite();
|
DataSet DS;
|
//¸ù¾Ýµ¥¾ÝºÅ»ñÈ¡¹ýÂËÌõ¼þ
|
string sWhere = " Where µ¥¾ÝºÅ like '%" + sBarCode + "'";
|
DS = dal.DisSourceBillList(sWhere);
|
if (DS == null || DS.Tables[0].Rows.Count <= 0)
|
{
|
sErrMsg = "ûÓзµ»ØÈκμǼ£¡";
|
return null;
|
}
|
oBar.HBarType = "Ô´µ¥ÌõÂë";
|
oBar.HSourceBillNo = Convert.ToString(DS.Tables[0].Rows[0]["HBillNo"]);
|
oBar.HSourceBillType = Convert.ToString(DS.Tables[0].Rows[0]["HBillType"]);
|
oBar.HSupID = Convert.ToInt64(DS.Tables[0].Rows[0]["HSupID"]);
|
oBar.HSupName = Convert.ToString(DS.Tables[0].Rows[0]["HSupName"]);
|
oBar.HDeptID = Convert.ToInt64(DS.Tables[0].Rows[0]["HDeptID"]);
|
oBar.HDeptName = Convert.ToString(DS.Tables[0].Rows[0]["HDeptName"]);
|
}
|
//Í⹺Èë¿âµ¥ Ô´µ¥£ºÊÕÁÏ֪ͨµ¥
|
else if (sBarBillName == "ÊÕÁÏ֪ͨµ¥" && HBillType == "1201")
|
{
|
DAL.Cls_S_IF_POStockInBill_Lite dal = new DAL.Cls_S_IF_POStockInBill_Lite();
|
DataSet DS;
|
//¸ù¾Ýµ¥¾ÝºÅ»ñÈ¡¹ýÂËÌõ¼þ
|
string sWhere = " Where µ¥¾ÝºÅ like '%" + sBarCode + "' and isnull(HBillSubType,0)=12510 ";
|
DS = dal.DisSourceBillList(sWhere);
|
if (DS == null || DS.Tables[0].Rows.Count <= 0)
|
{
|
sErrMsg = "ûÓзµ»ØÈκμǼ£¡";
|
return null;
|
}
|
oBar.HBarType = "Ô´µ¥ÌõÂë";
|
oBar.HSourceBillNo = Convert.ToString(DS.Tables[0].Rows[0]["HBillNo"]);
|
oBar.HSourceBillType = Convert.ToString(DS.Tables[0].Rows[0]["HBillType"]);
|
oBar.HSupID = Convert.ToInt64(DS.Tables[0].Rows[0]["HSupID"]);
|
oBar.HSupName = Convert.ToString(DS.Tables[0].Rows[0]["HSupName"]);
|
oBar.HDeptID = Convert.ToInt64(DS.Tables[0].Rows[0]["HDeptID"]);
|
oBar.HDeptName = Convert.ToString(DS.Tables[0].Rows[0]["HDeptName"]);
|
}
|
//ίÍâÈë¿âµ¥ Ô´µ¥£ºÎ¯Íâ¶©µ¥
|
else if (sBarBillName == "ίÍâ¶©µ¥" && HBillType == "1210")
|
{
|
DAL.Cls_S_IF_WWOrderBill_Lite dal = new DAL.Cls_S_IF_WWOrderBill_Lite();
|
DataSet DS;
|
//¸ù¾Ýµ¥¾ÝºÅ»ñÈ¡¹ýÂËÌõ¼þ
|
string sWhere = " Where µ¥¾ÝºÅ like '%" + sBarCode + "'";
|
DS = dal.DisSourceBillList(sWhere);
|
if (DS == null || DS.Tables[0].Rows.Count <= 0)
|
{
|
sErrMsg = "ûÓзµ»ØÈκμǼ£¡";
|
return null;
|
}
|
oBar.HBarType = "Ô´µ¥ÌõÂë";
|
oBar.HSourceBillNo = Convert.ToString(DS.Tables[0].Rows[0]["HBillNo"]);
|
oBar.HSourceBillType = Convert.ToString(DS.Tables[0].Rows[0]["HBillType"]);
|
oBar.HSupID = Convert.ToInt64(DS.Tables[0].Rows[0]["HSupID"]);
|
oBar.HSupName = Convert.ToString(DS.Tables[0].Rows[0]["HSupName"]);
|
oBar.HDeptID = Convert.ToInt64(DS.Tables[0].Rows[0]["HDeptID"]);
|
oBar.HDeptName = Convert.ToString(DS.Tables[0].Rows[0]["HDeptName"]);
|
}
|
//ίÍâÈë¿âµ¥ Ô´µ¥£ºÊÕÁÏ֪ͨµ¥-ίÍâ
|
else if (sBarBillName == "ÊÕÁÏ֪ͨµ¥-ίÍâ" && HBillType == "1210")
|
{
|
DAL.Cls_S_IF_POStockInBill_Lite dal = new DAL.Cls_S_IF_POStockInBill_Lite();
|
DataSet DS;
|
//¸ù¾Ýµ¥¾ÝºÅ»ñÈ¡¹ýÂËÌõ¼þ
|
string sWhere = " Where µ¥¾ÝºÅ like '%" + sBarCode + "' and isnull(HBillSubType,0)=12511 ";
|
DS = dal.DisSourceBillList(sWhere);
|
if (DS == null || DS.Tables[0].Rows.Count <= 0)
|
{
|
sErrMsg = "ûÓзµ»ØÈκμǼ£¡";
|
return null;
|
}
|
oBar.HBarType = "Ô´µ¥ÌõÂë";
|
oBar.HSourceBillNo = Convert.ToString(DS.Tables[0].Rows[0]["HBillNo"]);
|
oBar.HSourceBillType = Convert.ToString(DS.Tables[0].Rows[0]["HBillType"]);
|
oBar.HSupID = Convert.ToInt64(DS.Tables[0].Rows[0]["HSupID"]);
|
oBar.HSupName = Convert.ToString(DS.Tables[0].Rows[0]["HSupName"]);
|
oBar.HDeptID = Convert.ToInt64(DS.Tables[0].Rows[0]["HDeptID"]);
|
oBar.HDeptName = Convert.ToString(DS.Tables[0].Rows[0]["HDeptName"]);
|
}
|
//ÁìÁϳö¿â Ô´µ¥£ºÉú²úÈÎÎñµ¥-ͶÁÏ
|
else if (sBarBillName == "Éú²úÈÎÎñµ¥-ͶÁÏ" && HBillType == "1204")
|
{
|
DAL.Cls_S_IF_PPBomBillList_Lite dal = new DAL.Cls_S_IF_PPBomBillList_Lite();
|
DataSet DS;
|
//¸ù¾Ýµ¥¾ÝºÅ»ñÈ¡¹ýÂËÌõ¼þ
|
string sWhere = " Where µ¥¾ÝºÅ like '%" + sBarCode + "'";
|
DS = dal.DisSourceBillList(sWhere);
|
if (DS == null || DS.Tables[0].Rows.Count <= 0)
|
{
|
sErrMsg = "ûÓзµ»ØÈκμǼ£¡";
|
return null;
|
}
|
oBar.HBarType = "Ô´µ¥ÌõÂë";
|
oBar.HSourceBillNo = Convert.ToString(DS.Tables[0].Rows[0]["HBillNo"]);
|
oBar.HSourceBillType = Convert.ToString(DS.Tables[0].Rows[0]["HBillType"]);
|
oBar.HSupID = Convert.ToInt64(DS.Tables[0].Rows[0]["HSupID"]);
|
oBar.HSupName = Convert.ToString(DS.Tables[0].Rows[0]["HSupName"]);
|
oBar.HDeptID = Convert.ToInt64(DS.Tables[0].Rows[0]["HDeptID"]);
|
oBar.HDeptName = Convert.ToString(DS.Tables[0].Rows[0]["HDeptName"]);
|
}
|
//ÏúÊÛ³ö¿â Ô´µ¥£ºÏúÊÛ¶©µ¥
|
else if (sBarBillName == "ÏúÊÛ¶©µ¥" && HBillType == "1205")
|
{
|
DAL.Cls_S_IF_SEOrderBill_Lite dal = new DAL.Cls_S_IF_SEOrderBill_Lite();
|
DataSet DS;
|
//¸ù¾Ýµ¥¾ÝºÅ»ñÈ¡¹ýÂËÌõ¼þ
|
string sWhere = " Where µ¥¾ÝºÅ like '%" + sBarCode + "'";
|
DS = dal.DisSourceBillList(sWhere);
|
if (DS == null || DS.Tables[0].Rows.Count <= 0)
|
{
|
sErrMsg = "ûÓзµ»ØÈκμǼ£¡";
|
return null;
|
}
|
oBar.HBarType = "Ô´µ¥ÌõÂë";
|
oBar.HSourceBillNo = Convert.ToString(DS.Tables[0].Rows[0]["HBillNo"]);
|
oBar.HSourceBillType = Convert.ToString(DS.Tables[0].Rows[0]["HBillType"]);
|
oBar.HSupID = Convert.ToInt64(DS.Tables[0].Rows[0]["HSupID"]);
|
oBar.HSupName = Convert.ToString(DS.Tables[0].Rows[0]["HSupName"]);
|
oBar.HDeptID = Convert.ToInt64(DS.Tables[0].Rows[0]["HDeptID"]);
|
oBar.HDeptName = Convert.ToString(DS.Tables[0].Rows[0]["HDeptName"]);
|
}
|
//ÏúÊÛ³ö¿â Ô´µ¥£º·¢»õ֪ͨµ¥
|
else if (sBarBillName == "·¢»õ֪ͨµ¥" && HBillType == "1205")
|
{
|
DAL.Cls_S_IF_SeOutStockBill_Lite dal = new DAL.Cls_S_IF_SeOutStockBill_Lite();
|
DataSet DS;
|
//¸ù¾Ýµ¥¾ÝºÅ»ñÈ¡¹ýÂËÌõ¼þ
|
string sWhere = " Where µ¥¾ÝºÅ like '%" + sBarCode + "'";
|
DS = dal.DisSourceBillList(sWhere);
|
if (DS == null || DS.Tables[0].Rows.Count <= 0)
|
{
|
sErrMsg = "ûÓзµ»ØÈκμǼ£¡";
|
return null;
|
}
|
oBar.HBarType = "Ô´µ¥ÌõÂë";
|
oBar.HSourceBillNo = Convert.ToString(DS.Tables[0].Rows[0]["HBillNo"]);
|
oBar.HSourceBillType = Convert.ToString(DS.Tables[0].Rows[0]["HBillType"]);
|
oBar.HSupID = Convert.ToInt64(DS.Tables[0].Rows[0]["HSupID"]);
|
oBar.HSupName = Convert.ToString(DS.Tables[0].Rows[0]["HSupName"]);
|
oBar.HDeptID = Convert.ToInt64(DS.Tables[0].Rows[0]["HDeptID"]);
|
oBar.HDeptName = Convert.ToString(DS.Tables[0].Rows[0]["HDeptName"]);
|
}
|
//ίÍâ³ö¿âµ¥ Ô´µ¥£ºÎ¯Íâ¶©µ¥-ͶÁÏ
|
else if (sBarBillName == "ίÍâ¶©µ¥-ͶÁÏ" && HBillType == "1211")
|
{
|
DAL.Cls_S_IF_WWPPBomBill_Lite dal = new DAL.Cls_S_IF_WWPPBomBill_Lite();
|
DataSet DS;
|
//¸ù¾Ýµ¥¾ÝºÅ»ñÈ¡¹ýÂËÌõ¼þ
|
string sWhere = " Where µ¥¾ÝºÅ like '%" + sBarCode + "'";
|
DS = dal.DisSourceBillList(sWhere);
|
if (DS == null || DS.Tables[0].Rows.Count <= 0)
|
{
|
sErrMsg = "ûÓзµ»ØÈκμǼ£¡";
|
return null;
|
}
|
oBar.HBarType = "Ô´µ¥ÌõÂë";
|
oBar.HSourceBillNo = Convert.ToString(DS.Tables[0].Rows[0]["HBillNo"]);
|
oBar.HSourceBillType = Convert.ToString(DS.Tables[0].Rows[0]["HBillType"]);
|
oBar.HSupID = Convert.ToInt64(DS.Tables[0].Rows[0]["HSupID"]);
|
oBar.HSupName = Convert.ToString(DS.Tables[0].Rows[0]["HSupName"]);
|
oBar.HDeptID = Convert.ToInt64(DS.Tables[0].Rows[0]["HDeptID"]);
|
oBar.HDeptName = Convert.ToString(DS.Tables[0].Rows[0]["HDeptName"]);
|
}
|
else
|
{
|
sErrMsg = "Ô´µ¥ÀàÐÍÃû³ÆÉèÖò»ÕýÈ·£¡";
|
return null;
|
}
|
// ½«Ô´µ¥ÐÅϢдÈë ÁÙʱ»º´æ±í
|
if (tem.AddNew_Source(HBillID, HBillNo, HBillType, oBar.HSourceBillNo, oBar.HSourceBillType, sRedBlue, ref sErrMsg))
|
{
|
return oBar;
|
}
|
else
|
{
|
sErrMsg = "±£´æÔ´µ¥ÐÅϢʧ°Ü£¡" + sErrMsg;
|
return null;
|
}
|
}
|
}
|
}
|
else
|
{
|
sErrMsg = "ÎÞЧÌõÂëÀàÐÍ£¡";
|
return null;
|
}
|
}
|
}
|
}
|
}
|
|
//ɨÃèÎïÁÏÌõÂë ±£´æµ½³öÈë¿âÌõÂëÁÙʱ±í(ÎïÁÏ) ²úÆ·Èë¿â¶àÔ´µ¥Ä£¿é
|
public bool set_SavePonderationBillMain_Temp_BarCode_MulSource(string sBarCode, Int64 HBillID, string HBillType, string HBillNo, string HMaker, Int64 HWhID, Int64 HSPID, Double HQty, bool HRedBlueFlag, string HSourceBillType, Int64 HOWNERID, bool sXFFlag, bool sJDPFlag, ref string sErrMsg)
|
{
|
SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
|
DAL.ClsKF_PonderationBillMain_Temp_Ctl tem = new DAL.ClsKF_PonderationBillMain_Temp_Ctl();
|
Model.ClsKF_PonderationBillMain_Temp model = new Model.ClsKF_PonderationBillMain_Temp();
|
double sRelQty = 0;
|
|
//ÅжÏÌõÂëÊÇ·ñº¬ÌØÊâ·ûºÅ # £¬Èç¹ûº¬ÓÐÔò ²ð·Ö
|
string[] NewBarCode;
|
if (sBarCode.CompareTo("#") > 0)
|
{
|
NewBarCode = sBarCode.Split(Convert.ToChar("#"));
|
sBarCode = NewBarCode[0];
|
}
|
//¸ù¾ÝÌõÂë»ñÈ¡ÌõÂëÐÅÏ¢
|
DAL.ClsGy_BarCodeBill_View dal = new DAL.ClsGy_BarCodeBill_View();
|
if (dal.GetInfoByNumber_View(sBarCode))
|
{
|
//´ÓÌõÂë±íÖлñÈ¡ÌõÂëÔ´µ¥ÀàÐÍÐÅÏ¢
|
DataSet ds2 = oCn.RunProcReturn(" select HSourceBillType from Gy_BarCodeBill where HBarCodeType='ΨһÌõÂë' and HBarCode='" + sBarCode + "'", "Gy_BarCodeBill");
|
if (ds2 == null || ds2.Tables[0].Rows.Count == 0)
|
{
|
sErrMsg = "ÌõÂëÀàÐͲ»ÕýÈ·£¡";
|
return false;
|
}
|
else
|
{
|
if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0][0]) != "3710")
|
{
|
sErrMsg = "ÌõÂëÔ´µ¥ÐÅÏ¢´íÎó£¬ËùɨÌõÂëÔ´µ¥ÀàÐͱØÐëΪÉú²ú¶©µ¥£¡";
|
return false;
|
}
|
}
|
if (sXFFlag)
|
{
|
//Ïä·¢
|
DataSet dsxf = oCn.RunProcReturn("exec h_p_WMS_GetICMOBillandHMaterID_XF '" + sBarCode + "' ", "h_p_WMS_GetICMOBillandHMaterID_XF");
|
if (dsxf == null || dsxf.Tables[0].Rows.Count == 0)
|
{
|
sErrMsg = "ËùɨÃè³ÉÆ·ÂëÎÞÏà¹ØÏä·¢Éú²ú¶©µ¥£¬²»ÔÊÐíÏä·¢Èë¿â£¡";
|
return false;
|
}
|
else if (dsxf.Tables[0].Rows.Count != 1)
|
{
|
sErrMsg = "ËùɨÃè³ÉÆ·ÂëÏà¹ØÏä·¢Éú²ú¶©µ¥²»Î¨Ò»£¬²»ÔÊÐíÏä·¢Èë¿â£¡";
|
return false;
|
}
|
else
|
{
|
dal.omodel_View.HSourceInterID = DBUtility.ClsPub.isLong(dsxf.Tables[0].Rows[0]["HInterID"]);
|
dal.omodel_View.HSourceEntryID = DBUtility.ClsPub.isLong(dsxf.Tables[0].Rows[0]["HEntryID"]);
|
dal.omodel_View.HSourceBillNo = DBUtility.ClsPub.isStrNull(dsxf.Tables[0].Rows[0]["HBillNo"]);
|
dal.omodel_View.HMaterID = DBUtility.ClsPub.isLong(dsxf.Tables[0].Rows[0]["HMaterID"]);
|
dal.omodel_View.HBarCode = sBarCode + "-XF";
|
HWhID = DBUtility.ClsPub.isLong(dsxf.Tables[0].Rows[0]["HWhID"]);
|
HSPID = 0;
|
}
|
}
|
}
|
else
|
{
|
sErrMsg = "ÎÞЧÌõÂë";
|
return false;
|
}
|
|
if (sXFFlag)
|
{
|
////Åжϲ¢»ñÈ¡ ²Ö¿â ²ÖλÐÅÏ¢ Ïä·¢
|
//DataSet dsxf3 = oCn.RunProcReturn("exec h_p_WMS_GetBillWHID_XF " + HBillID.ToString() + ",'" + HBillType + "'," + dal.omodel_View.HMaterID + "," + HWhID.ToString() + "," + HSPID.ToString(), "h_p_WMS_GetBillWHID_XF");
|
//if (dsxf3 == null || dsxf3.Tables[0].Rows.Count == 0)
|
//{
|
// sErrMsg = "Åжϲ¢»ñÈ¡²Ö¿â²ÖλÐÅÏ¢£¬Î´Öª´íÎó£¡";
|
// return false;
|
//}
|
//else
|
//{
|
// if (DBUtility.ClsPub.isLong(dsxf3.Tables[0].Rows[0][0]) == 0)
|
// {
|
// HWhID = DBUtility.ClsPub.isLong(dsxf3.Tables[0].Rows[0]["HWHID"]);
|
// HSPID = DBUtility.ClsPub.isLong(dsxf3.Tables[0].Rows[0]["HSPID"]);
|
// }
|
// else
|
// {
|
// sErrMsg = DBUtility.ClsPub.isStrNull(dsxf3.Tables[0].Rows[0]["HRemark"]);
|
// return false;
|
// }
|
//}
|
}
|
else
|
{
|
if (sJDPFlag)
|
{
|
//½µµÈÆ·
|
DataSet dsJDP = oCn.RunProcReturn("exec h_p_WMS_GetBillWHID_JDP '" + sBarCode + "'", "h_p_WMS_GetBillWHID_JDP");
|
if (dsJDP == null || dsJDP.Tables[0].Rows.Count == 0)
|
{
|
sErrMsg = "Åжϲ¢»ñÈ¡½µµÈÆ·²Ö¿âÐÅÏ¢£¬Î´Öª´íÎó£¡";
|
return false;
|
}
|
else
|
{
|
HWhID = DBUtility.ClsPub.isLong(dsJDP.Tables[0].Rows[0]["HWHID"]);
|
HSPID = DBUtility.ClsPub.isLong(dsJDP.Tables[0].Rows[0]["HSPID"]);
|
}
|
}
|
else
|
{
|
//Åжϲ¢»ñÈ¡ ²Ö¿â ²ÖλÐÅÏ¢
|
DataSet ds3 = oCn.RunProcReturn("exec h_p_WMS_GetBillWHID " + HBillID.ToString() + ",'" + HBillType + "','" + sBarCode + "'," + HWhID.ToString() + "," + HSPID.ToString(), "h_p_WMS_GetBillWHID");
|
if (ds3 == null || ds3.Tables[0].Rows.Count == 0)
|
{
|
sErrMsg = "Åжϲ¢»ñÈ¡²Ö¿â²ÖλÐÅÏ¢£¬Î´Öª´íÎó£¡";
|
return false;
|
}
|
else
|
{
|
if (DBUtility.ClsPub.isLong(ds3.Tables[0].Rows[0][0]) == 0)
|
{
|
HWhID = DBUtility.ClsPub.isLong(ds3.Tables[0].Rows[0]["HWHID"]);
|
HSPID = DBUtility.ClsPub.isLong(ds3.Tables[0].Rows[0]["HSPID"]);
|
}
|
else
|
{
|
sErrMsg = DBUtility.ClsPub.isStrNull(ds3.Tables[0].Rows[0]["HRemark"]);
|
return false;
|
}
|
}
|
}
|
}
|
|
//»ñÈ¡ÌõÂëÊýÁ¿
|
if (dal.omodel_View.HBarCodeType != "ÍÐÅÌÌõÂë")
|
{
|
if (dal.omodel_View.HBarCodeType == "ΨһÌõÂë" && HQty > 0 && dal.omodel_View.HQty < HQty)
|
{
|
sRelQty = dal.omodel_View.HQty;
|
}
|
else if (HQty > 0)
|
{
|
sRelQty = HQty;
|
}
|
else
|
{
|
sRelQty = dal.omodel_View.HQty;
|
}
|
|
if (HRedBlueFlag)
|
{
|
//ÅжÏÌõÂë¿â´æ ·µ»Ø¿â´æÊýÁ¿ ²Ö¿â ²Öλ
|
DAL.ClsKF_PonderationBillMain_Temp_View Tempdal = new DAL.ClsKF_PonderationBillMain_Temp_View();
|
if (Tempdal.CheckQtyByBarCode(HBillID, HBillType, sBarCode, ref HWhID, ref HSPID, sRelQty, ref sRelQty))
|
{
|
|
}
|
else
|
{
|
if (sRelQty == 0)
|
{
|
sErrMsg = "ÎÞ¿â´æ£¡";
|
return false;
|
}
|
else
|
{
|
sErrMsg = "¿â´æ²»×㣬ÒÑ»ñȡʵ¼Ê¿â´æÊýÁ¿£¡";
|
}
|
}
|
}
|
else
|
{
|
//ÅжÏÌõÂëɨÃèÊýÁ¿ ·µ»ØÊ£ÓàδɨÃèÊýÁ¿
|
if (tem.IsBarCode(sBarCode, HBillType, HRedBlueFlag, ref sRelQty, ref sErrMsg))
|
{
|
|
}
|
else
|
{
|
sErrMsg = sErrMsg;
|
return false;
|
}
|
}
|
}
|
|
model.HInterID = HBillID;
|
model.HBillNo = HBillNo;
|
model.HBillType = HBillType;
|
model.HMaker = HMaker;
|
//
|
model.HMaterID = dal.omodel_View.HMaterID;
|
model.HAuxPropID = dal.omodel_View.HAuxPropID;
|
model.HErpClsID = dal.omodel_View.HErpClsID;
|
model.HQty = sRelQty;
|
model.HQtyMust = 0;
|
model.HBarCode = dal.omodel_View.HBarCode;
|
model.HBatchNo = dal.omodel_View.HBatchNo;
|
model.HMTONo = dal.omodel_View.HMTONo;
|
|
model.HWhID = HWhID;
|
model.HStockPlaceID = HSPID;
|
model.HSourceInterID = dal.omodel_View.HSourceInterID;
|
model.HSourceEntryID = dal.omodel_View.HSourceEntryID;
|
model.HSourceBillNo = dal.omodel_View.HSourceBillNo;
|
model.HSourceBillType = HSourceBillType;
|
model.HRedBlueFlag = HRedBlueFlag;
|
model.HPieceQty = 1;
|
model.HSTOCKORGID = dal.omodel_View.HSTOCKORGID;
|
model.HOWNERID = dal.omodel_View.HOWNERID;
|
|
if (sXFFlag)
|
{
|
//Ïä·¢
|
tem.oModel = model;
|
if (dal.omodel_View.HBarCodeType == "ΨһÌõÂë")
|
{
|
if (!tem.IsBarCode(model.HBarCode, model.HInterID, model.HErpClsID, model.HBillType))
|
{
|
sErrMsg = "´æÔÚÏàͬÌõÂ룬ÇëÎðÖØ¸´É¨Ã裡";
|
return false;
|
}
|
}
|
if (tem.AddNew_Source(ref sErrMsg))
|
{
|
return true;
|
}
|
else
|
{
|
sErrMsg = "ɨÃèʧ°Ü£¡" + sErrMsg;
|
return false;
|
}
|
}
|
else
|
{
|
//½«ÎïÁÏÌõÂëÐÅϢдÈë³öÈë¿âÌõÂëÁÙʱ±í
|
if (set_SavePonderationBillMain_Temp_Select_Qty(model, HQty, ref sErrMsg))
|
{
|
|
}
|
else
|
{
|
sErrMsg = "ɨÃèʧ°Ü£¡" + sErrMsg;
|
return false;
|
}
|
}
|
return true;
|
}
|
|
#region Ò»¼üɨÂë ÏúÊÛ³ö¿â¡¢ÏúÊÛÍË¿âÄ£¿é ·ÉÁúרÓÃ
|
|
public bool set_SavePonderationBillMain_Temp_FeiLong(string sBarCode, Int64 HBillID, string HBillType, string HBillNo, string HMaker, Int64 HWhID, Int64 HSPID, Double HQty, bool HRedBlueFlag, bool SourceFlag, string HSourceBillNo, string HSourceBillType, Int64 HOWNERID, string HExpressNumber, ref string sHSourceBillNo, ref string sHSourceBillType, ref long sHSupID, ref string sHSupName, ref long sHDeptID, ref string sHDeptName, ref string sHBarType, ref string sErrMsg)
|
{
|
SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
|
//»ñȡϵͳ²ÎÊý
|
Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
|
if (oSystemParameter.ShowBill(ref sErrMsg) == false)
|
{
|
sErrMsg = "»ñȡϵͳ²ÎÊýʧ°Ü£¡ " + sErrMsg;
|
return false;
|
}
|
string sRedBlue = "À¶×Ö";
|
if (HRedBlueFlag)
|
{
|
sRedBlue = "ºì×Ö";
|
}
|
else
|
{
|
sRedBlue = "À¶×Ö";
|
}
|
DataSet Dss;
|
//¸ù¾ÝµÝÈëµÄÌõÂ룬ÅжÏÌõÂëΪÎïÁÏÌõÂë »òÔ´µ¥ÌõÂë
|
Dss = oCn.RunProcReturn(" select 1 from h_v_IF_SEOrderBillList_Lite where HBillNo= '" + sBarCode + "'", "h_v_IF_SEOrderBillList_Lite");
|
|
//ÎÞ·µ»ØÊý¾ÝÔòΪÎïÁÏÌõÂë
|
if (Dss == null || Dss.Tables[0].Rows.Count == 0)
|
{
|
//ÏúÊÛÍË»õÄ£¿é,¸ù¾ÝÎïÁÏÌõÂëÖ±½Ó»ñÈ¡¶ÔÓ¦Ô´µ¥ÐÅÏ¢´æÈëÁÙʱ±í
|
if (HBillType == "1247")
|
{
|
//Åжϲ¢»ñÈ¡ ²Ö¿â ²ÖλÐÅÏ¢
|
DataSet ds4 = oCn.RunProcReturn("exec h_p_WMS_GetBillWHID " + HBillID.ToString() + ",'" + HBillType + "','" + sBarCode + "'," + HWhID.ToString() + "," + HSPID.ToString(), "h_p_WMS_GetBillWHID");
|
if (ds4 == null || ds4.Tables[0].Rows.Count == 0)
|
{
|
sErrMsg = "Åжϲ¢»ñÈ¡²Ö¿â²ÖλÐÅÏ¢£¬Î´Öª´íÎó£¡";
|
return false;
|
}
|
else
|
{
|
if (DBUtility.ClsPub.isLong(ds4.Tables[0].Rows[0][0]) == 0)
|
{
|
HWhID = DBUtility.ClsPub.isLong(ds4.Tables[0].Rows[0]["HWHID"]);
|
HSPID = DBUtility.ClsPub.isLong(ds4.Tables[0].Rows[0]["HSPID"]);
|
}
|
else
|
{
|
sErrMsg = DBUtility.ClsPub.isStrNull(ds4.Tables[0].Rows[0]["HRemark"]);
|
return false;
|
}
|
}
|
//½«ÎïÁÏÌõÂëÐÅϢдÈë³öÈë¿âÌõÂëÁÙʱ±í
|
DataSet dsf = oCn.RunProcReturn("exec h_p_Kf_SellOutBackBill_AddTemp_FeiLong " + HBillID.ToString() + ",'" + HBillNo + "','" + HBillType + "','" + HMaker + "','" + sBarCode + "'," + HQty + "," + HWhID + "," + HSPID + ",'" + HRedBlueFlag + "'," + HOWNERID + ",'" + HExpressNumber + "'", "h_p_Kf_SellOutBackBill_AddTemp_FeiLong");
|
if (dsf == null || dsf.Tables[0].Rows.Count == 0)
|
{
|
sErrMsg = "ÏúÊÛÍË»õɨÃèÎïÁÏ£¬Î´Öª´íÎó£¡";
|
return false;
|
}
|
else
|
{
|
if (DBUtility.ClsPub.isLong(dsf.Tables[0].Rows[0][0]) == 0)
|
{
|
sHBarType = "Ô´µ¥ÌõÂë";
|
sHSourceBillNo = DBUtility.ClsPub.isStrNull(dsf.Tables[0].Rows[0]["HSourceBillNo"]);
|
sHSourceBillType = DBUtility.ClsPub.isStrNull(dsf.Tables[0].Rows[0]["HSourceBillType"]);
|
sHSupID = DBUtility.ClsPub.isLong(dsf.Tables[0].Rows[0]["HSupID"]);
|
sHSupName = DBUtility.ClsPub.isStrNull(dsf.Tables[0].Rows[0]["HSupName"]);
|
sHDeptID = DBUtility.ClsPub.isLong(dsf.Tables[0].Rows[0]["HDeptID"]);
|
sHDeptName = DBUtility.ClsPub.isStrNull(dsf.Tables[0].Rows[0]["HDeptName"]);
|
}
|
else
|
{
|
sErrMsg = DBUtility.ClsPub.isStrNull(dsf.Tables[0].Rows[0]["HRemark"]);
|
return false;
|
}
|
}
|
}
|
else
|
{
|
//ÏúÊÛ³ö¿â²»ÔÊÐíÎÞÔ´µ¥³ö¿â
|
if (SourceFlag == false)
|
{
|
sErrMsg = "ÏúÊÛ³ö¿â²»ÔÊÐíÎÞÔ´µ¥³ö¿â£¬ÇëÏÈɨÃèÔ´µ¥£¡";
|
return false;
|
}
|
|
//ÎïÁÏÌõÂëдÈëÁÙʱ±íʱ£¬Åжϲֿâ²ÖλÊÇ·ñÕýÈ·
|
DataSet ds5 = oCn.RunProcReturn("exec h_p_WMS_CheckWHandSP " + HWhID.ToString() + "," + HSPID.ToString(), "h_p_WMS_CheckWHandSP");
|
if (ds5 == null || ds5.Tables[0].Rows.Count == 0)
|
{
|
sErrMsg = "ɨÃèÎïÁÏÌõÂë´æÈëÁÙʱ±íʱÅжϲֿâ²ÖλÊÇ·ñÕýÈ·,δ֪´íÎó£¡";
|
return false;
|
}
|
else
|
{
|
if (DBUtility.ClsPub.isLong(ds5.Tables[0].Rows[0][0]) == 1)
|
{
|
sErrMsg = DBUtility.ClsPub.isStrNull(ds5.Tables[0].Rows[0]["HRemark"]);
|
return false;
|
}
|
}
|
|
//½«ÎïÁÏÌõÂëÐÅϢдÈë³öÈë¿âÌõÂëÁÙʱ±í
|
DataSet dsf = oCn.RunProcReturn("exec h_p_Kf_SellOutBill_AddTemp_FeiLong " + HBillID.ToString() + ",'" + HBillNo + "','" + HBillType + "','" + HMaker + "','" + sBarCode + "'," + HWhID + "," + HSPID + ",'" + HRedBlueFlag + "'," + HOWNERID, "h_p_Kf_SellOutBill_AddTemp_FeiLong");
|
if (dsf == null || dsf.Tables[0].Rows.Count == 0)
|
{
|
sErrMsg = "ÏúÊÛ³ö¿âɨÃèÎïÁÏ£¬Î´Öª´íÎó£¡";
|
return false;
|
}
|
else
|
{
|
if (DBUtility.ClsPub.isLong(dsf.Tables[0].Rows[0][0]) == 1)
|
{
|
sErrMsg = DBUtility.ClsPub.isStrNull(dsf.Tables[0].Rows[0]["HRemark"]);
|
return false;
|
}
|
}
|
}
|
}
|
else
|
{
|
string sSourceBillType = "1401";
|
if (HBillType == "1205" && oSystemParameter.omodel.Kf_SellOutBill_MulSourceBill == "Y") //ϵͳ²ÎÊý ÏúÊÛ³ö¿âµ¥-¶àÔ´µ¥Ä£Ê½
|
{
|
DataSet ds1 = oCn.RunProcReturn("exec h_p_IF_MulSourceBill_Add_SellOut " + HBillID.ToString() + ",'" + HBillNo + "','" + HBillType + "','" + sBarCode + "','" + sSourceBillType + "','" + sRedBlue + "'", "h_p_IF_MulSourceBill_Add_SellOut");
|
if (ds1 == null || ds1.Tables[1].Rows.Count == 0)
|
{
|
sErrMsg = "ÏúÊÛ³ö¿â¶àÔ´µ¥Ä£Ê½É¨ÃèÔ´µ¥£¬Î´Öª´íÎó£¡";
|
return false;
|
}
|
else
|
{
|
if (DBUtility.ClsPub.isLong(ds1.Tables[1].Rows[0][0]) == 0)
|
{
|
sHBarType = "Ô´µ¥ÌõÂë";
|
sHSourceBillNo = DBUtility.ClsPub.isStrNull(ds1.Tables[1].Rows[0]["HSourceBillNo"]);
|
sHSourceBillType = DBUtility.ClsPub.isStrNull(ds1.Tables[1].Rows[0]["HSourceBillType"]);
|
sHSupID = DBUtility.ClsPub.isLong(ds1.Tables[1].Rows[0]["HSupID"]);
|
sHSupName = DBUtility.ClsPub.isStrNull(ds1.Tables[1].Rows[0]["HSupName"]);
|
sHDeptID = DBUtility.ClsPub.isLong(ds1.Tables[1].Rows[0]["HDeptID"]);
|
sHDeptName = DBUtility.ClsPub.isStrNull(ds1.Tables[1].Rows[0]["HDeptName"]);
|
}
|
else
|
{
|
sErrMsg = DBUtility.ClsPub.isStrNull(ds1.Tables[1].Rows[0]["HRemark"]);
|
return false;
|
}
|
}
|
}
|
else
|
{
|
sErrMsg = "ËùɨԴµ¥ÌõÂë²»ÊôÓÚ´ËÄ£¿éÔ´µ¥·¶Î§£¡";
|
return false;
|
}
|
}
|
return true;
|
}
|
|
#endregion
|
|
|
#region ÏúÊÛ³ö¿âÄ£¿é ËùɨÎïÁÏÌõÂë¶ÔÓ¦ÎïÁÏÓëÔ´µ¥ÎïÁϲ»Ò»Ö£¬È¡ÎïÁÏÌõÂëÐÅÏ¢£¬¸üгöÈë¿âÁÙʱ±íÖÐÔ´µ¥ÎïÁÏÐÅÏ¢£¨·ÉÁúרÓã©
|
public bool set_SavePonderationBillMain_Temp_DifferentMater_FeiLong(string sBarCode, Int64 HBillID, string HBillType, string HBillNo, string HMaker, Int64 HWhID, Int64 HSPID, bool HRedBlueFlag, Int64 HOWNERID, ref string sErrMsg)
|
{
|
SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
|
try
|
{
|
oCn.RunProc("EXEC h_p_Kf_SellOutBill_AddTemp_DifferentMater_FeiLong " + HBillID.ToString() + ",'" + HBillNo + "','" + HBillType + "','" + HMaker + "','" + sBarCode + "'," + HWhID + "," + HSPID + ",'" + HRedBlueFlag + "'," + HOWNERID);
|
return true;
|
}
|
catch (Exception e)
|
{
|
sErrMsg = "ÎïÁÏÌõÂë¶ÔÓ¦ÎïÁÏÓëÔ´µ¥ÎïÁϲ»Ò»ÖÂʱ£¬Ð´ÈëÌõÂë³öÈë¿âÁÙʱ±íʧ°Ü£¡" + e.Message;
|
return false;
|
}
|
}
|
|
#endregion
|
|
|
|
#endregion
|
}
|
}
|