D10SZKaiXiYa/E02梭织经轴仓库/U_WBSpecInPut.pas
2025-11-24 09:47:43 +08:00

1070 lines
27 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_WBSpecInPut;
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, dxDateRanges,
dxBarBuiltInMenu, U_BaseInput, U_BaseList, System.ImageList, Vcl.ImgList,
cxMemo, dxScrollbarAnnotations, cxContainer, dxSkinsCore,
dxSkinsDefaultPainters, cxImageList, dxSkinOffice2013White, dxSkinSharpPlus,
dxSkinWXI, cxMaskEdit, cxGroupBox, MATH, Vcl.Menus;
type
TfrmWBSpecInPut = class(TfrmBaseInput)
cxGrid1: TcxGrid;
Tv1: TcxGridDBTableView;
v1SPName: TcxGridDBColumn;
cxGrid1Level1: TcxGridLevel;
ToolBar1: TToolBar;
TBSave: TToolButton;
TBClose: TToolButton;
DS_1: TDataSource;
CDS_Sub: TClientDataSet;
ADOQueryCmd: TADOQuery;
ADOQueryMain: TADOQuery;
ADOQueryTemp: TADOQuery;
GPM_1: TcxGridPopupMenu;
v1Column12: TcxGridDBColumn;
v1SPSpec: TcxGridDBColumn;
v1Column1: TcxGridDBColumn;
v1Column18: TcxGridDBColumn;
v1Column10: TcxGridDBColumn;
v1Column15: TcxGridDBColumn;
v1Column3: TcxGridDBColumn;
ToolButton1: TToolButton;
Tv1Column1: TcxGridDBColumn;
ScrollBox1: TScrollBox;
Label3: TLabel;
WB_Code: TcxTextEdit;
ToolBar2: TToolBar;
ToolButton3: TToolButton;
ToolButton4: TToolButton;
Label8: TLabel;
WB_YarnQty: TcxTextEdit;
Tv1Column2: TcxGridDBColumn;
Label1: TLabel;
Label2: TLabel;
WB_Name: TcxTextEdit;
WB_ReedNote: TcxTextEdit;
Label5: TLabel;
BSQTY: TcxTextEdit;
Label10: TLabel;
WB_ReedNo: TcxTextEdit;
Label12: TLabel;
C_KCQTY: TcxTextEdit;
Tv1Column3: TcxGridDBColumn;
btn1: TToolButton;
Tv1Column4: TcxGridDBColumn;
Tv1Column6: TcxGridDBColumn;
Tv1Column7: TcxGridDBColumn;
Label18: TLabel;
ISSizing: TcxComboBox;
Tv1Column8: TcxGridDBColumn;
Label19: TLabel;
GKBH: TcxButtonEdit;
Tv1Column9: TcxGridDBColumn;
Label20: TLabel;
WB_TYPE: TcxComboBox;
Label4: TLabel;
WB_Width: TcxTextEdit;
cxGroupBox1: TcxGroupBox;
Label6: TLabel;
F_MAXKESHU: TcxTextEdit;
Label7: TLabel;
F_YarnStripQty: TcxTextEdit;
Label9: TLabel;
F_SJKESHU: TcxTextEdit;
Label11: TLabel;
F_YUSHU: TcxTextEdit;
cxGroupBox2: TcxGroupBox;
Label13: TLabel;
Label14: TLabel;
Label15: TLabel;
Label16: TLabel;
Z_MAXKESHU: TcxTextEdit;
Z_FENJIAO: TcxTextEdit;
Z_FJGENSHU: TcxTextEdit;
Z_BINGSHU: TcxTextEdit;
Label17: TLabel;
Label21: TLabel;
Z_SJKESHU1: TcxTextEdit;
Z_ZHOUSHU1: TcxTextEdit;
Label22: TLabel;
Label23: TLabel;
Z_SJKESHU2: TcxTextEdit;
Z_ZHOUSHU2: TcxTextEdit;
ToolButton2: TToolButton;
PopupMenu1: TPopupMenu;
N1: TMenuItem;
Label24: TLabel;
DCRQTY: TcxTextEdit;
Label29: TLabel;
Tv1YarnFactor: TcxGridDBColumn;
Label25: TLabel;
Label26: TLabel;
WB_YarnKCQty: TcxTextEdit;
BCRFQty: TcxTextEdit;
Label27: TLabel;
label28: TLabel;
Label30: TLabel;
Label31: TLabel;
Label32: TLabel;
Label33: TLabel;
Label34: TLabel;
Label35: TLabel;
note: TcxTextEdit;
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 ToolButton1Click(Sender: TObject);
procedure Tv1Column2PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
procedure btn1Click(Sender: TObject);
procedure GYNoDblClick(Sender: TObject);
procedure GKBHPropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
procedure v1Column3PropertiesEditValueChanged(Sender: TObject);
procedure WB_YarnQtyPropertiesEditValueChanged(Sender: TObject);
procedure WB_YarnQtyExit(Sender: TObject);
procedure Tv1Column8PropertiesEditValueChanged(Sender: TObject);
procedure WB_TYPEPropertiesChange(Sender: TObject);
procedure ToolButton2Click(Sender: TObject);
procedure N1Click(Sender: TObject);
procedure BCRFQtyPropertiesEditValueChanged(Sender: TObject);
procedure WB_ReedNoPropertiesEditValueChanged(Sender: TObject);
private
{ Private declarations }
function SaveData(): Boolean;
procedure JSJS(); //<2F><><EFBFBD>㾭˿
procedure JS(); //<2F><><EFBFBD>㾭˿
public
{ Public declarations }
FWBSID, FSTKName: string;
end;
var
frmWBSpecInPut: TfrmWBSpecInPut;
implementation
uses
U_DataLink, U_RTFun, U_ZDYHelp, U_YarnInfoSel, U_TatClothInfoSel, U_TatGYSel,
U_CompanySel, U_GKManageSel, U_LogInput;
{$R *.dfm}
procedure TfrmWBSpecInPut.JS();
var
FZGS, FF_MAXKESHU: double;
fTS, FSJKS, FFJ, FF_MAXKESHU2, ffjgs, fbs: Integer;
FSJKS1, FSJKZ2, FXZS1, FXZS2: Integer;
begin
//<2F>ܾ<EFBFBD><DCBE><EFBFBD><EFBFBD><EFBFBD><><C9B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɴ<EFBFBD><C9B4> <20><><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1>=<3D><><EFBFBD><EFBFBD>
// <20>ܾ<EFBFBD><DCBE><EFBFBD><EFBFBD><EFBFBD>/<2F><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1>=<3D><><EFBFBD><EFBFBD>
// <20>ܾ<EFBFBD><DCBE><EFBFBD><EFBFBD><EFBFBD>-<2D><><EFBFBD><EFBFBD>*<2A><><EFBFBD><EFBFBD> ȡ<><C8A1><EFBFBD><EFBFBD>=<3D><><EFBFBD><EFBFBD>
FZGS := STRTOFLOATDEF(WB_YarnQty.Text, 0);
FF_MAXKESHU := STRTOFLOATDEF(F_MAXKESHU.Text, 0);
if (FF_MAXKESHU <> 0) and (FZGS <> 0) then
begin
fTS := Ceil(FZGS / FF_MAXKESHU);
F_YarnStripQty.Text := INTTOSTR(fTS);
FSJKS := Floor(FZGS / fTS);
F_SJKESHU.Text := INTTOSTR(FSJKS);
F_YUSHU.Text := FLOATTOSTR(FZGS - FSJKS * fTS);
end
else
begin
Exit;
end;
// <20>ܾ<EFBFBD><DCBE><EFBFBD><EFBFBD><EFBFBD>/<2F>ֽ<EFBFBD> <20><><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1>=<3D>ֽʸ<D6BD><CAB8><EFBFBD>
// <20>ֽ<EFBFBD><D6BD><EFBFBD><EFBFBD><EFBFBD>/ ɴ<><C9B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɴ<EFBFBD><C9B4> <20><><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1>=<3D><><EFBFBD><EFBFBD>
// <20>ֽ<EFBFBD><D6BD><EFBFBD><EFBFBD><EFBFBD>/<2F><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1>=<3D><>ϡ<EFBFBD><CFA1><EFBFBD><EFBFBD>
// <20>ֽ<EFBFBD><D6BD><EFBFBD><EFBFBD><EFBFBD>- <20><><EFBFBD>ֽ<EFBFBD><D6BD><EFBFBD><EFBFBD><EFBFBD>/<2F><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>*6=<3D><>ϡ<EFBFBD><CFA1><EFBFBD><EFBFBD>
FFJ := StrToIntdef(Z_FENJIAO.Text, 0);
FF_MAXKESHU2 := STRTOintDEF(Z_MAXKESHU.Text, 0);
if (FFJ <> 0) and (FF_MAXKESHU2 <> 0) then
begin
ffjgs := Ceil(FZGS / FFJ);
Z_FJGENSHU.Text := inttostr(ffjgs);
fbs := Ceil(ffjgs / FF_MAXKESHU2);
Z_BINGSHU.Text := inttostr(fbs);
FSJKS1 := Floor(ffjgs / fbs);
if FSJKS1 * fbs = ffjgs then
begin
Z_SJKESHU1.Text := inttostr(FSJKS1);
Z_ZHOUSHU1.Text := inttostr(fbs);
Z_SJKESHU2.Text := '0';
Z_ZHOUSHU2.Text := '0';
end
else
begin
Z_SJKESHU1.Text := inttostr(FSJKS1);
Z_ZHOUSHU1.Text := inttostr(fbs - 1);
Z_SJKESHU2.Text := inttostr(ffjgs - (FSJKS1 * (fbs - 1)));
Z_ZHOUSHU2.Text := '1';
end;
end;
end;
procedure TfrmWBSpecInPut.JSJS();
var
GS, ZGS, MF, DS, WM, TW: double;
begin
if CDS_SUB.IsEmpty then
exit;
with CDS_SUB do
begin
DisableControls;
first;
while not eof do
begin
with CDS_SUB 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(WB_Width.text, 0); //<2F>ط<EFBFBD>
TW := strtofloatdef(WB_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;
end;
if ZGS <> 0 then
begin
with CDS_SUB do
begin
Edit;
FieldByName('MeterQty').Value := roundfloat(GS / ZGS * TW * DS / 9000, 2);
Post;
end;
end;
next;
end;
First;
EnableControls;
end;
end;
procedure TfrmWBSpecInPut.N1Click(Sender: TObject);
var
I, J: Integer;
AField: TField;
begin
with tv1 do
begin
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>
DataController.DataSource.Dataset.Edit; // <20><><EFBFBD><EFBFBD><EFBFBD>༭ģʽ
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD><D6B6><EFBFBD>
for J := 0 to ColumnCount - 1 do
begin
// <20><>ȡ<EFBFBD><C8A1>ǰ<EFBFBD>е<EFBFBD><D0B5>ֶ<EFBFBD>
AField := Columns[J].DataBinding.Field;
// <20><><EFBFBD><EFBFBD><EFBFBD>ֶδ<D6B6><CEB4><EFBFBD><EFBFBD>Ҳ<EFBFBD><D2B2><EFBFBD> RowNo <20><>
if (AField <> nil) and (CompareText(AField.FieldName, 'RowNo') <> 0) and (CompareText(Columns[J].Name, 'RowNo') <> 0) then // ˫<>ؼ<EFBFBD><D8BC><EFBFBD>ȷ<EFBFBD><C8B7><EFBFBD>ų<EFBFBD>
begin
AField.Clear; // <20><><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>ֵ
end;
end;
DataController.DataSource.Dataset.Post; // <20><EFBFBD>޸<EFBFBD>
end;
end;
procedure TfrmWBSpecInPut.BCRFQtyPropertiesEditValueChanged(Sender: TObject);
var
mBCRFQty, mWB_YarnKCQty, mBSQTY: Double; // <20><>ΪDouble<6C><65><EFBFBD><EFBFBD>
//<2F>ߴ<EFBFBD><DFB4><20><>ɴ<EFBFBD><C9B4><EFBFBD><EFBFBD><EFBFBD>س<EFBFBD><D8B3><EFBFBD>
mWB_YarnQty, mDCRQTY, mC_KCQTY: Double;
//<2F>ܾ<EFBFBD><DCBE><EFBFBD><EFBFBD><EFBFBD> <20>ش<EFBFBD><D8B4><20>س<EFBFBD><D8B3><EFBFBD>
begin
if BCRFQty.Text <> '' then
begin
mBCRFQty := StrToFloatDef(BCRFQty.Text, 0); // ʹ<><CAB9>StrToFloatDef<65><66><EFBFBD><EFBFBD>ȫ
end
else
begin
mBCRFQty := 0;
end;
if WB_YarnKCQty.Text <> '' then // <20><><EFBFBD><EFBFBD><EFBFBD>˱<EFBFBD><CBB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD>WB_YarnKCQty<74><79><EFBFBD><EFBFBD><EFBFBD><EFBFBD>BSQTY
begin
mWB_YarnKCQty := StrToFloatDef(WB_YarnKCQty.Text, 0);
end
else
begin
mWB_YarnKCQty := 0;
end;
// <20><>ɴ<EFBFBD><C9B4>
mBSQTY := Round(mBCRFQty * mWB_YarnKCQty * 2);
BSQTY.Text := FloatToStr(mBSQTY);
if WB_YarnQty.Text <> '' then
begin
mWB_YarnQty := StrToFloatDef(WB_YarnQty.Text, 0);
end
else
begin
mWB_YarnQty := 0;
end;
if DCRQTY.Text <> '' then
begin
mDCRQTY := StrToFloatDef(DCRQTY.Text, 0);
end
else
begin
mDCRQTY := 0;
end;
if mDCRQTY <> 0 then
begin
mC_KCQTY := RoundFloat(mWB_YarnKCQty * 2 + (mWB_YarnQty - mBSQTY) / mDCRQTY, 2);
C_KCQTY.Text := FloatToStr(mC_KCQTY);
end;
end;
procedure TfrmWBSpecInPut.btn1Click(Sender: TObject);
begin
try
frmTatClothInfoSel := TfrmTatClothInfoSel.Create(Application);
with frmTatClothInfoSel do
begin
if ShowModal = 1 then
begin
Self.WB_YarnQty.Text := frmTatClothInfoSel.CDS_1.fieldbyname('C_YarnQty').AsString;
Self.WB_ReedNo.Text := frmTatClothInfoSel.CDS_1.fieldbyname('C_ReedNo').AsString;
with Self.ADOQueryTemp do
begin
Close;
sql.Clear;
sql.Add('select A.* 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(frmTatClothInfoSel.CDS_1.fieldbyname('C_Code').AsString) + '''');
Open;
First;
Self.CDS_Sub.EmptyDataSet;
while not Eof do
begin
with Self.CDS_Sub do
begin
Append;
FieldByName('RowNo').Value := Self.ADOQueryTemp.fieldbyname('RowNo').value;
FieldByName('Y_Code').Value := Self.ADOQueryTemp.fieldbyname('Y_Code').value;
FieldByName('Y_Name').Value := Self.ADOQueryTemp.fieldbyname('Y_Name').value;
FieldByName('Y_Spec').Value := Self.ADOQueryTemp.fieldbyname('Y_Spec').value;
FieldByName('Y_Color').Value := Self.ADOQueryTemp.fieldbyname('Y_Color').value;
FieldByName('YarnQty').Value := Self.ADOQueryTemp.fieldbyname('YarnQty').value;
FieldByName('CycleYarnQty').Value := Self.ADOQueryTemp.fieldbyname('CycleYarnQty').value;
end;
Next;
end;
end;
end;
end;
finally
frmTatClothInfoSel.Free;
end;
end;
procedure TfrmWBSpecInPut.FormClose(Sender: TObject; var Action: TCloseAction);
begin
inherited;
Action := caFree;
end;
procedure TfrmWBSpecInPut.TBAddClick(Sender: TObject);
begin
try
frmYarnInfoSel := TfrmYarnInfoSel.Create(Application);
with frmYarnInfoSel do
begin
FSTKName := <><C9B4>';
if ShowModal = 1 then
begin
with Self.CDS_Sub do
begin
Append;
FieldByName('Y_Color').Value := frmYarnInfoSel.CDS_1.fieldbyname('Y_Color').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('FF').Value := frmYarnInfoSel.CDS_1.fieldbyname('FF').value;
FieldByName('ND').Value := frmYarnInfoSel.CDS_1.fieldbyname('ND').value;
FieldByName('Denier').Value := frmYarnInfoSel.CDS_1.fieldbyname('Denier').value;
FieldByName('Y_Ratio').Value := 0;
end;
end;
end;
finally
frmYarnInfoSel.Free;
end;
end;
function TfrmWBSpecInPut.SaveData(): Boolean;
var
MaxNo, MaxYRId: string;
begin
try
ADOQueryCmd.Connection.BeginTrans;
try
if FWBSID <> '' then
begin
frmLogInput := TfrmLogInput.Create(Application);
with frmLogInput do
begin
fWB_Code := Self.WB_Code.Text;
if ShowModal = 1 then
begin
end;
end;
end;
finally
frmLogInput.Free;
end;
if Trim(FWBSID) = '' then
begin
if GetLSNo(ADOQueryCmd, MaxNo, 'QJ', 'Tat_WB_Spec', 5, 0) = False then
raise Exception.Create(<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>');
WB_Code.Text := MaxNo;
end
else
begin
MaxNo := Trim(FWBSID);
end;
with ADOQueryCmd do
begin
Close;
SQL.Clear;
sql.Add('select * from Tat_WB_Spec where WBSID=''' + Trim(MaxNo) + '''');
Open;
end;
with ADOQueryCmd do
begin
if Trim(FWBSID) = '' 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 := SGetServerDateTime(ADOQueryTemp);
end;
FieldByName('WBSID').Value := Trim(MaxNo);
RTSetsavedata(ADOQueryCmd, 'Tat_WB_Spec', ScrollBox1, 2);
RTSetsavedata(ADOQueryCmd, 'Tat_WB_Spec', cxGroupBox1, 2);
RTSetsavedata(ADOQueryCmd, 'Tat_WB_Spec', cxGroupBox2, 2);
Post;
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('select * from Tat_WB_Spec where WB_Code=' + quotedstr(trim(WB_Code.Text)));
Open;
end;
if ADOQueryCmd.RecordCount > 1 then
raise Exception.Create('<27><><EFBFBD><EFBFBD><EFBFBD>ظ<EFBFBD>!');
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 Tat_WB_Formula ');
sql.Add('where WBSID=''' + Trim(MaxNo) + '''');
sql.Add('and YRId=''' + Trim(CDS_Sub.fieldbyname('YRId').AsString) + '''');
open;
end;
MaxYRId := Trim(ADOQueryTemp.fieldbyname('YRId').AsString);
if Trim(MaxYRId) = '' then
begin
if GetLSNo(ADOQueryCmd, MaxYRId, 'P', 'Tat_WB_Formula', 4, 0) = False then
raise Exception.Create(<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>');
end
else
begin
MaxYRId := Trim(MaxYRId);
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('select * from Tat_WB_Formula where YRId=''' + Trim(MaxYRId) + '''');
Open;
end;
with ADOQueryCmd do
begin
if Trim(MaxYRId) = '' 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;
FieldByName('WBSID').Value := Trim(MaxNo);
FieldByName('YRId').Value := Trim(MaxYRId);
RTSetSaveDataCDS(ADOQueryCmd, Tv1, CDS_Sub, 'Tat_WB_Formula', 0);
Post;
end;
Edit;
FieldByName('YRId').Value := Trim(MaxYRId);
Post;
Next;
end;
end;
CDS_Sub.EnableControls;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('update Tat_WB_Spec set WB_Name='); // X.RowNo
sql.Add(' SUBSTRING(CAST((select ''+''+X.Y_Name from Tat_WB_Formula X where isnull(X.Y_Name,'''')<>'''' and X.WBSID=Tat_WB_Spec.WBSID order by RowNo for xml path('''') ) AS VARCHAR(200)) , 2, 200)');
sql.Add('where isnull(WB_Name,'''')='''' and WBSID=''' + Trim(MaxNo) + '''');
// ShowMessage(SQL.Text);
ExecSQL;
end;
ADOQueryCmd.Connection.CommitTrans;
Result := True;
except
Result := False;
ADOQueryCmd.Connection.RollbackTrans;
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
end;
end;
procedure TfrmWBSpecInPut.TBCloseClick(Sender: TObject);
begin
Close;
end;
procedure TfrmWBSpecInPut.FormShow(Sender: TObject);
var
fsj: string;
begin
inherited;
ReadCxGrid(trim(self.Caption), Tv1, '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֿ<EFBFBD>');
with ADOQueryTemp do
begin
Close;
SQL.Clear;
sql.Add(' select * from Tat_WB_Spec ');
sql.Add(' where WBSID=''' + Trim(FWBSID) + '''');
Open;
end;
SCSHData(ADOQueryTemp, ScrollBox1, 2);
SCSHData(ADOQueryTemp, cxGroupBox1, 2);
SCSHData(ADOQueryTemp, cxGroupBox2, 2);
if WB_TYPE.Text = '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
begin
cxGroupBox2.Visible := True;
cxGroupBox1.Visible := false;
end
else
begin
cxGroupBox2.Visible := false;
cxGroupBox1.Visible := True;
end;
with ADOQueryTemp do
begin
Close;
sql.Clear;
sql.Add(' select * from Tat_WB_Formula ');
sql.Add(' where WBSID=''' + Trim(FWBSID) + '''');
Open;
end;
SCreateCDS(ADOQueryTemp, CDS_Sub);
SInitCDSData(ADOQueryTemp, CDS_Sub);
if FWBSID = '' then
begin
with CDS_Sub 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;
Append;
FieldByName('RowNo').Value := 'G';
Post;
Append;
FieldByName('RowNo').Value := 'H';
Post;
end;
end;
end;
procedure TfrmWBSpecInPut.GKBHPropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
begin
try
frmGKManageSel := tfrmGKManageSel.Create(Application);
with frmGKManageSel do
begin
if ShowModal = 1 then
begin
SELF.GKBH.Text := CDS_HZ.FieldByName('GKBH').AsString;
SELF.WB_ReedNo.Text := CDS_HZ.FieldByName('GKKH').AsString;
end;
end;
finally
frmGKManageSel.Free;
end;
end;
procedure TfrmWBSpecInPut.GYNoDblClick(Sender: TObject);
begin
inherited;
TcxButtonEdit(Sender).Properties.LookupItems.Text := '';
TcxButtonEdit(Sender).Text := '';
end;
procedure TfrmWBSpecInPut.TBDelClick(Sender: TObject);
begin
if CDS_Sub.IsEmpty then
Exit;
if Trim(CDS_Sub.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;
try
ADOQueryCmd.Connection.BeginTrans;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add(' delete Tat_WB_Formula where YRId=''' + Trim(CDS_Sub.fieldbyname('YRId').AsString) + '''');
ExecSQL;
end;
ADOQueryCmd.Connection.CommitTrans;
CDS_Sub.Delete;
except
ADOQueryCmd.Connection.RollbackTrans;
Application.MessageBox(<><C9BE><EFBFBD>쳣!', '<27><>ʾ', 0);
end;
end
else
begin
CDS_Sub.Delete;
end;
end;
procedure TfrmWBSpecInPut.TBSaveClick(Sender: TObject);
begin
ToolBar1.SetFocus;
// with CDS_Sub do
// begin
// CDS_Sub.First;
// while not Eof do
// begin
// if trim(CDS_Sub.fieldbyname('Y_Code').asstring) <> '' then
// begin
// if StrToFloatDef(Trim(CDS_Sub.fieldbyname('YarnQty').AsString), 0) = 0 then
// begin
// Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
// Exit;
// end;
// end;
//
// if trim(CDS_Sub.fieldbyname('Y_Code').asstring) <> '' then
// begin
// if StrToFloatDef(Trim(CDS_Sub.fieldbyname('CycleYarnQty').AsString), 0) = 0 then
// begin
// Application.MessageBox('ѭ<><D1AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
// Exit;
// end;
// end;
//
// CDS_Sub.Next;
// end;
// end;
if SaveData() then
begin
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>!', '<27><>ʾ', 0);
ModalResult := 1;
Exit;
end;
end;
procedure TfrmWBSpecInPut.ToolButton1Click(Sender: TObject);
begin
WriteCxGrid(trim(self.Caption), Tv1, '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֿ<EFBFBD>');
end;
procedure TfrmWBSpecInPut.ToolButton2Click(Sender: TObject);
var
I, J: Integer;
begin
// ȷ<><C8B7><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD><C3B5><EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD><C8B7><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD> TcxGridDBTableView<65><77>
with TV1 do
begin
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>
// for I := 0 to SelectedRowCount - 1 do
// begin
// <20><>ȡ<EFBFBD><C8A1><EFBFBD>ݼ<EFBFBD><DDBC><EFBFBD>¼
DataController.DataSource.Dataset.Edit; // <20><><EFBFBD><EFBFBD><EFBFBD>༭ģʽ
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD><D6B6><EFBFBD>
for J := 0 to ColumnCount - 1 do
begin
// <20><><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֻ<EFBFBD><D6BB>/<2F>ؼ<EFBFBD><D8BC>ֶΣ<D6B6>
if Columns[J].DataBinding.Field <> nil then
Columns[J].DataBinding.Field.Clear;
end;
DataController.DataSource.Dataset.Post; // <20><EFBFBD>޸<EFBFBD>
// end;
end;
end;
procedure TfrmWBSpecInPut.Tv1Column2PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
begin
try
frmYarnInfoSel := TfrmYarnInfoSel.Create(Application);
with frmYarnInfoSel do
begin
FSTKName := <><C9B4>';
if ShowModal = 1 then
begin
with Self.CDS_Sub do
begin
Edit;
FieldByName('Y_Color').Value := frmYarnInfoSel.CDS_1.fieldbyname('Y_Color').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('FF').Value := frmYarnInfoSel.CDS_1.fieldbyname('FF').value;
FieldByName('ND').Value := frmYarnInfoSel.CDS_1.fieldbyname('ND').value;
FieldByName('Denier').Value := frmYarnInfoSel.CDS_1.fieldbyname('Denier').value;
FieldByName('ZS').Value := frmYarnInfoSel.CDS_1.fieldbyname('ZS').value;
FieldByName('YarnFactor').Value := 0.059;
FieldByName('Y_Ratio').Value := 0;
end;
Tv1Column8PropertiesEditValueChanged(Sender);
end;
end;
finally
frmYarnInfoSel.Free;
end;
end;
procedure TfrmWBSpecInPut.Tv1Column8PropertiesEditValueChanged(Sender: TObject);
var
mvalue, FFieldName: string;
ZS, ZGS: double;
mYarnFactor: Double;
begin
mvalue := TcxTextEdit(Sender).EditingText;
FFieldName := Trim(Tv1.Controller.FocusedColumn.DataBinding.FilterFieldName);
with CDS_SUB 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('ZS').Value = null then
begin
ZS := 0; //֧<><D6A7>
end
else
begin
ZS := FieldByName('ZS').Value; //֧<><D6A7>
end;
if FieldByName('YarnFactor').Value = null then
begin
mYarnFactor := 0; //ɴ<><C9B4>ϵ<EFBFBD><CFB5>
end
else
begin
mYarnFactor := FieldByName('YarnFactor').Value; //ɴ<><C9B4>ϵ<EFBFBD><CFB5>
end;
end;
if ZS <> 0 then
begin
with CDS_SUB do
begin
Edit;
FieldByName('MeterQty').Value := roundfloat(mYarnFactor * ZGS / ZS, 2);
Post;
end;
end;
end;
procedure TfrmWBSpecInPut.v1Column3PropertiesEditValueChanged(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_SUB 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('Denier').Value = null then
// begin
// DS := 0; //D<><44>
// end
// else
// begin
// DS := FieldByName('Denier').Value; //D<><44>
// end;
//
// TW := strtofloatdef(WB_YarnQty.text, 0); //ͷ<><CDB7>
// end;
// if ZGS <> 0 then
// begin
// with CDS_SUB do
// begin
// Edit;
// FieldByName('MeterQty').Value := roundfloat(GS / ZGS * TW * DS / 9000, 2);
// Post;
// end;
// end;
end;
procedure TfrmWBSpecInPut.WB_ReedNoPropertiesEditValueChanged(Sender: TObject);
var
mWB_ReedNo,mC_KCQTY, mWB_Width: Double;
// <20>غ<EFBFBD> <20>س<EFBFBD><D8B3><EFBFBD> <20>ط<EFBFBD>
begin
if WB_ReedNo.Text <> '' then
begin
mWB_ReedNo := StrToFloatDef(WB_ReedNo.Text, 0); // ʹ<><CAB9>StrToFloatDef<65><66><EFBFBD><EFBFBD>ȫ
end
else
begin
mWB_ReedNo := 0;
end;
if C_KCQTY.Text <> '' then
begin
mC_KCQTY := StrToFloatDef(C_KCQTY.Text, 0); // ʹ<><CAB9>StrToFloatDef<65><66><EFBFBD><EFBFBD>ȫ
end
else
begin
mC_KCQTY := 0;
end;
if mWB_ReedNo <> 0 then
begin
mWB_Width := RoundFloat( mC_KCQTY*2/mWB_ReedNo,1 );
WB_Width.Text := FloatToStr(mWB_Width) ;
end;
end;
procedure TfrmWBSpecInPut.WB_TYPEPropertiesChange(Sender: TObject);
begin
if WB_TYPE.Text = '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
begin
cxGroupBox2.Visible := True;
cxGroupBox1.Visible := false;
end
else
begin
cxGroupBox2.Visible := false;
cxGroupBox1.Visible := True;
end;
end;
procedure TfrmWBSpecInPut.WB_YarnQtyExit(Sender: TObject);
begin
JS();
end;
procedure TfrmWBSpecInPut.WB_YarnQtyPropertiesEditValueChanged(Sender: TObject);
var
mBCRFQty, mWB_YarnKCQty, mBSQTY: Double; // <20><>ΪDouble<6C><65><EFBFBD><EFBFBD>
//<2F>ߴ<EFBFBD><DFB4><20><>ɴ<EFBFBD><C9B4><EFBFBD><EFBFBD><EFBFBD>س<EFBFBD><D8B3><EFBFBD>
mWB_YarnQty, mDCRQTY, mC_KCQTY: Double;
begin
JSJS();
//<2F>ܾ<EFBFBD><DCBE><EFBFBD><EFBFBD><EFBFBD> <20>ش<EFBFBD><D8B4>
if BCRFQty.Text <> '' then
begin
mBCRFQty := StrToFloatDef(BCRFQty.Text, 0); // ʹ<><CAB9>StrToFloatDef<65><66><EFBFBD><EFBFBD>ȫ
end
else
begin
mBCRFQty := 0;
end;
if WB_YarnKCQty.Text <> '' then // <20><><EFBFBD><EFBFBD><EFBFBD>˱<EFBFBD><CBB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD>WB_YarnKCQty<74><79><EFBFBD><EFBFBD><EFBFBD><EFBFBD>BSQTY
begin
mWB_YarnKCQty := StrToFloatDef(WB_YarnKCQty.Text, 0);
end
else
begin
mWB_YarnKCQty := 0;
end;
// <20><>ɴ<EFBFBD><C9B4>
mBSQTY := Round(mBCRFQty * mWB_YarnKCQty * 2);
BSQTY.Text := FloatToStr(mBSQTY);
if WB_YarnQty.Text <> '' then
begin
mWB_YarnQty := StrToFloatDef(WB_YarnQty.Text, 0);
end
else
begin
mWB_YarnQty := 0;
end;
if DCRQTY.Text <> '' then
begin
mDCRQTY := StrToFloatDef(DCRQTY.Text, 0);
end
else
begin
mDCRQTY := 0;
end;
if mDCRQTY <> 0 then
begin
mC_KCQTY := RoundFloat(mWB_YarnKCQty * 2 + (mWB_YarnQty - mBSQTY) / mDCRQTY, 2);
C_KCQTY.Text := FloatToStr(mC_KCQTY);
end;
end;
end.