982 lines
25 KiB
ObjectPascal
982 lines
25 KiB
ObjectPascal
unit U_TatClothInfoInput;
|
||
|
||
interface
|
||
|
||
uses
|
||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||
Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData, cxDataStorage,
|
||
cxEdit, DB, cxDBData, ADODB, DBClient, cxGridLevel, cxGridCustomTableView,
|
||
cxGridTableView, cxGridDBTableView, cxClasses, cxControls, cxGridCustomView,
|
||
cxGrid, ComCtrls, ToolWin, cxGridCustomPopupMenu, cxGridPopupMenu, cxTextEdit,
|
||
cxButtonEdit, StdCtrls, ExtCtrls, cxCurrencyEdit, BtnEdit, U_BaseList,
|
||
cxLookAndFeels, cxLookAndFeelPainters, dxSkinsCore, dxSkinsDefaultPainters,
|
||
cxNavigator, dxDateRanges, dxBarBuiltInMenu, cxPC, dxScrollbarAnnotations,
|
||
cxCheckBox;
|
||
|
||
type
|
||
TfrmTatClothInfoInput = class(TForm)
|
||
ToolBar1: TToolBar;
|
||
ToolButton1: TToolButton;
|
||
TBClose: TToolButton;
|
||
ADOQueryCmd: TADOQuery;
|
||
ADOQueryTemp: TADOQuery;
|
||
ScrollBox1: TScrollBox;
|
||
Label1: TLabel;
|
||
Label5: TLabel;
|
||
Label15: TLabel;
|
||
Label22: TLabel;
|
||
Label2: TLabel;
|
||
Label4: TLabel;
|
||
Label3: TLabel;
|
||
C_Code: TEdit;
|
||
C_Name: TEdit;
|
||
C_YarnQty: TEdit;
|
||
C_FinishLatitudeDensity: TEdit;
|
||
C_Width: TBtnEditC;
|
||
C_GramWeight: TBtnEditC;
|
||
Label12: TLabel;
|
||
C_FinishLongitudeDensity: TEdit;
|
||
ToolButton6: TToolButton;
|
||
BCIID: TEdit;
|
||
Label6: TLabel;
|
||
Label7: TLabel;
|
||
Label8: TLabel;
|
||
C_LatitudeSpec: TEdit;
|
||
C_LongitudeSpec: TEdit;
|
||
C_ReedNo: TEdit;
|
||
Label9: TLabel;
|
||
C_Spec: TEdit;
|
||
CDS_1: TClientDataSet;
|
||
DS_1: TDataSource;
|
||
CDS_2: TClientDataSet;
|
||
DS_2: TDataSource;
|
||
Label10: TLabel;
|
||
C_MachLatitudeDensity: TEdit;
|
||
cxPageControl3: TcxPageControl;
|
||
cxTabSheet1: TcxTabSheet;
|
||
cxTabSheet2: TcxTabSheet;
|
||
Panel1: TPanel;
|
||
cxPageControl2: TcxPageControl;
|
||
cxGrid1: TcxGrid;
|
||
TV1: TcxGridDBTableView;
|
||
cxGridDBColumn3: TcxGridDBColumn;
|
||
cxGridDBColumn4: TcxGridDBColumn;
|
||
cxGridDBColumn5: TcxGridDBColumn;
|
||
cxGridDBColumn8: TcxGridDBColumn;
|
||
cxGridDBColumn7: TcxGridDBColumn;
|
||
TV1Column1: TcxGridDBColumn;
|
||
TV1Column2: TcxGridDBColumn;
|
||
cxGridLevel2: TcxGridLevel;
|
||
Panel3: TPanel;
|
||
Panel4: TPanel;
|
||
Label20: TLabel;
|
||
ToolBar2: TToolBar;
|
||
ToolButton2: TToolButton;
|
||
ToolButton3: TToolButton;
|
||
ToolButton5: TToolButton;
|
||
Panel2: TPanel;
|
||
cxPageControl1: TcxPageControl;
|
||
cxGrid2: TcxGrid;
|
||
Tv2: TcxGridDBTableView;
|
||
v2Column10: TcxGridDBColumn;
|
||
cxGridDBColumn1: TcxGridDBColumn;
|
||
v2Column2: TcxGridDBColumn;
|
||
v2Column5: TcxGridDBColumn;
|
||
v2Column6: TcxGridDBColumn;
|
||
Tv2Column1: TcxGridDBColumn;
|
||
Tv2Column2: TcxGridDBColumn;
|
||
cxGridLevel1: TcxGridLevel;
|
||
Panel5: TPanel;
|
||
Panel6: TPanel;
|
||
Label21: TLabel;
|
||
ToolBar3: TToolBar;
|
||
ToolButton4: TToolButton;
|
||
ToolButton7: TToolButton;
|
||
ToolButton8: TToolButton;
|
||
Panel7: TPanel;
|
||
Label35: TLabel;
|
||
Label34: TLabel;
|
||
Label36: TLabel;
|
||
Label37: TLabel;
|
||
Label38: TLabel;
|
||
Label39: TLabel;
|
||
Label40: TLabel;
|
||
Label41: TLabel;
|
||
Label42: TLabel;
|
||
Label44: TLabel;
|
||
Label45: TLabel;
|
||
Label46: TLabel;
|
||
Label48: TLabel;
|
||
Label49: TLabel;
|
||
Label50: TLabel;
|
||
Label51: TLabel;
|
||
Label52: TLabel;
|
||
Label53: TLabel;
|
||
Label54: TLabel;
|
||
Label55: TLabel;
|
||
Label57: TLabel;
|
||
Label58: TLabel;
|
||
Label59: TLabel;
|
||
Label60: TLabel;
|
||
Label61: TLabel;
|
||
Label62: TLabel;
|
||
Label63: TLabel;
|
||
Label64: TLabel;
|
||
Label65: TLabel;
|
||
Label66: TLabel;
|
||
Label67: TLabel;
|
||
Label68: TLabel;
|
||
Label69: TLabel;
|
||
Label70: TLabel;
|
||
Label71: TLabel;
|
||
Label72: TLabel;
|
||
WB_2: TEdit;
|
||
WB_1: TEdit;
|
||
WB_4: TEdit;
|
||
WB_3: TEdit;
|
||
WB_6: TEdit;
|
||
WB_5: TEdit;
|
||
WB_8: TEdit;
|
||
WB_7: TEdit;
|
||
WB_10: TEdit;
|
||
WB_9: TEdit;
|
||
WB_12: TEdit;
|
||
WB_11: TEdit;
|
||
WB_14: TEdit;
|
||
WB_13: TEdit;
|
||
WB_16: TEdit;
|
||
WB_15: TEdit;
|
||
WB_18: TEdit;
|
||
WB_17: TEdit;
|
||
WB_20: TEdit;
|
||
WB_19: TEdit;
|
||
WB_22: TEdit;
|
||
WB_21: TEdit;
|
||
WB_24: TEdit;
|
||
WB_23: TEdit;
|
||
WB_26: TEdit;
|
||
WB_25: TEdit;
|
||
WB_28: TEdit;
|
||
WB_27: TEdit;
|
||
WB_30: TEdit;
|
||
WB_29: TEdit;
|
||
WB_32: TEdit;
|
||
WB_31: TEdit;
|
||
WB_34: TEdit;
|
||
WB_33: TEdit;
|
||
WB_36: TEdit;
|
||
WB_35: TEdit;
|
||
WB_38: TEdit;
|
||
WB_37: TEdit;
|
||
WB_40: TEdit;
|
||
WB_39: TEdit;
|
||
WB_42: TEdit;
|
||
WB_41: TEdit;
|
||
WB_44: TEdit;
|
||
WB_43: TEdit;
|
||
WB_46: TEdit;
|
||
WB_45: TEdit;
|
||
WB_48: TEdit;
|
||
WB_47: TEdit;
|
||
WB_50: TEdit;
|
||
WB_49: TEdit;
|
||
WB_52: TEdit;
|
||
WB_51: TEdit;
|
||
WB_54: TEdit;
|
||
WB_53: TEdit;
|
||
WB_56: TEdit;
|
||
WB_55: TEdit;
|
||
WB_58: TEdit;
|
||
WB_57: TEdit;
|
||
WB_60: TEdit;
|
||
WB_59: TEdit;
|
||
WB_62: TEdit;
|
||
WB_61: TEdit;
|
||
WB_64: TEdit;
|
||
WB_63: TEdit;
|
||
WB_66: TEdit;
|
||
WB_65: TEdit;
|
||
WB_68: TEdit;
|
||
WB_67: TEdit;
|
||
WB_70: TEdit;
|
||
WB_69: TEdit;
|
||
WB_72: TEdit;
|
||
WB_71: TEdit;
|
||
cxTabSheet3: TcxTabSheet;
|
||
Panel8: TPanel;
|
||
Label73: TLabel;
|
||
Edit1: TEdit;
|
||
Button1: TButton;
|
||
cxGrid3: TcxGrid;
|
||
TV3: TcxGridDBTableView;
|
||
cxGridDBColumn2: TcxGridDBColumn;
|
||
cxGridDBColumn6: TcxGridDBColumn;
|
||
cxGridDBColumn9: TcxGridDBColumn;
|
||
cxGridLevel3: TcxGridLevel;
|
||
CDS_3: TClientDataSet;
|
||
DS_3: TDataSource;
|
||
procedure FormShow(Sender: TObject);
|
||
procedure TBCloseClick(Sender: TObject);
|
||
procedure ToolButton1Click(Sender: TObject);
|
||
procedure CYColorKeyPress(Sender: TObject; var Key: Char);
|
||
procedure CYKZExit(Sender: TObject);
|
||
procedure CYMFExit(Sender: TObject);
|
||
procedure FormCreate(Sender: TObject);
|
||
procedure CYJGGYBtnDnClick(Sender: TObject);
|
||
procedure C_WidthBtnDnClick(Sender: TObject);
|
||
procedure C_WidthBtnUpClick(Sender: TObject);
|
||
procedure ToolButton6Click(Sender: TObject);
|
||
procedure ToolButton2Click(Sender: TObject);
|
||
procedure ToolButton3Click(Sender: TObject);
|
||
procedure ToolButton7Click(Sender: TObject);
|
||
procedure ToolButton4Click(Sender: TObject);
|
||
procedure ToolButton5Click(Sender: TObject);
|
||
procedure ToolButton8Click(Sender: TObject);
|
||
procedure Edit1KeyPress(Sender: TObject; var Key: Char);
|
||
procedure Button1Click(Sender: TObject);
|
||
private
|
||
canshu1: string;
|
||
Fint: Integer;
|
||
procedure InitGrid();
|
||
function SaveData(): Boolean;
|
||
procedure CALCYarnQty();
|
||
{ Private declarations }
|
||
public
|
||
FBCIID, FCTID: string;
|
||
CopyInt: Integer;
|
||
|
||
{ Public declarations }
|
||
end;
|
||
|
||
var
|
||
frmTatClothInfoInput: TfrmTatClothInfoInput;
|
||
|
||
implementation
|
||
|
||
uses
|
||
U_DataLink, U_RTFun, U_iniParam, U_ZDYHelp, U_AttachmentUpload, U_YarnInfoSel;
|
||
|
||
{$R *.dfm}
|
||
procedure TfrmTatClothInfoInput.Button1Click(Sender: TObject);
|
||
begin
|
||
if CDS_3.IsEmpty then
|
||
exit;
|
||
if CDS_3.Locate('ssel', True, []) = False then
|
||
begin
|
||
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϻ<EFBFBD><CFBA><EFBFBD><EFBFBD>ݲ<EFBFBD><DDB2>ָܻ<DCBB><D6B8><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
||
Exit;
|
||
CDS_3.DisableControls;
|
||
with CDS_3 do
|
||
begin
|
||
First;
|
||
while not Eof do
|
||
begin
|
||
if CDS_3.FieldByName('SSel').AsBoolean = True then
|
||
begin
|
||
if Trim(CDS_3.fieldbyname('QZID').AsString) <> '' then
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('delete Bs_cloth_info_qz where QZID=''' + Trim(CDS_3.fieldbyname('QZID').AsString) + '''');
|
||
ExecSQL;
|
||
end;
|
||
CDS_3.Delete;
|
||
end
|
||
else
|
||
Next;
|
||
|
||
end;
|
||
|
||
end;
|
||
CDS_3.EnableControls;
|
||
end;
|
||
|
||
procedure TfrmTatClothInfoInput.CALCYarnQty();
|
||
var
|
||
MYarnQty, MOrdQty, MWidth, MMachLatitudeDensity: Double;
|
||
begin
|
||
MYarnQty := STRTOFLOATDEF(C_YarnQty.Text, 0);
|
||
MOrdQty := 10000;
|
||
MWidth := STRTOFLOATDEF(StringReplace(C_Width.Text, 'CM', '', [rfReplaceAll, rfIgnoreCase]), 0);
|
||
MMachLatitudeDensity := STRTOFLOATDEF(C_MachLatitudeDensity.Text, 0);
|
||
with CDS_1 do
|
||
begin
|
||
DisableControls;
|
||
First;
|
||
while not Eof do
|
||
begin
|
||
Edit;
|
||
FieldByName('Y_Qty').Value := MYarnQty * MOrdQty * FieldByName('Y_Ratio').AsFloat / 100 / 9000 * FieldByName('Denier').AsFloat / 1000;
|
||
Next;
|
||
end;
|
||
EnableControls;
|
||
end;
|
||
|
||
with CDS_2 do
|
||
begin
|
||
DisableControls;
|
||
First;
|
||
while not Eof do
|
||
begin
|
||
Edit;
|
||
FieldByName('Y_Qty').Value := MMachLatitudeDensity * MOrdQty * MWidth * FieldByName('Y_Ratio').AsFloat / 100 / 9000 * FieldByName('Denier').AsFloat / 1000;
|
||
Next;
|
||
end;
|
||
EnableControls;
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmTatClothInfoInput.InitGrid();
|
||
begin
|
||
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
SQL.Add('select * from BS_Cloth_Info where BCIID=''' + Trim(FBCIID) + '''');
|
||
Open;
|
||
end;
|
||
|
||
SCSHData(ADOQueryTemp, ScrollBox1, 2);
|
||
SCSHData(ADOQueryTemp, ScrollBox1, 0);
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
SQL.Add('select * from BS_Cloth_Info_WB where BCIID=''' + Trim(FBCIID) + '''');
|
||
Open;
|
||
end;
|
||
|
||
SCSHData(ADOQueryTemp, PANEL7, 2);
|
||
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select A.* from BS_Cloth_Yarn A ');
|
||
sql.Add(' where YRType=''<27><>˿'' and A.BCIID=''' + Trim(FBCIID) + '''');
|
||
Open;
|
||
end;
|
||
SCreateCDS(ADOQueryTemp, CDS_1);
|
||
SInitCDSData(ADOQueryTemp, CDS_1);
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select A.* from BS_Cloth_Yarn A ');
|
||
sql.Add(' where YRType=''γ˿'' and A.BCIID=''' + Trim(FBCIID) + '''');
|
||
Open;
|
||
end;
|
||
SCreateCDS(ADOQueryTemp, CDS_2);
|
||
SInitCDSData(ADOQueryTemp, CDS_2);
|
||
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select A.* from Bs_cloth_info_qz A ');
|
||
sql.Add(' where A.BCIID=''' + Trim(FBCIID) + '''');
|
||
Open;
|
||
end;
|
||
SCreateCDS(ADOQueryTemp, CDS_3);
|
||
SInitCDSData(ADOQueryTemp, CDS_3);
|
||
end;
|
||
|
||
procedure TfrmTatClothInfoInput.FormShow(Sender: TObject);
|
||
begin
|
||
InitGrid();
|
||
if CopyInt = 1 then
|
||
begin
|
||
FBCIID := '';
|
||
BCIID.text := '';
|
||
C_Code.text := '';
|
||
ClearCDSColumn(CDS_2, ['YRId', 'bciid']);
|
||
ClearCDSColumn(CDS_1, ['YRId', 'bciid']);
|
||
ClearCDSColumn(CDS_3, ['QZID', 'bciid']);
|
||
end;
|
||
// if C_Code.text = '' then
|
||
// begin
|
||
// with ADOQueryTemp do
|
||
// begin
|
||
// Close;
|
||
// sql.Clear;
|
||
// sql.Add(' exec P_YP_Get_CPBH ');
|
||
// sql.Add('@CTID=' + quotedstr(Trim(FCTID)));
|
||
//
|
||
// Open;
|
||
// end;
|
||
// end;
|
||
// if trim(C_Code.Text) = '' then
|
||
// begin
|
||
// with ADOQueryTemp do
|
||
// begin
|
||
// Close;
|
||
// sql.Clear;
|
||
// sql.Add(' exec P_YP_Get_No @Str=''CP'' ');
|
||
// Open;
|
||
// end;
|
||
// C_Code.Text := trim(ADOQueryTemp.FieldByName('NewC_Code').asstring);
|
||
// end;
|
||
|
||
// if FCPName = '<27><>֯' then
|
||
// begin
|
||
// CYPUnit.text := 'KG';
|
||
// end;
|
||
// if FCPName = '<27><>֯' then
|
||
// begin
|
||
// CYPUnit.text := 'M';
|
||
// end;
|
||
|
||
end;
|
||
|
||
procedure TfrmTatClothInfoInput.TBCloseClick(Sender: TObject);
|
||
begin
|
||
Close;
|
||
end;
|
||
|
||
function TfrmTatClothInfoInput.SaveData(): Boolean;
|
||
var
|
||
maxId, maxpbno, QZMAXNO: string;
|
||
begin
|
||
try
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
if Trim(FBCIID) = '' then
|
||
begin
|
||
if GetLSNo(ADOQueryCmd, maxId, 'Y', 'BS_Cloth_Info', 4, 1) = False then
|
||
begin
|
||
Result := False;
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
|
||
BCIID.Text := trim(maxId);
|
||
end
|
||
else
|
||
begin
|
||
maxId := Trim(FBCIID);
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('select * from BS_Cloth_Info where BCIID=''' + Trim(FBCIID) + '''');
|
||
Open;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
if Trim(FBCIID) = '' then
|
||
begin
|
||
Append;
|
||
FieldByName('CTID').Value := Trim(FCTID);
|
||
FieldByName('FILLID').Value := Trim(DCode);
|
||
FieldByName('FILLER').Value := Trim(DName);
|
||
FieldByName('FILLTIME').Value := SGetServerDateTime(ADOQueryTemp);
|
||
end
|
||
else
|
||
begin
|
||
Edit;
|
||
FieldByName('EDITER').Value := Trim(DName);
|
||
FieldByName('EDITTIME').Value := SGetServerDateTime(ADOQueryTemp);
|
||
end;
|
||
FieldByName('BCIID').Value := Trim(maxId);
|
||
if trim(C_Code.Text) = '' then
|
||
C_Code.Text := Trim(maxId);
|
||
RTSetsavedata(ADOQueryCmd, 'BS_Cloth_Info', ScrollBox1, 2);
|
||
Post;
|
||
end;
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select count(*) as AA from BS_Cloth_Info where C_Code=''' + Trim(C_Code.Text) + '''');
|
||
Open;
|
||
if FieldByName('AA').AsInteger > 1 then
|
||
begin
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Result := False;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ظ<EFBFBD><D8B8><EFBFBD>', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
end;
|
||
|
||
////////////////////////// <20><><EFBFBD><EFBFBD><EFBFBD>ư<EFBFBD>ͼ //////////////////////////
|
||
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('select * from Bs_Cloth_Info_WB where BCIID=''' + Trim(FBCIID) + '''');
|
||
Open;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
if Trim(FBCIID) = '' then
|
||
begin
|
||
Append;
|
||
|
||
end
|
||
else
|
||
begin
|
||
Edit;
|
||
|
||
end;
|
||
FieldByName('BCIID').Value := Trim(maxId);
|
||
|
||
RTSetsavedata(ADOQueryCmd, 'Bs_Cloth_Info_WB', Panel7, 2);
|
||
Post;
|
||
end;
|
||
|
||
|
||
////////////////////////// <20><><EFBFBD><EFBFBD><EFBFBD>ư<EFBFBD>ͼ //////////////////////////
|
||
|
||
////////////////////////// <20><><EFBFBD>澭˿<E6BEAD><CBBF><EFBFBD>ȱ<EFBFBD> //////////////////////////
|
||
with CDS_1 do
|
||
begin
|
||
First;
|
||
while not Eof do
|
||
begin
|
||
if Trim(CDS_1.fieldbyname('YRId').AsString) = '' then
|
||
begin
|
||
if GetLSNo(ADOQueryTemp, maxpbno, 'RJ', 'BS_Cloth_Yarn', 4, 1) = False then
|
||
begin
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
end
|
||
else
|
||
begin
|
||
maxpbno := Trim(CDS_1.fieldbyname('YRId').AsString);
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('select * from BS_Cloth_Yarn where ');
|
||
sql.Add(' YRId=''' + Trim(maxpbno) + '''');
|
||
Open;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
if Trim(CDS_1.fieldbyname('YRId').AsString) = '' then
|
||
begin
|
||
Append;
|
||
FieldByName('Filler').Value := Trim(DName);
|
||
FieldByName('FillTime').Value := SGetServerDateTime(ADOQueryTemp);
|
||
end
|
||
else
|
||
begin
|
||
Edit;
|
||
FieldByName('Editer').Value := Trim(DName);
|
||
FieldByName('EditTime').Value := SGetServerDateTime(ADOQueryTemp);
|
||
end;
|
||
FieldByName('YRType').Value := '<27><>˿';
|
||
FieldByName('BCIID').Value := Trim(maxId);
|
||
FieldByName('YRId').Value := Trim(maxpbno);
|
||
RTSetSaveDataCDS(ADOQueryCmd, Tv2, CDS_1, 'BS_Cloth_Yarn', 0);
|
||
Post;
|
||
end;
|
||
CDS_1.Edit;
|
||
CDS_1.FieldByName('BCIID').Value := Trim(maxId);
|
||
CDS_1.FieldByName('YRId').Value := Trim(maxpbno);
|
||
|
||
Next;
|
||
end;
|
||
end;
|
||
////////////////////////// <20><><EFBFBD>澭˿<E6BEAD><CBBF><EFBFBD>ȱ<EFBFBD> //////////////////////////
|
||
|
||
////////////////////////// <20><><EFBFBD><EFBFBD>γ˿<CEB3><CBBF><EFBFBD>ȱ<EFBFBD> //////////////////////////
|
||
with CDS_2 do
|
||
begin
|
||
First;
|
||
while not Eof do
|
||
begin
|
||
if Trim(CDS_2.fieldbyname('YRId').AsString) = '' then
|
||
begin
|
||
if GetLSNo(ADOQueryTemp, maxpbno, 'RJ', 'BS_Cloth_Yarn', 4, 1) = False then
|
||
begin
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
end
|
||
else
|
||
begin
|
||
maxpbno := Trim(CDS_2.fieldbyname('YRId').AsString);
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('select * from BS_Cloth_Yarn where ');
|
||
sql.Add(' YRId=''' + Trim(maxpbno) + '''');
|
||
Open;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
if Trim(CDS_2.fieldbyname('YRId').AsString) = '' then
|
||
begin
|
||
Append;
|
||
FieldByName('Filler').Value := Trim(DName);
|
||
FieldByName('FillTime').Value := SGetServerDateTime(ADOQueryTemp);
|
||
end
|
||
else
|
||
begin
|
||
Edit;
|
||
FieldByName('Editer').Value := Trim(DName);
|
||
FieldByName('EditTime').Value := SGetServerDateTime(ADOQueryTemp);
|
||
end;
|
||
FieldByName('YRType').Value := 'γ˿';
|
||
FieldByName('BCIID').Value := Trim(maxId);
|
||
FieldByName('YRId').Value := Trim(maxpbno);
|
||
RTSetSaveDataCDS(ADOQueryCmd, Tv2, CDS_2, 'BS_Cloth_Yarn', 0);
|
||
Post;
|
||
end;
|
||
CDS_2.Edit;
|
||
CDS_2.FieldByName('BCIID').Value := Trim(maxId);
|
||
CDS_2.FieldByName('YRId').Value := Trim(maxpbno);
|
||
|
||
Next;
|
||
end;
|
||
end;
|
||
////////////////////////// <20><><EFBFBD><EFBFBD>γ˿<CEB3><CBBF><EFBFBD>ȱ<EFBFBD> //////////////////////////
|
||
///
|
||
///
|
||
///
|
||
///
|
||
/// <20><><EFBFBD><EFBFBD> <20><><EFBFBD>۹<EFBFBD><DBB9>յ<EFBFBD>
|
||
|
||
with CDS_3 do
|
||
begin
|
||
First;
|
||
while not Eof do
|
||
begin
|
||
if Trim(CDS_3.fieldbyname('QZID').AsString) = '' then
|
||
begin
|
||
if GetLSNo(ADOQueryTemp, QZMAXNO, 'QZ', 'Bs_cloth_info_qz', 4, 1) = False then
|
||
begin
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
end
|
||
else
|
||
begin
|
||
QZMAXNO := Trim(CDS_3.fieldbyname('QZID').AsString);
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('select * from Bs_cloth_info_qz where QZID=''' + Trim(QZMAXNO) + '''');
|
||
Open;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
if Trim(CDS_3.fieldbyname('QZID').AsString) = '' then
|
||
Append
|
||
else
|
||
Edit;
|
||
FieldByName('BCIID').Value := Trim(maxId);
|
||
|
||
FieldByName('QZID').Value := Trim(QZMAXNO);
|
||
RTSetSaveDataCDS(ADOQueryCmd, Tv3, CDS_3, 'Bs_cloth_info_qz', 0);
|
||
Post;
|
||
end;
|
||
CDS_3.Edit;
|
||
CDS_3.FieldByName('QZID').Value := Trim(QZMAXNO);
|
||
|
||
Next;
|
||
end;
|
||
end;
|
||
|
||
/// ////////////////////////// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>۹<EFBFBD><DBB9>յ<EFBFBD> //////////////////////////
|
||
|
||
ADOQueryCmd.Connection.CommitTrans;
|
||
FBCIID := maxId;
|
||
Result := True;
|
||
except
|
||
Result := False;
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!', '<27><>ʾ', 0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmTatClothInfoInput.CYJGGYBtnDnClick(Sender: TObject);
|
||
begin
|
||
TBtnEditC(Sender).Text := '';
|
||
end;
|
||
|
||
procedure TfrmTatClothInfoInput.ToolButton1Click(Sender: TObject);
|
||
var
|
||
MC_Code: string;
|
||
begin
|
||
C_Name.SetFocus;
|
||
if C_Name.Text = '' then
|
||
begin
|
||
Application.MessageBox('<27><>Ʒ<EFBFBD><C6B7><EFBFBD>Ʋ<EFBFBD><C6B2><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
if trim(C_Code.Text) = '' then
|
||
begin
|
||
|
||
if GetLSNo(ADOQueryCmd, MC_Code, 'C', 'BS_Cloth_Info', 4, 0) = False then
|
||
begin
|
||
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
C_Code.Text := MC_Code;
|
||
|
||
end;
|
||
CALCYarnQty();
|
||
if SaveData() then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>', '<27><>ʾ', 0);
|
||
ModalResult := 1;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmTatClothInfoInput.ToolButton2Click(Sender: TObject);
|
||
begin
|
||
// try
|
||
// frmYarnInfoSel := TfrmYarnInfoSel.Create(Application);
|
||
// with frmYarnInfoSel do
|
||
// begin
|
||
// if ShowModal = 1 then
|
||
// begin
|
||
// with self.CDS_1 do
|
||
// begin
|
||
// Append;
|
||
// FieldByName('Brand').Value := frmYarnInfoSel.CDS_1.fieldbyname('Brand').Value;
|
||
// FieldByName('Y_Code').Value := frmYarnInfoSel.CDS_1.fieldbyname('Y_Code').Value;
|
||
// FieldByName('Y_Name').Value := frmYarnInfoSel.CDS_1.fieldbyname('Y_Name').Value;
|
||
// FieldByName('Y_Spec').Value := frmYarnInfoSel.CDS_1.fieldbyname('Y_Spec').Value;
|
||
// FieldByName('Y_Color').Value := frmYarnInfoSel.CDS_1.fieldbyname('Y_Color').Value;
|
||
// FieldByName('Denier').Value := frmYarnInfoSel.CDS_1.fieldbyname('Denier').Value;
|
||
// FieldByName('Y_Ratio').Value := 0;
|
||
// Post;
|
||
// end;
|
||
//
|
||
// end;
|
||
// end;
|
||
// finally
|
||
// frmYarnInfoSel.Free;
|
||
// end;
|
||
|
||
with self.CDS_1 do
|
||
begin
|
||
Append;
|
||
|
||
FieldByName('Y_Ratio').Value := 0;
|
||
Post;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmTatClothInfoInput.ToolButton3Click(Sender: TObject);
|
||
begin
|
||
if CDS_1.IsEmpty then
|
||
Exit;
|
||
if Trim(CDS_1.fieldbyname('YRId').AsString) <> '' then
|
||
begin
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
||
Exit;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('delete BS_Cloth_Yarn where YRId=''' + Trim(CDS_1.fieldbyname('YRId').AsString) + '''');
|
||
ExecSQL;
|
||
end;
|
||
end;
|
||
CDS_1.Delete;
|
||
end;
|
||
|
||
procedure TfrmTatClothInfoInput.ToolButton4Click(Sender: TObject);
|
||
begin
|
||
// try
|
||
// frmYarnInfoSel := TfrmYarnInfoSel.Create(Application);
|
||
// with frmYarnInfoSel do
|
||
// begin
|
||
// if ShowModal = 1 then
|
||
// begin
|
||
// with self.CDS_2 do
|
||
// begin
|
||
// Append;
|
||
// FieldByName('Brand').Value := frmYarnInfoSel.CDS_1.fieldbyname('Brand').Value;
|
||
// FieldByName('Y_Code').Value := frmYarnInfoSel.CDS_1.fieldbyname('Y_Code').Value;
|
||
// FieldByName('Y_Name').Value := frmYarnInfoSel.CDS_1.fieldbyname('Y_Name').Value;
|
||
// FieldByName('Y_Spec').Value := frmYarnInfoSel.CDS_1.fieldbyname('Y_Spec').Value;
|
||
// FieldByName('Y_Color').Value := frmYarnInfoSel.CDS_1.fieldbyname('Y_Color').Value;
|
||
// FieldByName('Denier').Value := frmYarnInfoSel.CDS_1.fieldbyname('Denier').Value;
|
||
// FieldByName('Y_Ratio').Value := 0;
|
||
// Post;
|
||
// end;
|
||
// end;
|
||
// end;
|
||
// finally
|
||
// frmYarnInfoSel.Free;
|
||
// end;
|
||
|
||
with self.CDS_2 do
|
||
begin
|
||
Append;
|
||
|
||
FieldByName('Y_Ratio').Value := 0;
|
||
Post;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmTatClothInfoInput.ToolButton5Click(Sender: TObject);
|
||
begin
|
||
C_Name.SetFocus;
|
||
CALCYarnQty();
|
||
end;
|
||
|
||
procedure TfrmTatClothInfoInput.CYColorKeyPress(Sender: TObject; var Key: Char);
|
||
begin
|
||
if Key = #13 then
|
||
begin
|
||
Key := #0;
|
||
SelectNext(ActiveControl as TWinControl, True, True);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmTatClothInfoInput.CYKZExit(Sender: TObject);
|
||
begin
|
||
// if pos('G/M2', trim(CYKZ.Text)) = 0 then
|
||
// begin
|
||
// if pos('G/M', trim(CYKZ.Text)) = 0 then
|
||
// begin
|
||
// CYKZ.Text := trim(CYKZ.Text) + 'G/M2';
|
||
// end;
|
||
// end;
|
||
end;
|
||
|
||
procedure TfrmTatClothInfoInput.C_WidthBtnDnClick(Sender: TObject);
|
||
begin
|
||
TBtnEditC(Sender).Text := '';
|
||
TBtnEditC(Sender).TxtCode := '';
|
||
end;
|
||
|
||
procedure TfrmTatClothInfoInput.C_WidthBtnUpClick(Sender: TObject);
|
||
var
|
||
fsj: string;
|
||
FWZ: Integer;
|
||
begin
|
||
fsj := Trim(TEdit(Sender).Hint);
|
||
FWZ := Pos('/', fsj);
|
||
try
|
||
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
||
with frmZDYHelp do
|
||
begin
|
||
flag := Copy(fsj, 1, FWZ - 1);
|
||
flagname := Copy(fsj, FWZ + 1, Length(fsj) - FWZ);
|
||
if ShowModal = 1 then
|
||
begin
|
||
TEdit(Sender).Text := Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelp.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmTatClothInfoInput.Edit1KeyPress(Sender: TObject; var Key: Char);
|
||
var
|
||
i, j: Integer;
|
||
begin
|
||
if Key = #13 then
|
||
begin
|
||
|
||
begin
|
||
if Edit1.Text <> '' then
|
||
begin
|
||
i := CDS_3.RecordCount;
|
||
i := i + 1;
|
||
with CDS_3 do
|
||
begin
|
||
Append;
|
||
FieldByName('SSEL').Value := FALSE;
|
||
FieldByName('XuNO').Value := i;
|
||
FieldByName('DZZQZGL').Value := Trim(Edit1.Text);
|
||
Post;
|
||
end;
|
||
Edit1.Text := '';
|
||
end;
|
||
|
||
end;
|
||
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmTatClothInfoInput.CYMFExit(Sender: TObject);
|
||
begin
|
||
// if pos('"', trim(CYMF.Text)) = 0 then
|
||
// begin
|
||
// if pos('CM', trim(CYMF.Text)) = 0 then
|
||
// CYMF.Text := trim(CYMF.Text) + 'CM';
|
||
// end;
|
||
|
||
end;
|
||
|
||
procedure TfrmTatClothInfoInput.FormCreate(Sender: TObject);
|
||
begin
|
||
|
||
// LaYangDate.DateTime := SGetServerDateTime(ADOQueryTemp);
|
||
end;
|
||
|
||
procedure TfrmTatClothInfoInput.ToolButton6Click(Sender: TObject);
|
||
begin
|
||
if trim(C_Code.Text) = '' then
|
||
Exit;
|
||
try
|
||
frmAttachmentUpload := TfrmAttachmentUpload.Create(Application);
|
||
with frmAttachmentUpload do
|
||
begin
|
||
FEditAuthority := True;
|
||
fkeyNO := trim(C_Code.Text);
|
||
fType := '<27><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>';
|
||
if ShowModal = 1 then
|
||
begin
|
||
|
||
end;
|
||
end;
|
||
finally
|
||
frmAttachmentUpload.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmTatClothInfoInput.ToolButton7Click(Sender: TObject);
|
||
begin
|
||
if CDS_2.IsEmpty then
|
||
Exit;
|
||
if Trim(CDS_2.fieldbyname('YRId').AsString) <> '' then
|
||
begin
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
||
Exit;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('delete BS_Cloth_Yarn where YRId=''' + Trim(CDS_2.fieldbyname('YRId').AsString) + '''');
|
||
ExecSQL;
|
||
end;
|
||
end;
|
||
CDS_2.Delete;
|
||
end;
|
||
|
||
procedure TfrmTatClothInfoInput.ToolButton8Click(Sender: TObject);
|
||
begin
|
||
C_Name.SetFocus;
|
||
CALCYarnQty();
|
||
end;
|
||
|
||
end.
|
||
|