代码变更清单 - 20260802_2200

文件 1: BlueWhaleERPSources\AJS\BlueWhale_Std_AJS_INVTransferJournalC\INVTransferJournalClass.pas

类字段新增

FBillType: string;     // 2026-08-02 单别类型过滤(BW_INVLA.LA006)

类方法声明新增

procedure MarkINVLAAsTransferred(LA006, LA007, LA008: string);  // 2026-08-02
procedure SetQueryParams(AStartDate, AEndDate: string; AOnlyAudited: Boolean;
                         ABillType: string = '');  // 2026-08-02
property BillType: string read FBillType write FBillType;  // 2026-08-02

构造函数修改

// line 78 新增
FBillType := '';     // 2026-08-02 单别类型过滤

BuildQuerySQL 整体重写

新增方法实现

procedure TINVTransferJournal.MarkINVLAAsTransferred(LA006, LA007, LA008: string);
var
  strSQL: string;
begin
  { 2026-08-02 标记 BW_INVLA.LA025='Y',表示该单据已抛转分录,不可再抛转 }
  try
    strSQL := Format('UPDATE BW_INVLA SET LA025=''Y'' ' +
      ' WHERE LA006=''%s'' AND LA007=''%s'' AND LA008=''%s''',
      [LA006, LA007, LA008]);
    if Self.ExecSQL(strSQL, False) = False then
      Self.WriteLog(Format('标记单据[%s/%s]已抛转分录(LA025)失败!',
        [LA007, LA008]), False);
  except
    on E: Exception do
      Self.WriteLog('标记LA025失败: ' + E.Message, False);
  end;
end;

SetQueryParams 修改

procedure TINVTransferJournal.SetQueryParams(AStartDate, AEndDate: string;
  AOnlyAudited: Boolean; ABillType: string = '');
begin
  FStartDate := AStartDate;
  FEndDate := AEndDate;
  FOnlyAudited := AOnlyAudited;
  FBillType := ABillType;     // 2026-08-02 单别类型过滤
end;

ExecuteTransfer 修改

在 try block 末尾追加:

// 2026-08-02 标记 BW_INVLA.LA025='Y',不可再抛转
MarkINVLAAsTransferred(
  DataSet.FieldByName('LA006').AsString,
  DataSet.FieldByName('LA007').AsString,
  DataSet.FieldByName('LA008').AsString);

CancelTransfer 修改

---

文件 2: BlueWhaleERPSources\AJS\BlueWhale_Std_AJS_INVTransferJournalC\INVTransferJournalFrm.pas

字段声明新增

ViewMasterBillTypeName: TcxGridDBBandedColumn;  // 2026-08-02 单别名称
ViewMasterLA025: TcxGridDBBandedColumn;          // 2026-08-02 是否设置分录性质
ViewMasterAJSMBExists: TcxGridDBBandedColumn;    // 2026-08-02 AJSMB存在标志
edtBillType: TcxComboBox;       // 2026-08-02 单别类型过滤
lblBillType: TcxLabel;          // 2026-08-02 单别类型标签

DoInitWindow 修改

新增单别类型下拉框加载逻辑(从 BW_CMSMQ WHERE MQ026='3' 加载 MQ001 + MQ002):

edtBillType.Properties.Items.Clear;
edtBillType.Properties.Items.Add('全部');
edtBillType.ItemIndex := 0;
strSQL := 'SELECT MQ001, MQ002 FROM BW_CMSMQ WHERE MQ026=''3'' ORDER BY MQ001';
varData := INVTransferJournal.GetDataPack(strSQL);
if not VarIsEmpty(varData) then
begin
  dsBillType := TClientDataSet.Create(Self);
  try
    dsBillType.Data := varData;
    while not dsBillType.Eof do
    begin
      edtBillType.Properties.Items.Add(
        dsBillType.FieldByName('MQ001').AsString + ' - ' +
        dsBillType.FieldByName('MQ002').AsString);
      dsBillType.Next;
    end;
  finally
    dsBillType.Free;
  end;
end;

btnQueryClick 修改

strBillType := '';
if Assigned(edtBillType) and (edtBillType.Text <> '') and
   (edtBillType.Text <> '全部') then
  strBillType := Trim(edtBillType.Text);

INVTransferJournal.SetQueryParams(
  FormatDateTime('yyyymmdd', edtStartDate.Date),
  FormatDateTime('yyyymmdd', edtEndDate.Date),
  chkOnlyAudited.Checked,
  strBillType);

---

文件 3: BlueWhaleERPSources\AJS\BlueWhale_Std_AJS_INVTransferJournalC\INVTransferJournalFrm.dfm

pnlQuery 新增控件

object lblBillType: TcxLabel
  Left = 540
  Top = 14
  Caption = '单别类型'
  TabOrder = 5
  Transparent = True
end
object edtBillType: TcxComboBox
  Left = 596
  Top = 12
  Width = 180
  Height = 21
  TabOrder = 6
  Properties.DropDownListStyle = lsEditFixedList
end

按钮 Left 调整

按钮旧 Left新 Left
btnQuery560788
btnTransfer648876
btnCancelTransfer760988

Grid 列新增

object ViewMasterBillTypeName: TcxGridDBBandedColumn
  Caption = '单别名称'
  DataBinding.FieldName = 'BillTypeName'
  Width = 120
  Position.BandIndex = 0
  Position.ColIndex = 2
end

object ViewMasterLA025: TcxGridDBBandedColumn
  Caption = '是否设置分录性质'
  DataBinding.FieldName = 'LA025'
  Width = 80
  Position.BandIndex = 1
  Position.ColIndex = 14
end

Grid 列 ColIndex 调整(因 BillTypeName 插入)

列旧 ColIndex新 ColIndex
ViewMasterLA00723
ViewMasterLA00834
ViewMasterLA00156
ViewMasterLA00567
ViewMasterLA01478
ViewMasterLA00989
ViewMasterLA011910
ViewMasterLA0151011
ViewMasterLA0231112
ViewMasterLA0241213

Band 1 内 ColIndex 0-4 保持不变(成本/材料/人工/制费/加工 金额列)

---

数据库脚本

参考同目录文件 02_ADD_INVLA_LA025.sql:

  1. ALTER TABLE BW_INVLA ADD LA025
  2. UPDATE BW_INVLA SET LA025='Y' WHERE 已抛转