D10SZKaiXiYa/E01梭织生产计划/U_TatPlanInPut.pas
DESKTOP-E401PHE\Administrator 79a308562d 0
2025-08-23 14:29:45 +08:00

2115 lines
58 KiB
ObjectPascal
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

unit U_TatPlanInPut;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData, cxDataStorage,
cxEdit, DB, cxDBData, cxGridLevel, cxGridCustomTableView, cxGridTableView,
cxGridDBTableView, cxClasses, cxControls, cxGridCustomView, cxGrid, cxMemo,
cxRichEdit, ComCtrls, cxContainer, cxTextEdit, cxMaskEdit, cxButtonEdit,
StdCtrls, ToolWin, DBClient, ADODB, ExtCtrls, BtnEdit, cxDropDownEdit,
StrUtils, cxPC, ShellAPI, cxCalendar, Math, cxLookAndFeels,
cxLookAndFeelPainters, dxBarBuiltInMenu, cxNavigator, dxDateRanges,
U_BaseInput, System.ImageList, Vcl.ImgList, Vcl.Menus, cxCheckBox, dxCore,
cxDateUtils, dxScrollbarAnnotations, cxGridCustomPopupMenu, cxGridPopupMenu,
dxCoreClasses, dxHashUtils, dxSpreadSheetCore, dxSpreadSheetCoreFormulas,
dxSpreadSheetCoreHistory, dxSpreadSheetCoreStyles, dxSpreadSheetCoreStrs,
dxSpreadSheetConditionalFormatting, dxSpreadSheetConditionalFormattingRules,
dxSpreadSheetClasses, dxSpreadSheetContainers, dxSpreadSheetFormulas,
dxSpreadSheetHyperlinks, dxSpreadSheetFunctions, dxSpreadSheetStyles,
dxSpreadSheetGraphics, dxSpreadSheetPrinting, dxSpreadSheetTypes,
dxSpreadSheetUtils, dxSpreadSheetFormattedTextUtils, dxSpreadSheet,
dxSkinsCore, dxSkinsDefaultPainters, cxImageList, dxSkinOffice2013White,
dxSkinSharpPlus, dxSkinWXI, cxImage, cxDBEdit;
type
TfrmTatPlanInPut = class(TfrmBaseInput)
ToolBar1: TToolBar;
TBSave: TToolButton;
TBClose: TToolButton;
ScrollBox1: TScrollBox;
Label2: TLabel;
ADOQueryTemp: TADOQuery;
ADOQueryCmd: TADOQuery;
Label5: TLabel;
Label8: TLabel;
OrdPiece: TcxTextEdit;
Label13: TLabel;
OrdQty: TcxTextEdit;
CDS_2: TClientDataSet;
DS_1: TDataSource;
CDS_1: TClientDataSet;
DS_2: TDataSource;
Label47: TLabel;
lbl2: TLabel;
Label7: TLabel;
OrderNo: TcxTextEdit;
ToolButton8: TToolButton;
Label35: TLabel;
ConMId: TcxTextEdit;
ConSId: TcxTextEdit;
cxPageControl3: TcxPageControl;
cxTabSheet1: TcxTabSheet;
GroupBox1: TGroupBox;
Y_Note_PLJ: TMemo;
cxTabSheet2: TcxTabSheet;
GroupBox2: TGroupBox;
Y_Note_PLW: TMemo;
cxTabSheet3: TcxTabSheet;
Panel1: TPanel;
cxPageControl2: TcxPageControl;
Panel2: TPanel;
cxPageControl1: TcxPageControl;
DS_QZ: TDataSource;
CDS_QZ: TClientDataSet;
OrdType: TcxComboBox;
DlyDate: TcxDateEdit;
OrdDate: TcxDateEdit;
ConNo: TcxButtonEdit;
CustName: TcxButtonEdit;
GPM_1: TcxGridPopupMenu;
GPM_2: TcxGridPopupMenu;
cxTabSheet4: TcxTabSheet;
cxTabSheet5: TcxTabSheet;
CKF: TMemo;
ADOQuery1: TADOQuery;
ADOQueryMain: TADOQuery;
Label3: TLabel;
Label6: TLabel;
Label55: TLabel;
Label9: TLabel;
Label11: TLabel;
Label12: TLabel;
Label15: TLabel;
Label16: TLabel;
lbl1: TLabel;
Label17: TLabel;
Label18: TLabel;
Label20: TLabel;
Label21: TLabel;
Label22: TLabel;
Label23: TLabel;
Label24: TLabel;
Label25: TLabel;
Label26: TLabel;
Label27: TLabel;
Label30: TLabel;
Label31: TLabel;
Label32: TLabel;
Label33: TLabel;
Label34: TLabel;
Label36: TLabel;
Label37: TLabel;
Label38: TLabel;
ThroughHealdOrder: TcxMemo;
C_Name: TcxTextEdit;
C_YarnQty: TcxTextEdit;
C_Width: TcxTextEdit;
C_ReedNo: TcxTextEdit;
C_GramWeight: TcxTextEdit;
C_FinishLatitudeDensity: TcxTextEdit;
WB_Code: TcxButtonEdit;
WB_Name: TcxTextEdit;
C_Color: TcxTextEdit;
C_ColorNo: TcxTextEdit;
C_Pattern: TcxTextEdit;
C_StyleNo: TcxTextEdit;
C_Spec: TcxTextEdit;
C_Composition: TcxTextEdit;
MFDW: TcxComboBox;
C_FinishLongitudeDensity: TcxTextEdit;
LPDW: TcxComboBox;
GKBH: TcxTextEdit;
C_ReedWidth: TcxTextEdit;
C_KCQTY: TcxTextEdit;
BSQTY: TcxTextEdit;
DCRQTY: TcxTextEdit;
WB_ReedNote: TcxTextEdit;
ZYQTY: TcxTextEdit;
WYAMI: TcxTextEdit;
DAYQTY: TcxTextEdit;
LBQTY: TcxTextEdit;
GKDW: TcxComboBox;
LoomType: TcxComboBox;
Label39: TLabel;
cxGrid1: TcxGrid;
TV1: TcxGridDBTableView;
TV1Column7: TcxGridDBColumn;
cxGridDBColumn3: TcxGridDBColumn;
cxGridDBColumn4: TcxGridDBColumn;
TV1Column13: TcxGridDBColumn;
cxGridDBColumn8: TcxGridDBColumn;
TV1Column6: TcxGridDBColumn;
TV1Column14: TcxGridDBColumn;
TV1Column1: TcxGridDBColumn;
TV1Column2: TcxGridDBColumn;
TV1Column10: TcxGridDBColumn;
TV1Column8: TcxGridDBColumn;
TV1Column11: TcxGridDBColumn;
cxGridLevel2: TcxGridLevel;
cxGrid2: TcxGrid;
Tv2: TcxGridDBTableView;
Tv2Column7: TcxGridDBColumn;
v2Column10: TcxGridDBColumn;
cxGridDBColumn1: TcxGridDBColumn;
Tv2Column13: TcxGridDBColumn;
v2Column6: TcxGridDBColumn;
Tv2Column6: TcxGridDBColumn;
Tv2Column14: TcxGridDBColumn;
Tv2Column1: TcxGridDBColumn;
Tv2Column2: TcxGridDBColumn;
Tv2Column11: TcxGridDBColumn;
Tv2Column8: TcxGridDBColumn;
Tv2Column12: TcxGridDBColumn;
cxGridLevel1: TcxGridLevel;
Label1: TLabel;
Label29: TLabel;
Panel5: TPanel;
Label28: TLabel;
attname2: TcxButtonEdit;
cxDBImage2: TcxDBImage;
Panel4: TPanel;
Label4: TLabel;
ATTNAME1: TcxButtonEdit;
cxDBImage1: TcxDBImage;
Qry_ImgHX: TADOQuery;
DS_ImgHX: TDataSource;
DS_ImgHX2: TDataSource;
Qry_ImgHX2: TADOQuery;
C_CODE: TcxButtonEdit;
procedure TBCloseClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure TBSaveClick(Sender: TObject);
procedure cxGridDBColumn1PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
procedure v2Column11PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
//procedure OrdPieceLenChange(Sender: TObject);
//procedure OrdPieceChange(Sender: TObject);
procedure C_CodeKeyPress(Sender: TObject; var Key: Char);
procedure ConNoKeyPress(Sender: TObject; var Key: Char);
procedure MCTypeBtnUpClick(Sender: TObject);
procedure cxGridDBColumn4PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
procedure Edit1KeyPress(Sender: TObject; var Key: Char);
procedure ToolButton7Click(Sender: TObject);
procedure ToolButton9Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
// procedure OurCoNamePropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
procedure OurCoNameDblClick(Sender: TObject);
// procedure FtyCoNamePropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
procedure CustNamePropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
procedure C_CodePropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
procedure ConNoPropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
procedure ToolButton8Click(Sender: TObject);
//procedure OrdPiecePropertiesEditValueChanged(Sender: TObject);
procedure cxGridDBColumn3PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
procedure v2Column10PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
procedure TV1Column1PropertiesEditValueChanged(Sender: TObject);
procedure Tv2Column1PropertiesEditValueChanged(Sender: TObject);
procedure C_YarnQtyPropertiesEditValueChanged(Sender: TObject);
procedure WB_CodePropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
procedure cxButtonEdit1PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
procedure TV1CellClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
procedure Tv2CellClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
procedure OrdQtyPropertiesChange(Sender: TObject);
procedure TV1Column14PropertiesEditValueChanged(Sender: TObject);
procedure C_ReedWidthExit(Sender: TObject);
procedure ATTNAME1PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
procedure attname2PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
procedure C_CODEDblClick(Sender: TObject);
private
FXS, FGridFlag: Integer;
FUpdating: Boolean;
FLastChanged: TObject;
procedure InitData();
procedure InitImage();
procedure Initexcel();
procedure CALCYarnQty();
procedure JSJS(); //<2F><><EFBFBD>㾭˿
procedure JSWS(); //<2F><><EFBFBD><EFBFBD>γ˿
procedure JSKZ(); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
function SaveData(): Boolean;
procedure InitClothYarn(MC_Code: string);
{ Private declarations }
public
PState, FCopyInt: Integer;
FConNo, FMainId, FSubId: string;
fStatus: Integer; //0<><30><EFBFBD><EFBFBD>, 1<>޸<EFBFBD>
{ Public declarations }
end;
var
frmTatPlanInPut: TfrmTatPlanInPut;
newh: hwnd;
implementation
uses
U_DataLink, U_ZDYHelp, U_RTFun, U_TatClothInfoSel, U_CompanySel, U_YarnInfoSel,
U_TradeSalesContractSel, U_WBSpecSel, U_TatGYSel, U_PictureUpload;
{$R *.dfm}
procedure TfrmTatPlanInPut.InitImage();
begin
if attname1.Text <> '' then
begin
with Qry_ImgHX do
begin
close;
sql.Clear;
sql.Add('select * from TP_File A');
sql.Add('where isnull(WBID,'''')<>'''' and wbid=' + quotedstr(Trim(attname1.Text)));
SQL.Add('AND TFTYPE=''ZC'' ');
// ShowMessage(SQL.Text);
open;
end;
end;
if attname2.Text <> '' then
begin
with Qry_ImgHX2 do
begin
close;
sql.Clear;
sql.Add('select * from TP_File A');
sql.Add('where isnull(WBID,'''')<>'''' and wbid=' + quotedstr(Trim(attname2.Text)));
SQL.Add('AND TFTYPE=''qC'' ');
// ShowMessage(SQL.Text);
open;
end;
end;
end;
procedure TfrmTatPlanInPut.InitClothYarn(MC_Code: string);
begin
with ADOQueryTemp do
begin
Close;
sql.Clear;
sql.Add('select A.* from Bs_Cloth_Info A');
sql.Add(' where A.C_Code=''' + Trim(MC_Code) + '''');
Open;
end;
ConNo.tag := 9;
OrdPiece.tag := 9;
OrdQty.tag := 9;
ConMId.tag := 9;
ConSId.tag := 9;
SCSHData(ADOQueryTemp, ScrollBox1, 2);
attname1.Text := ADOQueryTemp.fieldbyname('attname1').AsString;
attname2.Text := ADOQueryTemp.fieldbyname('attname2').AsString;
ConNo.tag := 2;
OrdPiece.tag := 2;
OrdQty.tag := 2;
ConMId.tag := 2;
ConSId.tag := 2;
// Self.C_Code.Text := ADOQueryTemp.fieldbyname('C_Code').AsString;
// Self.C_Name.Text := ADOQueryTemp.fieldbyname('C_Name').AsString;
// Self.C_Spec.Text := ADOQueryTemp.fieldbyname('C_Spec').AsString;
// Self.C_FinishLatitudeDensity.Text := ADOQueryTemp.fieldbyname('C_FinishLatitudeDensity').AsString;
//
// Self.C_GramWeight.Text := ADOQueryTemp.fieldbyname('C_GramWeight').AsString;
// Self.C_ReedNo.Text := ADOQueryTemp.fieldbyname('C_ReedNo').AsString;
// Self.C_YarnQty.Text := ADOQueryTemp.fieldbyname('C_YarnQty').AsString;
//
// Self.LoomType.Text := ADOQueryTemp.fieldbyname('LoomType').AsString;
// Self.C_ReedWidth.Text := ADOQueryTemp.fieldbyname('C_ReedWidth').AsString;
//
// Self.C_Color.Text := ADOQueryTemp.fieldbyname('C_Color').AsString;
// Self.QZF.Text := ADOQueryTemp.fieldbyname('QZF').AsString;
// Self.CZF.Text := ADOQueryTemp.fieldbyname('CZF').AsString;
// Self.CKF.Text := ADOQueryTemp.fieldbyname('CKF').AsString;
// Self.Y_Note_PLJ.Text := ADOQueryTemp.fieldbyname('Y_Note_PLJ').AsString;
// Self.Y_Note_PLW.Text := ADOQueryTemp.fieldbyname('Y_Note_PLW').AsString;
//
with ADOQueryTemp do
begin
Close;
sql.Clear;
sql.Add('select A.*,MainId=cast('''' as varchar(30)),SubId=cast('''' as varchar(30)) from BS_Cloth_Yarn A inner join Bs_Cloth_Info B on A.BCIID=B.BCIID');
sql.Add(' where A.YRType=''<27><>˿'' and B.C_Code=''' + Trim(MC_Code) + '''');
Open;
end;
SCreateCDS(ADOQueryTemp, CDS_1);
SInitCDSData(ADOQueryTemp, CDS_1);
ClearCDSColumn(CDS_1, ['YRId', 'SubId', 'MainId']);
//
with ADOQueryTemp do
begin
Close;
sql.Clear;
sql.Add('select A.*,MainId=cast('''' as varchar(30)),SubId=cast('''' as varchar(30)) from BS_Cloth_Yarn A inner join Bs_Cloth_Info B on A.BCIID=B.BCIID');
sql.Add(' where A.YRType=''γ˿'' and B.C_Code=''' + Trim(MC_Code) + '''');
Open;
end;
SCreateCDS(ADOQueryTemp, CDS_2);
SInitCDSData(ADOQueryTemp, CDS_2);
ClearCDSColumn(CDS_2, ['YRId', 'SubId', 'MainId']);
//
with ADOQueryTemp do
begin
Close;
sql.Clear;
sql.Add('select A.*,MainId=cast('''' as varchar(30)),SubId=cast('''' as varchar(30)) from BS_Cloth_QZ A inner join Bs_Cloth_Info B on A.BCIID=B.BCIID');
sql.Add(' where B.C_Code=''' + Trim(MC_Code) + '''');
Open;
end;
SCreateCDS(ADOQueryTemp, CDS_QZ);
SInitCDSData(ADOQueryTemp, CDS_QZ);
ClearCDSColumn(CDS_QZ, ['QZID', 'SubId', 'MainId']);
InitImage();
end;
procedure TfrmTatPlanInPut.ATTNAME1PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
begin
try
frmPictureUpload := TfrmPictureUpload.create(self);
with frmPictureUpload do
begin
fFlileFlag := UserDataFlag + 'HX';
FDataId := AttName1.Text;
FPictureName := AttName1.Text;
FWidth := 600;
FHeight := 600;
FTFType := 'ZC';
if showmodal = 1 then
begin
AttName1.Text := frmPictureUpload.FPictureName;
end;
end;
finally
frmPictureUpload.free;
end;
initimage();
end;
procedure TfrmTatPlanInPut.attname2PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
begin
try
frmPictureUpload := TfrmPictureUpload.create(self);
with frmPictureUpload do
begin
fFlileFlag := UserDataFlag + 'HX';
FDataId := AttName1.Text;
FPictureName := AttName1.Text;
FWidth := 600;
FHeight := 600;
FTFType := 'ZC';
if showmodal = 1 then
begin
AttName2.Text := frmPictureUpload.FPictureName;
end;
end;
finally
frmPictureUpload.free;
end;
initimage();
end;
procedure TfrmTatPlanInPut.CALCYarnQty();
var
MYarnQty, MOrdQty, MWidth, MMachLatitudeDensity: Double;
begin
// MYarnQty := STRTOFLOATDEF(C_YarnQty.Text, 0);
// MOrdQty := STRTOFLOATDEF(OrdQty.Text, 0);
// 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 TfrmTatPlanInPut.TBCloseClick(Sender: TObject);
begin
ModalResult := 1;
end;
procedure TfrmTatPlanInPut.InitData();
var
PBNO, PBFlag: string;
begin
with ADOQueryMain do
begin
Close;
SQL.Clear;
sql.Add('select * from Tat_Plan_Main A where A.MainId=''' + Trim(FMainId) + '''');
Open;
end;
SCSHData(ADOQueryMain, ScrollBox1, 0);
attname1.Text := Trim(ADOQueryMain.FieldByName('attname1').AsString);
attname2.Text := Trim(ADOQueryMain.FieldByName('attname2').AsString);
CKF.Text := Trim(ADOQueryMain.FieldByName('CKF').AsString);
with ADOQueryMain do
begin
Close;
SQL.Clear;
sql.Add('select * from Tat_Plan_Sub A where A.MainId=''' + Trim(FMainId) + '''');
Open;
end;
SCSHData(ADOQueryMain, ScrollBox1, 2);
Y_Note_PLJ.Text := ADOQueryMain.FieldByName('Y_Note_PLJ').AsString;
Y_Note_PLW.Text := ADOQueryMain.FieldByName('Y_Note_PLW').AsString;
with ADOQueryMain do
begin
Close;
sql.Clear;
sql.Add('select A.* from Tat_Plan_Yarn A ');
sql.Add(' where YRType=''<27><>˿'' and A.MainId=''' + Trim(FMainId) + '''');
Open;
end;
SCreateCDS(ADOQueryMain, CDS_1);
SInitCDSData(ADOQueryMain, CDS_1);
with ADOQueryMain do
begin
Close;
sql.Clear;
sql.Add('select A.* from Tat_Plan_Yarn A ');
sql.Add(' where YRType=''γ˿'' and A.MainId=''' + Trim(FMainId) + '''');
Open;
end;
SCreateCDS(ADOQueryMain, CDS_2);
SInitCDSData(ADOQueryMain, CDS_2);
/////////////////ˢ<><CBA2><EFBFBD><EFBFBD><EFBFBD>۹<EFBFBD><DBB9>յ<EFBFBD><D5B5><EFBFBD>Ϣ/////////////////////////
with ADOQueryMain do
begin
Close;
sql.Clear;
sql.Add('select * from Tat_Plan_QZ where MainId=''' + Trim(FMainId) + '''');
Open;
end;
SCreateCDS(ADOQueryMain, CDS_QZ);
SInitCDSData(ADOQueryMain, CDS_QZ);
/////////////////ˢ<><CBA2><EFBFBD><EFBFBD><EFBFBD>۹<EFBFBD><DBB9>յ<EFBFBD><D5B5><EFBFBD>Ϣ/////////////////////////
if FMainId = '' then
begin
with CDS_1 do
begin
Append;
FieldByName('RowNo').Value := 'A';
Post;
Append;
FieldByName('RowNo').Value := 'B';
Post;
Append;
FieldByName('RowNo').Value := 'C';
Post;
Append;
FieldByName('RowNo').Value := 'D';
Post;
Append;
FieldByName('RowNo').Value := 'E';
Post;
Append;
FieldByName('RowNo').Value := 'F';
Post;
end;
with CDS_2 do
begin
Append;
FieldByName('RowNo').Value := 'A';
Post;
Append;
FieldByName('RowNo').Value := 'B';
Post;
Append;
FieldByName('RowNo').Value := 'C';
Post;
Append;
FieldByName('RowNo').Value := 'D';
Post;
Append;
FieldByName('RowNo').Value := 'E';
Post;
Append;
FieldByName('RowNo').Value := 'F';
Post;
end;
end;
if FCopyInt = 1 then
begin
FMainId := '';
OrderNo.text := '';
with CDS_1 do
begin
First;
while not Eof do
begin
Edit;
FieldByName('MainID').Value := '';
FieldByName('SubID').Value := '';
FieldByName('YRId').Value := '';
Post;
Next;
end;
end;
with CDS_2 do
begin
First;
while not Eof do
begin
Edit;
FieldByName('MainID').Value := '';
FieldByName('SubID').Value := '';
FieldByName('YRId').Value := '';
Post;
Next;
end;
end;
end;
if PState = 1 then
begin
ConNo.enabled := false;
// ScrollBox1.Enabled := False;
end;
InitImage();
end;
procedure TfrmTatPlanInPut.Initexcel();
var
myStream: TMemoryStream;
begin
// myStream := TMemoryStream.Create();
//
// with ADOQueryTemp do
// begin
// close;
// sql.Clear;
// sql.Add(' select * from BS_Cloth_Info_Excel A INNER JOIN Bs_Cloth_Info B on A.BCIID =B.BCIID where B.C_Code=''' + Trim(C_Code.text) + '''');
// open;
// end;
//
// if not ADOQueryTemp.IsEmpty then
// begin
//
// TBlobField(ADOQueryTemp.FieldByName('ExcelData')).SaveToStream(myStream);
// myStream.Position := 0;
// dxSpreadSheet1.LoadFromStream(myStream);
// end
// else
// begin
//// dxSpreadSheet1.ClearAll;
// end;
//
// myStream.Free;
end;
procedure TfrmTatPlanInPut.FormCreate(Sender: TObject);
var
FDate: TDateTime;
begin
FUpdating := False;
FDate := SGetServerDateTime(ADOQueryTemp);
OrdDate.Date := FDate;
DlyDate.Date := FDate;
end;
procedure TfrmTatPlanInPut.FormShow(Sender: TObject);
var
mSql: string;
begin
ReadCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƻ<EFBFBD><C6BB><EFBFBD>¼<EFBFBD><C2BC>11', Tv1, '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
ReadCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƻ<EFBFBD><C6BB><EFBFBD>¼<EFBFBD><C2BC>22', Tv2, '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
mSql := 'select distinct name=A.mctype from Bs_Machine A ';
SInitTcxComBoxBySql(ADOQueryTemp, LoomType, false, mSql);
InitData();
InitImage();
JSJS(); //<2F><><EFBFBD>㾭˿
JSWS(); //<2F><><EFBFBD><EFBFBD>γ˿
JSKZ();
// Initexcel();
end;
function TfrmTatPlanInPut.SaveData(): Boolean;
var
maxno, maxsubno, maxpbno, maxpzno, maxsjno, maxQZID: string;
begin
try
ADOQueryCmd.Connection.BeginTrans;
if Trim(FMainId) = '' then
begin
if GetLSNo(ADOQueryCmd, maxno, 'SZ', 'Tat_Plan_Main', 4, 1) = False then
raise Exception.Create('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE><EFBFBD><EFBFBD><ECB3A3>');
OrderNo.Text := maxno;
end
else
begin
maxno := Trim(FMainId);
end;
////////////////////////// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> //////////////////////////
with ADOQueryCmd do
begin
Close;
sql.Clear;
SQL.Add('select * from Tat_Plan_Main where MainId=''' + Trim(FMainId) + '''');
Open;
end;
with ADOQueryCmd do
begin
if Trim(FMainId) = '' then
begin
Append;
FieldByName('Filler').Value := Trim(DName);
end
else
begin
Edit;
FieldByName('Editer').Value := Trim(DName);
FieldByName('EditTime').Value := SGetServerDateTime(ADOQueryTemp);
end;
FieldByName('MainId').Value := Trim(maxno);
FieldByName('attname1').Value := Trim(attname1.text);
FieldByName('attname2').Value := Trim(attname2.text);
FieldByName('CKF').Value := Trim(CKF.text);
RTSetsavedata(ADOQueryCmd, 'Tat_Plan_Main', ScrollBox1, 0);
Post;
end;
////////////////////////// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> //////////////////////////
///
////////////////////////// <20><><EFBFBD><EFBFBD><EFBFBD>ӱ<EFBFBD> //////////////////////////
if Trim(FSubId) = '' then
begin
if GetLSNo(ADOQueryTemp, maxsubno, 'SZS', 'Tat_Plan_Sub', 4, 1) = False then
raise Exception.Create(<><C8A1><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE>ʧ<EFBFBD>ܣ<EFBFBD>');
end
else
begin
maxsubno := Trim(FSubId);
end;
with ADOQueryCmd do
begin
Close;
SQL.Clear;
sql.Add('select * from Tat_Plan_Sub where ');
sql.Add(' SubId=''' + Trim(maxsubno) + '''');
Open;
end;
with ADOQueryCmd do
begin
if Trim(FSubId) = '' then
Append
else
Edit;
FieldByName('MainId').Value := Trim(maxno);
FieldByName('SubId').Value := Trim(maxsubno);
RTSetsavedata(ADOQueryCmd, 'Tat_Plan_Sub', ScrollBox1, 2);
FieldByName('Y_Note_PLJ').Value := Trim(Y_Note_PLJ.Text);
FieldByName('Y_Note_PLW').Value := Trim(Y_Note_PLW.Text);
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', 'Tat_Plan_Yarn', 4, 1) = False then
raise Exception.Create(<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE>ʧ<EFBFBD>ܣ<EFBFBD>');
end
else
begin
maxpbno := Trim(CDS_1.fieldbyname('YRId').AsString);
end;
with ADOQueryCmd do
begin
Close;
SQL.Clear;
sql.Add('select * from Tat_Plan_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('MainId').Value := Trim(maxno);
FieldByName('SubId').Value := Trim(maxsubno);
FieldByName('YRId').Value := Trim(maxpbno);
RTSetSaveDataCDS(ADOQueryCmd, Tv1, CDS_1, 'Tat_Plan_Yarn', 0);
Post;
end;
CDS_1.Edit;
CDS_1.FieldByName('SubId').Value := Trim(maxsubno);
CDS_1.FieldByName('MainId').Value := Trim(maxno);
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', 'Tat_Plan_Yarn', 4, 1) = False then
raise Exception.Create(<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE>ʧ<EFBFBD>ܣ<EFBFBD>');
end
else
begin
maxpbno := Trim(CDS_2.fieldbyname('YRId').AsString);
end;
with ADOQueryCmd do
begin
Close;
SQL.Clear;
sql.Add('select * from Tat_Plan_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('MainId').Value := Trim(maxno);
FieldByName('SubId').Value := Trim(maxsubno);
FieldByName('YRId').Value := Trim(maxpbno);
RTSetSaveDataCDS(ADOQueryCmd, Tv2, CDS_2, 'Tat_Plan_Yarn', 0);
Post;
end;
CDS_2.Edit;
CDS_2.FieldByName('SubId').Value := Trim(maxsubno);
CDS_2.FieldByName('MainId').Value := Trim(maxno);
CDS_2.FieldByName('YRId').Value := Trim(maxpbno);
Next;
end;
end;
////////////////////////// <20><><EFBFBD><EFBFBD>γ˿<CEB3><CBBF><EFBFBD>ȱ<EFBFBD> //////////////////////////
//////////////////////////
ADOQueryCmd.Connection.CommitTrans;
FMainId := Trim(maxno);
FSubId := Trim(maxsubno);
Result := True;
except
Result := False;
CDS_1.EnableControls;
CDS_2.EnableControls;
ADOQueryCmd.Connection.RollbackTrans;
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
end;
end;
procedure TfrmTatPlanInPut.TBSaveClick(Sender: TObject);
var
FReal: Double;
maxConNo: string;
begin
OrdDate.SetFocus;
CALCYarnQty();
if Trim(CustName.Text) = '' then
begin
Application.MessageBox('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
Exit;
end;
if Trim(OrdType.Text) = '' then
begin
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ͳ<EFBFBD><CDB2><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
Exit;
end;
if Trim(C_Name.Text) = '' then
begin
Application.MessageBox('<27><>Ʒ<EFBFBD><C6B7><EFBFBD>Ʋ<EFBFBD><C6B2><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
Exit;
end;
if Trim(C_Code.Text) = '' then
begin
Application.MessageBox('<27><>Ʒ<EFBFBD><C6B7><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
Exit;
end;
if Trim(C_Width.Text) = '' then
begin
Application.MessageBox('<27>ϻ<EFBFBD><CFBB>ŷ<EFBFBD><C5B7><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
Exit;
end;
if Trim(OrdQty.Text) = '' then
begin
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
Exit;
end;
if Trim(OrdPiece.Text) = '' then
begin
Application.MessageBox(<><C6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
Exit;
end;
if TryStrToFloat(OrdQty.Text, FReal) = False then
begin
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
Exit;
end;
if TryStrToFloat(OrdPiece.Text, FReal) = False then
begin
Application.MessageBox(<><C6A5><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
Exit;
end;
if MFDW.Text = '' then
begin
Application.MessageBox('<27>ŷ<EFBFBD><C5B7><EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>', '<27><>ʾ', 0);
Exit;
end;
if C_Width.Text = '' then
begin
Application.MessageBox('<27>ŷ<EFBFBD><C5B7><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>', '<27><>ʾ', 0);
Exit;
end;
if C_FinishLongitudeDensity.Text = '' then
begin
Application.MessageBox('<27><><EFBFBD>ܲ<EFBFBD><DCB2><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>', '<27><>ʾ', 0);
Exit;
end;
if C_FinishLatitudeDensity.Text = '' then
begin
Application.MessageBox('γ<>ܲ<EFBFBD><DCB2><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>', '<27><>ʾ', 0);
Exit;
end;
if WB_Code.Text = '' then
begin
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ձ<EFBFBD><D5B1>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>', '<27><>ʾ', 0);
Exit;
end;
if WB_Name.Text = '' then
begin
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʋ<EFBFBD><C6B2><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>', '<27><>ʾ', 0);
Exit;
end;
if C_YarnQty.Text = '' then
begin
Application.MessageBox('<27><>ͷ<EFBFBD>Ʋ<EFBFBD><C6B2><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>', '<27><>ʾ', 0);
Exit;
end;
if GKBH.Text = '' then
begin
Application.MessageBox('<27><><EFBFBD>ر<EFBFBD><D8B1>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>', '<27><>ʾ', 0);
Exit;
end;
if C_ReedNo.Text = '' then
begin
Application.MessageBox('<27>غŲ<D8BA><C5B2><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>', '<27><>ʾ', 0);
Exit;
end;
if C_ReedWidth.Text = '' then
begin
Application.MessageBox('<27>ط<EFBFBD><D8B7><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>', '<27><>ʾ', 0);
Exit;
end;
if DCRQTY.Text = '' then
begin
Application.MessageBox('<27>ش<EFBFBD><D8B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>', '<27><>ʾ', 0);
Exit;
end;
if DAYQTY.Text = '' then
begin
Application.MessageBox('<27>ղ<EFBFBD><D5B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>', '<27><>ʾ', 0);
Exit;
end;
// with ADOQueryTemp do
// begin
// close;
// SQL.Clear;
// sql.Add('select * from Tat_Plan_Sub where C_Code = ' + QuotedStr(C_Code.Text));
// Open;
// end;
// if (ADOQueryTemp.RecordCount <> 0) and (FStatus = 0) then
// begin
// Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ظ<EFBFBD><D8B8><EFBFBD>', '<27><>ʾ', 0);
// Exit;
// end;
if SaveData() then
begin
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>', '<27><>ʾ', 0);
ModalResult := 1;
end;
end;
procedure TfrmTatPlanInPut.ToolButton7Click(Sender: TObject);
var
i, j: Integer;
begin
for j := 0 to 5 do
begin
i := CDS_QZ.RecordCount;
i := i + 1;
with CDS_QZ do
begin
Append;
FieldByName('SSEL').Value := FALSE;
FieldByName('XuNO').Value := i;
Post;
end;
end;
end;
procedure TfrmTatPlanInPut.ToolButton8Click(Sender: TObject);
begin
WriteCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƻ<EFBFBD><C6BB><EFBFBD>¼<EFBFBD><C2BC>11', Tv1, '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
WriteCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƻ<EFBFBD><C6BB><EFBFBD>¼<EFBFBD><C2BC>22', Tv2, '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
end;
procedure TfrmTatPlanInPut.ToolButton9Click(Sender: TObject);
begin
if CDS_QZ.IsEmpty then
exit;
if CDS_QZ.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_QZ.DisableControls;
with CDS_QZ do
begin
First;
while not Eof do
begin
if CDS_QZ.FieldByName('SSel').AsBoolean = True then
begin
if Trim(CDS_QZ.fieldbyname('QZID').AsString) <> '' then
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('delete PD_Plan_QZ where QZID=''' + Trim(CDS_QZ.fieldbyname('QZID').AsString) + '''');
ExecSQL;
end;
CDS_QZ.Delete;
end
else
Next;
end;
end;
CDS_QZ.EnableControls;
end;
procedure TfrmTatPlanInPut.TV1CellClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
var
AColumn: TcxGridColumn;
AFieldName: string;
begin
if Assigned(ACellViewInfo) then
begin
AColumn := ACellViewInfo.Item as TcxGridColumn;
AFieldName := AColumn.DataBinding.FilterFieldName;
if AFieldName = 'MeterQty' then
begin
TV1Column1.Styles.Header := DataLink_TatPlan.grid_head_blue;
TV1Column2.Styles.Header := DataLink_TatPlan.grid_head_blue;
TV1Column6.Styles.Header := DataLink_TatPlan.grid_head_blue;
TV1Column14.Styles.Header := DataLink_TatPlan.grid_head_blue;
C_YarnQty.Style.Color := clMoneyGreen;
end
else
begin
TV1Column1.Styles.Header := nil;
TV1Column2.Styles.Header := nil;
TV1Column6.Styles.Header := nil;
TV1Column14.Styles.Header := nil;
C_YarnQty.Style.Color := clWhite;
end;
end;
end;
procedure TfrmTatPlanInPut.TV1Column14PropertiesEditValueChanged(Sender: TObject);
var
mvalue, FFieldName: string;
ZS, ZGS: double;
begin
mvalue := TcxTextEdit(Sender).EditingText;
FFieldName := Trim(Tv1.Controller.FocusedColumn.DataBinding.FilterFieldName);
with CDS_1 do
begin
Edit;
FieldByName(FFieldName).Value := mvalue;
Post;
if FieldByName('QFYARNQTY').Value = null then
begin
ZGS := 0; //QUANFU<46><55><EFBFBD><EFBFBD>
end
else
begin
ZGS := FieldByName('QFYARNQTY').Value; //ȫ<><C8AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
end;
if FieldByName('Z_Number').Value = null then
begin
ZS := 0; //ѭ<><D1AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
end
else
begin
ZS := FieldByName('Z_Number').Value; //ѭ<><D1AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
end;
end;
if ZS <> 0 then
begin
with CDS_1 do
begin
Edit;
FieldByName('MeterQty').Value := roundfloat(ZGS * 0.059 / ZS * 1.08, 2);
Post;
end;
end;
end;
procedure TfrmTatPlanInPut.TV1Column1PropertiesEditValueChanged(Sender: TObject);
var
mvalue, FFieldName: string;
GS, ZGS, MF, DS, WM, TW, SUNHAO: double;
begin
mvalue := TcxTextEdit(Sender).EditingText;
FFieldName := Trim(Tv1.Controller.FocusedColumn.DataBinding.FilterFieldName);
with CDS_1 do
begin
Edit;
FieldByName(FFieldName).Value := mvalue;
Post;
if FieldByName('YarnQty').Value = null then
begin
GS := 0; //<2F><><EFBFBD><EFBFBD>
end
else
begin
GS := FieldByName('YarnQty').Value; //<2F><><EFBFBD><EFBFBD>
end;
if FieldByName('CycleYarnQty').Value = null then
begin
ZGS := 0; //ѭ<><D1AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
end
else
begin
ZGS := FieldByName('CycleYarnQty').Value; //ѭ<><D1AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
end;
if FieldByName('SH').Value = null then
begin
SUNHAO := 0; //<2F><><EFBFBD><EFBFBD>
end
else
begin
SUNHAO := FieldByName('SH').Value; //<2F><><EFBFBD><EFBFBD>
end;
MF := strtofloatdef(C_ReedWidth.text, 0); //<2F>ط<EFBFBD>
if FieldByName('TestDenier').Value = null then
begin
DS := 0; //D<><44>
end
else
begin
DS := FieldByName('TestDenier').Value; //D<><44>
end;
WM := strtofloatdef(C_FinishLatitudeDensity.text, 0); //γ<><CEB3>
TW := strtofloatdef(C_YarnQty.text, 0); //ͷ<><CDB7>
end;
if ZGS <> 0 then
begin
with CDS_1 do
begin
Edit;
FieldByName('MeterQty').Value := roundfloat(GS / ZGS * TW * DS * (1 + SUNHAO / 100) / 9000, 2);
Post;
end;
end;
JSKZ();
end;
procedure TfrmTatPlanInPut.Tv2CellClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
var
AColumn: TcxGridColumn;
AFieldName: string;
begin
if Assigned(ACellViewInfo) then
begin
AColumn := ACellViewInfo.Item as TcxGridColumn;
AFieldName := AColumn.DataBinding.FilterFieldName;
if AFieldName = 'MeterQty' then
begin
TV2Column1.Styles.Header := DataLink_TatPlan.grid_head_blue;
TV2Column2.Styles.Header := DataLink_TatPlan.grid_head_blue;
TV2Column6.Styles.Header := DataLink_TatPlan.grid_head_blue;
TV2Column14.Styles.Header := DataLink_TatPlan.grid_head_blue;
C_ReedWidth.Style.Color := clMoneyGreen;
C_FinishLatitudeDensity.Style.Color := clMoneyGreen;
end
else
begin
TV2Column1.Styles.Header := nil;
TV2Column2.Styles.Header := nil;
TV2Column6.Styles.Header := nil;
TV2Column14.Styles.Header := nil;
C_ReedWidth.Style.Color := clWhite;
C_FinishLatitudeDensity.Style.Color := clWhite;
end;
end;
end;
procedure TfrmTatPlanInPut.Tv2Column1PropertiesEditValueChanged(Sender: TObject);
var
mvalue, FFieldName: string;
GS, ZGS, MF, DS, WM, fsh: double;
begin
mvalue := TcxTextEdit(Sender).EditingText;
FFieldName := Trim(Tv2.Controller.FocusedColumn.DataBinding.FilterFieldName);
with CDS_2 do
begin
Edit;
FieldByName(FFieldName).Value := mvalue;
Post;
if FieldByName('YarnQty').Value = null then
begin
GS := 0; //<2F><><EFBFBD><EFBFBD>
end
else
begin
GS := FieldByName('YarnQty').Value; //<2F><><EFBFBD><EFBFBD>
end;
if FieldByName('Y_loss').Value = null then
begin
fsh := 0; //<2F><><EFBFBD><EFBFBD>
end
else
begin
fsh := FieldByName('Y_loss').Value; //<2F><><EFBFBD><EFBFBD>
end;
if FieldByName('CycleYarnQty').Value = null then
begin
ZGS := 0; //ѭ<><D1AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
end
else
begin
ZGS := FieldByName('CycleYarnQty').Value; //ѭ<><D1AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
end;
MF := strtofloatdef(C_ReedWidth.text, 0); //<2F>ط<EFBFBD>
if FieldByName('Z_Number').Value = null then
begin
DS := 0; //֧
end
else
begin
DS := FieldByName('Z_Number').Value; //֧<><D6A7>
end;
WM := strtofloatdef(C_FinishLatitudeDensity.text, 0); //γ<><CEB3>
end;
if (ZGS <> 0) and (DS <> 0) then
begin
with CDS_2 do
begin
Edit;
FieldByName('MeterQty').Value := roundfloat(WM * (MF + fsh) * 0.059 / DS * GS / ZGS * 1.08, 2);
Post;
end;
end;
JSKZ();
end;
procedure TfrmTatPlanInPut.cxButtonEdit1PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
begin
if (Trim(Self.C_Code.Text) = '') or (Trim(Self.C_Name.text) = '') then
begin
ShowMessage('<27><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7>Ϣ');
Exit;
end;
try
frmTatGYSel := TfrmTatGYSel.Create(Application);
with frmTatGYSel do
begin
C_Code.Text := Self.C_Code.Text;
C_Name.Text := Self.C_Name.Text;
if ShowModal = 1 then
begin
Self.orderno.Tag := 99;
Self.conno.Tag := 99;
// with ADOQueryTemp do
// begin
// Close;
// SQL.Clear;
// sql.Add('select * from Tat_Plan_Main A where A.MainId=''' + Trim(Self.GYNo.text) + '''');
// Open;
// end;
SCSHData(ADOQueryTemp, ScrollBox1, 0);
// Self.attname1.Text := Trim(ADOQueryTemp.FieldByName('attname1').AsString);
// Self.attname2.Text := Trim(ADOQueryTemp.FieldByName('attname2').AsString);
Self.CKF.Text := Trim(ADOQueryTemp.FieldByName('CKF').AsString);
// with ADOQueryTemp do
// begin
// Close;
// SQL.Clear;
// sql.Add('select * from Tat_Plan_Sub A where A.MainId=''' + Trim(Self.GYNo.text) + '''');
// Open;
// end;
SCSHData(ADOQueryTemp, ScrollBox1, 2);
Self.OrdQty.Text := Trim(ADOQueryTemp.FieldByName('OrdQty').AsString);
Self.OrdPiece.Text := Trim(ADOQueryTemp.FieldByName('OrdPiece').AsString);
Self.Y_Note_PLJ.Text := ADOQueryTemp.FieldByName('Y_Note_PLJ').AsString;
Self.Y_Note_PLW.Text := ADOQueryTemp.FieldByName('Y_Note_PLW').AsString;
// with ADOQueryTemp do
// begin
// Close;
// sql.Clear;
// sql.Add('select A.* from Tat_Plan_Yarn A ');
// sql.Add(' where YRType=''<27><>˿'' and A.MainId=''' + Trim(Self.GYNo.text) + '''');
// Open;
// end;
// SCreateCDS(ADOQueryTemp, self.CDS_1);
// SInitCDSData(ADOQueryTemp, self.CDS_1);
//
// with ADOQueryTemp do
// begin
// Close;
// sql.Clear;
// sql.Add('select A.* from Tat_Plan_Yarn A ');
// sql.Add(' where YRType=''γ˿'' and A.MainId=''' + Trim(Self.GYNo.text) + '''');
// Open;
// end;
// SCreateCDS(ADOQueryTemp, self.CDS_2);
// SInitCDSData(ADOQueryTemp, self.CDS_2);
// Self.OrderNo.text := '';
with self.CDS_1 do
begin
First;
while not Eof do
begin
Edit;
FieldByName('MainID').Value := '';
FieldByName('SubID').Value := '';
FieldByName('YRId').Value := '';
Post;
Next;
end;
end;
with self.CDS_2 do
begin
First;
while not Eof do
begin
Edit;
FieldByName('MainID').Value := '';
FieldByName('SubID').Value := '';
FieldByName('YRId').Value := '';
Post;
Next;
end;
end;
end;
end;
finally
frmTatGYSel.Free;
Self.orderno.Tag := 0;
Self.conno.Tag := 2;
end;
end;
procedure TfrmTatPlanInPut.cxGridDBColumn1PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
begin
try
frmYarnInfoSel := TfrmYarnInfoSel.Create(Application);
with frmYarnInfoSel do
begin
if ShowModal = 1 then
begin
with self.CDS_2 do
begin
Edit;
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;
Post;
end;
end;
end;
finally
frmYarnInfoSel.Free;
end;
end;
procedure TfrmTatPlanInPut.cxGridDBColumn3PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
begin
try
frmYarnInfoSel := TfrmYarnInfoSel.Create(Application);
with frmYarnInfoSel do
begin
if ShowModal = 1 then
begin
with self.CDS_1 do
begin
Edit;
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('FF').Value := frmYarnInfoSel.CDS_1.fieldbyname('FF').Value;
FieldByName('ND').Value := frmYarnInfoSel.CDS_1.fieldbyname('ND').Value;
FieldByName('Brand').Value := frmYarnInfoSel.CDS_1.fieldbyname('Brand').Value;
FieldByName('Y_Composition').Value := frmYarnInfoSel.CDS_1.fieldbyname('Y_Composition').Value;
FieldByName('TestDenier').Value := frmYarnInfoSel.CDS_1.fieldbyname('Denier').Value;
Post;
end;
JSJS();
JSWS();
JSKZ();
end;
end;
finally
frmYarnInfoSel.Free;
end;
end;
procedure TfrmTatPlanInPut.JSJS();
var
GS, ZGS, MF, DS, WM, TW: double;
begin
// if CDS_1.IsEmpty then
// exit;
// with CDS_1 do
// begin
// DisableControls;
// first;
// while not eof do
// begin
//
// with CDS_1 do
// begin
//
// if FieldByName('YarnQty').Value = null then
// begin
// GS := 0; //<2F><><EFBFBD><EFBFBD>
// end
// else
// begin
// GS := FieldByName('YarnQty').Value; //<2F><><EFBFBD><EFBFBD>
// end;
//
// if FieldByName('CycleYarnQty').Value = null then
// begin
// ZGS := 0; //ѭ<><D1AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// end
// else
// begin
// ZGS := FieldByName('CycleYarnQty').Value; //ѭ<><D1AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// end;
//
// MF := strtofloatdef(C_ReedWidth.text, 0); //<2F>ط<EFBFBD>
//
// TW := strtofloatdef(C_YarnQty.text, 0); //ͷ<><CDB7>
//
// if FieldByName('TestDenier').Value = null then
// begin
// DS := 0; //D<><44>
// end
// else
// begin
// DS := FieldByName('TestDenier').Value; //D<><44>
// end;
//
// WM := strtofloatdef(C_FinishLatitudeDensity.text, 0); //γ<><CEB3>
// end;
// if ZGS <> 0 then
// begin
// with CDS_1 do
// begin
// Edit;
// FieldByName('MeterQty').Value := roundfloat(GS / ZGS * TW * DS / 9000, 2);
// Post;
// end;
// end;
// next;
// end;
// First;
// EnableControls;
// end;
end;
procedure TfrmTatPlanInPut.JSWS();
var
GS, ZGS, MF, DS, WM: double;
begin
if CDS_2.IsEmpty then
exit;
// with CDS_2 do
// begin
// DisableControls;
// first;
// while not eof do
// begin
//
// with CDS_2 do
// begin
//
// if FieldByName('YarnQty').Value = null then
// begin
// GS := 0; //<2F><><EFBFBD><EFBFBD>
// end
// else
// begin
// GS := FieldByName('YarnQty').Value; //<2F><><EFBFBD><EFBFBD>
// end;
//
// if FieldByName('CycleYarnQty').Value = null then
// begin
// ZGS := 0; //ѭ<><D1AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// end
// else
// begin
// ZGS := FieldByName('CycleYarnQty').Value; //ѭ<><D1AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// end;
//
// MF := strtofloatdef(C_ReedWidth.text, 0); //<2F>ط<EFBFBD>
//
// if FieldByName('TestDenier').Value = null then
// begin
// DS := 0; //D<><44>
// end
// else
// begin
// DS := FieldByName('TestDenier').Value; //D<><44>
// end;
//
// WM := strtofloatdef(C_FinishLatitudeDensity.text, 0); //γ<><CEB3>
// end;
// if ZGS <> 0 then
// begin
// with CDS_2 do
// begin
// Edit;
// FieldByName('MeterQty').Value := roundfloat(GS / ZGS * MF * DS * WM / 9000, 2);
// Post;
// end;
// end;
// next;
// end;
// First;
// EnableControls;
// end;
end;
//procedure TfrmTatPlanInPut.JSKZ();
//var
// SumJS, SumWS: double;
//begin
// C_GramWeight.SetFocus;
//
// if Tv1.DataController.Summary.FooterSummaryValues[0] <> null then
// begin
// SumJS := Tv1.DataController.Summary.FooterSummaryValues[0];
// end
// else
// begin
// SumJS := 0;
// end;
//
// if Tv2.DataController.Summary.FooterSummaryValues[0] <> null then
// begin
// SumWS := Tv2.DataController.Summary.FooterSummaryValues[0];
// end
// else
// begin
// SumWS := 0;
// end;
//
// C_GramWeight.text := floattostr(roundfloat((SumJS + SumWS) / 3, 2));
//end;
//procedure TfrmTatPlanInPut.JSKZ();
//var
// SumJS, SumWS, ReedWidthValue: Double;
// ErrCode: Integer;
//begin
// C_GramWeight.SetFocus;
// SumJS := IfThen(VarIsNull(Tv1.DataController.Summary.FooterSummaryValues[0]),
// 0,
// Tv1.DataController.Summary.FooterSummaryValues[0]);
//
// SumWS := IfThen(VarIsNull(Tv2.DataController.Summary.FooterSummaryValues[0]),
// 0,
// Tv2.DataController.Summary.FooterSummaryValues[0]);
// Val(Trim(C_ReedWidth.Text), ReedWidthValue, ErrCode);
// if (ErrCode = 0) and (ReedWidthValue > 0) then
// C_GramWeight.Text := FormatFloat('0.00', (SumJS + SumWS) / ReedWidthValue)
// else
// C_GramWeight.Text := '0.00';
//end;
procedure TfrmTatPlanInPut.JSKZ();
var
SumJS, SumWS, ReedWidthValue: Double;
ErrCode: Integer;
IsInch: Boolean;
begin
C_GramWeight.SetFocus;
if Tv1.DataController.Summary.FooterSummaryValues[0] <> NULL then
begin
SumJS := IfThen(VarIsNull(Tv1.DataController.Summary.FooterSummaryValues[0]), 0, Tv1.DataController.Summary.FooterSummaryValues[0]);
end;
if Tv2.DataController.Summary.FooterSummaryValues[0] <> NULL then
begin
SumWS := IfThen(VarIsNull(Tv2.DataController.Summary.FooterSummaryValues[0]), 0, Tv2.DataController.Summary.FooterSummaryValues[0]);
end;
IsInch := ContainsText(C_ReedWidth.Text, '"');
Val(Trim(StringReplace(C_ReedWidth.Text, '"', '', [rfReplaceAll, rfIgnoreCase])), ReedWidthValue, ErrCode);
if (ErrCode = 0) and (ReedWidthValue > 0) then
begin
if IsInch then
begin
C_GramWeight.Text := FloatToStr(roundfloat(((SumJS + SumWS) / ReedWidthValue * 2.54 * 100), 0));
end
else
begin
C_GramWeight.Text := FloatToStr(roundfloat(((SumJS + SumWS) / ReedWidthValue * 100), 0));
end;
end
else
C_GramWeight.Text := '0.00';
end;
procedure TfrmTatPlanInPut.cxGridDBColumn4PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
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;
Post;
end;
end;
end;
finally
frmYarnInfoSel.Free;
end;
end;
procedure TfrmTatPlanInPut.v2Column10PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
begin
try
frmYarnInfoSel := TfrmYarnInfoSel.Create(Application);
with frmYarnInfoSel do
begin
if ShowModal = 1 then
begin
with self.CDS_2 do
begin
Edit;
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('FF').Value := frmYarnInfoSel.CDS_1.fieldbyname('FF').Value;
FieldByName('ND').Value := frmYarnInfoSel.CDS_1.fieldbyname('ND').Value;
FieldByName('Brand').Value := frmYarnInfoSel.CDS_1.fieldbyname('Brand').Value;
FieldByName('Y_Composition').Value := frmYarnInfoSel.CDS_1.fieldbyname('Y_Composition').Value;
FieldByName('TestDenier').Value := frmYarnInfoSel.CDS_1.fieldbyname('Denier').Value;
Post;
end;
JSJS();
JSWS();
JSKZ();
end;
end;
finally
frmYarnInfoSel.Free;
end;
end;
procedure TfrmTatPlanInPut.v2Column11PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
begin
try
frmCompanySel := TfrmCompanySel.Create(Application);
with frmCompanySel do
begin
if ShowModal = 1 then
begin
with Self.CDS_1 do
begin
Edit;
FieldByName('GYSName').Value := Trim(CDS_1.fieldbyname('CoName').AsString);
end;
end;
end;
finally
frmCompanySel.Free;
end;
end;
procedure TfrmTatPlanInPut.WB_CodePropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
begin
try
frmWBSpecSel := TfrmWBSpecSel.Create(Application);
with frmWBSpecSel do
begin
if ShowModal = 1 then
begin
Self.WB_Code.Text := Trim(frmWBSpecSel.CDS_1.fieldbyname('WB_Code').AsString);
Self.WB_Name.Text := Trim(frmWBSpecSel.CDS_1.fieldbyname('WB_Name').AsString);
Self.C_YarnQty.Text := Trim(frmWBSpecSel.CDS_1.fieldbyname('WB_YarnQty').AsString);
Self.C_ReedNo.Text := Trim(frmWBSpecSel.CDS_1.fieldbyname('WB_ReedNo').AsString);
Self.C_ReedWidth.Text := Trim(frmWBSpecSel.CDS_1.fieldbyname('WB_Width').AsString);
DCRQTY.Text := Trim(frmWBSpecSel.CDS_1.fieldbyname('DCRQTY').AsString);
C_KCQTY.Text := Trim(frmWBSpecSel.CDS_1.fieldbyname('C_KCQTY').AsString);
WB_ReedNote.Text := Trim(frmWBSpecSel.CDS_1.fieldbyname('WB_ReedNote').AsString);
BSQTY.Text := Trim(frmWBSpecSel.CDS_1.fieldbyname('BSQTY').AsString);
GKBH.Text := Trim(frmWBSpecSel.CDS_1.fieldbyname('GKBH').AsString);
Self.Y_Note_PLJ.Text := Trim(frmWBSpecSel.CDS_1.fieldbyname('WB_YarnArrNote').AsString);
with ADOQuery1 do
begin
Close;
sql.Clear;
sql.Add(' select * from Tat_WB_Formula ');
sql.Add(' where WBSID=''' + Trim(frmWBSpecSel.CDS_1.fieldbyname('WBSID').AsString) + '''');
sql.Add(' Order by RowNo ');
Open;
end;
self.CDS_1.EmptyDataSet;
self.ADOQuery1.First;
while not ADOQuery1.eof do
begin
with self.CDS_1 do
begin
APpend;
FieldByName('RowNo').Value := ADOQuery1.fieldbyname('RowNo').Value;
FieldByName('Y_Code').Value := ADOQuery1.fieldbyname('Y_Code').Value;
FieldByName('Y_Name').Value := ADOQuery1.fieldbyname('Y_Name').Value;
FieldByName('Y_Color').Value := ADOQuery1.fieldbyname('Y_Color').Value;
FieldByName('Y_Spec').Value := ADOQuery1.fieldbyname('Y_Spec').Value;
FieldByName('YarnQty').Value := ADOQuery1.fieldbyname('YarnQty').Value;
FieldByName('CycleYarnQty').Value := ADOQuery1.fieldbyname('CycleYarnQty').Value;
FieldByName('TestDenier').Value := ADOQuery1.fieldbyname('Denier').Value;
FieldByName('FF').Value := ADOQuery1.fieldbyname('FF').Value;
FieldByName('ND').Value := ADOQuery1.fieldbyname('ND').Value;
Post;
end;
ADOQuery1.next;
end;
JSJS();
JSWS();
JSKZ();
end;
end;
finally
frmWBSpecSel.Free;
end;
end;
//procedure TfrmTatPlanInPut.OrdPieceLenChange(Sender: TObject);
//var
// FOrdQty, FOrdPieceLen: Double;
//begin
// FOrdQty := StrToFloatDef(OrdQty.Text, 0);
// FOrdPieceLen := StrToFloatDef(OrdPieceLen.Text, 0);
// if FOrdPieceLen > 0 then
// OrdPiece.Text := IntToStr(Ceil(FOrdQty / FOrdPieceLen));
//end;
//
//procedure TfrmTatPlanInPut.OrdPieceChange(Sender: TObject);
//var
// FOrdQty, FOrdPieceLen, FOrdPiece: Double;
//begin
// FOrdPieceLen := StrToFloatDef(OrdPieceLen.Text, 0);
// FOrdPiece := StrToFloatDef(OrdPiece.Text, 0);
// if FOrdPiece > 0 then
// OrdQty.Text := FloatToStr(FOrdPieceLen * FOrdPiece)
// else
// OrdQty.Text := '0';
//end;
//
//procedure TfrmTatPlanInPut.OrdPiecePropertiesEditValueChanged(Sender: TObject);
//begin
// OrdQty.text := floattostr(strtofloatdef(OrdPiece.text, 0) * strtofloatdef(OrdPieceLen.text, 0));
//end;
procedure TfrmTatPlanInPut.OrdQtyPropertiesChange(Sender: TObject); //zong shu liang
begin
//UpdateCalculations(Sender);
end;
procedure TfrmTatPlanInPut.OurCoNameDblClick(Sender: TObject);
begin
TcxButtonEdit(Sender).Properties.LookupItems.Text := '';
TcxButtonEdit(Sender).Text := '';
end;
procedure TfrmTatPlanInPut.C_CODEDblClick(Sender: TObject);
begin
C_CODE.Text := '';
end;
procedure TfrmTatPlanInPut.C_CodeKeyPress(Sender: TObject; var Key: Char);
begin
if Key = #13 then
begin
Key := #0;
SelectNext(ActiveControl as TWinControl, True, True);
end;
end;
procedure TfrmTatPlanInPut.C_CodePropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
begin
try
frmTatClothInfoSel := TfrmTatClothInfoSel.Create(Application);
with frmTatClothInfoSel do
begin
if ShowModal = 1 then
begin
InitClothYarn(frmTatClothInfoSel.CDS_1.fieldbyname('C_Code').AsString);
Initexcel();
end;
end;
finally
frmTatClothInfoSel.Free;
end;
end;
procedure TfrmTatPlanInPut.C_ReedWidthExit(Sender: TObject);
var
mvalue, FFieldName: string;
GS, ZGS, MF, DS, WM, fsh: double;
begin
with CDS_2 do
begin
first;
while not eof do
begin
with CDS_2 do
begin
if FieldByName('YarnQty').Value = null then
begin
GS := 0; //<2F><><EFBFBD><EFBFBD>
end
else
begin
GS := FieldByName('YarnQty').Value; //<2F><><EFBFBD><EFBFBD>
end;
if FieldByName('Y_loss').Value = null then
begin
fsh := 0; //<2F><><EFBFBD><EFBFBD>
end
else
begin
fsh := FieldByName('Y_loss').Value; //<2F><><EFBFBD><EFBFBD>
end;
if FieldByName('CycleYarnQty').Value = null then
begin
ZGS := 0; //ѭ<><D1AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
end
else
begin
ZGS := FieldByName('CycleYarnQty').Value; //ѭ<><D1AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
end;
MF := strtofloatdef(C_ReedWidth.text, 0); //<2F>ط<EFBFBD>
if FieldByName('Z_Number').Value = null then
begin
DS := 0; //֧
end
else
begin
DS := FieldByName('Z_Number').Value; //֧<><D6A7>
end;
WM := strtofloatdef(C_FinishLatitudeDensity.text, 0); //γ<><CEB3>
end;
if (ZGS <> 0) and (DS <> 0) then
begin
with CDS_2 do
begin
Edit;
FieldByName('MeterQty').Value := roundfloat(WM * (MF + fsh) * 0.059 / DS * GS / ZGS * 1.08, 2);
Post;
end;
end;
next;
end;
end;
end;
procedure TfrmTatPlanInPut.C_YarnQtyPropertiesEditValueChanged(Sender: TObject);
begin
JSJS();
JSWS();
JSKZ();
end;
procedure TfrmTatPlanInPut.Edit1KeyPress(Sender: TObject; var Key: Char);
var
i, j: Integer;
begin
// if Key = #13 then
// begin
//
// if Edit1.Text <> '' then
// begin
// i := CDS_QZ.RecordCount;
// i := i + 1;
// with CDS_QZ do
// begin
// Append;
// FieldByName('SSEL').Value := FALSE;
// FieldByName('XuNO').Value := i;
// FieldByName('DZZQZGL').Value := Trim(Edit1.Text);
// Post;
// end;
// Edit1.Text := '';
// end;
//
// end;
end;
procedure TfrmTatPlanInPut.MCTypeBtnUpClick(Sender: TObject);
var
fsj: string;
FWZ: Integer;
begin
fsj := Trim(TBtnEditC(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
TBtnEditC(Sender).Text := Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
end;
end;
finally
frmZDYHelp.Free;
end;
end;
procedure TfrmTatPlanInPut.ConNoKeyPress(Sender: TObject; var Key: Char);
begin
if Key = #13 then
begin
Key := #0;
SelectNext(ActiveControl as TWinControl, True, True);
end;
end;
procedure TfrmTatPlanInPut.ConNoPropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
var
FConMainId, FMPRTCode: string;
begin
try
frmTradeSalesContractSel := TfrmTradeSalesContractSel.Create(Application);
with frmTradeSalesContractSel do
begin
fconNo := self.ConNo.Text;
fC_Code := self.C_Code.Text;
FLX := '<27><>֯<EFBFBD><D6AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
if ShowModal = 1 then
begin
self.CustName.Properties.LookupItems.Text := Trim(frmTradeSalesContractSel.CDS_1.fieldbyname('BuyNo').AsString);
self.CustName.Text := Trim(frmTradeSalesContractSel.CDS_1.fieldbyname('BuyName').AsString);
self.ConNo.Text := Trim(frmTradeSalesContractSel.CDS_1.fieldbyname('ConNo').AsString);
self.ConMId.Text := Trim(frmTradeSalesContractSel.CDS_1.fieldbyname('ConMId').AsString);
self.ConSId.Text := Trim(frmTradeSalesContractSel.CDS_1.fieldbyname('ConSId').AsString);
self.C_Code.Text := Trim(frmTradeSalesContractSel.CDS_1.fieldbyname('C_Code').AsString);
self.C_Width.Text := Trim(frmTradeSalesContractSel.CDS_1.fieldbyname('C_Width').AsString);
self.C_GramWeight.Text := Trim(frmTradeSalesContractSel.CDS_1.fieldbyname('C_GramWeight').AsString);
self.C_Color.Text := Trim(frmTradeSalesContractSel.CDS_1.fieldbyname('C_Color').AsString);
self.OrdQty.Text := Trim(frmTradeSalesContractSel.CDS_1.fieldbyname('ConQty').AsString);
InitClothYarn(frmTradeSalesContractSel.CDS_1.fieldbyname('C_Code').AsString);
Initexcel();
end;
end;
finally
frmTradeSalesContractSel.Free;
end;
end;
procedure TfrmTatPlanInPut.CustNamePropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
begin
try
frmCompanySel := TfrmCompanySel.Create(Application);
with frmCompanySel do
begin
FCoType := '<27>ͻ<EFBFBD>';
if ShowModal = 1 then
begin
CustName.Properties.LookupItems.Text := Trim(CDS_1.fieldbyname('CoCode').AsString);
CustName.Text := Trim(CDS_1.fieldbyname('CoAbbrName').AsString);
end;
end;
finally
frmCompanySel.Free;
end;
end;
end.