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

📄 frm_allimportbillinfo.pas

📁 这是一个基于delphi平台的物流空运管理系统!
💻 PAS
📖 第 1 页 / 共 5 页
字号:
      if FrmMain.execsql(sqlstr) then
      else
      begin
        ShowMessage('分单数据导入插入时出错,记录导入失败,请检查!');
        exit;
      end;
      {保存完毕以后,置于编辑状态}

     {保存货物记录}
      if ztrustfile.GoodsNumber > 0 then
      begin
        for i := 1 to ztrustfile.goodsnumber do
        begin
          context := fileread(myfilehandle, goodsfile, sizeof(goodsfile));
          codeget := FrmMain.GetCode('B');
          {件数  单位  体积  等级  公式  }
          {计费重量  单价  费用  货物描述  编号 编号  C.M.I  一个 }
          SqlStr := 'Insert into PlaneGoods(GoodsCode,FileCode,Pieces,weight,' +
            'kgid,Size,rateclass,Formula,chargweight,rate,' +
            'total,SpeGoods,SpeRemark,goods) Values(';
          FrmMain.InsStr(SqlStr, codeget, ',');
          FrmMain.InsStr(SqlStr, Varhawb, ',');
          FrmMain.InsStr(SqlStr, goodsfile.GoodsNumber, ',');
          FrmMain.InsStr(SqlStr, goodsfile.goodsweight, ',');
          FrmMain.InsStr(SqlStr, goodsfile.goodsunit, ',');
          FrmMain.InsStr(SqlStr, goodsfile.goodssize, ',');
          FrmMain.InsStr(SqlStr, goodsfile.goodsgrade, ',');
          FrmMain.InsStr(SqlStr, goodsfile.formul, ',');
          FrmMain.InsStr(SqlStr, goodsfile.chargeweight, ',');
          FrmMain.InsStr(SqlStr, goodsfile.unitprice, ',');
          FrmMain.InsStr(SqlStr, goodsfile.total, ',');
          FrmMain.InsStr(SqlStr, '', ',');
          FrmMain.InsStr(SqlStr, '', ',');
          FrmMain.InsStr(SqlStr, goodsfile.goodsdesc, '');
          if FrmMain.ExecSQL(sqlstr) then
          else
          begin
            ShowMessage('分单货物数据数据导入插入时出错,记录导入失败,请检查!');
            exit;
          end;
        end;
      end;
      {进舱派车通知}
      if ztrustfile.JCPCNumber > 0 then
      begin
        context := fileread(myfilehandle, jcpcfile, sizeof(jcpcfile));
        CodeGet := FrmMain.GetCode('Q');
        SqlStr := 'insert into landtrans(transcode,trustcode,goodshw,' +
          'carname,carrela,thdate,stationcode,' +
          'stationaddr,stationrelation,stationtele,jcno,jcdate,' +
          'jctime,ccdate,cctime,goodsplace,' +
          'goodsrelationstyle,goodsrelation,dodate,jcpc,benative,remark) values(';
        FrmMain.InsStr(sqlstr, CodeGet, ',');
        FrmMain.InsStr(sqlstr, varhawb, ',');
        FrmMain.InsStr(sqlstr, jcpcfile.goodshw, ',');
        FrmMain.InsStr(sqlstr, jcpcfile.carname, ',');
        FrmMain.InsStr(sqlstr, jcpcfile.carrela, ',');
        FrmMain.InsStr(sqlstr, jcpcfile.thdate, ',');
        FrmMain.InsStr(sqlstr, jcpcfile.station, ',');
        FrmMain.InsStr(sqlstr, jcpcfile.stationaddr, ',');
        FrmMain.InsStr(sqlstr, jcpcfile.stationrela, ',');
        FrmMain.InsStr(sqlstr, jcpcfile.stationstyle, ',');
        FrmMain.InsStr(sqlstr, jcpcfile.jcno, ',');
        FrmMain.InsStr(sqlstr, jcpcfile.jcdate, ',');
        FrmMain.InsStr(sqlstr, jcpcfile.jctime, ',');
        FrmMain.InsStr(sqlstr, jcpcfile.ccdate, ',');
        FrmMain.InsStr(sqlstr, jcpcfile.cctime, ',');
        FrmMain.InsStr(sqlstr, jcpcfile.goodsplace, ',');
        FrmMain.InsStr(sqlstr, jcpcfile.goodsrelastyle, ',');
        FrmMain.InsStr(sqlstr, jcpcfile.goodsrela, ',');
        FrmMain.InsStr(sqlstr, jcpcfile.recorddate, ',');
        FrmMain.InsStr(sqlstr, jcpcfile.ifpc, ',');
        FrmMain.InsStr(sqlstr, jcpcfile.ifnative, ',');

        FrmMain.InsStr(sqlstr, jcpcfile.remark, '');
        if FrmMain.ExecSQL(sqlstr) then
        else
        begin
          ShowMessage('分单进舱派车数据导入插入时出错,记录导入失败,请检查!');
          exit;
        end;
      end;

      {报关文件}
      if ztrustfile.bgnumber > 0 then
      begin
        for i := 1 to ztrustfile.bgnumber do
        begin
          context := fileread(myfilehandle, bgfile, sizeof(bgfile));
          codeget := FrmMain.GetCode('K');
          sqlstr := 'insert into truckfile(kcode,trustcode,fileno,mawb,cuscode,'
            +
            'ciqname,filename,filenameno,recedate,returndate,ciqrecedate,ciqreturndate,' +
            'occurtime,PlaneOcean,operator,remark) values(';
          FrmMain.InsStr(sqlstr, codeget, ',');
          FrmMain.InsStr(sqlstr, varhawb, ',');
          FrmMain.InsStr(sqlstr, bgfile.fileno, ',');
          FrmMain.InsStr(sqlstr, bgfile.mawb, ',');
          FrmMain.InsStr(sqlstr, bgfile.jyname, ',');
          FrmMain.InsStr(sqlstr, bgfile.bghname, ',');
          FrmMain.InsStr(sqlstr, bgfile.filename, ',');
          FrmMain.InsStr(sqlstr, bgfile.filenameno, ',');
          FrmMain.InsStr(sqlstr, bgfile.cusrecedate, ',');
          FrmMain.InsStr(sqlstr, bgfile.cusretudate, ',');
          FrmMain.InsStr(sqlstr, bgfile.ciqrecedate, ',');
          FrmMain.InsStr(sqlstr, bgfile.ciqretudate, ',');
          FrmMain.InsStr(sqlstr, bgfile.recorddate, ',');
          FrmMain.InsStr(sqlstr, 0, ',');
          FrmMain.InsStr(sqlstr, bgfile.opercode, ',');
          FrmMain.InsStr(sqlstr, bgfile.remark, '');
          if FrmMain.ExecSQL(SqlStr) then
          else
          begin
            ShowMessage('分单报关文件数据导入插入时出错,记录导入失败,请检查!');
            exit;
          end;
        end;
      end;

      {费用记录}
      if ztrustfile.farenumber > 0 then
      begin
        for i := 1 to ztrustfile.farenumber do
        begin
          context := fileread(myfilehandle, farefile, sizeof(farefile));
          codeget := FrmMain.GetCode('F');
          SqlStr := 'insert into FareInfo(Fareno,Filecode,cuscode,cuscodename,'
            +
            'Farecode,Farepaytodate,Billno,invoiceno,bxno,operator,Acount,FareType,' +
            'Writedate,currencytype,currencyrate,recedeal,' +
            'goodscode,unitprice,opercwmark,Remark) values (';
          FrmMain.InsStr(sqlstr, codeget, ',');
          FrmMain.InsStr(sqlstr, varhawb, ',');
          FrmMain.InsStr(sqlstr, farefile.cuscode, ',');
          FrmMain.InsStr(sqlstr, farefile.cuscodename, ',');
          FrmMain.InsStr(sqlstr, farefile.farename, ',');
          FrmMain.InsStr(sqlstr, farefile.paytodate, ',');
          FrmMain.InsStr(sqlstr, farefile.billno, ',');
          FrmMain.InsStr(sqlstr, farefile.invoiceno, ',');
          FrmMain.InsStr(sqlstr, '', ',');
          FrmMain.InsStr(sqlstr, farefile.opercode, ',');
          FrmMain.InsStr(sqlstr, farefile.fareacount, ',');
          FrmMain.InsStr(sqlstr, farefile.faretype, ',');
          FrmMain.InsStr(sqlstr, farefile.recorddate, ',');
          FrmMain.InsStr(sqlstr, farefile.currencytype, ',');
          FrmMain.InsStr(sqlstr, farefile.rate, ',');
          FrmMain.InsStr(sqlstr, farefile.recedeal, ',');
          FrmMain.InsStr(sqlstr, farefile.farefl, ',');
          FrmMain.InsStr(sqlstr, farefile.unitprice, ',');
          FrmMain.InsStr(sqlstr, farefile.opercwmark, ',');
          FrmMain.InsStr(sqlstr, '', '');
          if FrmMain.ExecSQL(SqlStr) then
          else
          begin
            ShowMessage('分单费用数据导入插入时出错,记录导入失败,请检查!');
            exit;
          end;
        end;
      end;
    end;
    ShowMessage('导入文件成功,请检查!');
    Fileclose(myfilehandle);
  except
    Fileclose(myfilehandle);
    ShowMessage('导入文件失败,请检查!');
  end;
end;

function TFrmAllImportBillInfo.UpdateRecord(FileName, VarCode: string): Boolean;
var
  ZTrustFile: TZtrustFile;
  GoodsFile: TGoods;
  JCPCFile: Tjcpc;
  BGFile: TBG;
  FareFile: TFare;
  MyFileHandle: Integer;
  context: integer;
  SqlStr: string;
  CodeGet: string;
  ValueArray: array[0..20] of string;
  ArrayCount: integer;
  I, j: Integer;
  HawbNumber: Integer;
  VarMain: string;
  VarHawb: string;
  RelaCode: string;
begin
  inherited;
  try
    MyFilehandle := FileOpen(Filename, fmOpenRead);
    if myfilehandle > 0 then
    else
    begin
      ShowMessage('创建文件失败,请检查!');
      exit;
    end;
    {读取主单记录}
    context := fileread(myfilehandle, ztrustfile, sizeof(ztrustfile));
    SqlStr := '';
    FrmMain.UpStr(sqlstr, 'filetable ');
    {Maincode}
    FrmMain.UpStr(sqlstr, 'maincode', Ztrustfile.mawb, ',');
    {hawb}
    FrmMain.UpStr(sqlstr, 'hawb', Ztrustfile.hawb, ',');
    {FileNo}
    FrmMain.UpStr(sqlstr, 'FileNo', Ztrustfile.fileno, ',');
    {trusttype}
    FrmMain.UpStr(sqlstr, 'TrustType', Ztrustfile.trusttype, ',');
    {trustsource}
    FrmMain.UpStr(sqlstr, 'TrustSource', Ztrustfile.trustsource, ',');
    {quotecode}
    if Ztrustfile.jjcode = '' then
      FrmMain.UpStr(sqlstr, 'QuoteCode', 'null', ',')
    else
      FrmMain.UpStr(sqlstr, 'QuoteCode', Ztrustfile.jjcode, ',');
    {djnumber}
    FrmMain.UpStr(sqlstr, 'DjNumber', Ztrustfile.djnumber, ',');
    {kjkm}
    FrmMain.UpStr(sqlstr, 'kjkm', Ztrustfile.kjkm, ',');
    {zcdjnumber}
    FrmMain.UpStr(sqlstr, 'zcdjnumber', Ztrustfile.zcdjnumber, ',');
    {zckjkm}
    FrmMain.UpStr(sqlstr, 'zckjkm', Ztrustfile.zckjkm, ',');

    {cuscode}
    if Ztrustfile.cuscode = '' then
      FrmMain.UpStr(sqlstr, 'CusCode', 'null', ',')
    else
      FrmMain.UpStr(sqlstr, 'cuscode', Ztrustfile.cuscode, ',');
    {发货人名称}
    FrmMain.UpStr(sqlstr, 'cuscodename', Ztrustfile.cuscodename, ',');
    {收货人}
    FrmMain.UpStr(sqlstr, 'ShouHuoren', Ztrustfile.consigncode, ',');
    {收货人名称}
    FrmMain.UpStr(sqlstr, 'Consignname', Ztrustfile.consignname, ',');
    {代理商}
    FrmMain.UpStr(sqlstr, 'agentcode', Ztrustfile.agentcode, ',');
    {Shipper}
    FrmMain.UpStr(sqlstr, 'Shipper', Ztrustfile.shipper, ',');
    {Consignee}
    FrmMain.UpStr(sqlstr, 'Consignee', Ztrustfile.consignee, ',');
    {Agent 通知方}
    FrmMain.UpStr(sqlstr, 'agent', Ztrustfile.inform, ',');

    {cuscompany运费对象}
    FrmMain.UpStr(sqlstr, 'cuscompany', '', ',');
    {Reciplace  收货地}
    FrmMain.UpStr(sqlstr, 'reciplace', Ztrustfile.receport, ',');
    {AirPort 装货港}
    FrmMain.UpStr(sqlstr, 'airport', Ztrustfile.loadport, ',');
    {AirPortTo 卸货港}
    FrmMain.UpStr(sqlstr, 'airportto', Ztrustfile.unloadport, ',');
    {destination 目的地}
    FrmMain.UpStr(sqlstr, 'destination', Ztrustfile.dest, ',');

    {Carrier 航空公司}
    FrmMain.UpStr(sqlstr, 'carrier', Ztrustfile.shipcomcode, ',');
    {一乘航班,经停,出运日期}

    FrmMain.UpStr(sqlstr, 'by1', Ztrustfile.ycvoyage, ',');
    FrmMain.UpStr(sqlstr, 'to1', Ztrustfile.ycport, ',');
    FrmMain.UpStr(sqlstr, 'fdate', Ztrustfile.ycvoyagedate, ',');
    FrmMain.UpStr(sqlstr, 'dfdate', Ztrustfile.ycvoyagedate, ',');
    FrmMain.UpStr(sqlstr, 'fdate1', Ztrustfile.ycvoyagedate, ',');
    {二乘航班,经停,出运日期}
    FrmMain.UpStr(sqlstr, 'by2', Ztrustfile.ecvoyage, ',');
    FrmMain.UpStr(sqlstr, 'to2', Ztrustfile.ecport, ',');
    FrmMain.UpStr(sqlstr, 'fdate2', Ztrustfile.ecvoyagedate, ',');
    {三乘航班,经停,出运日期}
    FrmMain.UpStr(sqlstr, 'by3', Ztrustfile.scvoyage, ',');
    FrmMain.UpStr(sqlstr, 'to3', Ztrustfile.scport, ',');
    FrmMain.UpStr(sqlstr, 'fdate3', Ztrustfile.scvoyagedate, ',');

    {Accinfo  麦头}
    FrmMain.UpStr(sqlstr, 'accinfo', Ztrustfile.maitou, ',');
    {Handing}
    FrmMain.UpStr(sqlstr, 'handling', Ztrustfile.hi, ',');
    {Curr}
    FrmMain.UpStr(sqlstr, 'curr', Ztrustfile.currency, ',');
    {CHGS}
    FrmMain.UpStr(sqlstr, 'chgs', Ztrustfile.chgs, ',');
    {PPD}
    FrmMain.UpStr(sqlstr, 'ppd', Ztrustfile.ppd, ',');
    {COLL}
    FrmMain.UpStr(sqlstr, 'coll', Ztrustfile.coll, ',');
    {OPPD}
    FrmMain.UpStr(sqlstr, 'oppd', Ztrustfile.oppd, ',');
    {OCOLL}
    FrmMain.UpStr(sqlstr, 'ocoll', Ztrustfile.ocoll, ',');
    {DCV}
    FrmMain.UpStr(sqlstr, 'dvc', Ztrustfile.dvc, ',');
    {DVCus}
    FrmMain.UpStr(sqlstr, 'dvcus', Ztrustfile.odvc, ',');
    {accinsurance}

    FrmMain.UpStr(sqlstr, 'AccInsurance', Ztrustfile.ai, ',');
    {A.i.c.}
    FrmMain.UpStr(sqlstr, 'aic', Ztrustfile.aic, ',');
    {签定日期}
    FrmMain.UpStr(sqlstr, 'execdate', Ztrustfile.billdate, ',');
    FrmMain.UpStr(sqlstr, 'dexecdate', Ztrustfile.billdate, ',');
    {签定地点}
    FrmMain.UpStr(sqlstr, 'execplace', Ztrustfile.billplace, ',');

    {业务员}
    FrmMain.UpStr(sqlstr, 'bussiness', Ztrustfile.bussiness, ',');
    {Befinish 是否完成标记}
    FrmMain.UpStr(sqlstr, 'befinish', Ztrustfile.finish, ',');

    FrmMain.UpStr(sqlstr, 'keydown', Ztrustfile.keydown, ',');
    FrmMain.UpStr(sqlstr, 'ifdiscard', Ztrustfile.discard, ',');
    FrmMain.UpStr(sqlstr, 'ifzhidan', Ztrustfile.zhidan, ',');
    {进出口标记 出口为1}
    FrmMain.UpStr(sqlstr, 'inout', 0, ',');

    {修改操作人}
    FrmMain.UpStr(sqlstr, 'modioper', Ztrustfile.ModiOper, ',');
    {操作人}
    FrmMain.UpStr(sqlstr, 'operate', Ztrustfile.opercode, '');
    FrmMain.UpStr(sqlstr, 'FileCode=', ZtrustFile.Relacode, 'w');
    if FrmMain.execsql(sqlstr) then
    else
    begin
      ShowMessage('主单数据更新时出错,记录导入失败,请检查!');
      exit;
    end;
    Varmain := ZtrustFile.relacode;
    RelaCode := ZTrustFile.relacode;
    FrmMain.ExecSQL(pchar('delete from planegoods where filecode=''' + VarMain +
      ''''));
    {保存货物记录}
    if ztrustfile.GoodsNumber > 0 then
    begin
      for i := 1 to ztrustfile.goodsnumber do
      begin
        context := fileread(myfilehandle, goodsfile, sizeof(goodsfile));
        codeget := FrmMain.GetCode('B');
        {件数  单位  体积  等级  公式  }
        {计费重量  单价  费用  货物描述  编号 编号  C.M.I  一个 }
        SqlStr := 'Insert into PlaneGoods(GoodsCode,FileCode,Pieces,weight,' +
          'kgid,Size,rateclass,Formula,chargweight,rate,' +
          'total,SpeGoods,SpeRemark,goods) Values(';
        FrmMain.InsStr(SqlStr, codeget, ',');
        FrmMain.InsStr(SqlStr, VarMain, ',');

⌨️ 快捷键说明

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