⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mgoods.cpp

📁 一个以前收集的基于C/S架构的ERP客户端源代码
💻 CPP
📖 第 1 页 / 共 2 页
字号:
  double b_GoodsOoq;
   m_GoodsOoq=GetMasterValue("GoodsOoq");
    if(m_GoodsOoq<0)
      throw Exception("发放批量不能小于0");

  double m_GoodsWasteRate;
  double b_GoodsWasteRate;
   m_GoodsWasteRate=GetMasterValue("GoodsWasteRate");
    if(m_GoodsWasteRate<0)
      throw Exception("损耗率不能小于0");

  double m_GoodsMinPack;
  double b_GoodsMinPack;
   m_GoodsMinPack=GetMasterValue("GoodsMinPack");
    if(m_GoodsMinPack<0)
      throw Exception("最小包装数不能小于0");

  double m_GoodsPaot;
  double b_GoodsPaot;
   m_GoodsPaot=GetMasterValue("GoodsPaot");
    if(m_GoodsPaot<0)
      throw Exception("采购提前期不能小于0");

  double m_GoodsPtof;
  double b_GoodsPtof;
   m_GoodsPtof=GetMasterValue("GoodsPtof");
    if(m_GoodsPtof<0)
      throw Exception("完工停放期不能小于0");

   int m_GoodsPlanType;
   int b_GoodsPlanType;
   m_GoodsPlanType=GetMasterValue("GoodsPlanType");
    if(m_GoodsPlanType!=1 && m_GoodsPlanType!=2 && m_GoodsPlanType!=3 && m_GoodsPlanType!=4 && m_GoodsPlanType!=5 && m_GoodsPlanType!=6)
      throw Exception("计划方法只能取值1-MRP,2-MPS,3-订货点,4-预测,5-成套件,6-自定义");

   AnsiString  m_GoodsRouteCode;
   AnsiString  b_GoodsRouteCode;
   m_GoodsRouteCode=GetMasterValue("GoodsRouteCode");
   b_GoodsRouteCode=GetMasterOldValue("GoodsRouteCode");
    if(m_GoodsRouteCode.Length()>18)
      throw Exception("工艺路线代码长度不能大于18");
    if(m_GoodsRouteCode.IsEmpty()==false && m_GoodsRouteCode!=b_GoodsRouteCode)
    {
       Query->Close();
       Query->SQL->Clear();
       Query->SQL->Add("select RoutehCode from sdRouteh where RoutehCode='"+m_GoodsRouteCode+"'");
       Query->Open();
       if(Query->RecordCount<=0)
       {
          Query->Close();
          throw Exception("工艺路线代码:'"+m_GoodsRouteCode+"'未定义");
       }
       Query->Close();
    }
    b_GoodsRouteCode = m_GoodsRouteCode;

   int m_GoodsOaot;
   int b_GoodsOaot;
   m_GoodsOaot=GetMasterValue("GoodsOaot");
    if(m_GoodsOaot<0)
      throw Exception("发料提前期不能小于0");

   int m_GoodsCostType;
   int b_GoodsCostType;
   m_GoodsCostType=GetMasterValue("GoodsCostType");
    if(m_GoodsCostType!=1 && m_GoodsCostType!=2 && m_GoodsCostType!=3 && m_GoodsCostType!=4 && m_GoodsCostType!=5 &&m_GoodsCostType!=6)
      throw Exception("成本核算方法只能取值1-移动平均,2-标准成本,3-加权平均,4-先进先出,5后进先出,6-个别计价");

   int m_GoodsCostFrom;
   int b_GoodsCostFrom;
   m_GoodsCostFrom=GetMasterValue("GoodsCostFrom");
    if(m_GoodsCostFrom!=1 && m_GoodsCostFrom!=2 && m_GoodsCostFrom!=3)
      throw Exception("成本归集来源只能取值1-采购,2-制造,3-在制");

  double m_GoodsStdCost;
  double b_GoodsStdCost;

  double m_GoodsPlnCost;
  double b_GoodsPlnCost;

   AnsiString  m_GoodsCurrencyCode;
   AnsiString  b_GoodsCurrencyCode;
   m_GoodsCurrencyCode=GetMasterValue("GoodsCurrencyCode");
   b_GoodsCurrencyCode=GetMasterOldValue("GoodsCurrencyCode");
    if(m_GoodsCurrencyCode.IsEmpty())
      throw Exception("币种不能为空");
    if(m_GoodsCurrencyCode.Length()>18)
      throw Exception("币种长度不能大于18");
    if(m_GoodsCurrencyCode!=b_GoodsCurrencyCode)
    {
       Query->Close();
       Query->SQL->Clear();
       Query->SQL->Add("select CurrencyCode from sdCurrency where CurrencyCode='"+m_GoodsCurrencyCode+"'");
       Query->Open();
       if(Query->RecordCount<=0)
       {
          Query->Close();
          throw Exception("货币编码:'"+m_GoodsCurrencyCode+"'未定义");
       }
       Query->Close();
    }
    b_GoodsCurrencyCode = m_GoodsCurrencyCode;

   AnsiString  m_GoodsABC;
   AnsiString  b_GoodsABC;
   m_GoodsABC=GetMasterValue("GoodsABC");
    if(m_GoodsABC!="A" && m_GoodsABC!="B" && m_GoodsABC!="C")
      throw Exception("ABC分类只能取值A B C");
    b_GoodsABC = m_GoodsABC;

   int m_GoodsOverDays;
   int b_GoodsOverDays;
   m_GoodsOverDays=GetMasterValue("GoodsOverDays");
    if(m_GoodsOverDays<0)
      throw Exception("积压天数不能小0");

   int m_GoodsIdleDays;
   int b_GoodsIdleDays;
   m_GoodsIdleDays=GetMasterValue("GoodsIdleDays");
    if(m_GoodsIdleDays<0)
      throw Exception("呆滞天数不能小于0");

   AnsiString  m_GoodsPreSupplyCode;
   AnsiString  b_GoodsPreSupplyCode;
   m_GoodsPreSupplyCode=GetMasterValue("GoodsPreSupplyCode");
   b_GoodsPreSupplyCode=GetMasterOldValue("GoodsPreSupplyCode");
    if(m_GoodsPreSupplyCode.Length()>18)
      throw Exception("主供应商代码长度不能大于18");
    if(m_GoodsPreSupplyCode.IsEmpty()==false && m_GoodsPreSupplyCode!=b_GoodsPreSupplyCode)
    {
       Query->Close();
       Query->SQL->Clear();
       Query->SQL->Add("select SupplyCode from sdSupply where SupplyCode='"+m_GoodsPreSupplyCode+"'");
       Query->Open();
       if(Query->RecordCount<=0)
       {
          Query->Close();
          throw Exception("供应商编码:'"+m_GoodsPreSupplyCode+"'未定义");
       }
       Query->Close();
    }
    b_GoodsPreSupplyCode = m_GoodsPreSupplyCode;

   AnsiString  m_GoodsSubSupplyCode;
   AnsiString  b_GoodsSubSupplyCode;
   m_GoodsSubSupplyCode=GetMasterValue("GoodsSubSupplyCode");
   b_GoodsSubSupplyCode=GetMasterOldValue("GoodsSubSupplyCode");
    if(m_GoodsSubSupplyCode.Length()>18)
      throw Exception("次供应商代码长度不能大于18");
    if(m_GoodsSubSupplyCode.IsEmpty()==false && m_GoodsSubSupplyCode!=b_GoodsSubSupplyCode)
    {
       Query->Close();
       Query->SQL->Clear();
       Query->SQL->Add("select SupplyCode from sdSupply where SupplyCode='"+m_GoodsSubSupplyCode+"'");
       Query->Open();
       if(Query->RecordCount<=0)
       {
          Query->Close();
          throw Exception("供应商编码:'"+m_GoodsSubSupplyCode+"'未定义");
       }
       Query->Close();
    }
    b_GoodsSubSupplyCode = m_GoodsSubSupplyCode;

   int m_GoodsGtqFlg;
   int b_GoodsGtqFlg;
   m_GoodsGtqFlg=GetMasterValue("GoodsGtqFlg");
    if(m_GoodsGtqFlg!=0 && m_GoodsGtqFlg!=1)
      throw Exception("保质期管理标志只能取值0-不需保质期管理,1-需保质期管理");

  double m_GoodsGtqVal;
  double b_GoodsGtqVal;
   m_GoodsGtqVal=GetMasterValue("GoodsGtqVal");
    if(m_GoodsGtqVal<0)
      throw Exception("保质期不能小于0");

   int m_GoodsTrackSo;
   int b_GoodsTrackSo;
   m_GoodsTrackSo=GetMasterValue("GoodsTrackSo");
    if(m_GoodsTrackSo!=0 && m_GoodsTrackSo!=1)
      throw Exception("定单跟踪标志只能取值0-不需定单跟踪1-需定单跟踪");

  double m_GoodsMinQty;
  //double m_GoodsMaxQty;
   m_GoodsMinQty=GetMasterValue("GoodsMinQty");
//   m_GoodsMaxQty=GetMasterValue("GoodsMaxQty;");
    if(m_GoodsMinQty<0)
      throw Exception("最小库存量不能小于0");
//    if(m_GoodsMaxQty > 0 && m_GoodsMinQty > m_GoodsMaxQty)
//      throw Exception("最小库存量不能大于最大库存量");


   AnsiString  m_GoodsColor;
   m_GoodsColor=GetMasterValue("GoodsColor");
  if(m_GoodsColor.Length()>18)
    throw Exception("物料颜色长度不能大于18");

   AnsiString  m_GoodsSize;
   m_GoodsSize=GetMasterValue("GoodsSize");
  if(m_GoodsSize.Length()>18)
    throw Exception("物料尺寸长度不能大于18");

   AnsiString  m_GoodsRigidity;
   m_GoodsRigidity=GetMasterValue("GoodsRigidity");
  if(m_GoodsRigidity.Length()>18)
    throw Exception("物料硬度长度不能大于18");

   int m_GoodsState;
   int b_GoodsState;
   m_GoodsState=GetMasterValue("GoodsState");
   b_GoodsState=GetMasterOldValue("GoodsState");
    if(m_GoodsState!=1 && m_GoodsState!=2 && m_GoodsState!=3 && m_GoodsState!=4)
      throw Exception("物料属性只能取值:1-正在设计,2-正在使用,3-正在淘汰,4-已经废弃");
    if(m_GoodsState!=b_GoodsState)
    {
      if(m_GoodsState==1 && b_GoodsState!=0)
        throw Exception("物料属性不能再改回'正在设计'属性");
    }

   int m_GoodsPpt;
   int b_GoodsPpt;
   m_GoodsPpt=GetMasterValue("GoodsPpt");
   b_GoodsPpt=GetMasterOldValue("GoodsPpt");
   //AnsiString m_GoodsCode;
   m_GoodsCode=GetMasterValue("GoodsCode");
    AnsiString ValStr;
    if(m_GoodsCode.IsEmpty())
      throw Exception("物料编码不能为空");
    if(m_GoodsPpt!=0 && m_GoodsPpt!=1 && m_GoodsPpt!=2)
      throw Exception("物料管理属性只能取值:0-无管理属性,1-需物料状态管理,2-需二维结构管理");
    if(m_GoodsPpt!=b_GoodsPpt)
    {
      Query->Close();
      Query->SQL->Clear();
      Query->SQL->Add("select * from sdLg where LgGoodsCode='"+m_GoodsCode+"'");
      Query->Open();
      if(Query->RecordCount>0)
      {
        Query->Close();
        throw Exception("物料已被货位引用不能再更改状态");
      }
      Query->Close();
      Query->SQL->Clear();
      Query->SQL->Add("select parameterm_GoodsPpt from sdparameter where parametercode='10507'");
      Query->Open();
      if(Query->RecordCount>0)
      {
        ValStr=Query->FieldValues["parameterm_GoodsPpt"];
        Query->Close();
        if(ValStr=="0" && (m_GoodsPpt==1 || m_GoodsPpt==2))
          throw Exception("本系统不支持物料属性管理,请与软件供应商联系!");
        if(ValStr=="1" && m_GoodsPpt==2)
          throw Exception("本系统不支持物料二维结构管理,请与软件供应商联系!");
      }
      else
      {
        Query->Close();
        b_GoodsPpt=0;
        throw Exception("系统物料管理属性参数被破坏!");
      }
      Query->Close();
    }
}
//---------------------------------------------------------------------------
void __fastcall TKSGoods::CmdExec(AnsiString Param)
{

}
//---------------------------------------------------------------------------

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -