2026-10-19 17:25:11 +08:00
|
|
|
|
unit U_CraftInfoInput;
|
|
|
|
|
|
|
|
|
|
|
|
interface
|
|
|
|
|
|
|
|
|
|
|
|
uses
|
|
|
|
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|
|
|
|
|
Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData, cxDataStorage,
|
|
|
|
|
|
cxEdit, DB, cxDBData, ADODB, DBClient, cxGridLevel, cxGridCustomTableView,
|
|
|
|
|
|
cxGridTableView, cxGridDBTableView, cxClasses, cxControls, cxGridCustomView,
|
|
|
|
|
|
cxGrid, ComCtrls, ToolWin, cxGridCustomPopupMenu, cxGridPopupMenu, cxTextEdit,
|
|
|
|
|
|
cxButtonEdit, StdCtrls, ExtCtrls, cxCurrencyEdit, BtnEdit, U_BaseList,
|
|
|
|
|
|
cxLookAndFeels, cxLookAndFeelPainters, dxSkinsCore, dxSkinsDefaultPainters,
|
|
|
|
|
|
cxNavigator, dxDateRanges, dxBarBuiltInMenu, cxPC, dxScrollbarAnnotations,
|
|
|
|
|
|
cxCheckBox, dxSkinWXI;
|
|
|
|
|
|
|
|
|
|
|
|
type
|
|
|
|
|
|
TfrmCraftInfoInput = class(TForm)
|
|
|
|
|
|
ToolBar1: TToolBar;
|
|
|
|
|
|
ToolButton1: TToolButton;
|
|
|
|
|
|
ToolButton9: TToolButton;
|
|
|
|
|
|
TBClose: TToolButton;
|
|
|
|
|
|
ADOQueryCmd: TADOQuery;
|
|
|
|
|
|
ADOQueryTemp: TADOQuery;
|
|
|
|
|
|
ScrollBox1: TScrollBox;
|
|
|
|
|
|
Label1: TLabel;
|
|
|
|
|
|
Label2: TLabel;
|
|
|
|
|
|
Label3: TLabel;
|
|
|
|
|
|
Label4: TLabel;
|
|
|
|
|
|
Label5: TLabel;
|
|
|
|
|
|
Label6: TLabel;
|
|
|
|
|
|
Label7: TLabel;
|
|
|
|
|
|
Label8: TLabel;
|
|
|
|
|
|
Label9: TLabel;
|
|
|
|
|
|
Label10: TLabel;
|
|
|
|
|
|
Label11: TLabel;
|
|
|
|
|
|
Label12: TLabel;
|
|
|
|
|
|
Label13: TLabel;
|
|
|
|
|
|
CR_Code: TEdit;
|
|
|
|
|
|
CR_Name: TEdit;
|
|
|
|
|
|
C_Width: TBtnEditC;
|
|
|
|
|
|
C_GramWeight: TBtnEditC;
|
|
|
|
|
|
C_Color: TEdit;
|
|
|
|
|
|
C_YarnQty: TEdit;
|
|
|
|
|
|
head_count: TEdit;
|
|
|
|
|
|
strip_width: TEdit;
|
|
|
|
|
|
C_MachLatitudeDensity: TEdit;
|
|
|
|
|
|
row_count_top: TEdit;
|
|
|
|
|
|
displace: TEdit;
|
|
|
|
|
|
reed_width: TEdit;
|
|
|
|
|
|
C_ReedNo: TEdit;
|
2026-10-22 17:28:26 +08:00
|
|
|
|
Label14: TLabel;
|
|
|
|
|
|
ends_per_dent: TEdit;
|
|
|
|
|
|
Label15: TLabel;
|
|
|
|
|
|
selvage_yarn: TEdit;
|
|
|
|
|
|
Label16: TLabel;
|
|
|
|
|
|
yardage: TEdit;
|
2026-10-19 17:25:11 +08:00
|
|
|
|
cxPageControl3: TcxPageControl;
|
|
|
|
|
|
cxTabSheet1: TcxTabSheet;
|
|
|
|
|
|
Panel1: TPanel;
|
|
|
|
|
|
cxPageControl2: TcxPageControl;
|
|
|
|
|
|
cxGrid1: TcxGrid;
|
|
|
|
|
|
TV1: TcxGridDBTableView;
|
|
|
|
|
|
TV1SeqNo: TcxGridDBColumn;
|
|
|
|
|
|
cxGridDBColumn3: TcxGridDBColumn;
|
|
|
|
|
|
cxGridDBColumn4: TcxGridDBColumn;
|
|
|
|
|
|
cxGridDBColumn5: TcxGridDBColumn;
|
|
|
|
|
|
cxGridDBColumn8: TcxGridDBColumn;
|
|
|
|
|
|
cxGridDBColumn7: TcxGridDBColumn;
|
|
|
|
|
|
TV1Column1: TcxGridDBColumn;
|
|
|
|
|
|
TV1Column2: TcxGridDBColumn;
|
|
|
|
|
|
cxGridLevel2: TcxGridLevel;
|
|
|
|
|
|
Panel3: TPanel;
|
|
|
|
|
|
Panel4: TPanel;
|
|
|
|
|
|
Label20: TLabel;
|
|
|
|
|
|
ToolBar2: TToolBar;
|
|
|
|
|
|
ToolButton2: TToolButton;
|
|
|
|
|
|
ToolButton3: TToolButton;
|
|
|
|
|
|
ToolButton5: TToolButton;
|
|
|
|
|
|
Panel2: TPanel;
|
|
|
|
|
|
cxPageControl1: TcxPageControl;
|
|
|
|
|
|
cxGrid2: TcxGrid;
|
|
|
|
|
|
Tv2: TcxGridDBTableView;
|
|
|
|
|
|
Tv2SeqNo: TcxGridDBColumn;
|
|
|
|
|
|
v2Column10: TcxGridDBColumn;
|
|
|
|
|
|
cxGridDBColumn1: TcxGridDBColumn;
|
|
|
|
|
|
v2Column2: TcxGridDBColumn;
|
|
|
|
|
|
v2Column5: TcxGridDBColumn;
|
|
|
|
|
|
v2Column6: TcxGridDBColumn;
|
|
|
|
|
|
Tv2Column1: TcxGridDBColumn;
|
|
|
|
|
|
Tv2Column2: TcxGridDBColumn;
|
|
|
|
|
|
cxGridLevel1: TcxGridLevel;
|
|
|
|
|
|
Panel5: TPanel;
|
|
|
|
|
|
Panel6: TPanel;
|
|
|
|
|
|
Label21: TLabel;
|
|
|
|
|
|
ToolBar3: TToolBar;
|
|
|
|
|
|
ToolButton4: TToolButton;
|
|
|
|
|
|
ToolButton7: TToolButton;
|
|
|
|
|
|
ToolButton8: TToolButton;
|
|
|
|
|
|
cxTabSheet2: TcxTabSheet;
|
|
|
|
|
|
Panel7: TPanel;
|
|
|
|
|
|
Label35: TLabel;
|
|
|
|
|
|
Label34: TLabel;
|
|
|
|
|
|
Label36: TLabel;
|
|
|
|
|
|
Label37: TLabel;
|
|
|
|
|
|
Label38: TLabel;
|
|
|
|
|
|
Label39: TLabel;
|
|
|
|
|
|
Label40: TLabel;
|
|
|
|
|
|
Label41: TLabel;
|
|
|
|
|
|
Label42: TLabel;
|
|
|
|
|
|
Label44: TLabel;
|
|
|
|
|
|
Label45: TLabel;
|
|
|
|
|
|
Label46: TLabel;
|
|
|
|
|
|
Label48: TLabel;
|
|
|
|
|
|
Label49: TLabel;
|
|
|
|
|
|
Label50: TLabel;
|
|
|
|
|
|
Label51: TLabel;
|
|
|
|
|
|
Label52: TLabel;
|
|
|
|
|
|
Label53: TLabel;
|
|
|
|
|
|
Label54: TLabel;
|
|
|
|
|
|
Label55: TLabel;
|
|
|
|
|
|
Label57: TLabel;
|
|
|
|
|
|
Label58: TLabel;
|
|
|
|
|
|
Label59: TLabel;
|
|
|
|
|
|
Label60: TLabel;
|
|
|
|
|
|
Label61: TLabel;
|
|
|
|
|
|
Label62: TLabel;
|
|
|
|
|
|
Label63: TLabel;
|
|
|
|
|
|
Label64: TLabel;
|
|
|
|
|
|
Label65: TLabel;
|
|
|
|
|
|
Label66: TLabel;
|
|
|
|
|
|
Label67: TLabel;
|
|
|
|
|
|
Label68: TLabel;
|
|
|
|
|
|
Label69: TLabel;
|
|
|
|
|
|
Label70: TLabel;
|
|
|
|
|
|
Label71: TLabel;
|
|
|
|
|
|
Label72: TLabel;
|
|
|
|
|
|
WB_2: TEdit;
|
|
|
|
|
|
WB_1: TEdit;
|
|
|
|
|
|
WB_4: TEdit;
|
|
|
|
|
|
WB_3: TEdit;
|
|
|
|
|
|
WB_6: TEdit;
|
|
|
|
|
|
WB_5: TEdit;
|
|
|
|
|
|
WB_8: TEdit;
|
|
|
|
|
|
WB_7: TEdit;
|
|
|
|
|
|
WB_10: TEdit;
|
|
|
|
|
|
WB_9: TEdit;
|
|
|
|
|
|
WB_12: TEdit;
|
|
|
|
|
|
WB_11: TEdit;
|
|
|
|
|
|
WB_14: TEdit;
|
|
|
|
|
|
WB_13: TEdit;
|
|
|
|
|
|
WB_16: TEdit;
|
|
|
|
|
|
WB_15: TEdit;
|
|
|
|
|
|
WB_18: TEdit;
|
|
|
|
|
|
WB_17: TEdit;
|
|
|
|
|
|
WB_20: TEdit;
|
|
|
|
|
|
WB_19: TEdit;
|
|
|
|
|
|
WB_22: TEdit;
|
|
|
|
|
|
WB_21: TEdit;
|
|
|
|
|
|
WB_24: TEdit;
|
|
|
|
|
|
WB_23: TEdit;
|
|
|
|
|
|
WB_26: TEdit;
|
|
|
|
|
|
WB_25: TEdit;
|
|
|
|
|
|
WB_28: TEdit;
|
|
|
|
|
|
WB_27: TEdit;
|
|
|
|
|
|
WB_30: TEdit;
|
|
|
|
|
|
WB_29: TEdit;
|
|
|
|
|
|
WB_32: TEdit;
|
|
|
|
|
|
WB_31: TEdit;
|
|
|
|
|
|
WB_34: TEdit;
|
|
|
|
|
|
WB_33: TEdit;
|
|
|
|
|
|
WB_36: TEdit;
|
|
|
|
|
|
WB_35: TEdit;
|
|
|
|
|
|
WB_38: TEdit;
|
|
|
|
|
|
WB_37: TEdit;
|
|
|
|
|
|
WB_40: TEdit;
|
|
|
|
|
|
WB_39: TEdit;
|
|
|
|
|
|
WB_42: TEdit;
|
|
|
|
|
|
WB_41: TEdit;
|
|
|
|
|
|
WB_44: TEdit;
|
|
|
|
|
|
WB_43: TEdit;
|
|
|
|
|
|
WB_46: TEdit;
|
|
|
|
|
|
WB_45: TEdit;
|
|
|
|
|
|
WB_48: TEdit;
|
|
|
|
|
|
WB_47: TEdit;
|
|
|
|
|
|
WB_50: TEdit;
|
|
|
|
|
|
WB_49: TEdit;
|
|
|
|
|
|
WB_52: TEdit;
|
|
|
|
|
|
WB_51: TEdit;
|
|
|
|
|
|
WB_54: TEdit;
|
|
|
|
|
|
WB_53: TEdit;
|
|
|
|
|
|
WB_56: TEdit;
|
|
|
|
|
|
WB_55: TEdit;
|
|
|
|
|
|
WB_58: TEdit;
|
|
|
|
|
|
WB_57: TEdit;
|
|
|
|
|
|
WB_60: TEdit;
|
|
|
|
|
|
WB_59: TEdit;
|
|
|
|
|
|
WB_62: TEdit;
|
|
|
|
|
|
WB_61: TEdit;
|
|
|
|
|
|
WB_64: TEdit;
|
|
|
|
|
|
WB_63: TEdit;
|
|
|
|
|
|
WB_66: TEdit;
|
|
|
|
|
|
WB_65: TEdit;
|
|
|
|
|
|
WB_68: TEdit;
|
|
|
|
|
|
WB_67: TEdit;
|
|
|
|
|
|
WB_70: TEdit;
|
|
|
|
|
|
WB_69: TEdit;
|
|
|
|
|
|
WB_72: TEdit;
|
|
|
|
|
|
WB_71: TEdit;
|
|
|
|
|
|
cxTabSheet5: TcxTabSheet;
|
|
|
|
|
|
warp_arrange: TMemo;
|
|
|
|
|
|
cxTabSheet6: TcxTabSheet;
|
|
|
|
|
|
weft_arrange: TMemo;
|
|
|
|
|
|
cxTabSheet7: TcxTabSheet;
|
|
|
|
|
|
Panel9: TPanel;
|
|
|
|
|
|
Label26: TLabel;
|
|
|
|
|
|
threading_method: TMemo;
|
|
|
|
|
|
CDS_1: TClientDataSet;
|
|
|
|
|
|
DS_1: TDataSource;
|
|
|
|
|
|
CDS_2: TClientDataSet;
|
|
|
|
|
|
DS_2: TDataSource;
|
|
|
|
|
|
procedure FormShow(Sender: TObject);
|
|
|
|
|
|
procedure TBCloseClick(Sender: TObject);
|
|
|
|
|
|
procedure ToolButton1Click(Sender: TObject);
|
|
|
|
|
|
procedure CYColorKeyPress(Sender: TObject; var Key: Char);
|
|
|
|
|
|
procedure C_WidthBtnDnClick(Sender: TObject);
|
|
|
|
|
|
procedure C_WidthBtnUpClick(Sender: TObject);
|
|
|
|
|
|
procedure ToolButton2Click(Sender: TObject);
|
|
|
|
|
|
procedure ToolButton3Click(Sender: TObject);
|
|
|
|
|
|
procedure ToolButton7Click(Sender: TObject);
|
|
|
|
|
|
procedure ToolButton4Click(Sender: TObject);
|
|
|
|
|
|
procedure ToolButton5Click(Sender: TObject);
|
|
|
|
|
|
procedure ToolButton8Click(Sender: TObject);
|
|
|
|
|
|
procedure ToolButton9Click(Sender: TObject);
|
|
|
|
|
|
procedure TV1YRatioPropertiesEditValueChanged(Sender: TObject);
|
|
|
|
|
|
procedure Tv2YRatioPropertiesEditValueChanged(Sender: TObject);
|
|
|
|
|
|
private
|
|
|
|
|
|
{ Private declarations }
|
|
|
|
|
|
procedure InitGrid();
|
|
|
|
|
|
procedure AddPresetYarnRows(ACDS: TClientDataSet);
|
|
|
|
|
|
function SaveData(): Boolean;
|
|
|
|
|
|
procedure CALCYarnQty();
|
|
|
|
|
|
procedure CalcGramWeight();
|
|
|
|
|
|
procedure SyncYRatioFromEditor(ACDS: TClientDataSet; Sender: TObject);
|
|
|
|
|
|
public
|
|
|
|
|
|
FCRID: string;
|
|
|
|
|
|
{ Public declarations }
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
var
|
|
|
|
|
|
frmCraftInfoInput: TfrmCraftInfoInput;
|
|
|
|
|
|
|
|
|
|
|
|
implementation
|
|
|
|
|
|
|
|
|
|
|
|
uses
|
|
|
|
|
|
U_DataLink, U_RTFun, U_ZDYHelp, U_CraftSync;
|
|
|
|
|
|
|
|
|
|
|
|
{$R *.dfm}
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmCraftInfoInput.CALCYarnQty();
|
|
|
|
|
|
var
|
|
|
|
|
|
MYarnQty, MOrdQty, MWidth, MMachLatitudeDensity: Double;
|
|
|
|
|
|
begin
|
|
|
|
|
|
MYarnQty := STRTOFLOATDEF(C_YarnQty.Text, 0);
|
|
|
|
|
|
MOrdQty := 10000;
|
|
|
|
|
|
MWidth := STRTOFLOATDEF(StringReplace(C_Width.Text, 'CM', '', [rfReplaceAll, rfIgnoreCase]), 0);
|
|
|
|
|
|
MMachLatitudeDensity := STRTOFLOATDEF(C_MachLatitudeDensity.Text, 0);
|
|
|
|
|
|
with CDS_1 do
|
|
|
|
|
|
begin
|
|
|
|
|
|
DisableControls;
|
|
|
|
|
|
First;
|
|
|
|
|
|
while not Eof do
|
|
|
|
|
|
begin
|
|
|
|
|
|
Edit;
|
|
|
|
|
|
FieldByName('Y_Qty').Value := MYarnQty * MOrdQty * FieldByName('Y_Ratio').AsFloat / 100 / 9000 * FieldByName('Denier').AsFloat / 1000;
|
|
|
|
|
|
Next;
|
|
|
|
|
|
end;
|
|
|
|
|
|
EnableControls;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
with CDS_2 do
|
|
|
|
|
|
begin
|
|
|
|
|
|
DisableControls;
|
|
|
|
|
|
First;
|
|
|
|
|
|
while not Eof do
|
|
|
|
|
|
begin
|
|
|
|
|
|
Edit;
|
|
|
|
|
|
FieldByName('Y_Qty').Value := MMachLatitudeDensity * MOrdQty * MWidth * FieldByName('Y_Ratio').AsFloat / 100 / 9000 * FieldByName('Denier').AsFloat / 1000;
|
|
|
|
|
|
Next;
|
|
|
|
|
|
end;
|
|
|
|
|
|
EnableControls;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmCraftInfoInput.SyncYRatioFromEditor(ACDS: TClientDataSet; Sender: TObject);
|
|
|
|
|
|
var
|
|
|
|
|
|
MValue: Double;
|
|
|
|
|
|
begin
|
|
|
|
|
|
MValue := StrToFloatDef(Trim(TcxTextEdit(Sender).EditingText), -1);
|
|
|
|
|
|
if MValue < 0 then
|
|
|
|
|
|
Exit;
|
|
|
|
|
|
if ACDS.FieldByName('Y_Ratio').AsFloat <> MValue then
|
|
|
|
|
|
begin
|
|
|
|
|
|
ACDS.Edit;
|
|
|
|
|
|
ACDS.FieldByName('Y_Ratio').AsFloat := MValue;
|
|
|
|
|
|
ACDS.Post;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmCraftInfoInput.CalcGramWeight();
|
|
|
|
|
|
|
|
|
|
|
|
function SumViewRatio(AView: TcxGridDBTableView; ARatioColumn: TcxGridDBColumn): Double;
|
|
|
|
|
|
var
|
|
|
|
|
|
i: Integer;
|
|
|
|
|
|
v: Variant;
|
|
|
|
|
|
begin
|
|
|
|
|
|
Result := 0;
|
|
|
|
|
|
for i := 0 to AView.DataController.RecordCount - 1 do
|
|
|
|
|
|
begin
|
|
|
|
|
|
v := AView.DataController.Values[i, ARatioColumn.Index];
|
|
|
|
|
|
if not VarIsNull(v) then
|
|
|
|
|
|
Result := Result + v;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
begin
|
|
|
|
|
|
C_GramWeight.Text := FormatFloat('0.######',
|
|
|
|
|
|
(SumViewRatio(TV1, cxGridDBColumn7) + SumViewRatio(Tv2, v2Column5)) / 1000);
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmCraftInfoInput.TV1YRatioPropertiesEditValueChanged(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
SyncYRatioFromEditor(CDS_1, Sender);
|
|
|
|
|
|
CalcGramWeight();
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmCraftInfoInput.Tv2YRatioPropertiesEditValueChanged(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
SyncYRatioFromEditor(CDS_2, Sender);
|
|
|
|
|
|
CalcGramWeight();
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmCraftInfoInput.InitGrid();
|
|
|
|
|
|
begin
|
|
|
|
|
|
|
|
|
|
|
|
with ADOQueryTemp do
|
|
|
|
|
|
begin
|
|
|
|
|
|
Close;
|
|
|
|
|
|
SQL.Clear;
|
|
|
|
|
|
SQL.Add('select * from BS_Craft_Info where CRID=''' + Trim(FCRID) + '''');
|
|
|
|
|
|
Open;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
//memo fields on tab sheets are not reached by SCSHData, load manually
|
|
|
|
|
|
warp_arrange.Text := Trim(ADOQueryTemp.fieldbyname('warp_arrange').AsString);
|
|
|
|
|
|
weft_arrange.Text := Trim(ADOQueryTemp.fieldbyname('weft_arrange').AsString);
|
|
|
|
|
|
threading_method.Text := Trim(ADOQueryTemp.fieldbyname('threading_method').AsString);
|
|
|
|
|
|
SCSHData(ADOQueryTemp, ScrollBox1, 2);
|
|
|
|
|
|
with ADOQueryTemp do
|
|
|
|
|
|
begin
|
|
|
|
|
|
Close;
|
|
|
|
|
|
SQL.Clear;
|
|
|
|
|
|
SQL.Add('select * from BS_Craft_Info_WB where CRID=''' + Trim(FCRID) + '''');
|
|
|
|
|
|
Open;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
SCSHData(ADOQueryTemp, PANEL7, 2);
|
|
|
|
|
|
|
|
|
|
|
|
with ADOQueryTemp do
|
|
|
|
|
|
begin
|
|
|
|
|
|
Close;
|
|
|
|
|
|
sql.Clear;
|
|
|
|
|
|
sql.Add('select A.* from BS_Craft_Yarn A ');
|
|
|
|
|
|
sql.Add(' where YRType=' + quotedstr('<27><>˿') + ' and A.CRID=''' + Trim(FCRID) + '''');
|
|
|
|
|
|
Open;
|
|
|
|
|
|
end;
|
|
|
|
|
|
SCreateCDS(ADOQueryTemp, CDS_1);
|
|
|
|
|
|
SInitCDSData(ADOQueryTemp, CDS_1);
|
|
|
|
|
|
with ADOQueryTemp do
|
|
|
|
|
|
begin
|
|
|
|
|
|
Close;
|
|
|
|
|
|
sql.Clear;
|
|
|
|
|
|
sql.Add('select A.* from BS_Craft_Yarn A ');
|
|
|
|
|
|
sql.Add(' where YRType=' + quotedstr('γ˿') + ' and A.CRID=''' + Trim(FCRID) + '''');
|
|
|
|
|
|
Open;
|
|
|
|
|
|
end;
|
|
|
|
|
|
SCreateCDS(ADOQueryTemp, CDS_2);
|
|
|
|
|
|
SInitCDSData(ADOQueryTemp, CDS_2);
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmCraftInfoInput.AddPresetYarnRows(ACDS: TClientDataSet);
|
|
|
|
|
|
const
|
|
|
|
|
|
CSeq: array[0..5] of string = ('<27><>', '<27><>', '<27><>', '<27><>', '<27><>', '<27><>');
|
|
|
|
|
|
var
|
|
|
|
|
|
i: Integer;
|
|
|
|
|
|
begin
|
|
|
|
|
|
for i := 0 to 5 do
|
|
|
|
|
|
begin
|
|
|
|
|
|
ACDS.Append;
|
|
|
|
|
|
ACDS.FieldByName('seq_no').Value := CSeq[i];
|
|
|
|
|
|
ACDS.Post;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmCraftInfoInput.FormShow(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
ReadCxGrid(self.Caption + 'TV1', Tv1, '<27><>ɴ<EFBFBD><C9B4><EFBFBD><EFBFBD>');
|
|
|
|
|
|
ReadCxGrid(self.Caption + 'TV2', Tv2, 'γɴ<CEB3><C9B4><EFBFBD><EFBFBD>');
|
|
|
|
|
|
InitGrid();
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmCraftInfoInput.TBCloseClick(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
Close;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
function TfrmCraftInfoInput.SaveData(): Boolean;
|
|
|
|
|
|
var
|
|
|
|
|
|
maxId, maxpbno: string;
|
|
|
|
|
|
begin
|
|
|
|
|
|
try
|
|
|
|
|
|
ADOQueryCmd.Connection.BeginTrans;
|
|
|
|
|
|
if Trim(FCRID) = '' then
|
|
|
|
|
|
begin
|
|
|
|
|
|
if GetLSNo(ADOQueryCmd, maxId, 'GY', 'BS_Craft_Info', 4, 1) = False then
|
|
|
|
|
|
begin
|
|
|
|
|
|
Result := False;
|
|
|
|
|
|
ADOQueryCmd.Connection.RollbackTrans;
|
|
|
|
|
|
Application.MessageBox('ȡ<><C8A1><EFBFBD>ձ<EFBFBD><D5B1><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
|
|
|
|
|
|
Exit;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end
|
|
|
|
|
|
else
|
|
|
|
|
|
begin
|
|
|
|
|
|
maxId := Trim(FCRID);
|
|
|
|
|
|
end;
|
|
|
|
|
|
with ADOQueryCmd do
|
|
|
|
|
|
begin
|
|
|
|
|
|
Close;
|
|
|
|
|
|
SQL.Clear;
|
|
|
|
|
|
sql.Add('select * from BS_Craft_Info where CRID=''' + Trim(FCRID) + '''');
|
|
|
|
|
|
Open;
|
|
|
|
|
|
end;
|
|
|
|
|
|
with ADOQueryCmd do
|
|
|
|
|
|
begin
|
|
|
|
|
|
if IsEmpty then
|
|
|
|
|
|
begin
|
|
|
|
|
|
Append;
|
|
|
|
|
|
FieldByName('FILLID').Value := Trim(DCode);
|
|
|
|
|
|
FieldByName('FILLER').Value := Trim(DName);
|
|
|
|
|
|
FieldByName('FILLTIME').Value := SGetServerDateTime(ADOQueryTemp);
|
|
|
|
|
|
end
|
|
|
|
|
|
else
|
|
|
|
|
|
begin
|
|
|
|
|
|
Edit;
|
|
|
|
|
|
FieldByName('EDITER').Value := Trim(DName);
|
|
|
|
|
|
FieldByName('EDITTIME').Value := SGetServerDateTime(ADOQueryTemp);
|
|
|
|
|
|
end;
|
|
|
|
|
|
FieldByName('CRID').Value := Trim(maxId);
|
|
|
|
|
|
if trim(CR_Code.Text) = '' then
|
|
|
|
|
|
CR_Code.Text := Trim(maxId);
|
|
|
|
|
|
RTSetsavedata(ADOQueryCmd, 'BS_Craft_Info', ScrollBox1, 2);
|
|
|
|
|
|
//memo fields on tab sheets, save manually
|
|
|
|
|
|
if Trim(warp_arrange.Text) = '' then
|
|
|
|
|
|
ADOQueryCmd.FieldByName('warp_arrange').Value := null
|
|
|
|
|
|
else
|
|
|
|
|
|
ADOQueryCmd.FieldByName('warp_arrange').Value := Trim(warp_arrange.Text);
|
|
|
|
|
|
if Trim(weft_arrange.Text) = '' then
|
|
|
|
|
|
ADOQueryCmd.FieldByName('weft_arrange').Value := null
|
|
|
|
|
|
else
|
|
|
|
|
|
ADOQueryCmd.FieldByName('weft_arrange').Value := Trim(weft_arrange.Text);
|
|
|
|
|
|
if Trim(threading_method.Text) = '' then
|
|
|
|
|
|
ADOQueryCmd.FieldByName('threading_method').Value := null
|
|
|
|
|
|
else
|
|
|
|
|
|
ADOQueryCmd.FieldByName('threading_method').Value := Trim(threading_method.Text);
|
|
|
|
|
|
Post;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
////////////////////////// <20><><EFBFBD><EFBFBD><EFBFBD>ư<EFBFBD>ͼ //////////////////////////
|
|
|
|
|
|
|
|
|
|
|
|
with ADOQueryCmd do
|
|
|
|
|
|
begin
|
|
|
|
|
|
Close;
|
|
|
|
|
|
SQL.Clear;
|
|
|
|
|
|
sql.Add('select * from BS_Craft_Info_WB where CRID=''' + Trim(FCRID) + '''');
|
|
|
|
|
|
Open;
|
|
|
|
|
|
end;
|
|
|
|
|
|
with ADOQueryCmd do
|
|
|
|
|
|
begin
|
|
|
|
|
|
if IsEmpty then
|
|
|
|
|
|
Append
|
|
|
|
|
|
else
|
|
|
|
|
|
Edit;
|
|
|
|
|
|
FieldByName('CRID').Value := Trim(maxId);
|
|
|
|
|
|
|
|
|
|
|
|
RTSetsavedata(ADOQueryCmd, 'BS_Craft_Info_WB', Panel7, 2);
|
|
|
|
|
|
Post;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
////////////////////////// <20><><EFBFBD><EFBFBD><EFBFBD>ư<EFBFBD>ͼ //////////////////////////
|
|
|
|
|
|
|
|
|
|
|
|
////////////////////////// <20><><EFBFBD>澭˿<E6BEAD><CBBF><EFBFBD>ȱ<EFBFBD> //////////////////////////
|
|
|
|
|
|
with CDS_1 do
|
|
|
|
|
|
begin
|
|
|
|
|
|
First;
|
|
|
|
|
|
while not Eof do
|
|
|
|
|
|
begin
|
|
|
|
|
|
if Trim(CDS_1.fieldbyname('YRId').AsString) = '' then
|
|
|
|
|
|
begin
|
|
|
|
|
|
if GetLSNo(ADOQueryTemp, maxpbno, 'RJ', 'BS_Craft_Yarn', 4, 1) = False then
|
|
|
|
|
|
begin
|
|
|
|
|
|
ADOQueryCmd.Connection.RollbackTrans;
|
|
|
|
|
|
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
|
|
|
|
|
|
Exit;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end
|
|
|
|
|
|
else
|
|
|
|
|
|
begin
|
|
|
|
|
|
maxpbno := Trim(CDS_1.fieldbyname('YRId').AsString);
|
|
|
|
|
|
end;
|
|
|
|
|
|
with ADOQueryCmd do
|
|
|
|
|
|
begin
|
|
|
|
|
|
Close;
|
|
|
|
|
|
SQL.Clear;
|
|
|
|
|
|
sql.Add('select * from BS_Craft_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('CRID').Value := Trim(maxId);
|
|
|
|
|
|
FieldByName('YRId').Value := Trim(maxpbno);
|
|
|
|
|
|
RTSetSaveDataCDS(ADOQueryCmd, TV1, CDS_1, 'BS_Craft_Yarn', 0);
|
|
|
|
|
|
Post;
|
|
|
|
|
|
end;
|
|
|
|
|
|
CDS_1.Edit;
|
|
|
|
|
|
CDS_1.FieldByName('CRID').Value := Trim(maxId);
|
|
|
|
|
|
CDS_1.FieldByName('YRId').Value := Trim(maxpbno);
|
|
|
|
|
|
|
|
|
|
|
|
Next;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
////////////////////////// <20><><EFBFBD>澭˿<E6BEAD><CBBF><EFBFBD>ȱ<EFBFBD> //////////////////////////
|
|
|
|
|
|
|
|
|
|
|
|
////////////////////////// <20><><EFBFBD><EFBFBD>γ˿<CEB3><CBBF><EFBFBD>ȱ<EFBFBD> //////////////////////////
|
|
|
|
|
|
with CDS_2 do
|
|
|
|
|
|
begin
|
|
|
|
|
|
First;
|
|
|
|
|
|
while not Eof do
|
|
|
|
|
|
begin
|
|
|
|
|
|
if Trim(CDS_2.fieldbyname('YRId').AsString) = '' then
|
|
|
|
|
|
begin
|
|
|
|
|
|
if GetLSNo(ADOQueryTemp, maxpbno, 'RJ', 'BS_Craft_Yarn', 4, 1) = False then
|
|
|
|
|
|
begin
|
|
|
|
|
|
ADOQueryCmd.Connection.RollbackTrans;
|
|
|
|
|
|
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
|
|
|
|
|
|
Exit;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end
|
|
|
|
|
|
else
|
|
|
|
|
|
begin
|
|
|
|
|
|
maxpbno := Trim(CDS_2.fieldbyname('YRId').AsString);
|
|
|
|
|
|
end;
|
|
|
|
|
|
with ADOQueryCmd do
|
|
|
|
|
|
begin
|
|
|
|
|
|
Close;
|
|
|
|
|
|
SQL.Clear;
|
|
|
|
|
|
sql.Add('select * from BS_Craft_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('CRID').Value := Trim(maxId);
|
|
|
|
|
|
FieldByName('YRId').Value := Trim(maxpbno);
|
|
|
|
|
|
RTSetSaveDataCDS(ADOQueryCmd, Tv2, CDS_2, 'BS_Craft_Yarn', 0);
|
|
|
|
|
|
Post;
|
|
|
|
|
|
end;
|
|
|
|
|
|
CDS_2.Edit;
|
|
|
|
|
|
CDS_2.FieldByName('CRID').Value := Trim(maxId);
|
|
|
|
|
|
CDS_2.FieldByName('YRId').Value := Trim(maxpbno);
|
|
|
|
|
|
|
|
|
|
|
|
Next;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
////////////////////////// <20><><EFBFBD><EFBFBD>γ˿<CEB3><CBBF><EFBFBD>ȱ<EFBFBD> //////////////////////////
|
|
|
|
|
|
|
|
|
|
|
|
////////////////////////// <20><><EFBFBD>ձ<EFBFBD><D5B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĭͬ<C4AC><CDAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>а<D0B0>Ʒ //////////////////////////
|
|
|
|
|
|
SyncCraftToProduct(Trim(maxId));
|
|
|
|
|
|
|
|
|
|
|
|
ADOQueryCmd.Connection.CommitTrans;
|
|
|
|
|
|
FCRID := maxId;
|
|
|
|
|
|
Result := True;
|
|
|
|
|
|
except
|
|
|
|
|
|
Result := False;
|
|
|
|
|
|
ADOQueryCmd.Connection.RollbackTrans;
|
|
|
|
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!', '<27><>ʾ', 0);
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmCraftInfoInput.ToolButton1Click(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
CR_Name.SetFocus;
|
|
|
|
|
|
if Trim(CR_Name.Text) = '' then
|
|
|
|
|
|
begin
|
|
|
|
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʋ<EFBFBD><C6B2><EFBFBD>Ϊ<EFBFBD>գ<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 TfrmCraftInfoInput.C_WidthBtnDnClick(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
TBtnEditC(Sender).Text := '';
|
|
|
|
|
|
TBtnEditC(Sender).TxtCode := '';
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmCraftInfoInput.C_WidthBtnUpClick(Sender: TObject);
|
|
|
|
|
|
var
|
|
|
|
|
|
fsj: string;
|
|
|
|
|
|
FWZ: Integer;
|
|
|
|
|
|
begin
|
|
|
|
|
|
fsj := Trim(TEdit(Sender).Hint);
|
|
|
|
|
|
FWZ := Pos('/', fsj);
|
|
|
|
|
|
try
|
|
|
|
|
|
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
|
|
|
|
|
with frmZDYHelp do
|
|
|
|
|
|
begin
|
|
|
|
|
|
flag := Copy(fsj, 1, FWZ - 1);
|
|
|
|
|
|
flagname := Copy(fsj, FWZ + 1, Length(fsj) - FWZ);
|
|
|
|
|
|
if ShowModal = 1 then
|
|
|
|
|
|
begin
|
|
|
|
|
|
TEdit(Sender).Text := Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
finally
|
|
|
|
|
|
frmZDYHelp.Free;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmCraftInfoInput.ToolButton2Click(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
//<2F><><EFBFBD>й̶<D0B9><CCB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ұ<EFBFBD><D2B1><EFBFBD><EFBFBD>켺<EFBFBD><ECBCBA><EFBFBD><EFBFBD>(<28><><EFBFBD>۱<EFBFBD><DBB1><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
|
|
|
|
|
AddPresetYarnRows(CDS_1);
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmCraftInfoInput.ToolButton3Click(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
if CDS_1.IsEmpty then
|
|
|
|
|
|
Exit;
|
|
|
|
|
|
if Trim(CDS_1.fieldbyname('YRId').AsString) <> '' then
|
|
|
|
|
|
begin
|
|
|
|
|
|
if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
|
|
|
|
|
Exit;
|
|
|
|
|
|
with ADOQueryCmd do
|
|
|
|
|
|
begin
|
|
|
|
|
|
Close;
|
|
|
|
|
|
sql.Clear;
|
|
|
|
|
|
sql.Add('delete BS_Craft_Yarn where YRId=''' + Trim(CDS_1.fieldbyname('YRId').AsString) + '''');
|
|
|
|
|
|
ExecSQL;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
CDS_1.Delete;
|
|
|
|
|
|
CalcGramWeight();
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmCraftInfoInput.ToolButton4Click(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
//<2F><><EFBFBD>й̶<D0B9><CCB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ұ<EFBFBD><D2B1><EFBFBD><EFBFBD>켺<EFBFBD><ECBCBA><EFBFBD><EFBFBD>(<28><><EFBFBD>۱<EFBFBD><DBB1><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
|
|
|
|
|
AddPresetYarnRows(CDS_2);
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmCraftInfoInput.ToolButton5Click(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
CR_Name.SetFocus;
|
|
|
|
|
|
CALCYarnQty();
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmCraftInfoInput.CYColorKeyPress(Sender: TObject; var Key: Char);
|
|
|
|
|
|
begin
|
|
|
|
|
|
if Key = #13 then
|
|
|
|
|
|
begin
|
|
|
|
|
|
Key := #0;
|
|
|
|
|
|
SelectNext(ActiveControl as TWinControl, True, True);
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmCraftInfoInput.ToolButton7Click(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
if CDS_2.IsEmpty then
|
|
|
|
|
|
Exit;
|
|
|
|
|
|
if Trim(CDS_2.fieldbyname('YRId').AsString) <> '' then
|
|
|
|
|
|
begin
|
|
|
|
|
|
if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
|
|
|
|
|
Exit;
|
|
|
|
|
|
with ADOQueryCmd do
|
|
|
|
|
|
begin
|
|
|
|
|
|
Close;
|
|
|
|
|
|
sql.Clear;
|
|
|
|
|
|
sql.Add('delete BS_Craft_Yarn where YRId=''' + Trim(CDS_2.fieldbyname('YRId').AsString) + '''');
|
|
|
|
|
|
ExecSQL;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
CDS_2.Delete;
|
|
|
|
|
|
CalcGramWeight();
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmCraftInfoInput.ToolButton8Click(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
CR_Name.SetFocus;
|
|
|
|
|
|
CALCYarnQty();
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmCraftInfoInput.ToolButton9Click(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
WriteCxGrid(self.Caption + 'TV1', Tv1, '<27><>ɴ<EFBFBD><C9B4><EFBFBD><EFBFBD>');
|
|
|
|
|
|
WriteCxGrid(self.Caption + 'TV2', Tv2, 'γɴ<CEB3><C9B4><EFBFBD><EFBFBD>');
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
end.
|