2025-02-20 14:17:49 +08:00
unit U_MachRollMain;
interface
uses
Winapi . Windows, Winapi . Messages, System. SysUtils, System. Variants,
System. Classes, Vcl. Graphics, mmsystem, Vcl. Controls, Vcl. Forms, Vcl. Dialogs,
cxGraphics, cxControls, cxLookAndFeels, cxLookAndFeelPainters, cxClasses,
dxLayoutContainer, dxLayoutControl, dxLayoutcxEditAdapters, cxContainer,
cxEdit, Vcl. StdCtrls, cxTextEdit, Vcl. ExtCtrls, dxLayoutControlAdapters,
U_BaseList, Data. DB, Data. Win. ADODB, Vcl. Buttons, Vcl. ComCtrls, Vcl. ToolWin,
cxImage, cxDBEdit, cxStyles, cxCustomData, cxFilter, cxData, cxDataStorage,
cxNavigator, dxDateRanges, dxScrollbarAnnotations, cxDBData, dxBarBuiltInMenu,
cxPC, cxGridLevel, cxGridCustomTableView, cxGridTableView, cxGridDBTableView,
cxGridCustomView, cxGrid, cxMemo, cxRichEdit, U_frameBads, Datasnap. DBClient,
RM_Common, RM_Class, RM_GridReport, cxCheckBox, cxMaskEdit, cxDropDownEdit,
Vcl. Menus, cxButtonEdit, RM_Dataset, cxGeometry, dxFramedControl, dxPanel,
U_KeyBoard, cxGroupBox, cxGridCustomPopupMenu, cxGridPopupMenu, MovePanel,
2025-02-21 15:28:49 +08:00
RM_RichEdit, cxProgressBar, cxCurrencyEdit, dxSkinsCore, frxBarcode, frxRich,
frxOLE, frxTableObject, frxExportXLSX, frxClass, frxExportBaseDialog,
2026-06-13 16:49:18 +08:00
frxExportPPTX, frxDBSet, dxSkinWXI, dxSkinsDefaultPainters, System. StrUtils,
imm, cxLookupEdit, cxDBLookupEdit, cxDBLookupComboBox;
2025-02-20 14:17:49 +08:00
type
TfrmMachRollMain = class( TfrmBaseList)
Panel_right: TPanel;
cds_params: TClientDataSet;
cds_paramsdabao: TStringField;
cds_paramspackRolls: TIntegerField;
cds_paramsrollNoMake: TStringField;
cds_paramsMinWeight: TIntegerField;
cds_paramsMaxWeight: TIntegerField;
cds_paramslblLenUnit: TStringField;
cds_paramsMinLen: TIntegerField;
cds_paramsmaxLen: TIntegerField;
cds_paramsweightRule: TIntegerField;
cds_paramschen: TStringField;
cds_paramsmabiao: TStringField;
cds_paramsmbunit: TStringField;
cds_paramsmplace: TIntegerField;
cds_paramsyplace: TIntegerField;
cds_paramskgplace: TIntegerField;
cds_paramslabNumber: TIntegerField;
CDS_2: TClientDataSet;
DS_2: TDataSource;
cds_1: TClientDataSet;
cds_3: TClientDataSet;
ds_3: TDataSource;
ds_1: TDataSource;
ADOQueryMain: TADOQuery;
cds_paramsoutPage: TStringField;
ADOQueryPrint: TADOQuery;
cds_paramsEndPieceNo: TIntegerField;
cds_paramsBeginPieceNo: TIntegerField;
cds_paramsFixedLength: TIntegerField;
cds_paramspacknoMake: TStringField;
cds_paramspieceOrder: TBooleanField;
cds_paramsLabVolume: TStringField;
cds_paramsLabPackage: TStringField;
cxGroupBox_keys: TcxGroupBox;
FrameKeyBoard1: TFrameKeyBoard;
cds_paramsAddwetPresent: TFloatField;
cds_paramsAddLenPresent: TFloatField;
GPM_3: TcxGridPopupMenu;
ADOQueryImage: TADOQuery;
DS_IMAGE: TDataSource;
cds_paramspackPrintPreview: TBooleanField;
cds_paramspacklabNumber: TIntegerField;
cds_paramspackPostAction: TStringField;
ADO_CJ: TADOQuery;
2025-02-21 15:28:49 +08:00
fRMDB_1: TfrxDBDataset;
frxReport1: TfrxReport;
frxPPTXExport1: TfrxPPTXExport;
frxXLSXExport1: TfrxXLSXExport;
frxReportTableObject1: TfrxReportTableObject;
frxOLEObject1: TfrxOLEObject;
frxRichObject1: TfrxRichObject;
frxBarCodeObject1: TfrxBarCodeObject;
2025-03-20 16:38:30 +08:00
cxGrid2: TcxGrid;
TV2: TcxGridDBTableView;
cxGridDBColumn1: TcxGridDBColumn;
TV2Column1: TcxGridDBColumn;
TV2Column2: TcxGridDBColumn;
v1PRTColor: TcxGridDBColumn;
v1PRTOrderQty: TcxGridDBColumn;
v1OrderUnit: TcxGridDBColumn;
cxGridDBColumn7: TcxGridDBColumn;
2025-03-13 13:37:36 +08:00
cxGridLevel1: TcxGridLevel;
2025-03-20 16:38:30 +08:00
TV2Column3: TcxGridDBColumn;
TV2Column4: TcxGridDBColumn;
ADO_2: TADOQuery;
TV2Column5: TcxGridDBColumn;
TV2Column7: TcxGridDBColumn;
2025-06-27 17:30:04 +08:00
Panel1: TPanel;
edtScan: TcxTextEdit;
Label1: TLabel;
OrderNo: TcxTextEdit;
ColorNo: TcxTextEdit;
FtyPCId: TcxTextEdit;
Qty: TcxTextEdit;
BCIOID: TcxTextEdit;
Color: TcxTextEdit;
CodeName: TcxTextEdit;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
Label9: TLabel;
InputLen: TcxTextEdit;
lblLenUnit: TLabel;
Label10: TLabel;
InputWeight: TcxTextEdit;
Tare: TcxTextEdit;
Label11: TLabel;
BTPrint: TButton;
Coefficient: TcxTextEdit;
lblRuleConversion: TcxComboBox;
Label12: TLabel;
AOrdDefNote1: TcxRichEdit;
packnote: TcxMemo;
unitPieces: TcxTextEdit;
presentWeight: TcxTextEdit;
presentLen: TcxTextEdit;
bt_printmd: TButton;
addWet: TcxTextEdit;
addLen: TcxTextEdit;
C_GramWeight: TcxTextEdit;
C_Width: TcxTextEdit;
customStrField2: TcxTextEdit;
customStrField1: TcxTextEdit;
C_StyleNo: TcxTextEdit;
RuleYardstick: TcxTextEdit;
C_Pattern: TcxTextEdit;
OutPutWeight: TcxTextEdit;
cxDBImage1: TcxDBImage;
Button1: TButton;
TV2Column8: TcxGridDBColumn;
2025-07-15 10:37:37 +08:00
Panel2: TPanel;
cxGrid3: TcxGrid;
Tv3: TcxGridDBTableView;
v3PieceNo: TcxGridDBColumn;
Tv3Yardage: TcxGridDBColumn;
Tv3Meter: TcxGridDBColumn;
v3NetWeight: TcxGridDBColumn;
v3GrossWeight: TcxGridDBColumn;
Tv3Grade: TcxGridDBColumn;
tv3CIID: TcxGridDBColumn;
cxGridLevel2: TcxGridLevel;
ToolBar2: TToolBar;
ToolButton3: TToolButton;
Trolldel: TToolButton;
ToolButton1: TToolButton;
Tlog: TToolButton;
ToolButton8: TToolButton;
2025-09-08 10:53:41 +08:00
ToolButton2: TButton;
2025-09-29 09:23:46 +08:00
Tv3Column1: TcxGridDBColumn;
TV2Column6: TcxGridDBColumn;
TV2Column9: TcxGridDBColumn;
TV2Column10: TcxGridDBColumn;
2026-06-13 16:49:18 +08:00
ToolButton4: TToolButton;
GroupBox1: TGroupBox;
Button3: TButton;
Label13: TLabel;
Label14: TLabel;
Label15: TLabel;
C_CODE: TcxTextEdit;
C_NAME2: TcxComboBox;
ADO_PM: TADOQuery;
Label16: TLabel;
DUNIT: TcxTextEdit;
ADO_YS: TADOQuery;
Label17: TLabel;
C_COLOR: TcxTextEdit;
Label18: TLabel;
CICUNIT: TcxTextEdit;
Panel3: TPanel;
cxGrid1: TcxGrid;
TV1: TcxGridDBTableView;
cxGridDBColumn2: TcxGridDBColumn;
cxGridLevel3: TcxGridLevel;
CDS_4: TClientDataSet;
DS_4: TDataSource;
ADO_4: TADOQuery;
C_NAME: TcxTextEdit;
Tv3Column2: TcxGridDBColumn;
cxGridPopupMenu1: TcxGridPopupMenu;
cxTextEdit1: TcxTextEdit;
cxStyleRepository1: TcxStyleRepository;
cxStyle1: TcxStyle;
DS_YS: TDataSource;
Button4: TButton;
Panel4: TPanel;
Label19: TLabel;
SCAN2: TcxTextEdit;
cxGrid4: TcxGrid;
TV4: TcxGridDBTableView;
cxGridDBColumn3: TcxGridDBColumn;
cxGridLevel4: TcxGridLevel;
Label20: TLabel;
TV4Column1: TcxGridDBColumn;
TV4Column2: TcxGridDBColumn;
DS_HP: TDataSource;
CDS_HP: TClientDataSet;
Button5: TButton;
Button6: TButton;
CheckBox1: TCheckBox;
TV2Column11: TcxGridDBColumn;
CRTYPE: TcxComboBox;
Button2: TButton;
C_COLORNO: TcxTextEdit;
Panel5: TPanel;
cxGrid5: TcxGrid;
TV5: TcxGridDBTableView;
cxGridDBColumn4: TcxGridDBColumn;
cxGridLevel5: TcxGridLevel;
CDS_5: TClientDataSet;
DS_5: TDataSource;
ADO_5: TADOQuery;
2025-02-20 14:17:49 +08:00
procedure FormCreate( Sender: TObject) ;
procedure FormShow( Sender: TObject) ;
procedure FormClose( Sender: TObject; var Action: TCloseAction) ;
procedure FormDestroy( Sender: TObject) ;
procedure edtScanDblClick( Sender: TObject) ;
procedure edtScanKeyPress( Sender: TObject; var Key: Char ) ;
procedure ToolButton8Click( Sender: TObject) ;
procedure edtScanEnter( Sender: TObject) ;
procedure BTPrintClick( Sender: TObject) ;
procedure TrolldelClick( Sender: TObject) ;
procedure ToolButton3Click( Sender: TObject) ;
procedure Tv3CustomDrawCell( Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean ) ;
procedure InputLenKeyPress( Sender: TObject; var Key: Char ) ;
procedure InputLenPropertiesChange( Sender: TObject) ;
procedure FrameKeyBoard1SpeedButton_ycClick( Sender: TObject) ;
procedure dxLayoutItem1CaptionClick( Sender: TObject) ;
procedure lblRuleConversionPropertiesChange( Sender: TObject) ;
procedure bt_printmdClick( Sender: TObject) ;
procedure dxLayoutControl_packDblClick( Sender: TObject) ;
procedure ToolButton1Click( Sender: TObject) ;
2025-02-21 15:28:49 +08:00
procedure FrameKeyBoard1SpeedButton1Click( Sender: TObject) ;
2025-02-25 16:04:43 +08:00
procedure ToolButton2Click( Sender: TObject) ;
2025-06-27 17:30:04 +08:00
procedure Button1Click( Sender: TObject) ;
2026-05-08 14:20:02 +08:00
procedure FrameKeyBoard1SpeedButton_backClick( Sender: TObject) ;
2026-06-13 16:49:18 +08:00
procedure ToolButton4Click( Sender: TObject) ;
procedure Button3Click( Sender: TObject) ;
procedure Button2Click( Sender: TObject) ;
procedure C_NAMEExit( Sender: TObject) ;
procedure C_NAMEPropertiesChange( Sender: TObject) ;
procedure c_colornoPropertiesChange( Sender: TObject) ;
procedure C_NAME2Click( Sender: TObject) ;
procedure C_NAME2Enter( Sender: TObject) ;
procedure c_colornoExit( Sender: TObject) ;
procedure c_colornoEnter( Sender: TObject) ;
procedure TV1CellClick( Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean ) ;
procedure C_NAMEClick( Sender: TObject) ;
procedure Panel1Click( Sender: TObject) ;
procedure cxTextEdit1Click( Sender: TObject) ;
procedure Button4Click( Sender: TObject) ;
procedure SCAN2KeyPress( Sender: TObject; var Key: Char ) ;
procedure Button6Click( Sender: TObject) ;
procedure Button5Click( Sender: TObject) ;
procedure ColorNoClick( Sender: TObject) ;
procedure C_COLORNOClick( Sender: TObject) ;
procedure TV5CellClick( Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean ) ;
procedure GroupBox1Click( Sender: TObject) ;
2025-02-20 14:17:49 +08:00
private
2025-02-20 17:32:25 +08:00
FCIID, FCIFName, FWorkshop: string ;
2026-06-13 16:49:18 +08:00
FBCIOID, FC_Code, FC_ColorNo, FC_Color, FQtyUnit, FLenUnit, FTMSId, FTMMId: string ;
2025-02-20 14:17:49 +08:00
Faddwet, faddlen: double ;
FFtyPCId, FGangNo, FRulePieceNo, FCDUnit: string ;
FPieceNo: Integer ;
fIsPack: string ;
fIsCommopen: Boolean ;
FPacketCIID: string ;
fLabPackage, fLabVolume: string ;
FPacketCount: Integer ;
fAddwetVirtual: double ;
fAddLenVirtual: double ;
fTareType: string ;
funitPiecesStr: string ; //ƴƥ
procedure setFocusCtrol( controlName: string ) ;
procedure QuantityConversion( ) ;
procedure ClearGlobal( ) ;
procedure InitPlan( MSubID: string ) ;
procedure SetUnit( MUnit: string ) ;
procedure SetDdetails( ) ;
procedure SetINIFile( ) ;
procedure GetINIFile( ) ;
procedure InitJYGrid( ) ;
2025-03-20 16:38:30 +08:00
procedure InitGrid2( ) ;
2026-06-13 16:49:18 +08:00
procedure InitGridCP( ) ;
procedure InitGridys( ) ;
2025-02-20 14:17:49 +08:00
procedure OpenCom( DllName: string ) ;
procedure CloseCom( DllName: string ) ;
2026-02-05 17:10:07 +08:00
procedure clearCom( DllName: string ) ;
2025-02-20 14:17:49 +08:00
function SaveData( ) : Boolean ;
procedure PrtData( MCIID: string ; againPring: Boolean = false ) ;
2026-06-13 16:49:18 +08:00
procedure PrtData2( MCIID: string ; againPring: Boolean = false ) ;
2025-02-20 14:17:49 +08:00
procedure BadSpeedButtonClick( Sender: TObject) ;
procedure setFormCtrol( ) ;
procedure On1201( var Message : Tmessage) ; message 1 2 0 1 ; // <20> <> <EFBFBD> ӳ<EFBFBD>
procedure On1301( var Message : Tmessage) ; message 1 3 0 1 ; // <20> <> <EFBFBD> <EFBFBD>
2025-02-20 17:32:25 +08:00
function CheckData( CKType: string ) : Boolean ;
2025-02-20 14:17:49 +08:00
function deletePack( packId: string ) : boolean ;
type
2026-06-13 16:49:18 +08:00
2025-02-20 14:17:49 +08:00
public
2026-06-13 16:49:18 +08:00
fmanage, fzt, FZT2: string ;
2025-09-29 09:23:46 +08:00
fFlileFlag, FCKLX: string ; //FCKLX <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> վ<EFBFBD> <D5BE> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
2025-02-20 14:17:49 +08:00
end ;
var
frmMachRollMain: TfrmMachRollMain;
newh, newh1: hwnd;
implementation
uses
U_DataLink, U_ControlData, U_ParamSet, U_RTFun, U_globalVar,
U_FormLayOutDesign, U_ZDYHelp, U_iniParam, U_ProductListHelp, U_SysLogList,
2025-06-27 17:30:04 +08:00
U_ProgressUpdate, U_LabelPrint, U_TradeClothTotalOutSel;
2025-02-20 14:17:49 +08:00
{$R *.dfm}
2026-02-05 17:10:07 +08:00
procedure TfrmMachRollMain. ClearCom( DllName: string ) ;
type
TMyFunc = function( sCommName: PAnsiChar ) : hwnd; stdcall ;
var
Tf1: TMyFunc;
Tp1: TFarProc;
Th1: Thandle;
begin
Th1 : = LoadLibrary( pchar( trim( DllName) ) ) ;
if Th1 > 0 then
begin
try
Tp1 : = GetProcAddress( Th1, 'CommClear' ) ;
if Tp1 < > nil then
begin
Tf1 : = TMyFunc( Tp1) ;
newh1 : = Tf1( 'Comm1' ) ;
end
else
begin
end ;
finally
// FreeLibrary(Th1);
end ;
end
else
begin
Application. MessageBox( pchar( '<27> Ҳ<EFBFBD> <D2B2> <EFBFBD> ' + trim( DllName) + ' <20> ļ<EFBFBD> <C4BC> <EFBFBD> ' ) , '<27> <> ʾ ' ) ;
end ;
end ;
2025-03-20 16:38:30 +08:00
procedure TfrmMachRollMain. InitGrid2( ) ;
var
SqlStr: string ;
begin
2025-09-29 09:23:46 +08:00
if FCKLX = '<27> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ' then
begin
SqlStr : = ' exec P_Trade_Market_WaitOut_Market ' ;
SqlStr : = SqlStr + ' @TMSId =' + quotedstr( trim( FTMSId) ) ;
end
else
begin
SqlStr : = ' exec P_Trade_Market_WaitOut ' ;
SqlStr : = SqlStr + ' @C_Code =' + quotedstr( trim( FC_Code) ) ;
SqlStr : = SqlStr + ' ,@C_ColorNo =' + quotedstr( trim( FC_ColorNo) ) ;
end ;
2025-03-20 16:38:30 +08:00
2025-09-29 09:23:46 +08:00
// showmessage(SqlStr);
2025-03-20 16:38:30 +08:00
InitCDSData( ADO_2, CDS_2, Tv2, SqlStr, '' , '' ) ;
end ;
2026-06-13 16:49:18 +08:00
procedure TfrmMachRollMain. InitGridCP( ) ;
var
SqlStr: string ;
begin
SqlStr : = ' select distinct C_CODE,c_name from bs_cloth_info where c_name like ' + quotedstr( '%' + trim( C_NAME. Text ) + '%' ) ;
SqlStr : = SqlStr + 'order by C_CODE,c_name' ;
// showmessage(SqlStr);
InitCDSData( ADO_4, CDS_4, Tv1, SqlStr, '' , '' ) ;
end ;
procedure TfrmMachRollMain. InitGridys( ) ;
var
SqlStr: string ;
begin
SqlStr : = ' select distinct A.C_Code,B.C_Color,B.C_ColorNo,B.referencePrice AS Price from bs_cloth_info A inner join BS_Cloth_Info_Sub B on A.BCIID=B.BCIID where c_name = ' + quotedstr( trim( C_NAME. Text ) ) ;
SqlStr : = SqlStr + ' AND B.C_ColorNO LIKE ' + quotedstr( '%' + trim( C_ColorNO. Text ) + '%' ) ;
SqlStr : = SqlStr + 'order by B.C_Color,B.C_ColorNo' ;
// showmessage(SqlStr);
InitCDSData( ADO_5, CDS_5, Tv5, SqlStr, '' , '' ) ;
end ;
2025-02-20 17:32:25 +08:00
function TfrmMachRollMain. CheckData( CKType: string ) : Boolean ;
var
mvalue: double ;
mCurPieceNo: Integer ;
begin
Result : = false ;
try
if trim( FBCIOID) = '' then
raise Exception. create( '<27> <> ɨ<EFBFBD> <C9A8> <EFBFBD> <EFBFBD> <EFBFBD> ̿<EFBFBD> <CCBF> <EFBFBD> ' ) ;
if trim( CKType) = '<27> ύ' then
begin
2025-06-27 17:30:04 +08:00
if trim( lblLenUnit. Caption) = '' then
2025-02-20 17:32:25 +08:00
raise Exception. create( '<27> <> <EFBFBD> ȵ<EFBFBD> λ<EFBFBD> <CEBB> <EFBFBD> <EFBFBD> Ϊ<EFBFBD> <CEAA> !' ) ;
if trim( InputWeight. Text ) < > '' then
begin
if TryStrToFloat( InputWeight. Text , mvalue) = false then
raise Exception. create( '<27> <> <EFBFBD> <EFBFBD> ¼<EFBFBD> <C2BC> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> !' ) ;
if strtofloatdef( trim( InputWeight. Text ) , 0 ) < cds_params. fieldbyName( 'minWeight' ) . AsInteger then
raise Exception. create( '<27> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> С <EFBFBD> <D0A1> ' + cds_params. fieldbyName( 'minWeight' ) . AsString + '!' ) ;
if strtofloatdef( trim( InputWeight. Text ) , 0 ) > cds_params. fieldbyName( 'maxWeight' ) . AsInteger then
raise Exception. create( '<27> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ܴ<EFBFBD> <DCB4> <EFBFBD> ' + cds_params. fieldbyName( 'maxWeight' ) . AsString + '!' ) ;
end ;
if trim( InputLen. Text ) < > '' then
begin
if TryStrToFloat( InputLen. Text , mvalue) = false then
raise Exception. create( '<27> <> <EFBFBD> <EFBFBD> ¼<EFBFBD> <C2BC> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> !' ) ;
if strtofloatdef( trim( InputLen. Text ) , 0 ) < cds_params. fieldbyName( 'minLen' ) . AsInteger then
raise Exception. create( '<27> <> <EFBFBD> Ȳ<EFBFBD> <C8B2> <EFBFBD> С <EFBFBD> <D0A1> ' + cds_params. fieldbyName( 'minLen' ) . AsString + '<27> <> !' ) ;
if strtofloatdef( trim( InputLen. Text ) , 0 ) > cds_params. fieldbyName( 'maxLen' ) . AsInteger then
raise Exception. create( '<27> <> <EFBFBD> Ȳ<EFBFBD> <C8B2> ܴ<EFBFBD> <DCB4> <EFBFBD> ' + cds_params. fieldbyName( 'maxLen' ) . AsString + '<27> <> !' ) ;
end ;
2026-06-13 16:49:18 +08:00
if UpperCase( CICUNIT. Text ) = 'KG' then
2025-02-20 17:32:25 +08:00
begin
if ( strtofloatdef( trim( InputWeight. Text ) , 0 ) = 0 ) then
raise Exception. create( '<27> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ϊ0!!' ) ;
end
2026-06-13 16:49:18 +08:00
else if ( UpperCase( CICUNIT. Text ) = 'M' ) or ( UpperCase( CICUNIT. Text ) = 'Y' ) then
2025-02-20 17:32:25 +08:00
begin
if ( strtofloatdef( trim( InputLen. Text ) , 0 ) = 0 ) then
raise Exception. create( '<27> <> <EFBFBD> Ȳ<EFBFBD> <C8B2> <EFBFBD> Ϊ0!!' ) ;
2026-06-13 16:49:18 +08:00
end
else
begin
if ( strtofloatdef( trim( InputLen. Text ) , 0 ) = 0 ) and ( strtofloatdef( trim( InputWeight. Text ) , 0 ) = 0 ) then
raise Exception. create( '<27> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ܶ<EFBFBD> Ϊ0!!' ) ;
2025-02-20 17:32:25 +08:00
end ;
2026-06-13 16:49:18 +08:00
// if UpperCase(FQtyUnit) = 'KG' then
// begin
// if (strtofloatdef(trim(InputWeight.Text), 0) = 0) then
// raise Exception.create('<27> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ϊ0!!');
// end
// else
// begin
// if (strtofloatdef(trim(InputLen.Text), 0) = 0) then
// raise Exception.create('<27> <> <EFBFBD> Ȳ<EFBFBD> <C8B2> <EFBFBD> Ϊ0!!');
// end;
2025-02-20 17:32:25 +08:00
end ;
Result : = true ;
except
Application. MessageBox( pchar( Exception( ExceptObject) . Message ) , '<27> <> ʾ <EFBFBD> <CABE> Ϣ' , 0 ) ;
end ;
end ;
2025-02-20 14:17:49 +08:00
procedure TfrmMachRollMain. BTPrintClick( Sender: TObject) ;
var
fPrintFile, MPacketId: string ;
mvalue: double ;
i: Integer ;
begin
2026-06-13 16:49:18 +08:00
if CDS_2. IsEmpty then
begin
Application. MessageBox( '<27> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ' , '<27> <> ʾ <EFBFBD> <CABE> Ϣ' , 0 ) ;
exit;
end ;
2025-02-20 14:17:49 +08:00
try
BTPrint. Enabled : = false ;
edtScan. SetFocus;
2025-02-20 17:32:25 +08:00
2025-02-20 14:17:49 +08:00
if CheckData( '<27> ύ' ) = false then
exit;
if SaveData( ) then
begin
InputLen. Text : = '' ;
presentLen. Text : = '' ;
funitPiecesStr : = '' ;
presentWeight. Text : = '' ;
2025-02-20 17:32:25 +08:00
if fileexists( ExtractFilePath( Application. ExeName) + '<27> <> ȷ.wav' ) then
playSound( pwidechar( '<27> <> ȷ.wav' ) , 0 , SND_FILENAME or SND_ASYNC) ;
2025-02-20 14:17:49 +08:00
InputWeight. Text : = '' ;
if trim( cds_params. fieldbyName( 'outPage' ) . AsString) = '<27> <> ' then
begin
PrtData( FCIID) ;
end ;
end ;
InputLen. SetFocus;
setFocusCtrol( InputLen. Name ) ;
InitJYGrid( ) ;
2025-03-20 16:38:30 +08:00
InitGrid2( ) ;
2026-06-13 16:49:18 +08:00
2025-02-20 14:17:49 +08:00
FCIID : = '' ;
finally
BTPrint. Enabled : = true ;
end ;
2026-02-05 17:10:07 +08:00
if fIsCommopen then
begin
ClearCom( MBDYDllName) ;
end ;
2026-06-13 16:49:18 +08:00
edtScan. SetFocus( ) ;
2025-02-20 14:17:49 +08:00
end ;
procedure TfrmMachRollMain. bt_printmdClick( Sender: TObject) ;
var
WSql: string ;
begin
if cds_3. IsEmpty then
Exit;
WSql : = '' ;
cds_3. DisableControls;
with cds_3 do
begin
First;
while not Eof do
begin
if WSql < > '' then
begin
WSql : = WSql + ',' + Trim( cds_3. fieldbyname( 'CIID' ) . AsString) ;
end
else
begin
WSql : = Trim( cds_3. fieldbyname( 'CIID' ) . AsString) ;
end ;
Next;
end ;
end ;
cds_3. EnableControls;
// try
// frmMdPrint := TfrmMdPrint.Create(Application);
// with frmMdPrint do
// begin
// FLMType := '<27> <> <EFBFBD> <EFBFBD> <EFBFBD> 뵥';
// FFiltration1 := WSql;
// FFiltration2 := WSql;
// if ShowModal = 1 then
// begin
//// Self.InitGrid();
// end;
// end;
// finally
// frmMdPrint.Free;
// end;
try
frmLabelPrint : = TfrmLabelPrint. Create( Application) ;
with frmLabelPrint do
begin
FLMType : = '<27> <> <EFBFBD> <EFBFBD> <EFBFBD> 뵥' ;
FFiltration1 : = WSql;
if ShowModal = 1 then
begin
// Self.InitGrid();
end ;
end ;
finally
frmLabelPrint. Free;
end ;
end ;
2025-06-27 17:30:04 +08:00
procedure TfrmMachRollMain. Button1Click( Sender: TObject) ;
var
fPrintFile, MPacketId, MTMSId: string ;
mvalue: double ;
i: Integer ;
begin
try
2026-02-05 17:10:07 +08:00
Button1. Enabled : = false ;
2025-06-27 17:30:04 +08:00
MTMSId : = Trim( SelTVKey( Tv2, [ 'TMSId' ] ) [ 0 ] ) ;
edtScan. SetFocus;
try
ADOQueryBaseCmd. Connection. BeginTrans;
2026-06-13 16:49:18 +08:00
if trim( MTMSId) = '' then
raise Exception. create( '<27> <> ѡ <EFBFBD> <D1A1> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ' ) ;
2025-06-27 17:30:04 +08:00
if trim( FBCIOID) = '' then
raise Exception. create( '<27> <> ɨ<EFBFBD> <C9A8> <EFBFBD> <EFBFBD> <EFBFBD> ̿<EFBFBD> <CCBF> <EFBFBD> ' ) ;
with ADOQueryBaseCmd do
begin
Close;
sql. Clear;
Sql. Add( 'exec P_BS_Cloth_Out_DistributionAll ' ) ;
Sql. Add( ' @StkID=' + quotedstr( Trim( FBCIOID) ) ) ;
Sql. Add( ' ,@TMSId =' + quotedstr( MTMSId) ) ;
Sql. Add( ' ,@Dcode=' + quotedstr( Trim( Dcode) ) ) ;
Sql. Add( ' ,@DName=' + quotedstr( Trim( DName) ) ) ;
2025-07-21 17:21:17 +08:00
// showmessage(sql.Text);
2025-06-27 17:30:04 +08:00
open;
end ;
if ADOQueryBaseCmd. fieldbyName( 'intReturn' ) . AsInteger = - 1 then
begin
raise Exception. create( pchar( trim( ADOQueryBaseCmd. fieldbyName( 'ShowMsg' ) . AsString) ) ) ;
end ;
FCIID : = trim( trim( ADOQueryBaseCmd. fieldbyName( 'MaxIOID2' ) . AsString) ) ;
2026-02-05 17:10:07 +08:00
if trim( cds_params. fieldbyName( 'outPage' ) . AsString) = '<27> <> ' then
begin
PrtData( FCIID) ;
end ;
2025-06-27 17:30:04 +08:00
ADOQueryBaseCmd. Connection. CommitTrans;
TradeMarketProgressUpdate( ADOQueryBaseCmd, MTMSId) ;
except
ADOQueryBaseCmd. Connection. RollbackTrans;
Application. MessageBox( pchar( Exception( ExceptObject) . Message ) , '<27> <> ʾ <EFBFBD> <CABE> Ϣ' , 0 ) ;
end ;
InputLen. SetFocus;
setFocusCtrol( InputLen. Name ) ;
InitJYGrid( ) ;
InitGrid2( ) ;
FCIID : = '' ;
finally
2026-02-05 17:10:07 +08:00
Button1. Enabled : = true ;
end ;
if fIsCommopen then
begin
ClearCom( MBDYDllName) ;
2025-06-27 17:30:04 +08:00
end ;
2026-06-13 16:49:18 +08:00
edtScan. SetFocus( ) ;
end ;
procedure TfrmMachRollMain. Button2Click( Sender: TObject) ;
var
Maxno, MBCIOID: string ;
MInputLen, MMeter, MYardage: double ;
MInputWeight, MGrossWeight, MNetWeight, MTare, Maddwet, maddLen: double ;
mYardStick: double ;
mPresentLen, mpresentWeight: double ;
begin
if C_name. Text = '' then
begin
application. MessageBox( '<27> <> <EFBFBD> Ʋ<EFBFBD> <C6B2> <EFBFBD> Ϊ<EFBFBD> <CEAA> ' , '<27> <> ʾ <EFBFBD> <CABE> Ϣ' , 0 ) ;
exit;
end ;
if C_COlor. Text = '' then
begin
application. MessageBox( '<27> <> ɫ<EFBFBD> <C9AB> <EFBFBD> <EFBFBD> Ϊ<EFBFBD> <CEAA> ' , '<27> <> ʾ <EFBFBD> <CABE> Ϣ' , 0 ) ;
exit;
end ;
if DUNIT. Text = '' then
begin
application. MessageBox( '<27> <> λ<EFBFBD> <CEBB> <EFBFBD> <EFBFBD> Ϊ<EFBFBD> <CEAA> ' , '<27> <> ʾ <EFBFBD> <CABE> Ϣ' , 0 ) ;
exit;
end ;
if ( ( DUNIT. Text = 'M' ) or ( DUNIT. Text = 'Y' ) ) and ( StrToFloatDef( InputLen. Text , 0 ) = 0 ) then
begin
application. MessageBox( '<27> <> <EFBFBD> Ȳ<EFBFBD> <C8B2> <EFBFBD> Ϊ0' , '<27> <> ʾ <EFBFBD> <CABE> Ϣ' , 0 ) ;
exit;
end ;
if ( UpperCase( DUNIT. Text ) = 'KG' ) and ( StrToFloatDef( InputWEIGHT. Text , 0 ) = 0 ) then
begin
application. MessageBox( '<27> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ϊ0' , '<27> <> ʾ <EFBFBD> <CABE> Ϣ' , 0 ) ;
exit;
end ;
with ADOQueryBaseTemp do
begin
Close;
sql. Clear;
sql. Add( 'select * from Bs_Cloth_Info A INNER JOIN BS_Cloth_Info_Sub B ON A.BCIID=B.BCIID ' ) ;
SQL. Add( ' where c_name=' + QuotedStr( C_NAME. Text ) ) ;
SQL. Add( ' AND B.c_COLOR=' + QuotedStr( c_COLOR. Text ) ) ;
SQL. Add( ' AND B.C_ColorNo=' + QuotedStr( C_ColorNo. Text ) ) ;
open;
end ;
if ADOQueryBaseTemp. IsEmpty then
begin
application. MessageBox( 'δ<> ҵ<EFBFBD> <D2B5> ò<EFBFBD> Ʒ ɫ<C6B7> <C9AB> <EFBFBD> <EFBFBD> ɫ<EFBFBD> <C9AB> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ȷ<EFBFBD> Ϻ <EFBFBD> <CFBA> <EFBFBD> д' , '<27> <> ʾ <EFBFBD> <CABE> Ϣ' , 0 ) ;
exit;
end ;
try
ADOQueryBaseCmd. Connection. BeginTrans;
Maddwet : = strTofloatDef( trim( addwet. text ) , 0 ) ; // Faddwet;
maddLen : = strTofloatDef( trim( addlen. text ) , 0 ) ; // faddlen;
mYardStick : = strtofloatdef( trim( RuleYardstick. Text ) , 1 0 0 ) ;
mPresentLen : = strTofloatDef( trim( presentlen. text ) , 0 ) ;
mpresentWeight : = strTofloatDef( trim( presentWeight. text ) , 0 ) ;
with ADOQueryBaseTemp do
begin
Close;
sql. Clear;
sql. Add( 'select * from BS_Cloth_IO where 1<>1 ' ) ;
open;
end ;
if not GetLSNo( ADOQueryBaseCmd, Maxno, 'TC' , 'BS_Cloth_IO' , 4 , 1 ) then
raise Exception. Create( 'ȡ<> <C8A1> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ʧ<EFBFBD> ܣ<EFBFBD> ' ) ;
if ( strtoIntdef( Trim( unitPieces. Text ) , 0 ) > 0 ) and ( strtoIntdef( trim( InputLen. Text ) , 0 ) > 0 ) then
begin
if strtoIntdef( trim( InputLen. Text ) , 0 ) > strtoIntdef( Trim( unitPieces. Text ) , 0 ) then
funitPiecesStr : = intTostr( ( strtoIntdef( trim( InputLen. Text ) , 0 ) ) - strtoIntdef( Trim( unitPieces. Text ) , 0 ) ) + '+' + Trim( unitPieces. Text ) ;
end ;
//0:<3A> <> <EFBFBD> 䣻1<E4A3BB> <31> <EFBFBD> <EFBFBD> ȥ<EFBFBD> <C8A5> <EFBFBD> <EFBFBD>
if gPresentNumFlag = 1 then
begin
mPresentLen : = - 1 * mPresentLen;
mpresentWeight : = - 1 * mpresentWeight;
end ;
MTare : = strtofloatdef( trim( Tare. Text ) , 0 ) ; // Ƥ<> <C6A4>
MInputWeight : = RoundFloat( strtofloatdef( trim( InputWeight. Text ) , 0 ) , cds_params. fieldbyName( 'KgPlace' ) . AsInteger) ; // <20> <> <EFBFBD> <EFBFBD>
MGrossWeight : = MInputWeight + Maddwet + mpresentWeight; // ë<> <C3AB>
MNetWeight : = MInputWeight + Maddwet + mpresentWeight - MTare; // <20> <> <EFBFBD> <EFBFBD> +<2B> <> <EFBFBD> <EFBFBD>
MInputLen : = RoundFloat( strtofloatdef( trim( InputLen. Text ) , 0 ) , 4 ) ;
// <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> +mAddLen
if ( uppercase( lblLenUnit. Caption) = 'M' ) or ( lblLenUnit. Caption = '<27> <> ' ) then
begin
MMeter : = RoundFloat( ( MInputLen + maddLen + mPresentLen) / ( mYardStick / 1 0 0 ) , cds_params. fieldbyName( 'MPlace' ) . AsInteger) ;
MYardage : = RoundFloat( MMeter / 0.9144 , cds_params. fieldbyName( 'YPlace' ) . AsInteger) ;
end
else
begin
MYardage : = RoundFloat( ( MInputLen + maddLen + mPresentLen) / ( mYardStick / 1 0 0 ) , cds_params. fieldbyName( 'YPlace' ) . AsInteger) ;
MMeter : = RoundFloat( MYardage * 0.9144 , cds_params. fieldbyName( 'MPlace' ) . AsInteger) ;
end ;
with ADOQueryBaseCmd do
begin
Close;
sql. Clear;
sql. Add( 'select * from BS_Cloth_IO where BCIOID=' '' + Trim( Maxno) + '' '' ) ;
Open;
end ;
with ADOQueryBaseCmd do
begin
if ADOQueryBaseCmd. ISEMPTY then
begin
Append;
FieldByName( 'Fillid' ) . Value : = Trim( Dcode) ;
FieldByName( 'Filler' ) . Value : = Trim( DName) ;
FieldByName( 'BCIONO' ) . Value : = Trim( Maxno) ;
FieldByName( 'BCIOID' ) . Value : = Trim( Maxno) ;
FieldByName( 'BCIONO' ) . Value : = Trim( Maxno) ;
FieldByName( 'STKID' ) . Value : = Trim( Maxno) ;
FieldByName( 'CIID' ) . Value : = Trim( Maxno) ;
end
else
begin
Edit;
FieldByName( 'Editid' ) . Value : = Trim( Dcode) ;
FieldByName( 'Editer' ) . Value : = Trim( DName) ;
FieldByName( 'EditTime' ) . Value : = SGetServerDate( ADOQueryBaseTemp) ;
FieldByName( 'status' ) . value : = '1' ;
end ;
FieldByName( 'C_NAME' ) . Value : = C_NAME. Text ;
FieldByName( 'C_CODE' ) . Value : = C_CODE. Text ;
FieldByName( 'C_COLORNO' ) . Value : = C_COLORNO. Text ;
FieldByName( 'C_COLOR' ) . Value : = C_COLOR. Text ;
FieldByName( 'IOTime' ) . Value : = StrToDate( FormatDateTime( 'yyyy-mm-dd' , SGetServerDate( ADOQueryBaseTemp) ) ) ;
FieldByName( 'STKName' ) . Value : = 'ó<> ײ<EFBFBD> ƥ' ;
FieldByName( 'IOFlag' ) . Value : = '<27> <> <EFBFBD> <EFBFBD> ' ;
FieldByName( 'IOTYPE' ) . Value : = CRTYPE. Text ;
FieldByName( 'IOQtyFlag' ) . Value : = 1 ;
FieldByName( 'piece' ) . Value : = 1 ;
FieldByName( 'stkpiece' ) . Value : = 1 ;
FieldByName( 'GrossWeight' ) . Value : = MGrossWeight;
FieldByName( 'NetWeight' ) . Value : = MNetWeight;
FieldByName( 'Meter' ) . Value : = MMeter;
FieldByName( 'Yardage' ) . Value : = MYardage;
FieldByName( 'QTYUNIT' ) . Value : = DUNIT. Text ;
if DUNIT. Text = 'M' then
begin
FieldByName( 'qty' ) . Value : = MMeter;
FieldByName( 'STKqty' ) . Value : = MMeter;
end
else if DUNIT. Text = 'Y' then
begin
FieldByName( 'qty' ) . Value : = MYardage;
FieldByName( 'STKqty' ) . Value : = MYardage;
end
else
begin
FieldByName( 'qty' ) . Value : = MGrossWeight;
FieldByName( 'STKqty' ) . Value : = MGrossWeight;
end ;
Post;
end ;
with ADOQueryBaseCmd 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 ADOQueryBaseCmd do
begin
Close;
sql. Clear;
sql. Add( 'Update BS_Cloth_IO Set status = 1' ) ;
sql. Add( ' where BCIOID=' '' + Trim( Maxno) + '' '' ) ;
ExecSQL;
end ;
with ADOQueryBaseCmd do
begin
Close;
sql. Clear;
sql. Add( 'insert into Finance_Need_Up(UType,UDataId,UOperation,UOperator,UModule,UDetails) ' ) ;
sql. Add( 'values(' 'ó<> ״<EFBFBD> <D7B4> 첼<EFBFBD> <ECB2BC> <EFBFBD> <EFBFBD> ' ' ' ) ;
sql. Add( ',' + quotedstr( Maxno) ) ;
sql. Add( ',' '<27> <> <EFBFBD> <EFBFBD> ' ' ' ) ;
sql. Add( ',' + quotedstr( DName) ) ;
sql. Add( ',' + quotedstr( trim( self. Caption) ) ) ;
sql. Add( ',' + quotedstr( Maxno) ) ;
sql. Add( ') ' ) ;
ExecSQL;
end ;
PrtData2( Maxno) ;
ADOQueryBaseCmd. Connection. CommitTrans;
InputLen. Text : = '' ;
presentLen. Text : = '' ;
funitPiecesStr : = '' ;
presentWeight. Text : = '' ;
except
ADOQueryBaseCmd. Connection. RollbackTrans;
application. MessageBox( PChar( Exception( ExceptObject) . Message ) , '<27> <> ʾ <EFBFBD> <CABE> Ϣ' , 0 ) ;
end ;
end ;
procedure TfrmMachRollMain. Button3Click( Sender: TObject) ;
begin
if GroupBox1. Visible = FALSE then
begin
GroupBox1. Visible : = True ;
button2. Visible : = True ;
CRTYPE. Visible : = True ;
end
else
begin
GroupBox1. Visible : = false ;
button2. Visible : = false ;
CRTYPE. Visible : = false ;
end ;
end ;
procedure TfrmMachRollMain. Button4Click( Sender: TObject) ;
begin
if BCIOID. text = '' then
begin
application. MessageBox( '<27> <> <EFBFBD> <EFBFBD> ɨ<EFBFBD> <C9A8> Ҫƴ<D2AA> <C6B4> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ' , '<27> <> ʾ <EFBFBD> <CABE> Ϣ' , 0 ) ;
exit;
end
else
begin
Label20. Caption : = '<27> ϵ<EFBFBD> <CFB5> <EFBFBD> <EFBFBD> <EFBFBD> Ϊ<EFBFBD> <CEAA> ' + BCIOID. text ;
Panel4. Visible : = true ;
with ADOQueryBaseTemp do
begin
Close;
sql. Clear;
sql. Add( 'select * From bs_cloth_io where 1<>1' ) ;
open;
end ;
SCreateCDS( ADOQueryBaseTemp, cds_hp) ;
SInitCDSData( ADOQueryBaseTemp, cds_hp) ;
end ;
end ;
procedure TfrmMachRollMain. Button5Click( Sender: TObject) ;
begin
if CDS_HP. IsEmpty then
begin
application. MessageBox( '<27> <> ϸ<EFBFBD> <CFB8> <EFBFBD> <EFBFBD> Ϊ<EFBFBD> <CEAA> ' , '<27> <> ʾ <EFBFBD> <CABE> Ϣ' , 0 ) ;
exit;
end ;
with CDS_HP do
begin
First;
while not Eof do
begin
try
ADOQueryBaseCmd. Connection. BeginTrans;
with ADOQueryBaseCmd do
begin
Close;
sql. Clear;
Sql. Add( 'exec P_BS_Cloth_Out_DistributionAll_hp ' ) ;
Sql. Add( ' @StkID=' + quotedstr( Trim( CDS_HP. FieldByName( 'bcioid' ) . AsString) ) ) ;
Sql. Add( ' ,@tostkid =' + quotedstr( bcioid. Text ) ) ;
Sql. Add( ' ,@Dcode=' + quotedstr( Trim( Dcode) ) ) ;
Sql. Add( ' ,@DName=' + quotedstr( Trim( DName) ) ) ;
// showmessage(sql.Text);
open;
end ;
if ADOQueryBaseCmd. fieldbyName( 'intReturn' ) . AsInteger = - 1 then
begin
raise Exception. create( pchar( trim( ADOQueryBaseCmd. fieldbyName( 'ShowMsg' ) . AsString) ) ) ;
end ;
ADOQueryBaseCmd. Connection. CommitTrans;
Application. MessageBox( pchar( '<27> <> <EFBFBD> <EFBFBD> <EFBFBD> ɹ<EFBFBD> ' ) , '<27> <> ʾ <EFBFBD> <CABE> Ϣ' , 0 ) ;
InitPlan( BCIOID. Text ) ;
except
ADOQueryBaseCmd. Connection. RollbackTrans;
Application. MessageBox( pchar( Exception( ExceptObject) . Message ) , '<27> <> ʾ <EFBFBD> <CABE> Ϣ' , 0 ) ;
end ;
Next;
end ;
end ;
end ;
procedure TfrmMachRollMain. Button6Click( Sender: TObject) ;
begin
Panel4. Visible : = false ;
2025-06-27 17:30:04 +08:00
end ;
2025-02-20 14:17:49 +08:00
procedure TfrmMachRollMain. FormClose( Sender: TObject; var Action: TCloseAction) ;
begin
inherited ;
if fIsCommopen then
begin
CloseCom( DZCDYDllName) ;
CloseCom( MBDYDllName) ;
end ;
Action : = caFree;
end ;
procedure TfrmMachRollMain. FormCreate( Sender: TObject) ;
begin
inherited ;
fIsCommopen : = false ;
cds_params. Close;
cds_params. CreateDataSet;
Panel_right. Align : = alClient;
end ;
procedure TfrmMachRollMain. FormDestroy( Sender: TObject) ;
begin
inherited ;
frmMachRollMain : = nil ;
end ;
procedure TfrmMachRollMain. FormShow( Sender: TObject) ;
var
i: Integer ;
begin
inherited ;
2025-02-20 17:32:25 +08:00
gIsCanDesign : = gIsCanDesign;
2025-02-20 14:17:49 +08:00
gGridNativeSet : = true ;
2025-02-20 17:32:25 +08:00
2025-02-20 14:17:49 +08:00
ReadCxGrid( trim( Self. Caption) + 'Tv3' , Tv3, gDllFileCaption) ;
2026-06-13 16:49:18 +08:00
ReadCxGrid( trim( Self. Caption) + 'Tv21' , Tv2, gDllFileCaption) ;
2025-02-20 14:17:49 +08:00
if IsINIFile( ) then
ReadINIFile( )
else
WriteINIFile;
GetINIFile( ) ;
setFormCtrol( ) ;
if trim( fmanage) < > '<27> <> Ȩ<EFBFBD> <C8A8> ' then
begin
if trim( DZCDYDllName) < > '' then
OpenCom( DZCDYDllName) ;
if trim( MBDYDllName) < > '' then
OpenCom( MBDYDllName) ;
end ;
if trim( fCanInputFs) = '1' then
begin
2025-08-13 17:36:55 +08:00
// cxGroupBox_keys.ClientHeight := round(cxGrid3.ClientHeight * 0.6);
2025-02-20 14:17:49 +08:00
frameKeyBoard1. SpeedButton10. Visible : = true ;
end
else
begin
2025-08-13 17:36:55 +08:00
// cxGroupBox_keys.ClientHeight := round(cxGrid3.ClientHeight * 0.55);
2025-02-20 14:17:49 +08:00
frameKeyBoard1. SpeedButton10. Visible : = false ;
end ;
2026-06-13 16:49:18 +08:00
with ADO_PM do
begin
Close;
sql. Clear;
sql. Add( ' SELECT distinct A.C_Name,A.C_CODE,TMSUnit=QTYUNIT ' ) ;
SQL. ADD( ' FROM Bs_Cloth_Info A ' ) ;
SQL. ADD( 'order by A.C_Code ' ) ;
// showmessage(SQL.text);
Open;
// c_name.Properties.LookupItems.Clear;
// while not Eof do
// begin
// c_name.Properties.LookupItems.Add(Trim(ADO_PM.fieldByName('c_name').AsString));
// Next;
// end;
end ;
with ADO_YS do
begin
Close;
sql. Clear;
sql. Add( ' SELECT DISTINCT A.C_Code,B.C_Color,B.C_ColorNo,B.referencePrice AS Price FROM Bs_Cloth_Info A inner join BS_Cloth_Info_Sub B on A.BCIID=B.BCIID ' ) ;
sql. Add( ' where 1<>1' ) ;
SQL. ADD( ' order by B.C_ColorNo' ) ;
//ShowMessage(sql.text);
Open;
end ;
// ֧<> <D6A7> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
// C_NAME.Properties.DropDownListStyle := lsEditList;
// C_NAME.Properties.ImeMode := imChinese;
2025-02-20 14:17:49 +08:00
end ;
2025-02-21 15:28:49 +08:00
procedure TfrmMachRollMain. FrameKeyBoard1SpeedButton1Click( Sender: TObject) ;
var
fsj: string ;
mComponent: TComponent;
mkey: Char ;
2026-06-13 16:49:18 +08:00
NewText: string ;
2025-02-21 15:28:49 +08:00
begin
fsj : = trim( TSpeedButton( Sender) . Hint) ;
if trim( fsj) = '' then
exit;
mComponent : = FindComponent( trim( TSpeedButton( Sender) . Hint) ) ;
if mComponent = nil then
exit;
if TcxTextEdit( mComponent) . Name = 'KuangHao' then
exit;
2026-06-13 16:49:18 +08:00
if ( trim( TSpeedButton( Sender) . Caption) = '<27> <> ' ) then
2025-02-21 15:28:49 +08:00
begin
2026-06-13 16:49:18 +08:00
Tare. Text : = FloatToStr( strtofloatdef( Tare. Text , 0 ) + 0.1 ) ;
2025-02-21 15:28:49 +08:00
end
2026-06-13 16:49:18 +08:00
else if ( trim( TSpeedButton( Sender) . Caption) = '<27> <> ' ) then
2025-02-21 15:28:49 +08:00
begin
2026-06-13 16:49:18 +08:00
Tare. Text : = FloatToStr( strtofloatdef( Tare. Text , 0 ) - 0.1 ) ;
2025-02-21 15:28:49 +08:00
end
2026-06-13 16:49:18 +08:00
else
2025-02-21 15:28:49 +08:00
begin
2026-06-13 16:49:18 +08:00
if ( TcxTextEdit( mComponent) . Name = 'edtScan' ) and ( trim( TSpeedButton( Sender) . Caption) = '<27> س<EFBFBD> ' ) then
begin
mkey : = #13 ;
edtScanKeyPress( edtScan, mkey) ;
exit;
end ;
fsj : = trim( TcxTextEdit( mComponent) . Text ) ;
if mComponent is TcxCurrencyEdit then
begin
TcxCurrencyEdit( mComponent) . text : = fsj + trim( TSpeedButton( Sender) . Caption) ;
TcxCurrencyEdit( mComponent) . SelectAll;
end
else if mComponent is TcxTextEdit then
begin
TcxTextEdit( mComponent) . Text : = fsj + trim( TSpeedButton( Sender) . Caption) ;
TcxTextEdit( mComponent) . SelectAll;
end
else if mComponent is TcxComboBox then
begin
NewText : = fsj + trim( TSpeedButton( Sender) . Caption) ;
;
// C_NAME.Properties.OnChange := nil;
if TcxComboBox( mComponent) . Properties. Items. IndexOf( NewText) = - 1 then
TcxComboBox( mComponent) . Properties. Items. Add( NewText) ;
TcxComboBox( mComponent) . ItemIndex : = TcxComboBox( mComponent) . Properties. Items. IndexOf( NewText) ;
TcxComboBox( mComponent) . DroppedDown : = True ;
// C_NAME.Text := C_NAME.Text + '1';
// TcxComboBox(mComponent).Text := fsj + trim(TSpeedButton(Sender).Caption);
// TcxComboBox(mComponent).SelectAll;
end ;
2025-02-21 15:28:49 +08:00
end ;
end ;
2026-05-08 14:20:02 +08:00
procedure TfrmMachRollMain. FrameKeyBoard1SpeedButton_backClick( Sender: TObject) ;
var
fsj: string ;
begin
fsj : = Trim( TcxTextEdit( FindComponent( Trim( TSpeedButton( Sender) . Hint) ) ) . Text ) ;
if Trim( fsj) = '' then
Exit;
TcxTextEdit( FindComponent( Trim( TSpeedButton( Sender) . Hint) ) ) . Text : = Copy( fsj, 1 , Length( fsj) - 1 ) ;
TcxTextEdit( FindComponent( Trim( TSpeedButton( Sender) . Hint) ) ) . SelectAll;
end ;
2025-02-20 14:17:49 +08:00
procedure TfrmMachRollMain. FrameKeyBoard1SpeedButton_ycClick( Sender: TObject) ;
begin
inherited ;
cxGroupBox_keys. Visible : = false ;
end ;
procedure TfrmMachRollMain. ClearGlobal( ) ;
begin
FBCIOID : = '' ;
2025-02-20 17:32:25 +08:00
2025-02-20 14:17:49 +08:00
FQtyUnit : = '' ;
2025-02-20 17:32:25 +08:00
2025-02-20 14:17:49 +08:00
FCIID : = '' ;
FWorkshop : = '' ;
InputLen. Text : = '' ;
Coefficient. Text : = '' ;
AOrdDefNote1. Text : = '' ;
2026-06-13 16:49:18 +08:00
Tare. Text : = '0.3' ;
2025-02-20 14:17:49 +08:00
InputWeight. Text : = '' ;
FLenUnit : = '' ;
Faddwet : = 0 ;
faddlen : = 0 ;
FPacketCIID : = '' ;
FPacketCount : = 0 ;
2025-03-20 16:38:30 +08:00
FC_ColorNo : = '' ;
FC_Code : = '' ;
2025-02-20 14:17:49 +08:00
end ;
procedure TfrmMachRollMain. QuantityConversion( ) ;
begin
// if trim(OrderNo.Text)='' then exit;
if cds_params. fieldbyName( 'weightRule' ) . AsInteger = 0 then
// InputWeight ë<> <C3AB> OutPutWeight <20> <> <EFBFBD> <EFBFBD>
begin
if lblRuleConversion. Text < > '<27> <> <EFBFBD> <EFBFBD> ת<EFBFBD> <D7AA> ' then
begin
if lblRuleConversion. Text = '<27> <> <EFBFBD> <EFBFBD> ת<EFBFBD> <D7AA> <EFBFBD> <EFBFBD> ' then
begin
InputWeight. Text : = floattostr( strtofloatdef( trim( InputLen. Text ) , 0 ) * strtofloatdef( trim( Coefficient. Text ) , 0 ) + strtofloatdef( trim( Tare. Text ) , 0 ) ) ;
end ;
if lblRuleConversion. Text = 'ë<> <C3AB> ת<EFBFBD> <D7AA> <EFBFBD> <EFBFBD> ' then
begin
InputLen. Text : = floattostr( strtofloatdef( trim( InputWeight. Text ) , 0 ) * strtofloatdef( trim( Coefficient. Text ) , 0 ) ) ;
end ;
if lblRuleConversion. Text = '<27> <> <EFBFBD> <EFBFBD> ת<EFBFBD> <D7AA> <EFBFBD> <EFBFBD> ' then
begin
InputLen. Text : = floattostr( ( RoundFloat( strtofloatdef( trim( InputWeight. Text ) , 0 ) , 1 ) - strtofloatdef( trim( Tare. Text ) , 0 ) ) * strtofloatdef( trim( Coefficient. Text ) , 0 ) ) ;
end ;
end ;
if strtofloatdef( trim( InputWeight. Text ) , 0 ) > 0 then
begin
OutPutWeight. Text : = floattostr( ( strtofloatdef( trim( InputWeight. Text ) , 0 ) - strtofloatdef( trim( Tare. Text ) , 0 ) ) ) ; // <20> <> <EFBFBD> <EFBFBD>
end ;
end ;
if cds_params. fieldbyName( 'weightRule' ) . AsInteger = 1 then
// InputWeight <20> <> <EFBFBD> <EFBFBD> OutPutWeight ë<> <C3AB>
begin
if lblRuleConversion. Text < > '<27> <> <EFBFBD> <EFBFBD> ת<EFBFBD> <D7AA> ' then
begin
if lblRuleConversion. Text = '<27> <> <EFBFBD> <EFBFBD> ת<EFBFBD> <D7AA> <EFBFBD> <EFBFBD> ' then
begin
InputWeight. Text : = floattostr( strtofloatdef( trim( InputLen. Text ) , 0 ) * strtofloatdef( trim( Coefficient. Text ) , 0 ) ) ;
end ;
if lblRuleConversion. Text = 'ë<> <C3AB> ת<EFBFBD> <D7AA> <EFBFBD> <EFBFBD> ' then
begin
InputLen. Text : = floattostr( ( strtofloatdef( trim( InputWeight. Text ) , 0 ) + strtofloatdef( trim( Tare. Text ) , 0 ) ) * strtofloatdef( trim( Coefficient. Text ) , 0 ) ) ;
end ;
if lblRuleConversion. Text = '<27> <> <EFBFBD> <EFBFBD> ת<EFBFBD> <D7AA> <EFBFBD> <EFBFBD> ' then
begin
InputLen. Text : = floattostr( RoundFloat( strtofloatdef( trim( InputWeight. Text ) , 0 ) , 1 ) * strtofloatdef( trim( Coefficient. Text ) , 0 ) ) ;
end ;
end ;
if strtofloatdef( trim( InputWeight. Text ) , 0 ) > 0 then
begin
OutPutWeight. Text : = floattostr( ( strtofloatdef( trim( InputWeight. Text ) , 0 ) + strtofloatdef( trim( Tare. Text ) , 0 ) ) ) ; // ë<> <C3AB>
end ;
end ;
end ;
procedure TfrmMachRollMain. InitPlan( MSubID: string ) ;
begin
2025-09-29 09:23:46 +08:00
if leftstr( MSubID, 2 ) = 'JS' then
begin
FCKLX : = '<27> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ' ;
Button1. visible : = false ;
ToolButton2. visible : = False ;
end
else
begin
FCKLX : = '<27> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ' ;
Button1. visible : = true ;
ToolButton2. visible : = true ;
end ;
2025-02-20 14:17:49 +08:00
with ADOQueryBaseTemp do
begin
Close;
SQL. Clear;
2025-09-29 09:23:46 +08:00
if FCKLX = '<27> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ' then
begin
SQL. Add( 'EXEC P_Trade_Insp_Get_Market @TMSId=' '' + trim( MSubID) + '' '' ) ;
end
else
begin
SQL. Add( 'EXEC P_Trade_Insp_Get_plan @BCIOID=' '' + trim( MSubID) + '' '' ) ;
end ;
2025-02-20 14:17:49 +08:00
Open;
if not IsEmpty then
begin
2025-02-20 17:32:25 +08:00
FLenUnit : = trim( ADOQueryBaseTemp. fieldbyName( 'LenUnit' ) . AsString) ;
2025-02-20 14:17:49 +08:00
if FLenUnit = '' then
begin
FLenUnit : = 'M' ;
end ;
2025-02-20 17:32:25 +08:00
fLabPackage : = 'Ĭ<> ϰ<EFBFBD> <CFB0> <EFBFBD> ǩ' ;
2025-06-20 13:56:26 +08:00
fLabVolume : = '<27> ͻ<EFBFBD> <CDBB> <EFBFBD> ǩ' ;
2025-02-20 17:32:25 +08:00
// fLabPackage := trim(ADOQueryBaseTemp.fieldbyName('LabPackage').AsString);
// fLabVolume := trim(ADOQueryBaseTemp.fieldbyName('LabVolume').AsString);
2025-02-20 14:17:49 +08:00
SetUnit( FLenUnit) ;
2025-06-27 17:30:04 +08:00
FCDUnit : = lblLenUnit. Caption;
2026-06-13 16:49:18 +08:00
CICUNIT. Text : = trim( fieldbyName( 'CICUNIT' ) . AsString) ;
2025-09-29 09:23:46 +08:00
FTMSId : = trim( fieldbyName( 'TMSId' ) . AsString) ;
FTMMId : = trim( fieldbyName( 'TMMId' ) . AsString) ;
2025-02-20 14:17:49 +08:00
FBCIOID : = trim( fieldbyName( 'BCIOID' ) . AsString) ;
2025-02-20 17:32:25 +08:00
FQtyUnit : = trim( fieldbyName( 'QtyUnit' ) . AsString) ;
2025-02-21 15:28:49 +08:00
OrderNo. Text : = trim( fieldbyName( 'FromOrdNo' ) . AsString) ;
CodeName. Text : = trim( fieldbyName( 'C_Name' ) . AsString) ;
2025-02-20 17:32:25 +08:00
C_width. Text : = trim( fieldbyName( 'C_width' ) . AsString) ;
C_GramWeight. Text : = trim( fieldbyName( 'C_GramWeight' ) . AsString) ;
2026-06-13 16:49:18 +08:00
ColorNo. Text : = trim( fieldbyName( 'C_ColorNo' ) . AsString) + ' ' + trim( fieldbyName( 'C_Color' ) . AsString) ;
2025-02-21 15:28:49 +08:00
Color. Text : = trim( fieldbyName( 'C_Color' ) . AsString) ;
2025-02-20 14:17:49 +08:00
C_Pattern. Text : = trim( fieldbyName( 'C_Pattern' ) . AsString) ;
FFtyPCId : = trim( fieldbyName( 'FtyPCId' ) . AsString) ;
2025-03-20 16:38:30 +08:00
FC_Code : = trim( fieldbyName( 'C_Code' ) . AsString) ;
FC_ColorNo : = trim( fieldbyName( 'C_ColorNo' ) . AsString) ;
2026-06-13 16:49:18 +08:00
FC_Color : = trim( fieldbyName( 'C_Color' ) . AsString) ;
2025-02-21 15:28:49 +08:00
cds_params. Edit;
2025-02-20 14:17:49 +08:00
cds_params. fieldbyName( 'outPage' ) . value : = '<27> <> ' ;
cds_params. Post;
2025-02-21 15:28:49 +08:00
// Coefficient.Text := trim(fieldbyName('Coefficient').AsString);
2025-02-20 14:17:49 +08:00
// ת<> <D7AA> ϵ<EFBFBD> <CFB5>
2025-02-21 15:28:49 +08:00
// lblRuleConversion.ItemIndex := lblRuleConversion.Properties.Items.IndexOf(fieldbyName('RuleConversion').AsString);
2025-02-20 14:17:49 +08:00
FtyPCId. Text : = FFtyPCId;
BCIOID. Text : = FBCIOID;
2025-02-20 17:32:25 +08:00
2025-02-21 15:28:49 +08:00
Qty. Text : = trim( fieldbyName( 'StkQty' ) . AsString) + trim( fieldbyName( 'QtyUnit' ) . AsString) ;
2025-02-20 17:32:25 +08:00
2025-02-21 15:28:49 +08:00
// Tare.Text := trim(fieldbyName('RuleLaterTare').AsString);
2025-02-20 14:17:49 +08:00
fTareType : = '' ;
2025-02-21 15:28:49 +08:00
RuleYardstick. Text : = '100' ;
2025-02-20 17:32:25 +08:00
2025-02-20 14:17:49 +08:00
packnote. Lines. Clear;
InputLen. SetFocus;
setFocusCtrol( InputLen. Name ) ;
SetDdetails( ) ;
end
else
begin
// ClearGlobal();
application. MessageBox( '<27> <> <EFBFBD> <EFBFBD> <EFBFBD> 쳣,<2C> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ϣ<EFBFBD> ʹ <EFBFBD> <CDB4> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> !' , '<27> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ϣ' ) ;
end ;
end ;
InitJYGrid( ) ;
2025-02-20 17:32:25 +08:00
2025-02-20 14:17:49 +08:00
edtScan. Text : = '' ;
// <20> <> ʾ <EFBFBD> <CABE>
setFormCtrol( ) ;
end ;
procedure TfrmMachRollMain. InputLenKeyPress( Sender: TObject; var Key: Char ) ;
begin
if Key = #13 then
begin
Key : = #0 ;
SelectNext( ActiveControl as TWinControl, true , true ) ;
end ;
end ;
procedure TfrmMachRollMain. InputLenPropertiesChange( Sender: TObject) ;
begin
// if StrToIntDef(trim(InputWeight.Text), 0) = 0 then
// begin
// exit;
// end;
QuantityConversion( ) ;
end ;
procedure TfrmMachRollMain. lblRuleConversionPropertiesChange( Sender: TObject) ;
begin
inherited ;
if lblRuleConversion. Text = '<27> <> <EFBFBD> <EFBFBD> ת<EFBFBD> <D7AA> ' then
begin
OutPutWeight. Text : = '' ;
InputLen. Text : = '' ;
InputWeight. Text : = '' ;
end ;
QuantityConversion( ) ;
end ;
procedure TfrmMachRollMain. SetUnit( MUnit: string ) ;
begin
2025-02-20 17:32:25 +08:00
2025-06-27 17:30:04 +08:00
lblLenUnit. Caption : = MUnit;
2025-02-20 14:17:49 +08:00
end ;
procedure TfrmMachRollMain. ToolButton1Click( Sender: TObject) ;
begin
frmParamSet : = TfrmParamSet. create( Self) ;
with frmParamSet do
begin
cds_params. Data : = Self. cds_params. Data;
if ShowModal = 1 then
begin
Self. cds_params. Data : = cds_params. Data;
setFormCtrol( ) ;
end ;
free;
end ;
SetINIFile( ) ;
if trim( fmanage) < > '<27> <> Ȩ<EFBFBD> <C8A8> ' then
begin
if ( trim( MBDYDllName) < > '' ) and not fIsCommopen then
OpenCom( MBDYDllName) ;
end ;
end ;
2025-02-25 16:04:43 +08:00
procedure TfrmMachRollMain. ToolButton2Click( Sender: TObject) ;
var
fPrintFile: string ;
Txt, fImagePath, Txt2, fImagePath2: string ;
Moudle: Thandle;
Makebar: TMakebar;
Mixtext: TMixtext;
begin
2026-06-13 16:49:18 +08:00
if CDS_2. IsEmpty then
begin
Application. MessageBox( '<27> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ' , '<27> <> ʾ <EFBFBD> <CABE> Ϣ' , 0 ) ;
exit;
end ;
if cxTextEdit1. Text < > '' then
begin
BTPrint. Click( ) ;
end ;
2025-02-25 16:04:43 +08:00
with ADOQueryPrint do
begin
Close;
SQL. Clear;
SQL. Add( ' EXEC P_BS_Cloth_Prt2 ' ) ;
SQL. Add( ' @Filtration=' '' + trim( FBCIOID) + '' '' ) ;
2026-02-05 17:10:07 +08:00
2025-02-25 16:04:43 +08:00
Open;
end ;
if ADOQueryPrint. IsEmpty then
begin
Application. MessageBox( '<27> <> ǩ<EFBFBD> <C7A9> <EFBFBD> <EFBFBD> δ<EFBFBD> ҵ<EFBFBD> <D2B5> <EFBFBD> ' , '<27> <> ʾ <EFBFBD> <CABE> Ϣ' , MB_ICONERROR) ;
exit;
end ;
ExportFtErpFile( '<27> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ǩ.fr3' , ADOQueryBaseTemp) ;
fPrintFile : = ExtractFilePath( Application. ExeName) + 'Report\<5C> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ǩ.fr3' ;
if FileExists( fPrintFile) then
begin
frxReport1. LoadFromFile( fPrintFile) ;
frxReport1. PrintOptions. Copies : = cds_params. fieldbyName( 'labNumber' ) . AsInteger;
frxReport1. PrintOptions. ShowDialog : = false ;
frxReport1. PrepareReport( True ) ;
frxReport1. Print( ) ;
end
else
begin
Application. MessageBox( PChar( 'û<> <C3BB> <EFBFBD> ҵ<EFBFBD> ' + fPrintFile) , '<27> <> ʾ ' , 0 ) ;
end ;
end ;
2025-02-20 14:17:49 +08:00
procedure TfrmMachRollMain. ToolButton3Click( Sender: TObject) ;
begin
if cds_3. IsEmpty then
exit;
2025-02-20 17:32:25 +08:00
PrtData( cds_3. fieldbyName( 'BCIOID' ) . AsString) ;
2025-02-20 14:17:49 +08:00
end ;
2026-06-13 16:49:18 +08:00
procedure TfrmMachRollMain. ToolButton4Click( Sender: TObject) ;
begin
writeCxGrid( trim( Self. Caption) + 'Tv3' , Tv3, gDllFileCaption) ;
writeCxGrid( trim( Self. Caption) + 'Tv21' , Tv2, gDllFileCaption) ;
end ;
2025-02-20 14:17:49 +08:00
procedure TfrmMachRollMain. TrolldelClick( Sender: TObject) ;
var
2025-02-21 15:28:49 +08:00
MBCIOID: string ;
2025-02-20 14:17:49 +08:00
begin
if cds_3. IsEmpty then
exit;
2025-02-21 15:28:49 +08:00
if Application. MessageBox( 'ȷ<> <C8B7> Ҫɾ<D2AA> <C9BE> ѡ <EFBFBD> <D1A1> <EFBFBD> ľ<EFBFBD> <C4BE> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ' , '<27> <> ʾ ' , 3 2 + 4 ) < > IDYES then
2025-02-20 14:17:49 +08:00
exit;
2025-02-21 15:28:49 +08:00
2025-02-20 14:17:49 +08:00
ADOQueryBaseCmd. Connection. BeginTrans;
try
2025-02-21 15:28:49 +08:00
MBCIOID : = trim( cds_3. fieldbyName( 'BCIOID' ) . AsString) ;
2025-02-20 14:17:49 +08:00
with ADOQueryBaseCmd do
begin
Close;
SQL. Clear;
2025-02-21 15:28:49 +08:00
Sql. Add( 'exec P_BS_Cloth_Out_Del ' ) ;
Sql. Add( ' @BCIOIDS=' + quotedstr( MBCIOID) ) ;
Sql. Add( ',@DCode=' + quotedstr( Trim( DCode) ) ) ;
Sql. Add( ',@DName=' + quotedstr( Trim( DName) ) ) ;
2025-02-20 14:17:49 +08:00
Open;
end ;
if ADOQueryBaseCmd. fieldbyName( 'intReturn' ) . AsInteger = - 1 then
begin
raise Exception. create( pchar( trim( ADOQueryBaseCmd. fieldbyName( 'ShowMsg' ) . AsString) ) ) ;
end ;
ADOQueryBaseCmd. Connection. CommitTrans;
cds_3. Delete;
Application. MessageBox( 'ɾ<> <C9BE> <EFBFBD> ɹ<EFBFBD> <C9B9> <EFBFBD> ' , '<27> <> ʾ <EFBFBD> <CABE> Ϣ' ) ;
2026-06-13 16:49:18 +08:00
InitGrid2( ) ;
InitJYGrid( ) ;
2025-02-20 14:17:49 +08:00
except
ADOQueryBaseCmd. Connection. RollbackTrans;
Application. MessageBox( pchar( Exception( ExceptObject) . Message ) , '<27> <> ʾ <EFBFBD> <CABE> Ϣ' , 0 ) ;
end ;
end ;
2026-06-13 16:49:18 +08:00
procedure TfrmMachRollMain. TV1CellClick( Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean ) ;
begin
fzt : = '0' ;
C_NAME. Text : = CDS_4. FieldByName( 'c_name' ) . AsString;
ADO_PM. Locate( 'C_Name' , C_NAME. Text , [ ] ) ;
C_Code. Text : = ADO_PM. FieldByName( 'C_Code' ) . Value;
DUnit. TEXT : = ADO_PM. FieldByName( 'TMSUnit' ) . Value;
with ADO_YS do
begin
Close;
sql. Clear;
sql. Add( ' SELECT DISTINCT A.C_Code,B.C_Color,B.C_ColorNo,B.referencePrice AS Price,DBO.GETNUM(B.C_ColorNo) FROM Bs_Cloth_Info A inner join BS_Cloth_Info_Sub B on A.BCIID=B.BCIID ' ) ;
sql. Add( ' where A.C_Code= ' + QuotedStr( C_CODE. TEXT ) ) ;
SQL. ADD( ' order by DBO.GETNUM(B.C_ColorNo)' ) ;
// ShowMessage(sql.text);
Open;
end ;
C_CoLOR. Text : = '' ;
C_CoLORNO. Text : = '' ;
Panel3. Visible : = false ;
fzt : = '1' ;
end ;
2025-02-20 14:17:49 +08:00
procedure TfrmMachRollMain. Tv3CustomDrawCell( Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean ) ;
begin
if AViewInfo. GridRecord. Values[ TcxGridDBTableView( Sender) . GetColumnByFieldName( 'Grade' ) . Index ] = '<27> <> Ʒ ' then
ACanvas. Brush. Color : = clRed;
end ;
2026-06-13 16:49:18 +08:00
procedure TfrmMachRollMain. TV5CellClick( Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean ) ;
begin
FZT2 : = '0' ;
C_COLOR. Text : = CDS_5. FieldByName( 'C_COLOR' ) . AsString;
C_COLORNO. Text : = CDS_5. FieldByName( 'C_COLORNO' ) . AsString;
Panel5. Visible : = false ;
FZT2 : = '1' ;
end ;
2025-02-20 14:17:49 +08:00
procedure TfrmMachRollMain. ToolButton8Click( Sender: TObject) ;
begin
inherited ;
Close;
end ;
procedure TfrmMachRollMain. setFocusCtrol( controlName: string ) ;
var
i: Integer ;
begin
with FrameKeyBoard1. dxPanel1 do
begin
for i : = 0 to ControlCount - 1 do
begin
if Controls[ i] is TSpeedButton then
begin
TSpeedButton( Controls[ i] ) . Hint : = trim( controlName) ;
if ( trim( controlName) = 'edtScan' ) and ( TSpeedButton( Controls[ i] ) . Name = 'SpeedButton_dot' ) then
begin
TSpeedButton( Controls[ i] ) . Caption : = '<27> س<EFBFBD> ' ;
end
else if ( TSpeedButton( Controls[ i] ) . Name = 'SpeedButton_dot' ) then
begin
TSpeedButton( Controls[ i] ) . Caption : = '.' ;
end ;
end ;
end ;
end ;
cxGroupBox_keys. Left : = Panel_right. Left + 5 ;
cxGroupBox_keys. Visible : = true ;
end ;
procedure TfrmMachRollMain. SetDdetails( ) ;
begin
AOrdDefNote1. Text : = '' ;
2025-02-20 17:32:25 +08:00
2025-02-20 14:17:49 +08:00
AOrdDefNote1. Text : = AOrdDefNote1. Text + '<27> <> <EFBFBD> <EFBFBD> :' + FBCIOID + #13 ;
if FRulePieceNo < > '' then
AOrdDefNote1. Text : = AOrdDefNote1. Text + '<27> <> <EFBFBD> Ź<EFBFBD> <C5B9> <EFBFBD> :' + FRulePieceNo + #13 ;
if gMachOperators < > '' then
AOrdDefNote1. Text : = AOrdDefNote1. Text + '<27> <> ̨<EFBFBD> <CCA8> Ա:' + gMachOperators + #13 ;
end ;
procedure TfrmMachRollMain. SetINIFile( ) ;
begin
IsDZCDYDll : = trim( cds_params. fieldbyName( 'chen' ) . AsString) ;
IsMBDYDll : = trim( cds_params. fieldbyName( 'mabiao' ) . AsString) ;
IsMBDYDllUnit : = trim( cds_params. fieldbyName( 'mbunit' ) . AsString) ;
LabQty : = trim( cds_params. fieldbyName( 'labNumber' ) . AsString) ;
FMinLen : = trim( cds_params. fieldbyName( 'minLen' ) . AsString) ;
FMaxLen : = trim( cds_params. fieldbyName( 'maxLen' ) . AsString) ;
FMinWeight : = trim( cds_params. fieldbyName( 'minweight' ) . AsString) ;
FMaxWeight : = trim( cds_params. fieldbyName( 'maxweight' ) . AsString) ;
FMPlace : = trim( cds_params. fieldbyName( 'mplace' ) . AsString) ;
FYPlace : = trim( cds_params. fieldbyName( 'yplace' ) . AsString) ;
FKgPlace : = trim( cds_params. fieldbyName( 'kgplace' ) . AsString) ;
WriteINIFile( ) ;
end ;
procedure TfrmMachRollMain. setFormCtrol( ) ;
begin
2025-02-20 17:32:25 +08:00
2025-02-20 14:17:49 +08:00
FrameKeyBoard1. SpeedButton_zdykey1. Caption : = gZdyKey1;
// FrameKeyBoard1.SpeedButton_zdykey2.Caption := gZdyKey2;
FrameKeyBoard1. SpeedButton_zdykey2. Caption : = gZdyKey2;
//<2F> <> <EFBFBD> <EFBFBD>
presentlen. text : = trim( cds_params. fieldbyName( 'AddLenPresent' ) . AsString) ;
presentWeight. text : = trim( cds_params. fieldbyName( 'AddwetPresent' ) . AsString) ;
end ;
procedure TfrmMachRollMain. GetINIFile( ) ;
begin
with cds_params do
begin
if IsEmpty then
Append
else
edit;
fieldbyName( 'chen' ) . value : = IsDZCDYDll;
fieldbyName( 'mabiao' ) . value : = IsMBDYDll;
fieldbyName( 'mbunit' ) . value : = IsMBDYDllUnit;
fieldbyName( 'MinLen' ) . value : = strtointdef( FMinLen, 0 ) ;
fieldbyName( 'MaxLen' ) . value : = strtointdef( FMaxLen, 1 0 0 ) ;
fieldbyName( 'MinWeight' ) . value : = strtointdef( FMinWeight, 0 ) ;
fieldbyName( 'MaxWeight' ) . value : = strtointdef( FMaxWeight, 5 0 ) ;
fieldbyName( 'MPlace' ) . value : = strtointdef( FMPlace, 1 ) ;
fieldbyName( 'YPlace' ) . value : = strtointdef( FYPlace, 1 ) ;
fieldbyName( 'KgPlace' ) . value : = strtointdef( FKgPlace, 1 ) ;
fieldbyName( 'labNumber' ) . value : = strtointdef( trim( LabQty) , 1 ) ;
Post;
end ;
end ;
2026-06-13 16:49:18 +08:00
procedure TfrmMachRollMain. GroupBox1Click( Sender: TObject) ;
begin
PANEL3. Visible : = FALSE ;
PANEL5. Visible : = FALSE ;
end ;
procedure TfrmMachRollMain. InitJYGrid( ) ;
2025-02-20 14:17:49 +08:00
var
MNetWeight, MJYLen: double ;
begin
try
cds_3. DisableControls;
2025-09-29 09:23:46 +08:00
if FCKLX = '<27> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ' then
2025-02-20 14:17:49 +08:00
begin
2025-09-29 09:23:46 +08:00
with ADOQueryMain do
begin
Close;
SQL. Clear;
2026-06-13 16:49:18 +08:00
SQL. Add( 'select A.*,tmmno=(select tmmno from Trade_Market_Main e where e.tmmid=a.tmmid)' ) ;
2025-09-29 09:23:46 +08:00
SQL. Add( 'from Bs_Cloth_IO A where IOType=' '<27> <> <EFBFBD> ۳<EFBFBD> <DBB3> <EFBFBD> ' ' and TMSId=' '' + trim( FTMSId) + '' '' ) ;
SQL. Add( 'order by filltime desc' ) ;
Open;
end ;
end
else
begin
with ADOQueryMain do
begin
Close;
SQL. Clear;
2026-06-13 16:49:18 +08:00
SQL. Add( 'select A.*,tmmno=(select tmmno from Trade_Market_Main e where e.tmmid=a.tmmid)' ) ;
SQL. Add( 'from Bs_Cloth_IO A where IOflag=' '<27> <> <EFBFBD> <EFBFBD> ' ' and STKID=' '' + trim( FBCIOID) + '' '' ) ;
SQL. Add( 'order by filltime desc' ) ;
Open;
end ;
Qty. Text : = trim( ADOQueryMain. fieldbyName( 'StkQty' ) . AsString) + trim( trim( ADOQueryMain. fieldbyName( 'QtyUnit' ) . AsString) ) ;
// InitPlan(FBCIOID);
with ADOQueryMain do
begin
Close;
SQL. Clear;
SQL. Add( 'select A.*,tmmno=(select tmmno from Trade_Market_Main e where e.tmmid=a.tmmid)' ) ;
2025-09-29 09:23:46 +08:00
SQL. Add( 'from Bs_Cloth_IO A where IOType=' '<27> <> <EFBFBD> ۳<EFBFBD> <DBB3> <EFBFBD> ' ' and STKID=' '' + trim( FBCIOID) + '' '' ) ;
SQL. Add( 'order by filltime desc' ) ;
Open;
end ;
2025-02-20 14:17:49 +08:00
end ;
2025-09-29 09:23:46 +08:00
2025-02-20 14:17:49 +08:00
SCreateCDS( ADOQueryMain, cds_3) ;
SInitCDSData( ADOQueryMain, cds_3) ;
finally
cds_3. EnableControls;
end ;
end ;
procedure TfrmMachRollMain. OpenCom( DllName: string ) ;
type
TMyFunc = function( fhandle: hwnd; sCommName: PAnsiChar ; IntTime: Integer ; IsMessage: Integer ) : hwnd; stdcall ;
var
Tf: TMyFunc;
Tp: TFarProc;
Th: Thandle;
begin
Th : = LoadLibrary( pchar( trim( DllName) ) ) ;
if Th > 0 then
begin
try
Tp : = GetProcAddress( Th, 'CommOpen' ) ;
if Tp < > nil then
begin
Tf : = TMyFunc( Tp) ;
newh : = Tf( Self. Handle, 'Comm1' , 5 0 0 , 1 ) ;
if newh < 1 then
begin
Application. MessageBox( pchar( '<27> <EFBFBD> <F2BFAAB4> <EFBFBD> ʧ<EFBFBD> ܣ<EFBFBD> ' ) , '<27> <> ʾ ' ) ;
end
else
fIsCommopen : = true ;
end
else
begin
fIsCommopen : = false ;
end ;
finally
2026-02-05 17:10:07 +08:00
// FreeLibrary(Th);
2025-02-20 14:17:49 +08:00
end ;
end
else
begin
fIsCommopen : = false ;
Application. MessageBox( pchar( '<27> Ҳ<EFBFBD> <D2B2> <EFBFBD> ' + trim( DllName) + ' <20> ļ<EFBFBD> <C4BC> <EFBFBD> ' ) , '<27> <> ʾ ' ) ;
end ;
end ;
procedure TfrmMachRollMain. CloseCom( DllName: string ) ;
type
TMyFunc = function( sCommName: PAnsiChar ) : hwnd; stdcall ;
var
Tf1: TMyFunc;
Tp1: TFarProc;
Th1: Thandle;
begin
Th1 : = LoadLibrary( pchar( trim( DllName) ) ) ;
if Th1 > 0 then
begin
try
Tp1 : = GetProcAddress( Th1, 'CommClose' ) ;
if Tp1 < > nil then
begin
Tf1 : = TMyFunc( Tp1) ;
newh1 : = Tf1( 'Comm1' ) ;
end
else
begin
end ;
finally
// FreeLibrary(Th1);
end ;
end
else
begin
Application. MessageBox( pchar( '<27> Ҳ<EFBFBD> <D2B2> <EFBFBD> ' + trim( DllName) + ' <20> ļ<EFBFBD> <C4BC> <EFBFBD> ' ) , '<27> <> ʾ ' ) ;
end ;
end ;
2026-06-13 16:49:18 +08:00
procedure TfrmMachRollMain. ColorNoClick( Sender: TObject) ;
var
i: Integer ;
begin
with FrameKeyBoard1. dxPanel1 do
begin
for i : = 0 to ControlCount - 1 do
begin
if Controls[ i] is TSpeedButton then
begin
TSpeedButton( Controls[ i] ) . Hint : = trim( 'ColorNo' ) ;
end ;
end ;
end ;
cxGroupBox_keys. Left : = Panel_right. Left + 5 ;
cxGroupBox_keys. Visible : = true ;
end ;
procedure TfrmMachRollMain. cxTextEdit1Click( Sender: TObject) ;
begin
if Trim( cxTextEdit1. Text ) = '' then
begin
cxTextEdit1. Text : = '<27> <> ' ;
end
else
begin
cxTextEdit1. Text : = '' ;
end ;
end ;
procedure TfrmMachRollMain. C_COLORNOClick( Sender: TObject) ;
begin
if C_NAME. Text < > '' then
begin
FZT2 : = '1' ;
Panel5. Visible : = true ;
Panel3. Visible : = false ;
InitGridys( ) ;
setFocusCtrol( TWinControl( Sender) . Name ) ;
end ;
end ;
procedure TfrmMachRollMain. c_colornoEnter( Sender: TObject) ;
var
i: Integer ;
begin
with FrameKeyBoard1. dxPanel1 do
begin
for i : = 0 to ControlCount - 1 do
begin
if Controls[ i] is TSpeedButton then
begin
TSpeedButton( Controls[ i] ) . Hint : = trim( 'C_COLORNO' ) ;
end ;
end ;
end ;
cxGroupBox_keys. Left : = Panel_right. Left + 5 ;
cxGroupBox_keys. Visible : = true ;
end ;
procedure TfrmMachRollMain. c_colornoExit( Sender: TObject) ;
var
i: Integer ;
begin
with FrameKeyBoard1. dxPanel1 do
begin
for i : = 0 to ControlCount - 1 do
begin
if Controls[ i] is TSpeedButton then
begin
TSpeedButton( Controls[ i] ) . Hint : = trim( 'C_NAME' ) ;
end ;
end ;
end ;
cxGroupBox_keys. Left : = Panel_right. Left + 5 ;
cxGroupBox_keys. Visible : = true ;
end ;
procedure TfrmMachRollMain. c_colornoPropertiesChange( Sender: TObject) ;
begin
// ADO_YS.Locate('C_ColorNo', C_ColorNo.Text, []);
//
// C_Color.Text := ADO_YS.FieldByName('C_Color').ASSTRING;
//
if FZT2 = '1' then
begin
Panel5. Visible : = true ;
InitGridYS( ) ;
end ;
end ;
procedure TfrmMachRollMain. C_NAME2Click( Sender: TObject) ;
var
i: Integer ;
begin
with FrameKeyBoard1. dxPanel1 do
begin
for i : = 0 to ControlCount - 1 do
begin
if Controls[ i] is TSpeedButton then
begin
TSpeedButton( Controls[ i] ) . Hint : = trim( 'C_NAME' ) ;
end ;
end ;
end ;
cxGroupBox_keys. Left : = Panel_right. Left + 5 ;
cxGroupBox_keys. Visible : = true ;
end ;
procedure TfrmMachRollMain. C_NAME2Enter( Sender: TObject) ;
var
i: Integer ;
begin
with FrameKeyBoard1. dxPanel1 do
begin
for i : = 0 to ControlCount - 1 do
begin
if Controls[ i] is TSpeedButton then
begin
TSpeedButton( Controls[ i] ) . Hint : = trim( 'C_NAME' ) ;
end ;
end ;
end ;
cxGroupBox_keys. Left : = Panel_right. Left + 5 ;
cxGroupBox_keys. Visible : = true ;
end ;
procedure TfrmMachRollMain. C_NAMEClick( Sender: TObject) ;
begin
fzt : = '1' ;
Panel3. Visible : = true ;
PANEL5. Visible : = FALSE ;
InitGridCP( ) ;
setFocusCtrol( TWinControl( Sender) . Name ) ;
end ;
procedure TfrmMachRollMain. C_NAMEExit( Sender: TObject) ;
begin
panel3. Visible : = False ;
end ;
procedure TfrmMachRollMain. C_NAMEPropertiesChange( Sender: TObject) ;
var
I: Integer ;
S: string ;
begin
if fzt = '1' then
begin
C_CoLOR. Text : = '' ;
C_CoLORNO. Text : = '' ;
Panel3. Visible : = true ;
PANEL5. Visible : = FALSE ;
InitGridCP( ) ;
end ;
end ;
2025-02-20 14:17:49 +08:00
procedure TfrmMachRollMain. dxLayoutControl_packDblClick( Sender: TObject) ;
begin
if gIsCanDesign then
layoutDesign( TdxLayoutControl( Sender) , ADOQueryBaseCmd, PWideChar( dcode) ) ;
end ;
procedure TfrmMachRollMain. dxLayoutItem1CaptionClick( Sender: TObject) ;
var
mkey: Char ;
begin
inherited ;
// frmProductListHelp := TfrmProductListHelp.create(Self);
// with frmProductListHelp do
// begin
// fType := '10';
// if ShowModal = 1 then
// begin
// edtScan.Text := trim(order_main.fieldbyName('Subid').AsString);
// mkey := #13;
// edtScanKeyPress(edtScan, mkey);
// end;
// free;
// end;
frmTradeClothTotalOutSel : = TfrmTradeClothTotalOutSel. create( Self) ;
with frmTradeClothTotalOutSel do
begin
if ShowModal = 1 then
begin
edtScan. Text : = trim( CDS_Main. fieldbyName( 'BCIOID' ) . AsString) ;
end ;
free;
end ;
mkey : = #13 ;
edtScanKeyPress( edtScan, mkey) ;
end ;
procedure TfrmMachRollMain. edtScanDblClick( Sender: TObject) ;
begin
inherited ;
edtScan. Text : = '' ;
end ;
procedure TfrmMachRollMain. edtScanEnter( Sender: TObject) ;
begin
inherited ;
2026-06-13 16:49:18 +08:00
2025-02-20 14:17:49 +08:00
setFocusCtrol( TWinControl( Sender) . Name ) ;
end ;
procedure TfrmMachRollMain. edtScanKeyPress( Sender: TObject; var Key: Char ) ;
2026-06-13 16:49:18 +08:00
var
strKeyID: string ;
2025-02-20 14:17:49 +08:00
begin
inherited ;
2026-06-13 16:49:18 +08:00
2025-02-20 14:17:49 +08:00
if Key = #13 then
begin
2026-06-13 16:49:18 +08:00
if panel4. Visible = true then
begin
if trim( edtScan. Text ) = FBCIOID then
begin
Application. MessageBox( 'ԭ<> <D4AD> <EFBFBD> 벻<EFBFBD> <EBB2BB> <EFBFBD> ٴ<EFBFBD> ɨ<EFBFBD> 裡' , '<27> <> ʾ <EFBFBD> <CABE> Ϣ' , MB_ICONERROR) ;
edtScan. Text : = '' ;
exit;
end ;
if cds_hp. Locate( 'BCIOID' , edtScan. Text , [ ] ) then
begin
Application. MessageBox( '<27> ظ<EFBFBD> ɨ<EFBFBD> 裡' , '<27> <> ʾ <EFBFBD> <CABE> Ϣ' , MB_ICONERROR) ;
edtScan. Text : = '' ;
exit;
// <20> <> <EFBFBD> ҵ<EFBFBD> <D2B5> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
end ;
with ADOQueryBaseTemp do
begin
Close;
SQL. Clear;
SQL. Add( 'EXEC P_Trade_Insp_Get_plan @BCIOID=' '' + trim( edtScan. Text ) + '' '' ) ;
Open;
end ;
if ADOQueryBaseTemp. IsEmpty = false then
begin
if ADOQueryBaseTemp. fieldbyname( 'C_NAME' ) . AsString < > CodeName. Text then
begin
Application. MessageBox( 'Ʒ <> <C6B7> <EFBFBD> <EFBFBD> һ <EFBFBD> £<EFBFBD> ' , '<27> <> ʾ <EFBFBD> <CABE> Ϣ' , MB_ICONERROR) ;
edtScan. Text : = '' ;
exit;
end ;
if ADOQueryBaseTemp. fieldbyname( 'C_COLOR' ) . AsString < > FC_Color then
begin
Application. MessageBox( '<27> <> ɫ<EFBFBD> <C9AB> һ <EFBFBD> £<EFBFBD> ' , '<27> <> ʾ <EFBFBD> <CABE> Ϣ' , MB_ICONERROR) ;
edtScan. Text : = '' ;
exit;
end ;
if ADOQueryBaseTemp. fieldbyname( 'C_COLORno' ) . AsString < > FC_Colorno then
begin
Application. MessageBox( 'ɫ<> Ų<EFBFBD> һ <EFBFBD> £<EFBFBD> ' , '<27> <> ʾ <EFBFBD> <CABE> Ϣ' , MB_ICONERROR) ;
edtScan. Text : = '' ;
exit;
end ;
with CDS_HP do
begin
Append;
CDS_HP. FieldByName( 'BCIOID' ) . AsString : = ADOQueryBaseTemp. FieldByName( 'BCIOID' ) . AsString;
CDS_HP. FieldByName( 'stkqty' ) . VALUE : = ADOQueryBaseTemp. FieldByName( 'stkqty' ) . ASFLOAT;
CDS_HP. FieldByName( 'qtyunit' ) . VALUE : = ADOQueryBaseTemp. FieldByName( 'qtyunit' ) . AsString;
Post;
end ;
end ;
edtScan. Text : = '' ;
edtScan. SetFocus( ) ;
end
else
begin
if trim( edtScan. Text ) = '' then
exit;
if trim( edtScan. Text ) = FBCIOID then
exit;
if checkbox1. Checked then
begin
if not cds_2. Locate( 'ssel' , True , [ ] ) then
begin
Application. MessageBox( '<27> <> <EFBFBD> <EFBFBD> ѡ <EFBFBD> <D1A1> <EFBFBD> <EFBFBD> <EFBFBD> ݣ<EFBFBD> ' , '<27> <> ʾ <EFBFBD> <CABE> Ϣ' , MB_OK) ;
Exit;
end ;
strKeyID : = cds_2. FieldByName( 'TMMID' ) . AsString;
end ;
ClearGlobal( ) ;
InitPlan( edtScan. Text ) ;
InitGrid2( ) ;
if trim( OrderNo. Text ) < > '' then
InputLen. SetFocus;
cxGroupBox_keys. Visible : = false ;
if checkbox1. Checked then
begin
Button1. Click( ) ;
if Trim( strKeyID) < > '' then
begin
cds_2. DisableControls;
try
cds_2. Locate( 'TMMID' , strKeyID, [ ] ) ;
cds_2. Edit;
cds_2. FieldByName( 'ssel' ) . AsBoolean : = True ;
cds_2. Post;
finally
cds_2. EnableControls;
end ;
end ;
end ;
end ;
2025-02-20 14:17:49 +08:00
end ;
end ;
function TfrmMachRollMain. SaveData( ) : Boolean ;
var
MInputLen, MMeter, MYardage: double ;
MInputWeight, MGrossWeight, MNetWeight, MTare, Maddwet, maddLen: double ;
mYardStick: double ;
mPresentLen, mpresentWeight: double ;
2025-06-27 17:30:04 +08:00
MTMSId: string ;
2025-02-20 14:17:49 +08:00
begin
Result : = false ;
2025-06-27 17:30:04 +08:00
MTMSId : = Trim( SelTVKey( Tv2, [ 'TMSId' ] ) [ 0 ] ) ;
2025-02-20 14:17:49 +08:00
Maddwet : = strTofloatDef( trim( addwet. text ) , 0 ) ; // Faddwet;
maddLen : = strTofloatDef( trim( addlen. text ) , 0 ) ; // faddlen;
mYardStick : = strtofloatdef( trim( RuleYardstick. Text ) , 1 0 0 ) ;
mPresentLen : = strTofloatDef( trim( presentlen. text ) , 0 ) ;
mpresentWeight : = strTofloatDef( trim( presentWeight. text ) , 0 ) ;
if ( strtoIntdef( Trim( unitPieces. Text ) , 0 ) > 0 ) and ( strtoIntdef( trim( InputLen. Text ) , 0 ) > 0 ) then
begin
if strtoIntdef( trim( InputLen. Text ) , 0 ) > strtoIntdef( Trim( unitPieces. Text ) , 0 ) then
funitPiecesStr : = intTostr( ( strtoIntdef( trim( InputLen. Text ) , 0 ) ) - strtoIntdef( Trim( unitPieces. Text ) , 0 ) ) + '+' + Trim( unitPieces. Text ) ;
end ;
//0:<3A> <> <EFBFBD> 䣻1<E4A3BB> <31> <EFBFBD> <EFBFBD> ȥ<EFBFBD> <C8A5> <EFBFBD> <EFBFBD>
if gPresentNumFlag = 1 then
begin
mPresentLen : = - 1 * mPresentLen;
mpresentWeight : = - 1 * mpresentWeight;
end ;
try
ADOQueryBaseCmd. Connection. BeginTrans;
2025-02-20 17:32:25 +08:00
MTare : = strtofloatdef( trim( Tare. Text ) , 0 ) ; // Ƥ<> <C6A4>
MInputWeight : = RoundFloat( strtofloatdef( trim( InputWeight. Text ) , 0 ) , cds_params. fieldbyName( 'KgPlace' ) . AsInteger) ; // <20> <> <EFBFBD> <EFBFBD>
2026-06-13 16:49:18 +08:00
MGrossWeight : = MInputWeight + Maddwet + mpresentWeight; // ë<> <C3AB>
MNetWeight : = MInputWeight + Maddwet + mpresentWeight - MTare; // <20> <> <EFBFBD> <EFBFBD> +<2B> <> <EFBFBD> <EFBFBD>
2025-02-20 14:17:49 +08:00
2025-02-20 17:32:25 +08:00
MInputLen : = RoundFloat( strtofloatdef( trim( InputLen. Text ) , 0 ) , 4 ) ;
// <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> +mAddLen
2025-06-27 17:30:04 +08:00
if ( uppercase( lblLenUnit. Caption) = 'M' ) or ( lblLenUnit. Caption = '<27> <> ' ) then
2025-02-20 14:17:49 +08:00
begin
2025-02-20 17:32:25 +08:00
MMeter : = RoundFloat( ( MInputLen + maddLen + mPresentLen) / ( mYardStick / 1 0 0 ) , cds_params. fieldbyName( 'MPlace' ) . AsInteger) ;
MYardage : = RoundFloat( MMeter / 0.9144 , cds_params. fieldbyName( 'YPlace' ) . AsInteger) ;
end
else
2025-02-20 14:17:49 +08:00
begin
2025-02-20 17:32:25 +08:00
MYardage : = RoundFloat( ( MInputLen + maddLen + mPresentLen) / ( mYardStick / 1 0 0 ) , cds_params. fieldbyName( 'YPlace' ) . AsInteger) ;
MMeter : = RoundFloat( MYardage * 0.9144 , cds_params. fieldbyName( 'MPlace' ) . AsInteger) ;
2025-02-20 14:17:49 +08:00
end ;
2025-09-29 09:23:46 +08:00
if FCKLX = '<27> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ' then
2025-02-20 14:17:49 +08:00
begin
2025-09-29 09:23:46 +08:00
with ADOQueryBaseCmd do
begin
Close;
sql. Clear;
Sql. Add( 'exec P_BS_Cloth_Out_Distribution_KC ' ) ;
Sql. Add( ' @GrossWeight=' + quotedstr( Trim( FloatToStr( MGrossWeight) ) ) ) ;
Sql. Add( ' ,@Tare=' + quotedstr( Trim( FloatToStr( MTare) ) ) ) ;
Sql. Add( ' ,@NetWeight=' + quotedstr( Trim( FloatToStr( MNetWeight) ) ) ) ;
Sql. Add( ' ,@Meter=' + quotedstr( Trim( FloatToStr( MMeter) ) ) ) ;
Sql. Add( ' ,@Yardage=' + quotedstr( Trim( FloatToStr( MYardage) ) ) ) ;
Sql. Add( ' ,@QtyUnit=' + quotedstr( Trim( lblLenUnit. caption) ) ) ;
Sql. Add( ' ,@StkID=' + quotedstr( Trim( FBCIOID) ) ) ;
Sql. Add( ' ,@TMSId =' + quotedstr( FTMSId) ) ;
Sql. Add( ' ,@TMMId =' + quotedstr( FTMSId) ) ;
Sql. Add( ' ,@Dcode=' + quotedstr( Trim( Dcode) ) ) ;
Sql. Add( ' ,@DName=' + quotedstr( Trim( DName) ) ) ;
// ShowMessage(sql.Text);
open;
end ;
end
else
begin
with ADOQueryBaseCmd do
begin
Close;
sql. Clear;
Sql. Add( 'exec P_BS_Cloth_Out_Distribution ' ) ;
Sql. Add( ' @GrossWeight=' + quotedstr( Trim( FloatToStr( MGrossWeight) ) ) ) ;
Sql. Add( ' ,@Tare=' + quotedstr( Trim( FloatToStr( MTare) ) ) ) ;
Sql. Add( ' ,@NetWeight=' + quotedstr( Trim( FloatToStr( MNetWeight) ) ) ) ;
Sql. Add( ' ,@Meter=' + quotedstr( Trim( FloatToStr( MMeter) ) ) ) ;
Sql. Add( ' ,@Yardage=' + quotedstr( Trim( FloatToStr( MYardage) ) ) ) ;
Sql. Add( ' ,@StkID=' + quotedstr( Trim( FBCIOID) ) ) ;
Sql. Add( ' ,@TMSId =' + quotedstr( MTMSId) ) ;
Sql. Add( ' ,@Dcode=' + quotedstr( Trim( Dcode) ) ) ;
Sql. Add( ' ,@DName=' + quotedstr( Trim( DName) ) ) ;
2026-06-13 16:49:18 +08:00
ShowMessage( sql. Text ) ;
2025-09-29 09:23:46 +08:00
open;
end ;
2025-02-20 14:17:49 +08:00
end ;
2025-02-20 17:32:25 +08:00
if ADOQueryBaseCmd. fieldbyName( 'intReturn' ) . AsInteger = - 1 then
2025-02-20 14:17:49 +08:00
begin
2025-02-20 17:32:25 +08:00
raise Exception. create( pchar( trim( ADOQueryBaseCmd. fieldbyName( 'ShowMsg' ) . AsString) ) ) ;
2025-02-20 14:17:49 +08:00
end ;
2025-02-20 17:32:25 +08:00
FCIID : = trim( trim( ADOQueryBaseCmd. fieldbyName( 'MaxIOID2' ) . AsString) ) ;
2025-02-20 14:17:49 +08:00
ADOQueryBaseCmd. Connection. CommitTrans;
2025-06-27 17:30:04 +08:00
TradeMarketProgressUpdate( ADOQueryBaseCmd, MTMSId) ;
2025-02-20 14:17:49 +08:00
Result : = true ;
except
ADOQueryBaseCmd. Connection. RollbackTrans;
Application. MessageBox( pchar( Exception( ExceptObject) . Message ) , '<27> <> ʾ <EFBFBD> <CABE> Ϣ' , 0 ) ;
end ;
end ;
2026-06-13 16:49:18 +08:00
procedure TfrmMachRollMain. SCAN2KeyPress( Sender: TObject; var Key: Char ) ;
begin
if Key = #13 then
begin
with ADOQueryBaseTemp do
begin
Close;
SQL. Clear;
SQL. Add( 'EXEC P_Trade_Insp_Get_plan @BCIOID=' '' + trim( SCAN2. Text ) + '' '' ) ;
Open;
end ;
if ADOQueryBaseTemp. IsEmpty = false then
begin
if ADOQueryBaseTemp. fieldbyname( 'C_NAME' ) . AsString < > CodeName. Text then
begin
Application. MessageBox( 'Ʒ <> <C6B7> <EFBFBD> <EFBFBD> һ <EFBFBD> £<EFBFBD> ' , '<27> <> ʾ <EFBFBD> <CABE> Ϣ' , MB_ICONERROR) ;
SCAN2. Text : = '' ;
exit;
end ;
if ADOQueryBaseTemp. fieldbyname( 'C_COLOR' ) . AsString < > FC_Color then
begin
Application. MessageBox( '<27> <> ɫ<EFBFBD> <C9AB> һ <EFBFBD> £<EFBFBD> ' , '<27> <> ʾ <EFBFBD> <CABE> Ϣ' , MB_ICONERROR) ;
SCAN2. Text : = '' ;
exit;
end ;
if ADOQueryBaseTemp. fieldbyname( 'C_COLORno' ) . AsString < > FC_Colorno then
begin
Application. MessageBox( 'ɫ<> Ų<EFBFBD> һ <EFBFBD> £<EFBFBD> ' , '<27> <> ʾ <EFBFBD> <CABE> Ϣ' , MB_ICONERROR) ;
SCAN2. Text : = '' ;
exit;
end ;
with CDS_HP do
begin
Append;
CDS_HP. FieldByName( 'BCIOID' ) . AsString : = ADOQueryBaseTemp. FieldByName( 'BCIOID' ) . AsString;
CDS_HP. FieldByName( 'stkqty' ) . VALUE : = ADOQueryBaseTemp. FieldByName( 'stkqty' ) . ASFLOAT;
CDS_HP. FieldByName( 'qtyunit' ) . VALUE : = ADOQueryBaseTemp. FieldByName( 'qtyunit' ) . AsString;
Post;
end ;
end ;
SCAN2. Text : = '' ;
end ;
end ;
procedure TfrmMachRollMain. Panel1Click( Sender: TObject) ;
begin
Panel3. Visible : = false ;
Panel5. Visible : = false ;
end ;
2025-02-20 14:17:49 +08:00
procedure TfrmMachRollMain. PrtData( MCIID: string ; againPring: Boolean = false ) ;
var
fPrintFile: string ;
Txt, fImagePath, Txt2, fImagePath2: string ;
Moudle: Thandle;
Makebar: TMakebar;
Mixtext: TMixtext;
begin
with ADOQueryPrint do
begin
Close;
SQL. Clear;
2025-02-21 15:28:49 +08:00
SQL. Add( ' EXEC P_BS_Cloth_Prt2 ' ) ;
SQL. Add( ' @Filtration=' '' + trim( MCIID) + '' '' ) ;
2025-02-20 14:17:49 +08:00
Open;
end ;
if ADOQueryPrint. IsEmpty then
begin
Application. MessageBox( '<27> <> ǩ<EFBFBD> <C7A9> <EFBFBD> <EFBFBD> δ<EFBFBD> ҵ<EFBFBD> <D2B5> <EFBFBD> ' , '<27> <> ʾ <EFBFBD> <CABE> Ϣ' , MB_ICONERROR) ;
exit;
end ;
2025-02-21 15:28:49 +08:00
// if trim(ADOQueryPrint.fieldbyName('SLabVolume').AsString) <> '' then
// fLabVolume := trim(ADOQueryPrint.fieldbyName('SLabVolume').AsString)
// else
// fLabVolume := trim(ADOQueryPrint.fieldbyName('LabVolume').AsString);
2026-02-05 17:10:07 +08:00
// if fLabVolume = '' then
// begin
// Application.MessageBox('<27> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> δ<EFBFBD> <CEB4> <EFBFBD> ñ<EFBFBD> ǩ<EFBFBD> <C7A9> ', '<27> <> ʾ <EFBFBD> <CABE> Ϣ', MB_ICONERROR);
// exit;
// end;
//
// ExportFtErpFile(fLabVolume + '.fr3', ADOQueryBaseTemp);
// fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\' + fLabVolume + '.fr3';
ExportFtErpFile( '<27> ͻ<EFBFBD> <CDBB> <EFBFBD> ǩ.fr3' , ADOQueryBaseTemp) ;
fPrintFile : = ExtractFilePath( Application. ExeName) + 'Report\<5C> ͻ<EFBFBD> <CDBB> <EFBFBD> ǩ.fr3' ;
2025-02-20 14:17:49 +08:00
if FileExists( fPrintFile) then
begin
2025-02-21 15:28:49 +08:00
frxReport1. LoadFromFile( fPrintFile) ;
frxReport1. PrintOptions. Copies : = cds_params. fieldbyName( 'labNumber' ) . AsInteger;
frxReport1. PrintOptions. ShowDialog : = false ;
frxReport1. PrepareReport( True ) ;
frxReport1. Print( ) ;
2025-02-20 14:17:49 +08:00
end
else
begin
2025-02-21 15:28:49 +08:00
Application. MessageBox( PChar( 'û<> <C3BB> <EFBFBD> ҵ<EFBFBD> ' + fPrintFile) , '<27> <> ʾ ' , 0 ) ;
2025-02-20 14:17:49 +08:00
end ;
end ;
2026-06-13 16:49:18 +08:00
procedure TfrmMachRollMain. PrtData2( MCIID: string ; againPring: Boolean = false ) ;
var
fPrintFile: string ;
Txt, fImagePath, Txt2, fImagePath2: string ;
Moudle: Thandle;
Makebar: TMakebar;
Mixtext: TMixtext;
begin
with ADOQueryPrint do
begin
Close;
SQL. Clear;
SQL. Add( ' EXEC P_BS_Cloth_Prt2 ' ) ;
SQL. Add( ' @Filtration=' '' + trim( MCIID) + '' '' ) ;
Open;
end ;
if ADOQueryPrint. IsEmpty then
begin
Application. MessageBox( '<27> <> ǩ<EFBFBD> <C7A9> <EFBFBD> <EFBFBD> δ<EFBFBD> ҵ<EFBFBD> <D2B5> <EFBFBD> ' , '<27> <> ʾ <EFBFBD> <CABE> Ϣ' , MB_ICONERROR) ;
exit;
end ;
// if trim(ADOQueryPrint.fieldbyName('SLabVolume').AsString) <> '' then
// fLabVolume := trim(ADOQueryPrint.fieldbyName('SLabVolume').AsString)
// else
// fLabVolume := trim(ADOQueryPrint.fieldbyName('LabVolume').AsString);
// if fLabVolume = '' then
// begin
// Application.MessageBox('<27> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> δ<EFBFBD> <CEB4> <EFBFBD> ñ<EFBFBD> ǩ<EFBFBD> <C7A9> ', '<27> <> ʾ <EFBFBD> <CABE> Ϣ', MB_ICONERROR);
// exit;
// end;
//
// ExportFtErpFile(fLabVolume + '.fr3', ADOQueryBaseTemp);
// fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\' + fLabVolume + '.fr3';
ExportFtErpFile( '<27> ͻ<EFBFBD> <CDBB> ˲ֱ<CBB2> ǩ.fr3' , ADOQueryBaseTemp) ;
fPrintFile : = ExtractFilePath( Application. ExeName) + 'Report\<5C> ͻ<EFBFBD> <CDBB> ˲ֱ<CBB2> ǩ.fr3' ;
if FileExists( fPrintFile) then
begin
frxReport1. LoadFromFile( fPrintFile) ;
frxReport1. PrintOptions. Copies : = cds_params. fieldbyName( 'labNumber' ) . AsInteger;
frxReport1. PrintOptions. ShowDialog : = false ;
frxReport1. PrepareReport( True ) ;
frxReport1. Print( ) ;
end
else
begin
Application. MessageBox( PChar( 'û<> <C3BB> <EFBFBD> ҵ<EFBFBD> ' + fPrintFile) , '<27> <> ʾ ' , 0 ) ;
end ;
end ;
2025-02-20 14:17:49 +08:00
procedure TfrmMachRollMain. BadSpeedButtonClick( Sender: TObject) ;
begin
end ;
procedure TfrmMachRollMain. On1301( var Message : Tmessage) ;
var
i1, i2: Integer ;
unitname: string ;
fdata: double ;
begin
i1 : = Message . WParam;
i2 : = Message . LParam;
if ( trim( cds_params. fieldbyName( 'mabiao' ) . AsString) = '1' ) then
begin
InputLen. Text : = format( '%.2f' , [ i1 / 1 0 0 0 0 0 ] ) ;
if trim( cds_params. fieldbyName( 'mbunit' ) . AsString) = '1' then
begin
if i2 = 0 then
begin
SetUnit( 'M' ) ;
end
else
begin
SetUnit( 'Y' ) ;
end ;
end ;
end ;
end ;
procedure TfrmMachRollMain. On1201( var Message : Tmessage) ;
var
i1, i2: Integer ;
unitname: string ;
fdata: double ;
begin
i1 : = Message . WParam;
i2 : = Message . LParam;
if trim( cds_params. fieldbyName( 'chen' ) . AsString) = '1' then
begin
InputWeight. Text : = format( '%.2f' , [ i1 / 1 0 0 0 0 0 ] ) ;
end ;
end ;
/////////////////////////////////////
function TfrmMachRollMain. deletePack( packId: string ) : boolean ;
var
ccids: string ;
packNo: integer ;
begin
try
ccids : = '' ;
packNo : = strtointdef( Trim( cds_3. FieldByName( 'packetNo' ) . AsString) , 0 ) ;
ADOQueryBaseCmd. Connection. BeginTrans;
cds_3. First;
while not cds_3. eof do
begin
if Trim( cds_3. FieldByName( 'packetid' ) . AsString) = packId then
begin
ccids : = ccids + ',' + Trim( cds_3. FieldByName( 'CIID' ) . AsString) ;
end ;
with ADOQueryBaseCmd do
begin
Close;
SQL. Clear;
SQL. Add( 'insert into Trade_Need_Up(UType,UOperation,UDataId,uoperator) values(' '<27> <> <EFBFBD> <EFBFBD> ' ',' '<27> <> <EFBFBD> <EFBFBD> ɾ<EFBFBD> <C9BE> ' ',' + QuotedStr( Trim( cds_3. FieldByName( 'CIID' ) . AsString) ) + ',' + QuotedStr( DName) + ') ' ) ;
ExecSQL;
end ;
cds_3. Next;
end ;
with ADOQueryBaseCmd do
begin
Close;
SQL. Clear;
SQL. Add( 'exec P_Trade_Insp_Del ' ) ;
SQL. Add( '@CIIDS=' + QuotedStr( ccids) ) ;
SQL. Add( ',@DCode=' + QuotedStr( DCode) ) ;
SQL. Add( ',@DName=' + QuotedStr( DName) ) ;
Open;
end ;
if ADOQueryBaseCmd. fieldbyName( 'intReturn' ) . AsInteger = - 1 then
begin
raise Exception. create( pchar( trim( ADOQueryBaseCmd. fieldbyName( 'ShowMsg' ) . AsString) ) ) ;
end ;
ADOQueryBaseCmd. Connection. CommitTrans;
InitJYGrid( ) ;
Application. MessageBox( 'ɾ<> <C9BE> <EFBFBD> ɹ<EFBFBD> <C9B9> <EFBFBD> ' , '<27> <> ʾ <EFBFBD> <CABE> Ϣ' ) ;
except
ADOQueryBaseCmd. Connection. RollbackTrans;
Application. MessageBox( pchar( Exception( ExceptObject) . Message ) , '<27> <> ʾ <EFBFBD> <CABE> Ϣ' , 0 ) ;
end ;
end ;
end .