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

📄 mtsh.cpp

📁 一个以前收集的基于C/S架构的ERP客户端源代码
💻 CPP
📖 第 1 页 / 共 2 页
字号:
   AnsiString  b_TKSLoc;
   m_TKSLoc=GetDetailValue("TsdLoc");
   b_TKSLoc=GetDetailOldValue("TsdLoc");
    if(m_TKSLoc.IsEmpty())
      throw Exception("货位编码不能为空");
    if(m_TKSLoc.Length()>18)
      throw Exception("货位编码长度不能大于18");
    if(m_TKSLoc!=b_TKSLoc)
    {
      Query->Close();
      Query->SQL->Clear();
      Query->SQL->Add("select loccode from sdloc where loccode='"+m_TKSLoc+"'");
      Query->Open();
      if(Query->RecordCount<=0)
      {
        Query->Close();
        throw Exception("货位编码:"+m_TKSLoc+"不存在");
      }
      Query->Close();
    }

   AnsiString  m_TKSGoods;
   AnsiString  b_TKSGoods;
   m_TKSGoods=GetDetailValue("TsdGoods");
   b_TKSGoods=GetDetailOldValue("TsdGoods");
    if(m_TKSGoods.IsEmpty())
      throw Exception("物料编码不能为空");
    if(m_TKSGoods.Length()>18)
      throw Exception("物料编码长度不能大于18");

   AnsiString  m_TKSUnit;
   AnsiString  b_TKSUnit;
   m_TKSUnit=GetDetailValue("TsdUnit");
   b_TKSUnit=GetDetailOldValue("TsdUnit");
 //  AnsiString  m_TKSGoods;
   m_TKSGoods=GetDetailValue("TsdGoods");
    if(m_TKSGoods.IsEmpty())
      throw Exception("盘点物料不能为空");
    if(m_TKSUnit.IsEmpty())
      throw Exception("计量单位不能为空");
    if(m_TKSUnit.Length()>18)
      throw Exception("计量单位长度不能大于18");
    if(m_TKSUnit!=b_TKSUnit)
    {
      Query->Close();
      Query->SQL->Clear();
      Query->SQL->Add("Select Unitcode from sdUnit where Unitcode='"+m_TKSUnit+"'");
      Query->Open();
      if(Query->RecordCount<=0)
      {
        Query->Close();
        throw Exception("计量单位:"+m_TKSUnit+"不存在");
      }
      Query->Close();
    }

   AnsiString  m_TKSBatch;
   AnsiString  b_TKSBatch;
   m_TKSBatch=GetDetailValue("TsdBatch");
   b_TKSBatch=GetDetailOldValue("TsdBatch");
  // AnsiString  m_TKSLoc;
   m_TKSLoc=GetDetailValue("TsdLoc");
  // AnsiString  m_TKSGoods;
   m_TKSGoods=GetDetailValue("TsdGoods");
    int IsBatch;
    if(m_TKSLoc.IsEmpty())
      throw Exception("盘点货位不能为空");
    if(m_TKSGoods.IsEmpty())
      throw Exception("盘点物料不能为空");
    if(m_TKSBatch.Length()>18)
      throw Exception("批号编码长度不能大于18");
    Query->Close();
    Query->SQL->Clear();
    Query->SQL->Add("select GoodsBatch from sdgoods where goodscode='"+m_TKSGoods+"'");
    Query->Open();
    if(Query->RecordCount<=0)
    {
      Query->Close();
      throw Exception("盘点物料不存在");
    }
    else
    {
      IsBatch=Query->FieldValues["GoodsBatch"];
      Query->Close();
    }
    if(IsBatch==0)
    {
      if(!m_TKSBatch.IsEmpty())
        throw Exception("物料:"+m_TKSGoods+" 不需批次管理");
    }
    if(m_TKSBatch.IsEmpty()==false && m_TKSBatch!=b_TKSBatch)
    {
      Query->Close();
      Query->SQL->Clear();
      Query->SQL->Add("select Batchcode from sdBatch where Batchcode='"+m_TKSBatch+"'");
      Query->Open();
      if(Query->RecordCount<=0)
      {
        Query->Close();
        throw Exception("批号编码:"+m_TKSBatch+"未定义");
      }
      Query->Close();
    }

   AnsiString  m_TKSSod;
   AnsiString  b_TKSSod;
   m_TKSSod=GetDetailValue("TsdSod");
   b_TKSSod=GetDetailOldValue("TsdSod");
 //  AnsiString  m_TKSLoc;
   m_TKSLoc=GetDetailValue("TsdLoc");
  // AnsiString  m_TKSGoods;
   m_TKSGoods=GetDetailValue("TsdGoods");
    int TrackSo;
    if(m_TKSLoc.IsEmpty())
      throw Exception("盘点货位不能为空");
    if(m_TKSGoods.IsEmpty())
      throw Exception("盘点物料不能为空");
    if(m_TKSSod.Length()>18)
      throw Exception("订单号长度不能大于18");
    Query->Close();
    Query->SQL->Clear();
    Query->SQL->Add("select GoodsTrackSo from sdgoods where goodscode='"+m_TKSGoods+"'");
    Query->Open();
    if(Query->RecordCount<=0)
    {
      Query->Close();
      throw Exception("盘点物料不存在");
    }
    else
    {
      TrackSo=Query->FieldValues["GoodsTrackSo"];
      Query->Close();
    }
    if(TrackSo==0)
    {
      if(!m_TKSSod.IsEmpty())
        throw Exception("物料:"+m_TKSGoods+" 不需跟踪订单管理");
    }
    if(m_TKSSod.IsEmpty()==false && m_TKSSod!=b_TKSSod)
    {
      Query->Close();
      Query->SQL->Clear();
      Query->SQL->Add("select Sohcode from sdSoh where Sohcode='"+m_TKSSod+"'");
      Query->Open();
      if(Query->RecordCount<=0)
      {
        Query->Close();
        throw Exception("订单:"+m_TKSSod+"不存在");
      }
      Query->Close();
    }

   int m_TKSSodLine;
   int b_TKSSodLine;
   m_TKSSodLine=GetDetailValue("TsdSodLine");
   b_TKSSodLine=GetDetailOldValue("TsdSodLine");
   //AnsiString  m_TKSSod;
   m_TKSSod=GetDetailValue("TsdSod");
    if(m_TKSSod.IsEmpty())
      b_TKSSodLine=0;
    else
    {
      if(m_TKSSodLine<=0)
        throw Exception("订单行号不能小于等于零");
      if(m_TKSSodLine!=b_TKSSodLine)
      {
        Query->Close();
        Query->SQL->Clear();
        Query->SQL->Add("select sodline from sdsod where sodcode='"+m_TKSSod+"' and sodline="+AnsiString(m_TKSSodLine));\
        Query->Open();
        if(Query->RecordCount<=0)
        {
          Query->Close();
          throw Exception("订单行号不存在");
        }
        Query->Close();
      }
    }

   double m_TKSAQty;
   m_TKSAQty=GetDetailValue("TsdAQty");

  double m_TKSTQty;
  double b_TKSTQty;
   m_TKSTQty=GetDetailValue("TsdTQty");
   b_TKSTQty=GetDetailOldValue("TsdTQty");
  // AnsiString  m_TKSGoods;
   m_TKSGoods=GetDetailValue("TsdGoods");
   double  m_TKSTAmt;
   m_TKSTAmt=GetDetailValue("TsdTAmt");
   double  m_TKSTPrice;
   m_TKSTPrice=GetDetailValue("TsdTPrice");
  // double  m_TKSAQty;
   m_TKSAQty=GetDetailValue("TsdAQty");
   double TmpVal;
   double m_TKSDQty;
   int m_TKSFlg;
   
    if(m_TKSGoods.IsEmpty())
      throw Exception("盘点物料不能为空");
    if(m_TKSTQty<0)
      throw Exception("实盘数量不能小于零");
    if(m_TKSTAmt<0)
      throw Exception("实盘金额不能小于零");
   /* if(m_TKSTQty>0)
      m_TKSTPrice=DataCarry(m_TKSTAmt/m_TKSTQty,4,0); */
    else
      m_TKSTPrice=0;
    //TmpVal=DataCarry(m_TKSAQty-b_TKSTQty,2,0);      ???????????
    if(TmpVal>0)
    {
      m_TKSDQty=TmpVal;
      m_TKSFlg=-1;
    }
    else
    {
      m_TKSDQty=-TmpVal;
      m_TKSFlg=1;
    }

  // double m_TKSDQty;
   m_TKSDQty=GetDetailValue("TsdDQty");

  // int m_TKSFlg;
   m_TKSFlg=GetDetailValue("TsdFlg");
    if(m_TKSFlg>1 || m_TKSFlg<-1)
      throw Exception("盘点标志只能取值1-盘盈,0-盘平,-1-盘亏");

  double m_TKSAPrice;
   m_TKSAPrice=GetDetailValue("TsdAPrice");
    if(m_TKSAPrice<0)
      throw Exception("帐面单价不能小于零");

  double m_TKSAAmt;
   m_TKSAAmt=GetDetailValue("TsdAAmt");

 // double m_TKSTPrice;
  double b_TKSTPrice;
   m_TKSTPrice=GetDetailValue("TsdTPrice");
   b_TKSTPrice=GetDetailOldValue("TsdTPrice");
    if(m_TKSTPrice<0)
      throw Exception("实盘单价不能小于零");
   // m_TKSTAmt=DataCarry(m_TKSTQty*b_TKSTPrice,2,0);     ??????????????????????

//  double m_TKSTAmt;
   m_TKSTAmt=GetDetailValue("TsdTAmt");
 // AnsiString  m_TKSGoods;
   m_TKSGoods=GetDetailValue("TsdGoods");
 // double  m_TKSTQty;
   m_TKSTQty=GetDetailValue("TsdTQty");
// double  m_TKSTPrice;
   m_TKSTPrice=GetDetailValue("TsdTPrice");
 // double TmpVal;
//  double m_TKSAQty,m_TKSDQty;
//  int m_TKSFlg;

    if(m_TKSGoods.IsEmpty())
      throw Exception("盘点物料不能为空");
    if(m_TKSTAmt<0)
      throw Exception("实盘成本不能小于零");
    if(m_TKSTQty<0)
      throw Exception("实盘数量不能小于零");
   /* if(m_TKSTQty>0)
      m_TKSTPrice=DataCarry(m_TKSTAmt/m_TKSTQty,4,0);         ??????????????????? */
    else
      m_TKSTPrice=0;
    TmpVal=m_TKSAQty-m_TKSTQty;
    if(TmpVal>0)
    {
      m_TKSDQty=TmpVal;
      m_TKSFlg=-1;
    }
    else
    {
      m_TKSDQty=-TmpVal;
      m_TKSFlg=1;
    }

   AnsiString  m_TKSDesc;
   m_TKSDesc=GetDetailValue("TsdDesc");
    if(m_TKSDesc.Length()>40)
      throw Exception("备注长度不能大于40");

}
//---------------------------------------------------------------------------
void __fastcall TKSTsh::CmdExec(AnsiString Param)
{
}
//---------------------------------------------------------------------------

⌨️ 快捷键说明

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