494 lines
14 KiB
ObjectPascal
494 lines
14 KiB
ObjectPascal
|
unit U_DyeGreyClothInEdit;
|
|||
|
|
|||
|
interface
|
|||
|
|
|||
|
uses
|
|||
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|||
|
Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData, cxDataStorage,
|
|||
|
cxEdit, DB, cxDBData, cxCalendar, cxDropDownEdit, ComCtrls, ToolWin,
|
|||
|
cxGridLevel, cxGridCustomTableView, cxGridTableView, cxGridDBTableView,
|
|||
|
cxClasses, cxControls, cxGridCustomView, cxGrid, cxGridCustomPopupMenu,
|
|||
|
cxGridPopupMenu, ADODB, DBClient, cxButtonEdit, cxTextEdit, StdCtrls, ExtCtrls,
|
|||
|
cxLookAndFeels, cxLookAndFeelPainters, cxNavigator, dxSkinsCore,
|
|||
|
dxSkinsDefaultPainters, dxDateRanges, dxBarBuiltInMenu, U_BaseInput,
|
|||
|
System.ImageList, Vcl.ImgList;
|
|||
|
|
|||
|
type
|
|||
|
TfrmDyeGreyClothInEdit = class(TfrmBaseInput)
|
|||
|
cxGrid2: TcxGrid;
|
|||
|
Tv1: TcxGridDBTableView;
|
|||
|
v1Column2: TcxGridDBColumn;
|
|||
|
v1SPName: TcxGridDBColumn;
|
|||
|
v2Column6: TcxGridDBColumn;
|
|||
|
cxGrid2Level1: TcxGridLevel;
|
|||
|
ToolBar1: TToolBar;
|
|||
|
TBAdd: TToolButton;
|
|||
|
TBDel: TToolButton;
|
|||
|
TBSave: TToolButton;
|
|||
|
TBClose: TToolButton;
|
|||
|
v1Column4: TcxGridDBColumn;
|
|||
|
DataSource3: TDataSource;
|
|||
|
CDS_Sub: TClientDataSet;
|
|||
|
ADOQueryCmd: TADOQuery;
|
|||
|
ADOQueryMain: TADOQuery;
|
|||
|
ADOQueryTemp: TADOQuery;
|
|||
|
cxGridPopupMenu2: TcxGridPopupMenu;
|
|||
|
v1Column12: TcxGridDBColumn;
|
|||
|
v1FactoryName: TcxGridDBColumn;
|
|||
|
v1Column6: TcxGridDBColumn;
|
|||
|
v1SPSpec: TcxGridDBColumn;
|
|||
|
v1QtyUnit: TcxGridDBColumn;
|
|||
|
v1Column5: TcxGridDBColumn;
|
|||
|
v1Column1: TcxGridDBColumn;
|
|||
|
v1SPMF: TcxGridDBColumn;
|
|||
|
v1Column8: TcxGridDBColumn;
|
|||
|
v1Column9: TcxGridDBColumn;
|
|||
|
v1Column7: TcxGridDBColumn;
|
|||
|
v1YWY: TcxGridDBColumn;
|
|||
|
Tv1Column3: TcxGridDBColumn;
|
|||
|
Tv1Column5: TcxGridDBColumn;
|
|||
|
Tv1Column8: TcxGridDBColumn;
|
|||
|
Tv1Column1: TcxGridDBColumn;
|
|||
|
Tv1Column2: TcxGridDBColumn;
|
|||
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
procedure TBAddClick(Sender: TObject);
|
|||
|
procedure TBCloseClick(Sender: TObject);
|
|||
|
procedure FormShow(Sender: TObject);
|
|||
|
procedure TBDelClick(Sender: TObject);
|
|||
|
procedure TBSaveClick(Sender: TObject);
|
|||
|
procedure v1Column14PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|||
|
procedure v2Column1PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|||
|
procedure v1Column5PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|||
|
procedure v1Column8PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|||
|
procedure v2Column6PropertiesEditValueChanged(Sender: TObject);
|
|||
|
procedure Tv1Column1PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|||
|
private
|
|||
|
{ Private declarations }
|
|||
|
function SaveCKData(): Boolean;
|
|||
|
public
|
|||
|
{ Public declarations }
|
|||
|
FWorkshop, FBCId, canshu3, FSTKName, FKHName: string;
|
|||
|
end;
|
|||
|
|
|||
|
var
|
|||
|
frmDyeGreyClothInEdit: TfrmDyeGreyClothInEdit;
|
|||
|
|
|||
|
implementation
|
|||
|
|
|||
|
uses
|
|||
|
U_DataLink, U_RTFun, U_ZDYHelp, U_DyePlanCardSel, U_CompanySel;
|
|||
|
|
|||
|
{$R *.dfm}
|
|||
|
|
|||
|
procedure TfrmDyeGreyClothInEdit.FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
begin
|
|||
|
inherited;
|
|||
|
Action := caFree;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDyeGreyClothInEdit.TBAddClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if CDS_Sub.IsEmpty = False then
|
|||
|
begin
|
|||
|
CopyAddRowCDS(CDS_Sub);
|
|||
|
with CDS_Sub do
|
|||
|
begin
|
|||
|
Edit;
|
|||
|
FieldByName('BCIOID').Value := null;
|
|||
|
FieldByName('StkCoNo').Value := '<27><><EFBFBD><EFBFBD><EFBFBD>ֿ<EFBFBD>';
|
|||
|
FieldByName('StkCoName').Value := '<27><><EFBFBD><EFBFBD><EFBFBD>ֿ<EFBFBD>';
|
|||
|
post;
|
|||
|
end;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
with CDS_Sub do
|
|||
|
begin
|
|||
|
Append;
|
|||
|
FieldByName('IOTime').Value := Trim(FormatDateTime('yyyy-MM-dd', Now));
|
|||
|
FieldByName('StkCoNo').Value := '<27><><EFBFBD><EFBFBD><EFBFBD>ֿ<EFBFBD>';
|
|||
|
FieldByName('StkCoName').Value := '<27><><EFBFBD><EFBFBD><EFBFBD>ֿ<EFBFBD>';
|
|||
|
FieldByName('QtyUnit').Value := 'KG';
|
|||
|
Post;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
function TfrmDyeGreyClothInEdit.SaveCKData(): Boolean;
|
|||
|
var
|
|||
|
Maxno, MBCIOID: string;
|
|||
|
begin
|
|||
|
try
|
|||
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
CDS_Sub.DisableControls;
|
|||
|
with CDS_Sub do
|
|||
|
begin
|
|||
|
First;
|
|||
|
while not eof do
|
|||
|
begin
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from BS_Cloth_IO where BCIOID=''' + Trim(CDS_Sub.fieldbyname('BCIOID').AsString) + '''');
|
|||
|
open;
|
|||
|
end;
|
|||
|
MBCIOID := Trim(ADOQueryTemp.fieldbyname('BCIOID').AsString);
|
|||
|
if Trim(MBCIOID) = '' then
|
|||
|
begin
|
|||
|
if not GetLSNo(ADOQueryCmd, Maxno, 'PR', 'BS_Cloth_IO', 3, 1) then
|
|||
|
raise Exception.Create('ȡȾɫ<C8BE><C9AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>');
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
Maxno := Trim(MBCIOID);
|
|||
|
end;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from BS_Cloth_IO where BCIOID=''' + Trim(Maxno) + '''');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
if Trim(MBCIOID) = '' then
|
|||
|
begin
|
|||
|
Append;
|
|||
|
FieldByName('Fillid').Value := Trim(Dcode);
|
|||
|
FieldByName('Filler').Value := Trim(DName);
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
Edit;
|
|||
|
FieldByName('Editid').Value := Trim(Dcode);
|
|||
|
FieldByName('Editer').Value := Trim(DName);
|
|||
|
FieldByName('EditTime').Value := SGetServerDate(ADOQueryTemp);
|
|||
|
end;
|
|||
|
RTSetSaveDataCDS(ADOQueryCmd, Tv1, CDS_Sub, 'BS_Cloth_IO', 0);
|
|||
|
FieldByName('FromCoNo').Value := CDS_Sub.fieldbyname('FromCoNo').Value;
|
|||
|
FieldByName('StkCoNo').Value := CDS_Sub.fieldbyname('StkCoNo').Value;
|
|||
|
FieldByName('BCIOID').Value := Trim(Maxno);
|
|||
|
FieldByName('STKID').Value := Trim(Maxno);
|
|||
|
FieldByName('STKName').Value := FSTKName;
|
|||
|
FieldByName('Workshop').Value := FWorkshop;
|
|||
|
FieldByName('IOFlag').Value := '<27><><EFBFBD><EFBFBD>';
|
|||
|
FieldByName('IOQtyFlag').Value := 1;
|
|||
|
Post;
|
|||
|
end;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('Update BS_Cloth_IO Set StkPiece=(select Sum(isnull(Piece,0)*IOQtyFlag) from BS_Cloth_IO A where A.STKID=BS_Cloth_IO.BCIOID )');
|
|||
|
sql.Add(',StkQty=(select Sum(isnull(Qty,0)*IOQtyFlag) from BS_Cloth_IO A where A.STKID=BS_Cloth_IO.BCIOID )');
|
|||
|
sql.Add(' where BCIOID=''' + Trim(Maxno) + '''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select stkQty,StkPiece from BS_Cloth_IO where BCIOID=''' + Trim(Maxno) + '''');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
if ADOQueryTemp.FieldByName('stkQty').Value < 0 then
|
|||
|
raise Exception.Create('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С<EFBFBD>ڳ<EFBFBD><DAB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܱ<EFBFBD><DCB1><EFBFBD>!');
|
|||
|
if ADOQueryTemp.FieldByName('StkPiece').Value < 0 then
|
|||
|
raise Exception.Create('<27><><EFBFBD><EFBFBD>ƥ<EFBFBD><C6A5>С<EFBFBD>ڳ<EFBFBD><DAB3><EFBFBD>ƥ<EFBFBD><C6A5><EFBFBD><EFBFBD><EFBFBD>ܱ<EFBFBD><DCB1><EFBFBD>!');
|
|||
|
|
|||
|
Edit;
|
|||
|
FieldByName('BCIOID').Value := Trim(Maxno);
|
|||
|
Post;
|
|||
|
Next;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
CDS_Sub.EnableControls;
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
|
|||
|
Result := True;
|
|||
|
except
|
|||
|
Result := False;
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDyeGreyClothInEdit.TBCloseClick(Sender: TObject);
|
|||
|
begin
|
|||
|
WriteCxGrid(FSTKName + '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ǽ<EFBFBD>ZP', Tv1, '<27><><EFBFBD><EFBFBD><EFBFBD>ϲֿ<CFB2>');
|
|||
|
Close;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDyeGreyClothInEdit.FormShow(Sender: TObject);
|
|||
|
var
|
|||
|
fsj: string;
|
|||
|
begin
|
|||
|
inherited;
|
|||
|
ReadCxGrid(FSTKName + '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ǽ<EFBFBD>ZP', Tv1, '<27><><EFBFBD><EFBFBD><EFBFBD>ϲֿ<CFB2>');
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add(' select A.* ');
|
|||
|
sql.Add(' from BS_Cloth_IO A');
|
|||
|
sql.Add(' where BCIOID=''' + Trim(FBCId) + '''');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS(ADOQueryTemp, CDS_Sub);
|
|||
|
SInitCDSData(ADOQueryTemp, CDS_Sub);
|
|||
|
// fsj := 'select name=CJName ,Code=null from CheJian';
|
|||
|
// SInitCxGridComboBoxBySql(ADOQueryTemp, v1Column7, fsj, 0, True, '');
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDyeGreyClothInEdit.TBDelClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if CDS_Sub.IsEmpty then
|
|||
|
Exit;
|
|||
|
if Trim(CDS_Sub.fieldbyname('BCIOID').AsString) <> '' then
|
|||
|
begin
|
|||
|
if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
|||
|
Exit;
|
|||
|
|
|||
|
try
|
|||
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
Sql.Clear;
|
|||
|
Sql.Add('exec P_BS_Cloth_In_Del ');
|
|||
|
Sql.Add(' @BCIOIDS=' + quotedstr(Trim(CDS_Sub.fieldbyname('BCIOID').AsString)));
|
|||
|
Sql.Add(',@DCode=' + quotedstr(Trim(DCode)));
|
|||
|
Sql.Add(',@DName=' + quotedstr(Trim(DName)));
|
|||
|
Open;
|
|||
|
end;
|
|||
|
if ADOQueryCmd.FieldByName('intReturn').AsInteger = -1 then
|
|||
|
raise Exception.Create(pchar(trim(ADOQueryCmd.FieldByName('ShowMsg').AsString)));
|
|||
|
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
CDS_Sub.Delete;
|
|||
|
except
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
end;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
CDS_Sub.Delete;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDyeGreyClothInEdit.TBSaveClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if CDS_Sub.IsEmpty then
|
|||
|
Exit;
|
|||
|
if CDS_Sub.Locate('IOTime', null, []) = True then
|
|||
|
begin
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD>ʱ<EFBFBD>䲻<EFBFBD><E4B2BB>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
if CDS_Sub.Locate('IOType', null, []) = True then
|
|||
|
begin
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ͳ<EFBFBD><CDB2><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
if CDS_Sub.Locate('C_Name', null, []) = True then
|
|||
|
begin
|
|||
|
Application.MessageBox('Ʒ<><C6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
|
|||
|
if CDS_Sub.Locate('Piece', null, []) = True then
|
|||
|
begin
|
|||
|
Application.MessageBox('ƥ<><C6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
{if CDS_Sub.Locate('Qty',null,[])=True then
|
|||
|
begin
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!','<27><>ʾ',0);
|
|||
|
Exit;
|
|||
|
end; }
|
|||
|
if CDS_Sub.Locate('QtyUnit', null, []) = True then
|
|||
|
begin
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
{if CDS_Sub.Locate('CRType;LCKNO', VarArrayOf(['<27>ز<EFBFBD>', Null]), [loPartialKey]) then
|
|||
|
begin
|
|||
|
Application.MessageBox('<27>زֵ<D8B2><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̿<EFBFBD><CCBF>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD><CEAA>!','<27><>ʾ',0);
|
|||
|
Exit;
|
|||
|
end; }
|
|||
|
if SaveCKData() then
|
|||
|
begin
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
//ModalResult:=1;
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDyeGreyClothInEdit.Tv1Column1PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|||
|
begin
|
|||
|
try
|
|||
|
frmCompanySel := TfrmCompanySel.Create(Application);
|
|||
|
with frmCompanySel do
|
|||
|
begin
|
|||
|
FCoType := '<27>ͻ<EFBFBD>';
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
with Self.CDS_Sub do
|
|||
|
begin
|
|||
|
Edit;
|
|||
|
FieldByName('StkCoNo').Value := Trim(CDS_1.fieldbyname('CoCode').AsString);
|
|||
|
FieldByName('StkCoName').Value := Trim(CDS_1.fieldbyname('CoAbbrName').AsString);
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmCompanySel.Free;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDyeGreyClothInEdit.v1Column14PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|||
|
begin
|
|||
|
|
|||
|
try
|
|||
|
frmCompanySel := TfrmCompanySel.Create(Application);
|
|||
|
with frmCompanySel do
|
|||
|
begin
|
|||
|
FCoType := '<27>ͻ<EFBFBD>';
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
with Self.CDS_Sub do
|
|||
|
begin
|
|||
|
Edit;
|
|||
|
FieldByName('FromCoNo').Value := Trim(CDS_1.fieldbyname('CoCode').AsString);
|
|||
|
FieldByName('FromCoName').Value := Trim(CDS_1.fieldbyname('CoAbbrName').AsString);
|
|||
|
|
|||
|
FieldByName('SalesER').Value := Trim(CDS_1.fieldbyname('SalesER').AsString);
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmCompanySel.Free;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDyeGreyClothInEdit.v2Column1PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|||
|
begin
|
|||
|
try
|
|||
|
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
|||
|
with frmZDYHelp do
|
|||
|
begin
|
|||
|
flag := 'JWLYCLName';
|
|||
|
flagname := 'Ʒ<><C6B7>';
|
|||
|
MainType := FSTKName;
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
with Self.CDS_Sub do
|
|||
|
begin
|
|||
|
Edit;
|
|||
|
FieldByName('C_Name').Value := Trim(frmZDYHelp.ClientDataSet1.fieldbyname('ZdyName').AsString);
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmZDYHelp.Free;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDyeGreyClothInEdit.v2Column6PropertiesEditValueChanged(Sender: TObject);
|
|||
|
var
|
|||
|
mvalue, FFieldName: string;
|
|||
|
FPS, FQty, FPiZhong: Double;
|
|||
|
begin
|
|||
|
mvalue := TcxTextEdit(Sender).EditingText;
|
|||
|
FFieldName := Trim(Tv1.Controller.FocusedColumn.DataBinding.FilterFieldName);
|
|||
|
if Trim(mvalue) = '' then
|
|||
|
begin
|
|||
|
mvalue := '0';
|
|||
|
end;
|
|||
|
|
|||
|
with CDS_Sub do
|
|||
|
begin
|
|||
|
Edit;
|
|||
|
FieldByName(FFieldName).Value := mvalue;
|
|||
|
Post;
|
|||
|
FPS := CDS_Sub.fieldbyname('Piece').AsFloat;
|
|||
|
FQty := CDS_Sub.fieldbyname('Qty').AsFloat;
|
|||
|
FPiZhong := CDS_Sub.fieldbyname('PieceWeight').AsFloat;
|
|||
|
end;
|
|||
|
|
|||
|
if Trim(FFieldName) <> 'PieceWeight' then
|
|||
|
begin
|
|||
|
if FPS = 0 then
|
|||
|
FPiZhong := FQty / 1
|
|||
|
else
|
|||
|
FPiZhong := FQty / FPS;
|
|||
|
end;
|
|||
|
|
|||
|
with CDS_Sub do
|
|||
|
begin
|
|||
|
Edit;
|
|||
|
FieldByName('PieceWeight').Value := FPiZhong;
|
|||
|
Post;
|
|||
|
end;
|
|||
|
|
|||
|
tv1.Controller.EditingController.ShowEdit();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDyeGreyClothInEdit.v1Column5PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|||
|
begin
|
|||
|
try
|
|||
|
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
|||
|
with frmZDYHelp do
|
|||
|
begin
|
|||
|
flag := 'StkPosition';
|
|||
|
flagname := '<27><>λ';
|
|||
|
MainType := FSTKName;
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
with Self.CDS_Sub do
|
|||
|
begin
|
|||
|
Edit;
|
|||
|
FieldByName('StkPosition').Value := Trim(frmZDYHelp.ClientDataSet1.fieldbyname('ZdyName').AsString);
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmZDYHelp.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDyeGreyClothInEdit.v1Column8PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|||
|
begin
|
|||
|
try
|
|||
|
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
|||
|
with frmZDYHelp do
|
|||
|
begin
|
|||
|
flag := 'C_Spec';
|
|||
|
flagname := '<27><><EFBFBD><EFBFBD>';
|
|||
|
MainType := FSTKName;
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
with Self.CDS_Sub do
|
|||
|
begin
|
|||
|
Edit;
|
|||
|
FieldByName('C_Spec').Value := Trim(frmZDYHelp.ClientDataSet1.fieldbyname('ZdyName').AsString);
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmZDYHelp.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
end.
|
|||
|
|