?? tass00_01.pas.svn-base
字號:
unit TasS00_01;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, BAS100_01, Menus, StdCtrls, Buttons, ComCtrls, dxExEdtr,
dxCntner, dxTL, dxDBCtrl, dxDBGrid, DB, ADODB, dxDBTLCl, dxGrClms;
type
TTasS00_01Form = class(TBas100_01Form)
PageControl1: TPageControl;
bbtnOk: TBitBtn;
bbtnExit: TBitBtn;
TabSheet1: TTabSheet;
gbUnit: TGroupBox;
lblUnit: TLabel;
cbUnit: TComboBox;
edtDay: TEdit;
lblDay: TLabel;
edtWeek: TEdit;
lblWeek: TLabel;
edtMonth: TEdit;
lblMonth: TLabel;
cbChangeUnit: TCheckBox;
gbPriority: TGroupBox;
lblPriority: TLabel;
edtHight: TEdit;
edtLow: TEdit;
edtDefault: TEdit;
lblDefault: TLabel;
gbOther: TGroupBox;
cbDelete: TCheckBox;
cbStatus: TCheckBox;
TabSheet2: TTabSheet;
Label1: TLabel;
dxDBGrid1: TdxDBGrid;
dsTas120: TDataSource;
adsTas120: TADODataSet;
adsTas120FSel: TBooleanField;
adsTas120FNo: TIntegerField;
adsTas120FName: TStringField;
adsTas120FRemark: TStringField;
dxDBGrid1FSel: TdxDBGridCheckColumn;
dxDBGrid1FName: TdxDBGridMaskColumn;
dxDBGrid1FRemark: TdxDBGridMaskColumn;
qryQuery: TADOQuery;
lblByTotal: TLabel;
lblTotal: TLabel;
cbTotal: TComboBox;
lblByFinish: TLabel;
lblFinish: TLabel;
cbFinish: TComboBox;
cbUpdate: TCheckBox;
cbHours: TCheckBox;
cbItems: TCheckBox;
cbClass: TComboBox;
procedure FormCreate(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure bbtnOkClick(Sender: TObject);
procedure bbtnExitClick(Sender: TObject);
procedure edtDayKeyPress(Sender: TObject; var Key: Char);
procedure edtWeekKeyPress(Sender: TObject; var Key: Char);
procedure edtMonthKeyPress(Sender: TObject; var Key: Char);
procedure edtHightKeyPress(Sender: TObject; var Key: Char);
procedure edtLowKeyPress(Sender: TObject; var Key: Char);
procedure edtDefaultKeyPress(Sender: TObject; var Key: Char);
procedure dxDBGrid1KeyPress(Sender: TObject; var Key: Char);
procedure dxDBGrid1MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
private
procedure SetInterface;
{ Private declarations }
public
{ Public declarations }
end;
var
TasS00_01Form: TTasS00_01Form;
implementation
uses SYSDATA, CommFun;
{$R *.dfm}
procedure TTasS00_01Form.SetInterface;
var
S,ANo:String;
ABoolean:Boolean;
begin
Caption:=GetDBString('TASS0001001'); //任務管理參數
TabSheet1.Caption:=GetDBString('TASS0001002'); //參數設置
gbUnit.Caption:=GetDBString('TASS0001003'); //時間單位
gbPriority.Caption:=GetDBString('TASS0001004'); //優先級別
gbOther.Caption:=GetDBString('TASS0001005'); //其他參數
lblUnit.Caption:=GetDBString('TASS0001006'); //時間單位
lblDay.Caption:=GetDBString('TASS0001007'); //時為一天
lblWeek.Caption:=GetDBString('TASS0001008'); //天為一周
lblMonth.Caption:=GetDBString('TASS0001009'); //天為一月
cbChangeUnit.Caption:=GetDBString('TASS0001010'); //允許單據錄入時更改時間單位
lblPriority.Caption:=GetDBString('TASS0001011'); //優先級別
lblDefault.Caption:=GetDBString('TASS0001012'); //優先級缺省值
cbDelete.Caption:=GetDBString('TASS0001013'); //允許刪除狀態為完成的任務計劃下的任務匯報單
bbtnOk.Caption:=GetDBString('TASS0001014'); //確定(&O)
bbtnExit.Caption:=GetDBString('TASS0001015'); //退出(&X)
lblByTotal.Caption:=GetDBString('TASS0001016'); //按照
lblByFinish.Caption:=lblByTotal.Caption; //按照
lblTotal.Caption:=GetDBString('TASS0001017'); //統計任務計劃的總數量
lblFinish.Caption:=GetDBString('TASS0001018'); //統計任務計劃的完成數量
cbTotal.Clear;
cbTotal.Items.Add(GetDBString('TASS0001019')); //申報日期
cbTotal.Items.Add(GetDBString('TASS0001020')); //需求日期
cbTotal.Items.Add(GetDBString('TASS0001021')); //預計開始日期
cbTotal.Items.Add(GetDBString('TASS0001022')); //預計完成日期
cbTotal.Items.Add(GetDBString('TASS0001023')); //實際開始日期
cbTotal.Items.Add(GetDBString('TASS0001024')); //實際完成日期
cbTotal.ItemIndex:=0;
cbUpdate.Caption:=GetDBString('TASS0001025'); //任務完成時,反寫客戶資料的產品信息(安裝日期、保養日期)
cbHours.Caption:=GetDBString('TASS0001026'); //任務匯報時,是否錄入詳細的工時信息
cbItems.Caption:=GetDBString('TASS0001027'); //任務匯報時,是否錄入詳細的零件信息
cbFinish.Clear;
cbFinish.Items:=cbTotal.Items;
cbFinish.ItemIndex:=5;
S:=GetSysParams('TAS0001');//時間單位 0=時,1=天,2=周,3=月
if S<>'' then cbUnit.ItemIndex:=StrToInt(S);
S:=GetSysParams('TAS0002'); //8時為一天
if S<>'' then edtDay.Text:=S;
S:=GetSysParams('TAS0003'); //5天為一周
if S<>'' then edtWeek.Text:=S;
S:=GetSysParams('TAS0004'); //22天為一月
if S<>'' then edtMonth.Text:=S;
S:=GetSysParams('TAS0005'); //允許單據錄入時更改時間單位
if S<>'' then cbChangeUnit.Checked:=S='Y';
S:=GetSysParams('TAS0006'); //最高優先級別
if S<>'' then edtHight.Text:=S;
S:=GetSysParams('TAS0007'); //最低優先級別
if S<>'' then edtLow.Text:=S;
S:=GetSysParams('TAS0008'); //優先級缺省值
if S<>'' then edtDefault.Text:=S;
S:=GetSysParams('TAS0009'); //允許刪除狀態為完成的任務計劃下的任務匯報單
if S<>'' then cbDelete.Checked:=S='Y';
S:=GetSysParams('TAS0010'); //使用顏色標明任務的狀態。如:計劃=黑色,執行=藍色,完成=灰色,返工=紅色
if S<>'' then cbStatus.Checked:=S='Y';
//完成數量統計中包含下列狀態
S:=GetSysParams('TAS0011'); //完成數量統計中包含下列狀態
if S='' then S:='[3]';
adsTas120.Close;
adsTas120.FieldDefs.Clear;
adsTas120.FieldDefs.Add('FSel',ftBoolean,0);
adsTas120.FieldDefs.Add('FNo',ftInteger,0);
adsTas120.FieldDefs.Add('FName',ftString,50);
adsTas120.FieldDefs.Add('FRemark',ftString,100);
adsTas120.CreateDataSet;
qryQuery.Close;
qryQuery.SQL.Clear;
qryQuery.SQL.Add('select * from TAS120 order by T120_002');
qryQuery.Open;
while not qryQuery.Eof do
begin
ANo:='['+qryQuery.FieldByName('T120_001').AsString+']';
if Pos(ANo,S)<>0 then ABoolean:=True else ABoolean:=False;
adsTas120.Append;
adsTas120.FieldByName('FSel').Value:=ABoolean;
adsTas120.FieldByName('FNo').Value:=qryQuery.FieldByName('T120_001').Value;
adsTas120.FieldByName('FName').Value:=qryQuery.FieldByName('T120_003').Value;
adsTas120.FieldByName('FRemark').Value:=qryQuery.FieldByName('T120_004').Value;
adsTas120.Post;
qryQuery.Next;
end;
//按照"申報日期"統計任務計劃的總數量
S:=GetSysParams('TAS0012'); //按照"申報日期"統計任務計劃的總數量
if S='' then S:='0';
cbTotal.ItemIndex:=StrToInt(S); //申報日期
//按照"實際完成日期"統計任務計劃的完成數量
S:=GetSysParams('TAS0013'); //按照"實際完成日期"統計任務計劃的完成數量
if S='' then S:='5';
cbFinish.ItemIndex:=StrToInt(S); //實際完成日期
S:=GetSysParams('TAS0014'); //任務完成時,反寫客戶資料的產品信息(安裝日期、保養日期)
if S<>'' then cbUpdate.Checked:=S='Y';
S:=GetSysParams('TAS0015'); //任務匯報時,是否錄入詳細的工時信息
if S<>'' then cbHours.Checked:=S='Y';
S:=GetSysParams('TAS0016'); //任務匯報時,是否錄入詳細的零件信息
if S<>'' then cbItems.Checked:=S='Y';
cbClass.Clear;
qryQuery.Close;
qryQuery.SQL.Clear;
qryQuery.SQL.Add('select T100_001,T100_002 from TAS100 where T100_005<>0');
qryQuery.Open;
while not qryQuery.Eof do
begin
cbClass.Items.Add(qryQuery.FieldByName('T100_002').AsString);
qryQuery.Next;
end;
S:=GetSysParams('TAS0017'); //反寫客戶資料的產品信息(安裝日期、保養日期)的任務類別
if S='' then S:='-1';
if qryQuery.Locate('T100_001',StrToInt(S),[]) then
S:=qryQuery.FieldByName('T100_002').AsString
else
S:='';
cbClass.ItemIndex:=cbClass.Items.IndexOf(S);
end;
procedure TTasS00_01Form.FormCreate(Sender: TObject);
begin
inherited;
SetInterface;
PageControl1.ActivePageIndex:=0;
end;
procedure TTasS00_01Form.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
inherited;
qryQuery.Close;
adsTas120.Close;
end;
procedure TTasS00_01Form.bbtnOkClick(Sender: TObject);
var
S,ANo:string;
begin
inherited;
//確定(&O)
Screen.Cursor:=crHourGlass;
//時間單位 0=時,1=天,2=周,3=月
SetSysParams('TAS0001',IntToStr(cbUnit.ItemIndex));
//8時為一天
SetSysParams('TAS0002',edtDay.Text);
//5天為一周
SetSysParams('TAS0003',edtWeek.Text);
//22天為一月
SetSysParams('TAS0004',edtMonth.Text);
//允許單據錄入時更改時間單位
if cbChangeUnit.Checked then SetSysParams('TAS0005','Y') else SetSysParams('TAS0005','N');
//最高優先級別
SetSysParams('TAS0006',edtHight.Text);
//最低優先級別
SetSysParams('TAS0007',edtLow.Text);
//優先級缺省值
SetSysParams('TAS0008',edtDefault.Text);
//允許刪除狀態為完成的任務計劃下的任務匯報單
if cbDelete.Checked then SetSysParams('TAS0009','Y') else SetSysParams('TAS0009','N');
//使用顏色標明任務的狀態。如:計劃=黑色,執行=藍色,完成=灰色,返工=紅色
if cbStatus.Checked then SetSysParams('TAS0010','Y') else SetSysParams('TAS0010','N');
//完成數量統計中包含下列狀態
S:='';
adsTas120.First;
while not adsTas120.Eof do
begin
if adsTas120.FieldByName('FSel').AsBoolean then
begin
ANo:='['+adsTas120.FieldByName('FNo').AsString+'],';
S:=S+ANo;
end;
adsTas120.Next;
end;
if S='' then S:='[3]' else Delete(S,Length(S),1); //刪除最后的,號
SetSysParams('TAS0011',S); //完成數量統計中包含下列狀態
//完成數量統計中包含下列狀態
AStatusNo:=GetSysParams('TAS0011');
if AStatusNo='' then AStatusNo:='[3]';
ReplaceString('[','',AStatusNo);
ReplaceString(']','',AStatusNo);
//按照"申報日期"統計任務計劃的總數量
SetSysParams('TAS0012',IntToStr(cbTotal.ItemIndex));
//按照"實際完成日期"統計任務計劃的完成數量
SetSysParams('TAS0013',IntToStr(cbFinish.ItemIndex));
case cbTotal.ItemIndex of
0:AByTotal:='T510_006'; //0=申報日期 T510_006
1:AByTotal:='T510_007'; //1=需求日期 T510_007
2:AByTotal:='T510_025'; //2=預計開始日期 T510_025
3:AByTotal:='T510_026'; //3=預計完成日期 T510_026
4:AByTotal:='T510_027'; //4=實際開始日期 T510_027
5:AByTotal:='T510_028'; //5=實際完成日期 T510_028
end;
case cbFinish.ItemIndex of
0:AByFinish:='T510_006'; //0=申報日期 T510_006
1:AByFinish:='T510_007'; //1=需求日期 T510_007
2:AByFinish:='T510_025'; //2=預計開始日期 T510_025
3:AByFinish:='T510_026'; //3=預計完成日期 T510_026
4:AByFinish:='T510_027'; //4=實際開始日期 T510_027
5:AByFinish:='T510_028'; //5=實際完成日期 T510_028
end;
//任務完成時,反寫客戶資料的產品信息(安裝日期、保養日期)
if cbUpdate.Checked then SetSysParams('TAS0014','Y') else SetSysParams('TAS0014','N');
//任務匯報時,是否錄入詳細的工時信息
if cbHours.Checked then SetSysParams('TAS0015','Y') else SetSysParams('TAS0015','N');
//任務匯報時,是否錄入詳細的零件信息
if cbItems.Checked then SetSysParams('TAS0016','Y') else SetSysParams('TAS0016','N');
//反寫客戶資料的產品信息(安裝日期、保養日期)的任務類別
qryQuery.Close;
qryQuery.SQL.Clear;
qryQuery.SQL.Add('select T100_001 from TAS100 where T100_002='+''''+cbClass.Text+'''');
qryQuery.Open;
S:=qryQuery.FieldByName('T100_001').AsString;
if S='' then S:='-1';
SetSysParams('TAS0017',S);
Screen.Cursor:=crDefault;
ShowMsg('UMS10000051'); //系統參數設置成功
Close;
end;
procedure TTasS00_01Form.bbtnExitClick(Sender: TObject);
begin
inherited;
//退出(&X)
Close;
end;
procedure TTasS00_01Form.edtDayKeyPress(Sender: TObject; var Key: Char);
begin
inherited;
ValidInteger(Sender,Key);
end;
procedure TTasS00_01Form.edtWeekKeyPress(Sender: TObject; var Key: Char);
begin
inherited;
ValidInteger(Sender,Key);
end;
procedure TTasS00_01Form.edtMonthKeyPress(Sender: TObject; var Key: Char);
begin
inherited;
ValidInteger(Sender,Key);
end;
procedure TTasS00_01Form.edtHightKeyPress(Sender: TObject; var Key: Char);
begin
inherited;
ValidInteger(Sender,Key);
end;
procedure TTasS00_01Form.edtLowKeyPress(Sender: TObject; var Key: Char);
begin
inherited;
ValidInteger(Sender,Key);
end;
procedure TTasS00_01Form.edtDefaultKeyPress(Sender: TObject;
var Key: Char);
begin
inherited;
ValidInteger(Sender,Key);
end;
procedure TTasS00_01Form.dxDBGrid1KeyPress(Sender: TObject; var Key: Char);
begin
inherited;
if Key=#32 then //vk_space
begin
adsTas120.Edit;
adsTas120.FieldByName('FSel').AsBoolean:=not adsTas120.FieldByName('FSel').AsBoolean;
adsTas120.Post;
end;
end;
procedure TTasS00_01Form.dxDBGrid1MouseUp(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
inherited;
if dxDBGrid1.GetColumnAt(X,Y)=nil then Exit;
if dxDBGrid1.GetColumnAt(X,Y).Field.FieldName='FSel' then
begin
adsTas120.Edit;
adsTas120.FieldByName('FSel').AsBoolean:=not adsTas120.FieldByName('FSel').AsBoolean;
adsTas120.Post;
end;
end;
initialization
RegisterClass(TTasS00_01Form);
finalization
UnRegisterClass(TTasS00_01Form);
end.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -