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

📄 updbommc.pas

📁 拥有全套神州数码马易飞ERP源码,现上传部分源码
💻 PAS
字号:
unit updBOMMC;

interface

uses sysUtils, dbtables, Bde, updBase;

type
  TUpdateBOMMC = class(TBaseUpdateUnit)
  private
    function update_byBOMI04(xSource: Variant): Boolean;
  public
    function update(xSource: Variant; xAction: string;
       var xMsg: variant; xOtherVar: variant; xUserData: variant): Boolean;
  end;

implementation

function TUpdateBOMMC.update(xSource: Variant; xAction: string;
           var xMsg: variant; xOtherVar: variant; xUserData: variant): Boolean;
begin
  Result := True;
  self.saveVar(xAction, xOtherVar, xUserData);
  try
    self.setDBname(xSource[0]);
    if compareText(self.SourceTxnCode, 'TXNBOMI04') = 0 then
      Result := update_byBOMI04(xSource);
  finally
    self.Query1.close;
  end;
  xMsg := self.Msg;
end;

function TUpdateBOMMC.update_byBOMI04(xSource: Variant): Boolean;
var
  mExist: Boolean;
begin
  Result := True;
  self.Msg[0] := 'skip';
  self.Msg[1] := 'BOMMC';
  self.Msg[2] := xSource[8]+' '+xSource[9]+' '+xSource[10];

  try
    with self.Query1 do
    begin
      if not Prepared then
      begin
        close;
        SQL.clear;
        RequestLive := False;
        SQL.add('Select * from $$BOMMC where MC001=:MC001 ');
        ParamByName('MC001').asString := xSource[2];
        open;
        first;
        mExist := not eof;
        if mExist then
        begin
          self.OldFlag := FieldByName('FLAG').asInteger;
          self.NewFlag := self.OldFlag + 1;
          if self.NewFlag > C_MAXFLAG then self.NewFlag := 1;

          close;
          SQL.clear;
          RequestLive := False;
          SQL.add('update $$BOMMC set MC001=:MC001b,MC002=:MC002,MC003=:MC003,MC004=:MC004,MC005=:MC005, ');
          if self.Action = 'A' then
            SQL.add(' MC006=:MC006,MC007=:MC007,MC008=:MC008,MC009=:MC009,MODI_DATE=:MODI_DATE,FLAG=:FLAG ')
          else
            SQL.add(' MC006=:MC006,MC007=:MC007,MC008=:MC008,MC009=:MC009,FLAG=:FLAG ');
          SQL.add(' where MC001=:MC001a ');
          ParamByName('MC001a').asString := xSource[2];
          ParamByName('MC001b').asString := xSource[3];
          ParamByName('MC002').asString  := xSource[4];
          ParamByName('MC003').asString  := xSource[5];
          ParamByName('MC004').asFloat   := xSource[6];
          ParamByName('MC005').asString  := xSource[7];
          ParamByName('MC006').asString  := xSource[8];
          ParamByName('MC007').asString  := xSource[9];
          ParamByName('MC008').asString  := xSource[10];
          ParamByName('MC009').asString  := xSource[11];
          if self.Action = 'A' then
            ParamByName('MODI_DATE').asString := xSource[1];
          ParamByName('FLAG').asInteger   := self.NewFlag;
          try
            TransSqlCommand(Query1);
            ExecSQL;
          except
            on E: EDBEngineError do
            begin
              if E.Errors[0].ErrorCode <> DBIERR_KEYVIOL then raise;
            end;
          end;
        end;
      end;
    end; //end with query1
    self.Msg[0] := '';
  except
    on E: Exception do
    begin
      Result := False;
      self.Msg[0] := E.Message;
    end;
  end;
end;


end.

⌨️ 快捷键说明

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