D10szGerun/E03梭织坯布检验/U_TatMachInsp.pas

2945 lines
83 KiB
ObjectPascal
Raw Normal View History

2026-09-11 10:45:49 +08:00
unit U_TatMachInsp;
interface
uses
Windows, Messages, SysUtils, StrUtils, Variants, Classes, Graphics, Controls,
Forms, Dialogs, StdCtrls, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData,
cxDataStorage, cxEdit, DB, cxDBData, cxCalendar, cxGridLevel,
cxGridCustomTableView, cxGridTableView, cxGridDBTableView, cxClasses,
cxControls, cxGridCustomView, cxGrid, RM_Common, RM_Class, RM_GridReport,
RM_System, RM_Dataset, ADODB, DBClient, cxGridCustomPopupMenu, cxGridPopupMenu,
ExtCtrls, ComCtrls, ToolWin, cxTextEdit, Buttons, cxSplitter, cxCheckBox,
MovePanel, cxLookAndFeels, cxLookAndFeelPainters, cxNavigator, Menus,
U_BaseList, dxSkinsCore, dxSkinsDefaultPainters, dxDateRanges,
dxBarBuiltInMenu, cxContainer, cxImage, cxDBEdit, IdBaseComponent, IdComponent,
IdTCPConnection, IdTCPClient, IdExplicitTLSClientServerBase, ShellAPI, IdFTP,
FireDAC.Stan.StorageXML, cxPC, XMLDoc, XMLIntf, DateUtils, cxMaskEdit,
2026-09-11 17:23:39 +08:00
cxButtonEdit, BtnEdit, dxScrollbarAnnotations, dxCoreGraphics, dxSkinWXI;
2026-09-11 10:45:49 +08:00
type
TfrmTatMachInsp = class(TfrmBaseList)
cxStyleRepository1: TcxStyleRepository;
cxStyle1: TcxStyle;
cxStyle2: TcxStyle;
GPM_1: TcxGridPopupMenu;
ADOQueryMain: TADOQuery;
ADOCmd: TADOQuery;
RMDB_1: TRMDBDataSet;
DS_2: TDataSource;
CDS_2: TClientDataSet;
ADOQueryPrint: TADOQuery;
GPM_2: TcxGridPopupMenu;
ADOQueryMainDSC: TADOQuery;
RM1: TRMGridReport;
ADOTmp: TADOQuery;
ScrollBox1: TScrollBox;
SpeedButton13: TSpeedButton;
SpeedButton14: TSpeedButton;
SpeedButton15: TSpeedButton;
SpeedButton16: TSpeedButton;
SpeedButton17: TSpeedButton;
SpeedButton18: TSpeedButton;
SpeedButton21: TSpeedButton;
SpeedButton22: TSpeedButton;
SpeedButton23: TSpeedButton;
SpeedButton24: TSpeedButton;
SpeedButton25: TSpeedButton;
SpeedButton26: TSpeedButton;
SpeedButton29: TSpeedButton;
SpeedButton30: TSpeedButton;
SpeedButton31: TSpeedButton;
SpeedButton32: TSpeedButton;
SpeedButton33: TSpeedButton;
SpeedButton34: TSpeedButton;
SpeedButton37: TSpeedButton;
SpeedButton38: TSpeedButton;
SpeedButton39: TSpeedButton;
SpeedButton40: TSpeedButton;
SpeedButton41: TSpeedButton;
SpeedButton42: TSpeedButton;
SpeedButton45: TSpeedButton;
SpeedButton46: TSpeedButton;
SpeedButton47: TSpeedButton;
SpeedButton48: TSpeedButton;
SpeedButton50: TSpeedButton;
SpeedButton51: TSpeedButton;
SpeedButton54: TSpeedButton;
SpeedButton55: TSpeedButton;
SpeedButton56: TSpeedButton;
SpeedButton57: TSpeedButton;
SpeedButton58: TSpeedButton;
SpeedButton59: TSpeedButton;
SpeedButton62: TSpeedButton;
SpeedButton63: TSpeedButton;
SpeedButton64: TSpeedButton;
SpeedButton65: TSpeedButton;
SpeedButton66: TSpeedButton;
SpeedButton67: TSpeedButton;
SpeedButton70: TSpeedButton;
SpeedButton71: TSpeedButton;
SpeedButton72: TSpeedButton;
SpeedButton73: TSpeedButton;
SpeedButton74: TSpeedButton;
SpeedButton75: TSpeedButton;
SpeedButton19: TSpeedButton;
SpeedButton20: TSpeedButton;
SpeedButton27: TSpeedButton;
SpeedButton28: TSpeedButton;
SpeedButton35: TSpeedButton;
SpeedButton36: TSpeedButton;
SpeedButton43: TSpeedButton;
SpeedButton44: TSpeedButton;
SpeedButton52: TSpeedButton;
SpeedButton53: TSpeedButton;
SpeedButton60: TSpeedButton;
SpeedButton61: TSpeedButton;
SpeedButton68: TSpeedButton;
SpeedButton69: TSpeedButton;
SpeedButton76: TSpeedButton;
SpeedButton77: TSpeedButton;
SpeedButton78: TSpeedButton;
SpeedButton79: TSpeedButton;
SpeedButton80: TSpeedButton;
SpeedButton81: TSpeedButton;
SpeedButton82: TSpeedButton;
SpeedButton83: TSpeedButton;
CDS_3: TClientDataSet;
DS_3: TDataSource;
ADOQueryImage: TADOQuery;
DataSource2: TDataSource;
IdFTP1: TIdFTP;
Panel4: TPanel;
cxGrid3: TcxGrid;
Tv3: TcxGridDBTableView;
cxGridDBColumn1: TcxGridDBColumn;
v3Column1: TcxGridDBColumn;
v3Column4: TcxGridDBColumn;
v3Column5: TcxGridDBColumn;
cxGridLevel2: TcxGridLevel;
Tv3Column1: TcxGridDBColumn;
MovePanel1: TMovePanel;
Label17: TLabel;
Label18: TLabel;
lblLenUnit1: TLabel;
CIFBeg: TEdit;
Button1: TButton;
Button4: TButton;
CIFEnd: TEdit;
CIFQty: TEdit;
RadioGroup1: TRadioGroup;
Button2: TButton;
Tv3Column3: TcxGridDBColumn;
Tv3Column4: TcxGridDBColumn;
cxStyle4: TcxStyle;
cxPageControl1: TcxPageControl;
cxTabSheet1: TcxTabSheet;
<EFBFBD>鿴: TcxTabSheet;
cxGrid2: TcxGrid;
Tv2: TcxGridDBTableView;
tv2CDType: TcxGridDBColumn;
tv2CDWZ: TcxGridDBColumn;
v2Column2: TcxGridDBColumn;
Tv2CDQty: TcxGridDBColumn;
Tv2CDReason: TcxGridDBColumn;
v2Column1: TcxGridDBColumn;
v2Column3: TcxGridDBColumn;
v2Column4: TcxGridDBColumn;
cxGridLevel1: TcxGridLevel;
cxGrid1: TcxGrid;
TV1: TcxGridDBTableView;
cxGridDBColumn2: TcxGridDBColumn;
cxGridDBColumn3: TcxGridDBColumn;
cxGridDBColumn4: TcxGridDBColumn;
cxGridDBColumn5: TcxGridDBColumn;
cxGridDBColumn6: TcxGridDBColumn;
cxGridDBColumn7: TcxGridDBColumn;
cxGridDBColumn8: TcxGridDBColumn;
cxGridDBColumn9: TcxGridDBColumn;
cxGridLevel3: TcxGridLevel;
DS_1: TDataSource;
CDS_1: TClientDataSet;
lblCIFName: TLabel;
Label2: TLabel;
Label8: TLabel;
CIFNumber: TEdit;
Panel9: TPanel;
Panel2: TPanel;
lblLenUnit: TLabel;
Label5: TLabel;
InputLen: TEdit;
BTPrint: TButton;
Button6: TButton;
Button8: TButton;
ToolBar2: TToolBar;
ToolButton3: TToolButton;
ToolButton5: TToolButton;
ToolButton6: TToolButton;
GPM_3: TcxGridPopupMenu;
Panel6: TPanel;
Label35: TLabel;
Label16: TLabel;
Label26: TLabel;
edtChen: TEdit;
edtMaBiao: TEdit;
ComboBox1: TComboBox;
Edit6: TEdit;
Label6: TLabel;
Panel10: TPanel;
Label14: TLabel;
Label23: TLabel;
Label24: TLabel;
Label25: TLabel;
Label1: TLabel;
PCId: TEdit;
Loom: TEdit;
Repairer: TEdit;
CodeName: TEdit;
edtScan: TEdit;
ToolButton4: TToolButton;
ToolButton7: TToolButton;
ToolButton8: TToolButton;
Label7: TLabel;
edtMBDW: TEdit;
Label9: TLabel;
MinLen: TEdit;
Label15: TLabel;
MinWeight: TEdit;
MaxLen: TEdit;
MaxWeight: TEdit;
Label19: TLabel;
MPlace: TEdit;
Label20: TLabel;
Label21: TLabel;
YPlace: TEdit;
Label27: TLabel;
KgPlace: TEdit;
Label28: TLabel;
Label33: TLabel;
Label13: TLabel;
BatchNo: TEdit;
Label22: TLabel;
Grade: TComboBox;
Label10: TLabel;
C_ColorDepth: TComboBox;
Label12: TLabel;
Label34: TLabel;
Label49: TLabel;
WorkShift: TComboBox;
SCPerson: TcxButtonEdit;
JBSCPerson: TcxButtonEdit;
Label36: TLabel;
OutPutQty1: TEdit;
Label38: TLabel;
OutPutQty2: TEdit;
Label4: TLabel;
Label11: TLabel;
InputWeight: TEdit;
Tare: TEdit;
Label3: TLabel;
lblRuleConversion: TLabel;
Coefficient: TEdit;
Label29: TLabel;
Label30: TLabel;
SPEC: TEdit;
MF: TEdit;
Label32: TLabel;
KZ: TEdit;
Button5: TButton;
Label31: TLabel;
code: TEdit;
Label50: TLabel;
Label37: TLabel;
Label39: TLabel;
Label40: TLabel;
Label41: TLabel;
JBSCPerson3: TcxButtonEdit;
JBSCPerson4: TcxButtonEdit;
OutPutQty3: TEdit;
OutPutQty4: TEdit;
Label42: TLabel;
Label43: TLabel;
JBSCPerson5: TcxButtonEdit;
OutPutQty5: TEdit;
Panel3: TPanel;
SpeedButton1: TSpeedButton;
SpeedButton2: TSpeedButton;
SpeedButton3: TSpeedButton;
SpeedButton4: TSpeedButton;
SpeedButton5: TSpeedButton;
SpeedButton6: TSpeedButton;
SpeedButton7: TSpeedButton;
SpeedButton8: TSpeedButton;
SpeedButton9: TSpeedButton;
SpeedButton10: TSpeedButton;
SpeedButton11: TSpeedButton;
SpeedButton12: TSpeedButton;
SpeedButton49: TSpeedButton;
SpeedButton84: TSpeedButton;
SpeedButton85: TSpeedButton;
SpeedButton86: TSpeedButton;
SpeedButton87: TSpeedButton;
SpeedButton88: TSpeedButton;
SpeedButton89: TSpeedButton;
SpeedButton90: TSpeedButton;
SpeedButton91: TSpeedButton;
SpeedButton92: TSpeedButton;
SpeedButton93: TSpeedButton;
SpeedButton94: TSpeedButton;
SpeedButton95: TSpeedButton;
SpeedButton96: TSpeedButton;
SpeedButton97: TSpeedButton;
SpeedButton98: TSpeedButton;
SpeedButton99: TSpeedButton;
SpeedButton100: TSpeedButton;
SpeedButton101: TSpeedButton;
SpeedButton102: TSpeedButton;
SpeedButton103: TSpeedButton;
SpeedButton104: TSpeedButton;
SpeedButton105: TSpeedButton;
SpeedButton106: TSpeedButton;
SpeedButton107: TSpeedButton;
SpeedButton108: TSpeedButton;
SpeedButton109: TSpeedButton;
SpeedButton110: TSpeedButton;
Button7: TButton;
SpeedButton111: TSpeedButton;
SpeedButton112: TSpeedButton;
Panel1: TPanel;
Label44: TLabel;
Label45: TLabel;
SpeedButton113: TSpeedButton;
Button9: TButton;
carno: TEdit;
Label46: TLabel;
Label47: TLabel;
JBSCPerson6: TcxButtonEdit;
OutPutQty6: TEdit;
Label48: TLabel;
Label51: TLabel;
JBSCPerson7: TcxButtonEdit;
OutPutQty7: TEdit;
Button3: TButton;
Button10: TButton;
2026-09-12 17:23:29 +08:00
points: TEdit;
2026-09-11 17:23:39 +08:00
Label52: TLabel;
Label53: TLabel;
2026-09-12 17:23:29 +08:00
weaver_name: TcxButtonEdit;
Tv2weaver_name: TcxGridDBColumn;
Tv2points: TcxGridDBColumn;
TV1weaver_name: TcxGridDBColumn;
TV1points: TcxGridDBColumn;
Tv2weaver_code: TcxGridDBColumn;
Label54: TLabel;
Label55: TLabel;
code_table_length: TEdit;
Label56: TLabel;
Tv3code_table_length: TcxGridDBColumn;
2026-09-14 17:17:52 +08:00
Tv3c_code: TcxGridDBColumn;
2026-09-24 17:22:46 +08:00
Tv3CalcMeter: TcxGridDBColumn;
Tv3EstimatedDiff: TcxGridDBColumn;
Tv3ActualDiff: TcxGridDBColumn;
2026-10-14 17:23:44 +08:00
Tv3add_weight: TcxGridDBColumn;
2026-09-24 17:22:46 +08:00
Label57: TLabel;
edtMax: TEdit;
C_LongitudeBatchNo: TEdit;
C_LatitudeBatchNo: TEdit;
Label58: TLabel;
Label59: TLabel;
2026-09-29 17:27:52 +08:00
BtnCon: TButton;
2026-10-14 17:23:44 +08:00
add_weight: TEdit;
Label60: TLabel;
2026-10-15 17:27:46 +08:00
Label61: TLabel;
Tv3c_name: TcxGridDBColumn;
2026-09-11 10:45:49 +08:00
procedure FormDestroy(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormShow(Sender: TObject);
procedure BTPrintClick(Sender: TObject);
procedure SpeedButton1Click(Sender: TObject);
procedure SpeedButton12Click(Sender: TObject);
procedure SpeedButton13Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure edtScanKeyPress(Sender: TObject; var Key: Char);
procedure CIFBegClick(Sender: TObject);
procedure CIFEndChange(Sender: TObject);
procedure Edit6Click(Sender: TObject);
procedure MJstr3KeyPress(Sender: TObject; var Key: Char);
procedure Button2Click(Sender: TObject);
procedure edtScanClick(Sender: TObject);
procedure NetWeightKeyPress(Sender: TObject; var Key: Char);
procedure FormCreate(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure edtChenClick(Sender: TObject);
procedure Button6Click(Sender: TObject);
procedure Button8Click(Sender: TObject);
procedure Tv3MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
2026-09-28 17:25:53 +08:00
procedure Tv2CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
2026-09-11 10:45:49 +08:00
procedure edtYJClick(Sender: TObject);
procedure Pic_Image1DblClick(Sender: TObject);
procedure Tv3CustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
procedure lblLenUnitClick(Sender: TObject);
procedure ToolButton3Click(Sender: TObject);
procedure ToolButton6Click(Sender: TObject);
procedure ToolButton5Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure ToolButton4Click(Sender: TObject);
procedure ToolButton7Click(Sender: TObject);
procedure ToolButton8Click(Sender: TObject);
procedure ComboBox1Change(Sender: TObject);
procedure MinLenExit(Sender: TObject);
procedure cxButtonEdit1PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
procedure JBSCPersonPropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
procedure Button5Click(Sender: TObject);
procedure carnoBtnClick(Sender: TObject);
procedure OutPutQty1Change(Sender: TObject);
procedure SCPersonClick(Sender: TObject);
procedure JBSCPersonClick(Sender: TObject);
procedure carnoClick(Sender: TObject);
procedure JBSCPerson3Click(Sender: TObject);
procedure JBSCPerson4Click(Sender: TObject);
procedure JBSCPerson5Click(Sender: TObject);
procedure OutPutQty1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure OutPutQty2MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure OutPutQty3MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure OutPutQty4MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure OutPutQty5MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure Button7Click(Sender: TObject);
procedure SpeedButton113Click(Sender: TObject);
procedure Button9Click(Sender: TObject);
procedure JBSCPerson6Click(Sender: TObject);
procedure JBSCPerson7Click(Sender: TObject);
procedure OutPutQty6MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure OutPutQty7MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure Button10Click(Sender: TObject);
2026-09-11 17:23:39 +08:00
procedure codeClick(Sender: TObject);
procedure codeExit(Sender: TObject);
2026-10-15 17:27:46 +08:00
procedure CodeNameExit(Sender: TObject);
2026-09-12 17:23:29 +08:00
procedure weaver_nameClick(Sender: TObject);
2026-09-14 17:17:52 +08:00
procedure InputWeightChange(Sender: TObject);
procedure KZChange(Sender: TObject);
2026-10-15 17:27:46 +08:00
procedure add_weightChange(Sender: TObject);
2026-09-24 17:22:46 +08:00
procedure edtMaxClick(Sender: TObject);
2026-09-29 17:27:52 +08:00
procedure BtnConClick(Sender: TObject);
2026-09-11 10:45:49 +08:00
private
{ Private declarations }
FCIID, FOperationStatus, FCIFName, FWorkshop: string;
FOrderNo, FMainId, FSubId, FPCId, FConNo, FConMId, FConSId: string;
FLoom, FBatchNO, FLenUnit, FC_Code, FC_Name, FC_Spec, FC_Width, FC_GramWeight: string;
FC_Color, FC_ColorNo, FC_StyleNo, FC_Pattern, FC_CustPattern, FC_ColorDepth: string;
FFtyPCId, FGangNo: string;
FPieceNo: Integer;
IsCommopen: boolean;
procedure SetINIFile(); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>
procedure GetINIFile(); //<2F><><EFBFBD>ó<EFBFBD><C3B3>ȵ<EFBFBD>λ
procedure SetUnit(MUnit: string); //<2F><><EFBFBD>ó<EFBFBD><C3B3>ȵ<EFBFBD>λ
procedure SetDdetails(); //ˢ<><CBA2><EFBFBD><EFBFBD>ϸ<EFBFBD><CFB8>Ϣ
procedure InitCDPanel(); //ˢ<>´õ<C2B4>ѡ<EFBFBD><D1A1>
procedure InitCDGrid(MCIID: string); //ˢ<>´õ<C2B4><C3B5>Ǽ<EFBFBD><C7BC><EFBFBD>Ϣ
procedure InitCDGridCX(MCIID: string); //ˢ<>´õ<C2B4><C3B5><EFBFBD>ѯ<EFBFBD><D1AF>Ϣ
procedure InitJYGrid(); //ˢ<>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD>Ϣ
function CheckData(CKType: string): Boolean; //У<><D0A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
function SaveData(): Boolean; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
procedure InitLCK(MPCId: string); //ɨ<><C9A8><EFBFBD><EFBFBD><EFBFBD>̿<EFBFBD>
procedure InitJTM(MCIID: string); //ɨ<><C9A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
procedure ClearGlobal(); //<2F><><EFBFBD><EFBFBD>ȫ<EFBFBD><C8AB>ID
procedure PrtData(MCIID: string); //<2F><>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD>ǩ
procedure QuantityConversion(); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
procedure InitImage(YFTPName: string); //ͼƬ
procedure InitImageHX(HXSID: string);
procedure LookImage(FileName: string);
procedure OpenCom(DllName: string); //<2F>򿪴<EFBFBD><F2BFAAB4><EFBFBD>
procedure CloseCom(DllName: string); //<2F>رմ<D8B1><D5B4><EFBFBD>
procedure On1201(var Message: Tmessage); message 1201; //<2F><><EFBFBD>ӳ<EFBFBD>
procedure On1301(var Message: Tmessage); message 1301; //<2F><><EFBFBD><EFBFBD>
2026-09-14 17:17:52 +08:00
procedure CalcInputLenByWeightKZ;
2026-10-10 17:25:31 +08:00
procedure AllocWeaverMeter(AIdx: Integer);
2026-10-09 17:24:29 +08:00
function RoundUpToHalf(AValue: Double): Double; //decimal 0.1-0.4 -> 0.5, 0.6-0.9 -> next integer
2026-10-12 17:23:40 +08:00
function FormatQty2(AValue: Double): string;
2026-10-16 17:21:20 +08:00
function SelBoundProduct(AMCNO: string): string; //<2F><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>̨<EFBFBD>󶨵IJ<F3B6A8B5>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD><EFBFBD>ز<EFBFBD>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>
2026-09-11 10:45:49 +08:00
public
fmanage: string;
fFlileFlag: string;
{ Public declarations }
end;
var
frmTatMachInsp: TfrmTatMachInsp;
newh, newh1: hwnd;
implementation
uses
U_DataLink, U_RTFun, U_ZDYHelp, U_iniParam, U_EmployeeSel, U_TatClothInfoSel,
2026-09-29 17:27:52 +08:00
U_SCPersonColor, U_SCPersonColor5, U_TatConSel;
2026-09-11 10:45:49 +08:00
{$R *.dfm}
2026-10-12 17:23:40 +08:00
function TfrmTatMachInsp.FormatQty2(AValue: Double): string;
var
S: string;
begin
S := FormatFloat('0.00', AValue);
if (Length(S) >= 3) and (Copy(S, Length(S) - 2, 3) = '.00') then
Result := Copy(S, 1, Length(S) - 3)
else
Result := S;
end;
2026-10-09 17:24:29 +08:00
2026-09-14 17:17:52 +08:00
procedure TfrmTatMachInsp.CalcInputLenByWeightKZ;
var
2026-10-15 17:27:46 +08:00
W, AW, KZValue: Double;
2026-09-14 17:17:52 +08:00
begin
if Trim(InputWeight.Text) = '' then
Exit;
if Trim(KZ.Text) = '' then
Exit;
if not TryStrToFloat(Trim(InputWeight.Text), W) then
Exit;
2026-10-15 17:27:46 +08:00
if not TryStrToFloat(Trim(add_weight.Text), AW) then
AW := 0;
2026-09-14 17:17:52 +08:00
if not TryStrToFloat(Trim(KZ.Text), KZValue) then
Exit;
if KZValue = 0 then
begin
InputLen.Text := '';
Exit;
end;
2026-10-16 17:21:20 +08:00
// InputLen.Text := FormatFloat('0.##', (W + AW) / KZValue);
InputLen.Text := FormatFloat('0.#', RoundUpToHalf(RoundFloat((W + AW) / KZValue, 1)));
2026-09-14 17:17:52 +08:00
end;
2026-09-11 10:45:49 +08:00
procedure TfrmTatMachInsp.SetINIFile();
begin
if edtChen.Text = '<27><>' then
IsDZCDYDll := '1'
else
IsDZCDYDll := '0';
if edtMaBiao.Text = '<27><>' then
IsMBDYDll := '1'
else
IsMBDYDll := '0';
if edtMBDW.Text = '<27><>' then
IsMBDYDllUnit := '1'
else
IsMBDYDllUnit := '0';
LabQty := ComboBox1.Text;
FMinLen := MinLen.Text;
FMaxLen := MaxLen.Text;
FMinWeight := MinWeight.Text;
FMaxWeight := MaxWeight.Text;
FMPlace := MPlace.Text;
FYPlace := YPlace.Text;
FKgPlace := KgPlace.Text;
WriteINIFile();
end;
procedure TfrmTatMachInsp.GetINIFile();
begin
if IsDZCDYDll = '1' then
edtChen.Text := '<27><>'
else
edtChen.Text := '';
if IsMBDYDll = '1' then
edtMaBiao.Text := '<27><>'
else
edtMaBiao.Text := '';
if IsMBDYDllUnit = '1' then
edtMBDW.Text := '<27><>'
else
edtMBDW.Text := '';
ComboBox1.ItemIndex := ComboBox1.Items.IndexOf(trim(LabQty));
MinLen.Text := FMinLen;
MaxLen.Text := FMaxLen;
MinWeight.Text := FMinWeight;
MaxWeight.Text := FMaxWeight;
MPlace.Text := FMPlace;
YPlace.Text := FYPlace;
KgPlace.Text := FKgPlace;
end;
procedure TfrmTatMachInsp.SetDdetails();
begin
// AOrdDefNote1.Text := '';
// AOrdDefNote1.Text := AOrdDefNote1.Text + '<27><><EFBFBD><EFBFBD>:' + FPCId + #13;
// AOrdDefNote1.Text := AOrdDefNote1.Text + 'Ʒ<><C6B7>:' + FC_Name + #13;
// AOrdDefNote1.Text := AOrdDefNote1.Text + '<27><>ɫ:' + FC_Color + #13;
// AOrdDefNote1.Text := AOrdDefNote1.Text + 'ɫ<><C9AB>:' + FC_ColorNo + #13;
end;
procedure TfrmTatMachInsp.SetUnit(MUnit: string);
begin
lblLenUnit.Caption := MUnit;
lblLenUnit1.Caption := MUnit;
end;
procedure TfrmTatMachInsp.InitImage(YFTPName: string);
begin
// with ADOQueryImage do
// begin
// close;
// sql.Clear;
// sql.Add('select * from TC_File A');
// sql.Add('where isnull(WBID,'''')<>'''' and WBID=' + quotedstr(YFTPName));
//// showmessage(sql.text);
// open;
// end;
end;
procedure TfrmTatMachInsp.InitImageHX(HXSID: string);
begin
// with Qry_ImgHX do
// begin
// close;
// sql.Clear;
// sql.Add('select * from TC_File A');
// sql.Add('where isnull(WBID,'''')<>'''' and WBID=' + quotedstr(HXSID));
//// ShowMessage(SQL.Text);
// open;
// end;
end;
procedure TfrmTatMachInsp.QuantityConversion();
begin
if lblRuleConversion.Caption = '<27><>ת<EFBFBD><D7AA><EFBFBD><EFBFBD>' then
begin
InputWeight.Text := floattostr(StrToFloatdef(trim(InputLen.Text), 0) * StrToFloatdef(trim(Coefficient.Text), 0));
end;
if lblRuleConversion.Caption = '<27><><EFBFBD><EFBFBD>ת<EFBFBD><D7AA>' then
begin
InputLen.Text := floattostr(StrToFloatdef(trim(InputWeight.Text), 0) * StrToFloatdef(trim(Coefficient.Text), 0));
end;
end;
function TfrmTatMachInsp.CheckData(CKType: string): Boolean;
var
mvalue: Double;
begin
try
// if Trim(FPCId) = '' then
// raise Exception.Create('<27><>ɨ<EFBFBD><C9A8><EFBFBD><EFBFBD><EFBFBD>̿<EFBFBD><CCBF><EFBFBD>');
if Trim(CKType) = '<27>ύ' then
begin
if trim(CodeName.text) = '' then
raise Exception.Create('Ʒ<><C6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!');
if trim(carno.text) = '' then
raise Exception.Create('<27><>̨<EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD><CEAA>!');
2026-09-15 17:28:07 +08:00
// if trim(SCPerson.text) = '' then
// raise Exception.Create('<27><><EFBFBD><EFBFBD>1<EFBFBD><31><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!');
2026-09-11 10:45:49 +08:00
if trim(JBSCPerson.text) <> '' then
begin
if OutPutQty2.Text = '' then
begin
raise Exception.Create('<27><><EFBFBD><EFBFBD>2<EFBFBD><32>Ϊ<EFBFBD><CEAA>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!');
end;
end;
if trim(JBSCPerson3.text) <> '' then
begin
if OutPutQty3.Text = '' then
begin
raise Exception.Create('<27><><EFBFBD><EFBFBD>3<EFBFBD><33>Ϊ<EFBFBD><CEAA>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!');
end;
end;
if trim(JBSCPerson4.text) <> '' then
begin
if OutPutQty4.Text = '' then
begin
raise Exception.Create('<27><><EFBFBD><EFBFBD>4<EFBFBD><34>Ϊ<EFBFBD><CEAA>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!');
end;
end;
if trim(JBSCPerson5.text) <> '' then
begin
if OutPutQty5.Text = '' then
begin
raise Exception.Create('<27><><EFBFBD><EFBFBD>5<EFBFBD><35>Ϊ<EFBFBD><CEAA>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!');
end;
end;
if trim(JBSCPerson6.text) <> '' then
begin
if OutPutQty6.Text = '' then
begin
raise Exception.Create('<27><><EFBFBD><EFBFBD>6<EFBFBD><36>Ϊ<EFBFBD><CEAA>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!');
end;
end;
if trim(JBSCPerson7.text) <> '' then
begin
if OutPutQty7.Text = '' then
begin
raise Exception.Create('<27><><EFBFBD><EFBFBD>7<EFBFBD><37>Ϊ<EFBFBD><CEAA>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!');
end;
end;
if trim(lblLenUnit.Caption) = '' then
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) < Strtofloatdef(MinWeight.Text, 0) then
raise Exception.Create('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С<EFBFBD><D0A1>' + MinWeight.Text + '!');
if strtofloatdef(trim(InputWeight.Text), 0) > Strtofloatdef(MaxWeight.Text, 0) then
raise Exception.Create('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܴ<EFBFBD><DCB4><EFBFBD>' + MaxWeight.Text + '!');
end;
2026-10-14 17:23:44 +08:00
if Trim(add_weight.Text) <> '' then
begin
if TryStrToFloat(add_weight.Text, mvalue) = False then
raise Exception.Create('<27><><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!');
end;
2026-09-11 10:45:49 +08:00
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) < Strtofloatdef(MinLen.Text, 0) then
raise Exception.Create('<27><><EFBFBD>Ȳ<EFBFBD><C8B2><EFBFBD>С<EFBFBD><D0A1>' + MinLen.Text + '<27><>!');
if strtofloatdef(trim(InputLen.Text), 0) > Strtofloatdef(MaxLen.Text, 0) then
raise Exception.Create('<27><><EFBFBD>Ȳ<EFBFBD><C8B2>ܴ<EFBFBD><DCB4><EFBFBD>' + MaxLen.Text + '<27><>!');
end;
if (strtofloatdef(trim(InputLen.Text), 0) = 0) and (strtofloatdef(trim(InputWeight.Text), 0) = 0) then
raise Exception.Create('<27><><EFBFBD>Ⱥ<EFBFBD><C8BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܶ<EFBFBD>Ϊ0!!');
end;
Result := True;
except
Result := false;
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
end;
end;
procedure TfrmTatMachInsp.ClearGlobal();
begin
FOrderNo := '';
FConNo := '';
FConMId := '';
FConSId := '';
FMainId := '';
FSubId := '';
FPCId := '';
FC_CustPattern := '';
FC_ColorDepth := '';
FFtyPCId := '';
FGangNo := '';
FC_Code := '';
FC_Name := '';
FBatchNO := '';
FC_Spec := '';
FC_Color := '';
FC_ColorNo := '';
FC_StyleNo := '';
FC_Width := '';
FC_GramWeight := '';
FC_Pattern := '';
FCIID := '';
FWorkshop := '';
InputLen.Text := '';
Coefficient.Text := '';
// AOrdDefNote1.Text := '';
Tare.Text := '';
InputWeight.Text := '';
2026-09-12 17:23:29 +08:00
code_table_length.Text := '';
2026-10-14 17:23:44 +08:00
add_weight.Text := '';
2026-09-11 10:45:49 +08:00
FLenUnit := '';
FLoom := '';
2026-09-24 17:22:46 +08:00
C_LongitudeBatchNo.Text := '';
C_LatitudeBatchNo.Text := '';
2026-09-11 10:45:49 +08:00
end;
procedure TfrmTatMachInsp.LookImage(FileName: string);
var
sFieldName: string;
begin
sFieldName := leftbstr(ExtractFilePath(Application.ExeName), 1) + ':\ͼƬ<CDBC>鿴';
if not DirectoryExists(pchar(sFieldName)) then
CreateDirectory(pchar(sFieldName), nil);
sFieldName := sFieldName + '\' + trim(FileName);
try
IdFTP1.Host := ReadINIFileStr('SYSTEMSET.INI', 'SERVER', '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ', '127.0.0.1');
IdFTP1.Username := 'three';
IdFTP1.Password := '641010';
IdFTP1.Connect();
except
;
end;
if IdFTP1.Connected then
begin
try
IdFTP1.Get(fFlileFlag + '\' + Trim(FileName), sFieldName, true, false);
except
Application.MessageBox('<27>ͻ<EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', MB_ICONWARNING);
IdFTP1.Quit;
Exit;
end;
end
else
begin
Application.MessageBox('<27>޷<EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', MB_ICONWARNING);
IdFTP1.Quit;
Exit;
end;
if IdFTP1.Connected then
IdFTP1.Quit;
ShellExecute(Handle, 'open', PChar(sFieldName), '', '', SW_SHOWNORMAL);
end;
procedure TfrmTatMachInsp.Pic_Image1DblClick(Sender: TObject);
begin
if TcxDBImage(Sender).Picture.Height = 0 then
exit;
LookImage(ADOQueryImage.fieldbyname(TcxDBImage(Sender).Hint).asstring);
end;
procedure TfrmTatMachInsp.InitLCK(MPCId: string);
begin
with ADOTmp do
begin
Close;
sql.Clear;
// sql.Add('EXEC P_Tat_Insp_Get_PlanCard @PCID=''' + Trim(MPCId) + '''');
sql.Add('EXEC P_Tat_Insp_Get_ORDERNO @MAINID=''' + Trim(MPCId) + '''');
Open;
end;
if ADOTmp.IsEmpty = False then
begin
// if Trim(ADOTmp.fieldbyname('Status').AsString) <> '9' then
// begin
// application.MessageBox('<27><><EFBFBD>̿<EFBFBD><CCBF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬<D7B4><CCAC>', '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_ICONERROR);
// ClearGlobal();
// end
// else
begin
// InitImage(Trim(ADOTmp.fieldbyname('YFTPName').AsString));
// InitImageHX(Trim(ADOTmp.fieldbyname('HXSID').AsString));
// FLenUnit := Trim(ADOTmp.fieldbyname('LenUnit').AsString);
// SetUnit(FLenUnit);
FConNo := Trim(ADOTmp.fieldbyname('ConNo').AsString);
FOrderNo := Trim(ADOTmp.fieldbyname('OrderNo').AsString);
FMainId := Trim(ADOTmp.fieldbyname('MainId').AsString);
FSubId := Trim(ADOTmp.fieldbyname('SubId').AsString);
// FPCId := Trim(ADOTmp.fieldbyname('PCId').AsString);
// FWorkshop := Trim(ADOTmp.fieldbyname('Workshop').AsString);
FC_Code := Trim(ADOTmp.fieldbyname('C_Code').AsString);
FC_Name := Trim(ADOTmp.fieldbyname('C_Name').AsString);
FC_Spec := Trim(ADOTmp.fieldbyname('C_Spec').AsString);
FC_Color := Trim(ADOTmp.fieldbyname('C_Color').AsString);
FC_ColorNo := Trim(ADOTmp.fieldbyname('C_ColorNo').AsString);
FC_Width := Trim(ADOTmp.fieldbyname('C_Width').AsString);
FC_GramWeight := Trim(ADOTmp.fieldbyname('C_GramWeight').AsString);
FC_Pattern := Trim(ADOTmp.fieldbyname('C_Pattern').AsString);
// FLoom := Trim(ADOTmp.fieldbyname('Loom').AsString);
// FBatchNO := Trim(ADOTmp.fieldbyname('BatchNO').AsString);
// PieceNo.Text := Trim(ADOTmp.fieldbyname('maxRoll').AsString);
Coefficient.Text := '0';
CodeName.Text := FC_Name;
// BatchNO.Text := FBatchNO;
spec.Text := FC_Spec;
Code.Text := FC_Code;
mf.Text := FC_Width;
KZ.Text := FC_GramWeight;
Label14.Caption := Trim(ADOTmp.fieldbyname('orderno').AsString);
Loom.Text := FLoom;
// Repairer.Text := Trim(ADOTmp.fieldbyname('Repairer').AsString);
SetDdetails();
InputLen.SetFocus;
CIFBegClick(InputLen);
end;
end
else
begin
application.MessageBox('<27>ƻ<EFBFBD><C6BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_ICONERROR);
ClearGlobal();
end;
InitJYGrid();
InitCDGrid(FCIID);
edtScan.Text := '';
end;
2026-09-14 17:17:52 +08:00
procedure TfrmTatMachInsp.InputWeightChange(Sender: TObject);
begin
CalcInputLenByWeightKZ;
end;
2026-10-10 17:25:31 +08:00
procedure TfrmTatMachInsp.AllocWeaverMeter(AIdx: Integer);
const
2026-10-12 17:23:40 +08:00
CAdj = 4;
2026-10-10 17:25:31 +08:00
var
L, M1, M2, M3: Double;
begin
L := StrToFloatdef(Trim(code_table_length.Text), 0);
if L <= 0 then
begin
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
Exit;
end;
2026-10-12 17:23:40 +08:00
2026-10-10 17:25:31 +08:00
M1 := StrToFloatdef(Trim(OutPutQty1.Text), 0);
M2 := StrToFloatdef(Trim(OutPutQty2.Text), 0);
M3 := StrToFloatdef(Trim(OutPutQty3.Text), 0);
2026-10-12 17:23:40 +08:00
2026-10-10 17:25:31 +08:00
case AIdx of
2026-10-12 17:23:40 +08:00
1:
OutPutQty1.Text := FormatQty2(L);
2026-10-10 17:25:31 +08:00
2:
2026-10-12 17:23:40 +08:00
begin
OutPutQty1.Text := FormatQty2(M1 + CAdj);
OutPutQty2.Text := FormatQty2(L - M1 - CAdj);
2026-10-10 17:25:31 +08:00
end;
2026-10-12 17:23:40 +08:00
2026-10-10 17:25:31 +08:00
3:
2026-10-12 17:23:40 +08:00
begin
OutPutQty2.Text := FormatQty2(M2 + CAdj);
OutPutQty3.Text := FormatQty2(L - M1 - M2 - CAdj);
2026-10-10 17:25:31 +08:00
end;
2026-10-12 17:23:40 +08:00
2026-10-10 17:25:31 +08:00
4:
2026-10-12 17:23:40 +08:00
begin
OutPutQty3.Text := FormatQty2(M3 + CAdj);
OutPutQty4.Text := FormatQty2(L - M1 - M2 - M3 - CAdj);
2026-10-10 17:25:31 +08:00
end;
end;
end;
2026-09-11 10:45:49 +08:00
procedure TfrmTatMachInsp.JBSCPerson3Click(Sender: TObject);
begin
inherited;
try
frmEmployeeSel := TfrmEmployeeSel.Create(self);
with frmEmployeeSel do
begin
FPost := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
if ShowModal = 1 then
begin
JBSCPerson3.Text := frmEmployeeSel.FRName;
JBSCPerson3.Hint := frmEmployeeSel.FRCode;
end;
end;
finally
frmEmployeeSel.Free;
end;
end;
procedure TfrmTatMachInsp.JBSCPerson4Click(Sender: TObject);
begin
inherited;
try
frmEmployeeSel := TfrmEmployeeSel.Create(self);
with frmEmployeeSel do
begin
FPost := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
if ShowModal = 1 then
begin
JBSCPerson4.Text := frmEmployeeSel.FRName;
JBSCPerson4.Hint := frmEmployeeSel.FRCode;
end;
end;
finally
frmEmployeeSel.Free;
end;
end;
procedure TfrmTatMachInsp.JBSCPerson5Click(Sender: TObject);
begin
inherited;
try
frmEmployeeSel := TfrmEmployeeSel.Create(self);
with frmEmployeeSel do
begin
FPost := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
if ShowModal = 1 then
begin
JBSCPerson5.Text := frmEmployeeSel.FRName;
JBSCPerson5.Hint := frmEmployeeSel.FRCode;
end;
end;
finally
frmEmployeeSel.Free;
end;
end;
procedure TfrmTatMachInsp.JBSCPerson6Click(Sender: TObject);
begin
try
frmEmployeeSel := TfrmEmployeeSel.Create(self);
with frmEmployeeSel do
begin
FPost := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
if ShowModal = 1 then
begin
JBSCPerson6.Text := frmEmployeeSel.FRName;
JBSCPerson6.Hint := frmEmployeeSel.FRCode;
end;
end;
finally
frmEmployeeSel.Free;
end;
end;
procedure TfrmTatMachInsp.JBSCPerson7Click(Sender: TObject);
begin
try
frmEmployeeSel := TfrmEmployeeSel.Create(self);
with frmEmployeeSel do
begin
FPost := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
if ShowModal = 1 then
begin
JBSCPerson7.Text := frmEmployeeSel.FRName;
JBSCPerson7.Hint := frmEmployeeSel.FRCode;
end;
end;
finally
frmEmployeeSel.Free;
end;
end;
procedure TfrmTatMachInsp.JBSCPersonClick(Sender: TObject);
begin
inherited;
try
frmEmployeeSel := TfrmEmployeeSel.Create(self);
with frmEmployeeSel do
begin
FPost := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
if ShowModal = 1 then
begin
JBSCPerson.Text := frmEmployeeSel.FRName;
JBSCPerson.Hint := frmEmployeeSel.FRCode;
end;
end;
finally
frmEmployeeSel.Free;
end;
end;
procedure TfrmTatMachInsp.JBSCPersonPropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
begin
try
frmEmployeeSel := TfrmEmployeeSel.Create(self);
with frmEmployeeSel do
begin
FPost := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
if ShowModal = 1 then
begin
JBSCPerson.Text := frmEmployeeSel.FRName;
JBSCPerson.Hint := frmEmployeeSel.FRCode;
end;
end;
finally
frmEmployeeSel.Free;
end;
end;
2026-09-14 17:17:52 +08:00
procedure TfrmTatMachInsp.KZChange(Sender: TObject);
begin
CalcInputLenByWeightKZ;
end;
2026-10-15 17:27:46 +08:00
procedure TfrmTatMachInsp.add_weightChange(Sender: TObject);
begin
CalcInputLenByWeightKZ;
end;
2026-09-11 10:45:49 +08:00
procedure TfrmTatMachInsp.InitJTM(MCIID: string);
begin
with ADOTmp do
begin
Close;
sql.Clear;
sql.Add('select * from Tat_Cloth_IO where StkId=''' + Trim(MCIID) + ''' and IOFlag=''<27><><EFBFBD><EFBFBD>''');
Open;
end;
if not ADOTmp.IsEmpty then
begin
Application.MessageBox('<27>Ѳ<EFBFBD><D1B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݲ<EFBFBD><DDB2>ܲ<EFBFBD><DCB2><EFBFBD>!', '<27><>ʾ', 0);
Exit;
end;
with ADOTmp do
begin
Close;
sql.Clear;
sql.Add('select * from Tat_Cloth_IO where StkId=''' + Trim(MCIID) + ''' and IOFlag=''<27><><EFBFBD><EFBFBD>''');
Open;
end;
if not ADOTmp.IsEmpty then
begin
Application.MessageBox('<27>Ѳ<EFBFBD><D1B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݲ<EFBFBD><DDB2>ܲ<EFBFBD><DCB2><EFBFBD>!', '<27><>ʾ', 0);
Exit;
end;
with ADOTmp do
begin
Close;
sql.Clear;
sql.Add('select * from Tat_Cloth_Inspect where CIID=''' + Trim(MCIID) + '''');
Open;
end;
if not ADOTmp.IsEmpty then
begin
FOperationStatus := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
FCIID := MCIID;
InitCDGrid(MCIID);
end;
end;
procedure TfrmTatMachInsp.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-09-11 17:23:39 +08:00
procedure TfrmTatMachInsp.codeClick(Sender: TObject);
var
i: Integer;
begin
panel3.Visible := true;
with Panel3 do
begin
for i := 0 to ControlCount - 1 do
begin
if Controls[i] is TSpeedButton then
begin
TSpeedButton(Controls[i]).Hint := Trim(TEdit(Sender).Name);
end;
end;
end;
end;
procedure TfrmTatMachInsp.codeExit(Sender: TObject);
begin
if Trim(code.Text) = '' then
Exit;
code.Text := Trim(code.Text);
with ADOTmp do
begin
Close;
SQL.Clear;
SQL.Add('SELECT * FROM Bs_Cloth_Info WHERE C_Code = ' + QuotedStr(code.Text));
Open;
end;
2026-10-15 17:27:46 +08:00
if (not ADOTmp.IsEmpty) and (ADOTmp.FieldByName('Status').AsInteger = 5) then
2026-09-11 17:23:39 +08:00
begin
code.Text := Trim(ADOTmp.FieldByName('C_Code').AsString);
CodeName.Text := Trim(ADOTmp.FieldByName('C_Name').AsString);
MF.Text := Trim(ADOTmp.FieldByName('C_Width').AsString);
KZ.Text := Trim(ADOTmp.FieldByName('C_GramWeight').AsString);
SPEC.Text := Trim(ADOTmp.FieldByName('C_SPEC').AsString);
2026-09-24 17:22:46 +08:00
C_LongitudeBatchNo.Text := Trim(ADOTmp.FieldByName('C_LongitudeBatchNo').AsString);
C_LatitudeBatchNo.Text := Trim(ADOTmp.FieldByName('C_LatitudeBatchNo').AsString);
2026-09-11 17:23:39 +08:00
FMainId := '';
FSubId := '';
Label14.Caption := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
end
else
begin
2026-10-15 17:27:46 +08:00
if ADOTmp.IsEmpty then
Application.MessageBox('δ<>ҵ<EFBFBD><D2B5>ò<EFBFBD>Ʒ<EFBFBD><C6B7><EFBFBD>ţ<EFBFBD><C5A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>룡', '<27><>ʾ', MB_ICONWARNING)
else
Application.MessageBox('<27>ò<EFBFBD>Ʒ<EFBFBD><C6B7>ͣ<EFBFBD>ã<EFBFBD><C3A3><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD>ã<EFBFBD>', '<27><>ʾ', MB_ICONWARNING);
2026-09-11 17:23:39 +08:00
CodeName.Text := '';
MF.Text := '';
KZ.Text := '';
SPEC.Text := '';
2026-09-24 17:22:46 +08:00
C_LongitudeBatchNo.Text := '';
C_LatitudeBatchNo.Text := '';
2026-09-11 17:23:39 +08:00
end;
end;
2026-10-15 17:27:46 +08:00
procedure TfrmTatMachInsp.CodeNameExit(Sender: TObject);
begin
if Trim(CodeName.Text) = '' then
Exit;
CodeName.Text := Trim(CodeName.Text);
with ADOTmp do
begin
Close;
SQL.Clear;
SQL.Add('SELECT * FROM Bs_Cloth_Info WHERE C_Name = ' + QuotedStr(CodeName.Text));
Open;
end;
if (not ADOTmp.IsEmpty) and (ADOTmp.FieldByName('Status').AsInteger = 5) then
begin
code.Text := Trim(ADOTmp.FieldByName('C_Code').AsString);
CodeName.Text := Trim(ADOTmp.FieldByName('C_Name').AsString);
MF.Text := Trim(ADOTmp.FieldByName('C_Width').AsString);
KZ.Text := Trim(ADOTmp.FieldByName('C_GramWeight').AsString);
SPEC.Text := Trim(ADOTmp.FieldByName('C_SPEC').AsString);
C_LongitudeBatchNo.Text := Trim(ADOTmp.FieldByName('C_LongitudeBatchNo').AsString);
C_LatitudeBatchNo.Text := Trim(ADOTmp.FieldByName('C_LatitudeBatchNo').AsString);
FMainId := '';
FSubId := '';
Label14.Caption := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
end
else
begin
if ADOTmp.IsEmpty then
Application.MessageBox('δ<>ҵ<EFBFBD><D2B5>ò<EFBFBD>Ʒ<EFBFBD><C6B7><EFBFBD>ƣ<EFBFBD><C6A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>룡', '<27><>ʾ', MB_ICONWARNING)
else
Application.MessageBox('<27>ò<EFBFBD>Ʒ<EFBFBD><C6B7>ͣ<EFBFBD>ã<EFBFBD><C3A3><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD>ã<EFBFBD>', '<27><>ʾ', MB_ICONWARNING);
code.Text := '';
MF.Text := '';
KZ.Text := '';
SPEC.Text := '';
C_LongitudeBatchNo.Text := '';
C_LatitudeBatchNo.Text := '';
end;
end;
2026-09-11 10:45:49 +08:00
procedure TfrmTatMachInsp.ComboBox1Change(Sender: TObject);
begin
SetINIFile();
end;
procedure TfrmTatMachInsp.OpenCom(DllName: string);
type
TMyFunc = function(fhandle: hwnd; sCommName: PAnsiChar; IntTime: integer; IsMessage: integer): HWND; stdcall;
var
Tf: TMyFunc;
Tp: TFarProc;
Th: Thandle;
begin
// closeCom(FComFile);
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', 500, 1);
if newh < 1 then
begin
application.MessageBox(Pchar('<27>򿪴<EFBFBD><F2BFAAB4><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>'), '<27><>ʾ');
end
else
IsCommOpen := true;
end
else
begin
IsCommOpen := false;
end;
finally
// FreeLibrary(Th);
end;
end
else
begin
IsCommOpen := false;
application.MessageBox(Pchar('<27>Ҳ<EFBFBD><D2B2><EFBFBD> ' + trim(DllName) + ' <20>ļ<EFBFBD><C4BC><EFBFBD>'), '<27><>ʾ');
end;
end;
procedure TfrmTatMachInsp.OutPutQty1Change(Sender: TObject);
begin
inherited;
if JBSCPerson.Text <> '' then
begin
OutPutQty2.Text := floattostr(strtofloatdef(InputLen.Text, 0) - strtofloatdef(OutPutQty1.Text, 0));
end;
end;
procedure TfrmTatMachInsp.OutPutQty1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
inherited;
if Trim(SCPerson.Text) = '' then
begin
raise Exception.Create('<27><><EFBFBD><EFBFBD><EFBFBD>뵲<EFBFBD><EBB5B2><EFBFBD><EFBFBD>1!');
end;
end;
procedure TfrmTatMachInsp.OutPutQty2MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
inherited;
if Trim(JBSCPerson.Text) = '' then
begin
raise Exception.Create('<27><><EFBFBD><EFBFBD><EFBFBD>뵲<EFBFBD><EBB5B2><EFBFBD><EFBFBD>2!');
end;
end;
procedure TfrmTatMachInsp.OutPutQty3MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
inherited;
if Trim(JBSCPerson3.Text) = '' then
begin
raise Exception.Create('<27><><EFBFBD><EFBFBD><EFBFBD>뵲<EFBFBD><EBB5B2><EFBFBD><EFBFBD>3!');
end;
end;
procedure TfrmTatMachInsp.OutPutQty4MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
inherited;
if Trim(JBSCPerson4.Text) = '' then
begin
raise Exception.Create('<27><><EFBFBD><EFBFBD><EFBFBD>뵲<EFBFBD><EBB5B2><EFBFBD><EFBFBD>4!');
end;
end;
procedure TfrmTatMachInsp.OutPutQty5MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
inherited;
if Trim(JBSCPerson5.Text) = '' then
begin
raise Exception.Create('<27><><EFBFBD><EFBFBD><EFBFBD>뵲<EFBFBD><EBB5B2><EFBFBD><EFBFBD>5!');
end;
end;
procedure TfrmTatMachInsp.OutPutQty6MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
if Trim(JBSCPerson6.Text) = '' then
begin
raise Exception.Create('<27><><EFBFBD><EFBFBD><EFBFBD>뵲<EFBFBD><EBB5B2><EFBFBD><EFBFBD>6!');
end;
end;
procedure TfrmTatMachInsp.OutPutQty7MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
if Trim(JBSCPerson7.Text) = '' then
begin
raise Exception.Create('<27><><EFBFBD><EFBFBD><EFBFBD>뵲<EFBFBD><EBB5B2><EFBFBD><EFBFBD>7!');
end;
end;
procedure TfrmTatMachInsp.FormDestroy(Sender: TObject);
begin
inherited;
frmTatMachInsp := nil;
end;
procedure TfrmTatMachInsp.On1301(var Message: Tmessage);
var
i1, i2: integer;
unitname: string;
fdata: double;
2026-09-24 17:22:46 +08:00
MLen: string;
2026-09-11 10:45:49 +08:00
begin
i1 := Message.WParam;
i2 := Message.LParam;
if (trim(edtMaBiao.Text) = '<27><>') then
begin
2026-09-24 17:22:46 +08:00
// InputLen.Text := format('%.1f', [i1 / 100000]);
2026-10-16 17:21:20 +08:00
// MLen := Format('%.1f', [i1 / 100000]);
MLen := FormatFloat('0.#', RoundUpToHalf(RoundFloat(i1 / 100000, 1)));
2026-09-24 17:22:46 +08:00
if Trim(edtMax.Text) = '<27><>' then
begin
code_table_length.Text := MLen;
end
else
begin
InputLen.Text := MLen;
code_table_length.Text := MLen;
end;
2026-09-11 10:45:49 +08:00
end;
if (trim(edtMBDW.Text) = '<27><>') then
begin
if i2 = 0 then
begin
SetUnit('M');
end
else
begin
SetUnit('Y');
end;
end;
end;
procedure TfrmTatMachInsp.On1201(var Message: Tmessage);
var
i1, i2: integer;
unitname: string;
fdata: double;
begin
i1 := Message.WParam;
i2 := Message.LParam;
if trim(edtChen.Text) = '<27><>' then
begin
InputWeight.Text := format('%.2f', [i1 / 100000]);
end;
end;
procedure TfrmTatMachInsp.FormClose(Sender: TObject; var Action: TCloseAction);
begin
inherited;
if isCommopen then
begin
closeCom(DZCDYDllName);
closeCom(MBDYDllName);
end;
Action := caFree;
end;
procedure TfrmTatMachInsp.InitCDGrid(MCIID: string);
begin
cxPageControl1.ActivePageIndex := 0;
with ADOTmp do
begin
Close;
SQL.Clear;
sql.Add('select * from Tat_Cloth_Inspect_Flaw where CIID=' + quotedstr(Trim(MCIID)));
Open;
end;
SCreateCDS(ADOTmp, CDS_2);
SInitCDSData(ADOTmp, CDS_2);
end;
procedure TfrmTatMachInsp.InitCDGridCX(MCIID: string);
begin
cxPageControl1.ActivePageIndex := 1;
with ADOTmp do
begin
Close;
SQL.Clear;
sql.Add('select * from Tat_Cloth_Inspect_Flaw where CIID=' + quotedstr(Trim(MCIID)));
Open;
end;
SCreateCDS(ADOTmp, CDS_1);
SInitCDSData(ADOTmp, CDS_1);
end;
2026-10-09 17:24:29 +08:00
function TfrmTatMachInsp.RoundUpToHalf(AValue: Double): Double;
var
MIntPart: Double;
begin
Result := AValue;
if AValue <= 0 then
Exit;
MIntPart := Int(AValue);
if Frac(AValue) < 0.05 then
Result := MIntPart //integer, keep as is
else if Frac(AValue) <= 0.5 then
Result := MIntPart + 0.5 //decimal 0.1-0.4 -> 0.5
else
Result := MIntPart + 1; //decimal 0.6-0.9 -> next integer
end;
2026-09-11 10:45:49 +08:00
procedure TfrmTatMachInsp.InitJYGrid();
var
MNetWeight, MJYLen: double;
begin
with ADOQueryMain do
begin
Close;
SQL.Clear;
if FMainId <> '' then
begin
2026-09-24 17:22:46 +08:00
sql.Add('select A.*,');
2026-10-14 17:23:44 +08:00
sql.Add(' CM2.CalcMeter AS CalcMeter,');
2026-09-24 17:22:46 +08:00
sql.Add(' ISNULL((select top 1 TRY_CAST(B.estimated_diff AS decimal(18,4)) from Bs_Cloth_Info B where B.c_code = A.c_code), 0) AS EstimatedDiff,');
2026-10-14 17:23:44 +08:00
sql.Add(' ROUND(ABS(CM2.CalcMeter - ISNULL(TRY_CAST(A.code_table_length AS decimal(18,4)), 0)), 1) AS ActualDiff');
sql.Add(' ,ROUND(ISNULL(TRY_CAST(A.Meter AS decimal(18,4)), 0) + ISNULL(TRY_CAST(A.add_length AS decimal(18,4)), 0), 2) AS MeterWithAddLength');
2026-10-15 17:27:46 +08:00
sql.Add(' ,ROUND(ISNULL(TRY_CAST(A.GrossWeight AS decimal(18,4)), 0) + ISNULL(TRY_CAST(A.add_weight AS decimal(18,4)), 0), 2) AS GrossWeightWithAdd');
sql.Add(' ,ROUND(ISNULL(TRY_CAST(A.NetWeight AS decimal(18,4)), 0) + ISNULL(TRY_CAST(A.add_weight AS decimal(18,4)), 0), 2) AS NetWeightWithAdd');
2026-09-24 17:22:46 +08:00
sql.Add('from Tat_Cloth_Inspect A ');
2026-10-15 17:27:46 +08:00
sql.Add('outer apply (select ROUND(ISNULL((ISNULL(TRY_CAST(A.GrossWeight AS decimal(18,4)), 0) + ISNULL(TRY_CAST(A.add_weight AS decimal(18,4)), 0)) / NULLIF(TRY_CAST(A.C_GramWeight AS decimal(18,4)), 0), 0), 1) as CalcMeterRaw) CM');
sql.Add('outer apply (select CASE WHEN CAST(CM.CalcMeterRaw AS decimal(18,1)) <= 0 THEN CAST(CM.CalcMeterRaw AS decimal(18,1))');
sql.Add(' WHEN CAST(CM.CalcMeterRaw AS decimal(18,1)) - FLOOR(CAST(CM.CalcMeterRaw AS decimal(18,1))) < 0.05 THEN FLOOR(CAST(CM.CalcMeterRaw AS decimal(18,1)))');
sql.Add(' WHEN CAST(CM.CalcMeterRaw AS decimal(18,1)) - FLOOR(CAST(CM.CalcMeterRaw AS decimal(18,1))) <= 0.5 THEN FLOOR(CAST(CM.CalcMeterRaw AS decimal(18,1))) + 0.5');
sql.Add(' ELSE CEILING(CAST(CM.CalcMeterRaw AS decimal(18,1))) END as CalcMeter) CM2');
2026-09-11 10:45:49 +08:00
sql.Add('where mainid=' + quotedstr(fmainid));
sql.Add('and filler=' + quotedstr(dname));
sql.Add('order by filltime desc');
end
else
begin
2026-09-24 17:22:46 +08:00
sql.Add('select A.*,');
2026-10-14 17:23:44 +08:00
sql.Add(' CM2.CalcMeter AS CalcMeter,');
2026-09-24 17:22:46 +08:00
sql.Add(' ISNULL((select top 1 TRY_CAST(B.estimated_diff AS decimal(18,4)) from Bs_Cloth_Info B where B.c_code = A.c_code), 0) AS EstimatedDiff,');
2026-10-14 17:23:44 +08:00
sql.Add(' ROUND(ABS(CM2.CalcMeter - ISNULL(TRY_CAST(A.code_table_length AS decimal(18,4)), 0)), 1) AS ActualDiff');
sql.Add(' ,ROUND(ISNULL(TRY_CAST(A.Meter AS decimal(18,4)), 0) + ISNULL(TRY_CAST(A.add_length AS decimal(18,4)), 0), 2) AS MeterWithAddLength');
2026-10-15 17:27:46 +08:00
sql.Add(' ,ROUND(ISNULL(TRY_CAST(A.GrossWeight AS decimal(18,4)), 0) + ISNULL(TRY_CAST(A.add_weight AS decimal(18,4)), 0), 2) AS GrossWeightWithAdd');
sql.Add(' ,ROUND(ISNULL(TRY_CAST(A.NetWeight AS decimal(18,4)), 0) + ISNULL(TRY_CAST(A.add_weight AS decimal(18,4)), 0), 2) AS NetWeightWithAdd');
2026-09-24 17:22:46 +08:00
sql.Add('from Tat_Cloth_Inspect A ');
2026-10-15 17:27:46 +08:00
sql.Add('outer apply (select ROUND(ISNULL((ISNULL(TRY_CAST(A.GrossWeight AS decimal(18,4)), 0) + ISNULL(TRY_CAST(A.add_weight AS decimal(18,4)), 0)) / NULLIF(TRY_CAST(A.C_GramWeight AS decimal(18,4)), 0), 0), 1) as CalcMeterRaw) CM');
sql.Add('outer apply (select CASE WHEN CAST(CM.CalcMeterRaw AS decimal(18,1)) <= 0 THEN CAST(CM.CalcMeterRaw AS decimal(18,1))');
sql.Add(' WHEN CAST(CM.CalcMeterRaw AS decimal(18,1)) - FLOOR(CAST(CM.CalcMeterRaw AS decimal(18,1))) < 0.05 THEN FLOOR(CAST(CM.CalcMeterRaw AS decimal(18,1)))');
sql.Add(' WHEN CAST(CM.CalcMeterRaw AS decimal(18,1)) - FLOOR(CAST(CM.CalcMeterRaw AS decimal(18,1))) <= 0.5 THEN FLOOR(CAST(CM.CalcMeterRaw AS decimal(18,1))) + 0.5');
sql.Add(' ELSE CEILING(CAST(CM.CalcMeterRaw AS decimal(18,1))) END as CalcMeter) CM2');
2026-09-11 10:45:49 +08:00
sql.Add('where convert(varchar(10),filltime,120)=convert(varchar(10),getdate(),120)');
sql.Add('and filler=' + quotedstr(dname));
sql.Add('and mainid=''<27>޶<EFBFBD><DEB6><EFBFBD>''');
sql.Add('order by filltime desc');
end;
2026-10-15 17:27:46 +08:00
// showmessage(sql.text);
2026-09-11 10:45:49 +08:00
Open;
end;
SCreateCDS(ADOQueryMain, CDS_3);
SInitCDSData(ADOQueryMain, CDS_3);
with ADOTmp do
begin
Close;
SQL.Clear;
2026-10-14 17:23:44 +08:00
sql.Add('select COUNT(*)JS,ROUND(SUM(ISNULL(METER,0)+ISNULL(add_length,0)),2)METER');
2026-09-24 17:22:46 +08:00
sql.Add('from Tat_Cloth_Inspect A ');
2026-09-11 10:45:49 +08:00
sql.Add('where convert(varchar(10),filltime,120)=convert(varchar(10),getdate(),120)');
sql.Add('and filler=' + quotedstr(dname));
sql.Add('and mainid=''<27>޶<EFBFBD><DEB6><EFBFBD>''');
Open;
end;
if ADOTmp.IsEmpty = FALSE then
begin
LABEL45.Caption := '<27><><EFBFBD><EFBFBD><EFBFBD>Ѵ<EFBFBD>ƥ<EFBFBD><C6A5>:' + ADOTmp.FieldByName('JS').AsString;
LABEL44.Caption := '<27><><EFBFBD><EFBFBD><EFBFBD>Ѵ򳤶<D1B4>:' + ADOTmp.FieldByName('METER').AsString;
end;
end;
procedure TfrmTatMachInsp.FormShow(Sender: TObject);
begin
inherited;
ReadCxGrid(trim(Self.Caption) + 'Tv1', Tv1, 'ó<>׼<EFBFBD><D7BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
ReadCxGrid(trim(Self.Caption) + 'Tv2', Tv2, 'ó<>׼<EFBFBD><D7BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
ReadCxGrid(trim(Self.Caption) + 'Tv3', Tv3, 'ó<>׼<EFBFBD><D7BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
fFlileFlag := UserDataFlag + 'HX';
InitCDPanel();
InitCDGrid(FCIID);
InitJYGrid();
if IsINIFile() then
ReadINIFile()
else
WriteINIFile;
GetINIFile();
if trim(fmanage) <> '<27><>Ȩ<EFBFBD><C8A8>' then
begin
if trim(DZCDYDllName) <> '' then
OpenCom(DZCDYDllName);
if trim(MBDYDllName) <> '' then
OpenCom(MBDYDllName);
// edtScan.SetFocus;
end;
end;
procedure TfrmTatMachInsp.InitCDPanel();
var
AA: array[0..100] of string;
i, j: Integer;
begin
with ADOTmp do
begin
Close;
sql.Clear;
sql.Add('select ZDYName from KH_Zdy where Type=''WFBCD''and MainType=''<27><>֯'' order by ZDYNO ');
Open;
end;
if ADOTmp.IsEmpty then
begin
Application.MessageBox('û<>ж<EFBFBD><D0B6><EFBFBD><EFBFBD>õ㣡', '<27><>ʾ', 0);
Exit;
end;
with ADOTmp do
begin
First;
i := 0;
while not Eof do
begin
AA[i] := Trim(fieldbyname('ZDYName').AsString);
i := i + 1;
Next;
end;
end;
i := i - 1;
if i > 69 then
begin
i := 69;
end;
for j := 0 to i do
begin
with ScrollBox1 do
begin
TSpeedButton(Controls[j]).Visible := True;
TSpeedButton(Controls[j]).Hint := AA[j];
if Length(AA[j]) > 4 then
begin
TSpeedButton(Controls[j]).Caption := Copy(Trim(AA[j]), 1, 4) + #13 + Copy(Trim(AA[j]), 5, Length(AA[j]) - 4);
end
else
TSpeedButton(Controls[j]).Caption := AA[j];
end;
end;
end;
procedure TfrmTatMachInsp.Tv3CustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
2026-10-10 17:25:31 +08:00
var
ATableView: TcxGridDBTableView;
AColActual, AColEstimated: TcxGridDBColumn;
vActual, vEstimated: Variant;
2026-09-11 10:45:49 +08:00
begin
2026-10-10 17:25:31 +08:00
if AViewInfo.GridRecord = nil then
Exit;
if not (Sender is TcxGridDBTableView) then
Exit;
ATableView := TcxGridDBTableView(Sender);
//actual diff > estimated diff: light pink, same as U_TatClothInspList
AColActual := ATableView.GetColumnByFieldName('ActualDiff');
AColEstimated := ATableView.GetColumnByFieldName('EstimatedDiff');
if (AColActual <> nil) and (AColEstimated <> nil) then
begin
vActual := AViewInfo.GridRecord.Values[AColActual.Index];
vEstimated := AViewInfo.GridRecord.Values[AColEstimated.Index];
if not (VarIsNull(vActual) or VarIsEmpty(vActual)) and
not (VarIsNull(vEstimated) or VarIsEmpty(vEstimated)) then
begin
if StrToFloatDef(VarToStr(vActual), 0) > StrToFloatDef(VarToStr(vEstimated), 0) then
ACanvas.Brush.Color := $00C0C0FF;
end;
end;
//defective roll keeps red
if AViewInfo.GridRecord.Values[ATableView.GetColumnByFieldName('Grade').Index] = '<27><>Ʒ' then
2026-09-11 10:45:49 +08:00
ACanvas.Brush.Color := clRed;
end;
procedure TfrmTatMachInsp.Tv3MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
if CDS_3.isEmpty then
exit;
InitCDGridCX(CDS_3.FieldByName('CIID').AsString);
end;
2026-09-28 17:25:53 +08:00
procedure TfrmTatMachInsp.Tv2CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
begin
if CDS_2.IsEmpty then
Exit;
if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD><C3B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
Exit;
//<2F>ѱ<EFBFBD><D1B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĵõ㣨CIFID<49>ǿգ<C7BF>ֱ<EFBFBD><D6B1>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><DDBF><EFBFBD>¼
if Trim(CDS_2.fieldbyname('CIFID').AsString) <> '' then
begin
ADOCmd.Connection.BeginTrans;
try
with ADOCmd do
begin
Close;
sql.Clear;
sql.Add('delete Tat_Cloth_Inspect_Flaw where CIFID=' + quotedstr(Trim(CDS_2.fieldbyname('CIFID').AsString)));
ExecSQL;
end;
////////////////// <20><><EFBFBD>¾<EFBFBD><C2BE>Ŵõ<C5B4><C3B5><EFBFBD>Ϣ //////////////////
with ADOCmd do
begin
Close;
sql.Clear;
sql.Add('exec P_Tat_Insp_Up @CIID=' + quotedstr(Trim(CDS_2.fieldbyname('CIID').AsString)));
sql.Add(',@InspType=' + QuotedStr('<27><><EFBFBD><EFBFBD><EFBFBD>޸<EFBFBD>'));
ExecSQL;
end;
////////////////// <20><><EFBFBD>¾<EFBFBD><C2BE>Ŵõ<C5B4><C3B5><EFBFBD>Ϣ //////////////////
ADOCmd.Connection.CommitTrans;
except
ADOCmd.Connection.RollbackTrans;
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
Exit;
end;
end;
CDS_2.Delete;
end;
2026-09-11 10:45:49 +08:00
function TfrmTatMachInsp.SaveData(): Boolean;
var
maxno, MCIID, strsql: string;
2026-10-10 17:25:31 +08:00
MNewRoll: Boolean;
2026-09-11 10:45:49 +08:00
MInputLen, MMeter, MYardage: Double;
MInputWeight, MGrossWeight, MNetWeight, MTare: Double;
2026-09-24 17:22:46 +08:00
MUseLen: Double;
2026-09-11 10:45:49 +08:00
begin
fmainid := '';
fsubid := '';
2026-10-10 17:25:31 +08:00
MNewRoll := False;
2026-09-11 10:45:49 +08:00
if FOperationStatus = '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
begin
MCIID := FCIID;
end
else
begin
MCIID := '';
end;
try
ADOCmd.Connection.BeginTrans;
///<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
with ADOCmd do
begin
Close;
sql.Clear;
SQL.Add('select * from Tat_Cloth_Inspect where CIID=''' + Trim(MCIID) + '''');
Open;
end;
with ADOCmd do
begin
if Trim(MCIID) = '' then
begin
2026-10-10 17:25:31 +08:00
MNewRoll := True; //MCIID is reassigned to the new barcode below
2026-09-11 10:45:49 +08:00
if not GetLSNo(ADOTmp, maxno, 'T' + Trim(SCXFlag), 'Tat_Cloth_Inspect', 4, 1) then
raise Exception.Create('<27><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>');
Append;
FieldByName('Filler').Value := Trim(DName);
FieldByName('CIID').Value := Trim(maxno);
end
else
begin
maxno := Trim(MCIID);
Edit;
FieldByName('Editer').Value := Trim(DName);
FieldByName('EditTime').Value := SGetServerDateTime(ADOTmp);
end;
///////////////////////// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> /////////////////////////
MTare := StrToFloatdef(trim(Tare.Text), 0);
MInputWeight := RoundFloat(StrToFloatdef(trim(InputWeight.Text), 0), StrTointdef(KgPlace.Text, 0));
MGrossWeight := MInputWeight + MTare; //ë<><C3AB>
MNetWeight := MInputWeight; //<2F><><EFBFBD><EFBFBD>
FieldByName('InputWeight').Value := MInputWeight;
FieldByName('GrossWeight').Value := MGrossWeight;
FieldByName('NetWeight').Value := MNetWeight;
FieldByName('Tare').Value := MTare;
2026-10-14 17:23:44 +08:00
FieldByName('add_weight').Value := StrToFloatdef(Trim(add_weight.Text), 0);
2026-09-11 10:45:49 +08:00
///////////////////////// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> /////////////////////////
///
///////////////////////// <20><><EFBFBD>泤<EFBFBD><E6B3A4> /////////////////////////
MInputLen := RoundFloat(StrToFloatdef(trim(InputLen.Text), 0), 1);
2026-09-24 17:22:46 +08:00
2026-10-17 17:28:05 +08:00
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>δ<EFBFBD><CEB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>ύͬ<E1BDBB><CDAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD>߼<EFBFBD><DFBC><EFBFBD><EFBFBD><EFBFBD>һλС<CEBB><D0A1>
if Trim(code_table_length.Text) <> '' then
code_table_length.Text :=
FormatFloat('0.#', RoundUpToHalf(RoundFloat(StrToFloatdef(Trim(code_table_length.Text), 0), 1)));
2026-09-24 17:22:46 +08:00
// <20><>ѡ edtMax ʱ<><CAB1>ȡ¼<C8A1>볤<EFBFBD><EBB3A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>еĽϴ<C4BD>ֵ<EFBFBD><D6B5><EFBFBD>뻻<EFBFBD><EBBBBB>
if Trim(edtMax.Text) = '<27><>' then
begin
if StrToFloatdef(trim(InputLen.Text), 0) >= StrToFloatdef(trim(code_table_length.Text), 0) then
MUseLen := StrToFloatdef(trim(InputLen.Text), 0)
else
MUseLen := StrToFloatdef(trim(code_table_length.Text), 0);
end
else
MUseLen := StrToFloatdef(trim(InputLen.Text), 0);
2026-09-11 10:45:49 +08:00
if lblLenUnit.Caption = 'M' then
begin
2026-09-24 17:22:46 +08:00
MMeter := RoundFloat(MUseLen, StrTointdef(MPlace.Text, 0));
2026-09-11 10:45:49 +08:00
MYardage := RoundFloat(MMeter / 0.9144, StrTointdef(YPlace.Text, 0));
end
else
begin
2026-09-24 17:22:46 +08:00
MYardage := RoundFloat(MUseLen, StrTointdef(YPlace.Text, 0));
2026-09-11 10:45:49 +08:00
MMeter := RoundFloat(MYardage * 0.9144, StrTointdef(MPlace.Text, 0));
end;
FieldByName('InputLen').Value := RoundFloat(StrToFloatdef(trim(InputLen.Text), 0), 1);
2026-10-14 17:23:44 +08:00
FieldByName('Meter').Value := RoundUpToHalf(MMeter);
2026-09-11 10:45:49 +08:00
FieldByName('Yardage').Value := MYardage;
FieldByName('LenUnit').Value := TRIM(lblLenUnit.Caption);
2026-09-12 17:23:29 +08:00
FieldByName('code_table_length').Value :=
2026-09-24 17:22:46 +08:00
StrToFloatdef(Trim(code_table_length.Text), 0);
2026-09-11 10:45:49 +08:00
///////////////////////// <20><><EFBFBD>泤<EFBFBD><E6B3A4> /////////////////////////
FieldByName('Coefficient').Value := StrToFloatdef(Coefficient.text, 0);
FieldByName('Grade').Value := Grade.text;
FieldByName('PieceNo').Value := 0;
FieldByName('OrderNo').value := Trim(FOrderNo);
if fmainid = '' then
begin
FieldByName('MainId').value := '<27>޶<EFBFBD><DEB6><EFBFBD>';
end
else
begin
FieldByName('MainId').value := Trim(FMainId);
end;
if FSubId = '' then
begin
FieldByName('SubId').value := '<27>޶<EFBFBD><DEB6><EFBFBD>';
end
else
begin
FieldByName('SubId').value := Trim(FSubId);
end;
FieldByName('Workshop').value := Trim(FWorkshop);
FieldByName('CIIOFlag').Value := 'δ<><CEB4><EFBFBD><EFBFBD>';
FieldByName('PCId').value := FPCId;
FieldByName('C_Code').value := trim(code.Text);
FieldByName('C_Name').value := trim(codename.Text);
2026-09-24 17:22:46 +08:00
FieldByName('C_LongBatchNo').Value := Trim(C_LongitudeBatchNo.Text);
FieldByName('C_LatBatchNo').Value := Trim(C_LatitudeBatchNo.Text);
2026-09-11 10:45:49 +08:00
FieldByName('C_Spec').value := trim(Spec.Text);
FieldByName('C_Color').value := FC_Color;
FieldByName('C_ColorNo').value := FC_ColorNo;
FieldByName('C_StyleNo').value := FC_StyleNo;
FieldByName('C_Width').value := trim(mf.Text);
FieldByName('C_GramWeight').value := trim(kz.Text);
FieldByName('C_Pattern').value := FC_Pattern;
FieldByName('C_CustPattern').value := FC_CustPattern;
FieldByName('C_ColorDepth').value := C_ColorDepth.Text;
FieldByName('CIMachNo').Value := Trim(SCXFlag);
FieldByName('CARNO').Value := Trim(CARNO.Text);
2026-09-15 17:28:07 +08:00
FieldByName('WorkShift').Value := Trim(WorkShift.Text);
2026-09-11 10:45:49 +08:00
FieldByName('SCPerson').Value := Trim(SCPerson.Text);
FieldByName('JBSCPerson').Value := Trim(JBSCPerson.Text);
FieldByName('JBSCPerson3').Value := Trim(JBSCPerson3.Text);
FieldByName('JBSCPerson4').Value := Trim(JBSCPerson4.Text);
FieldByName('JBSCPerson5').Value := Trim(JBSCPerson5.Text);
FieldByName('JBSCPerson6').Value := Trim(JBSCPerson6.Text);
FieldByName('JBSCPerson7').Value := Trim(JBSCPerson7.Text);
FieldByName('OutPutQty1').Value := strtofloatdef(OutPutQty1.Text, 0);
FieldByName('OutPutQty2').Value := strtofloatdef(OutPutQty2.Text, 0);
FieldByName('OutPutQty3').Value := strtofloatdef(OutPutQty3.Text, 0);
FieldByName('OutPutQty4').Value := strtofloatdef(OutPutQty4.Text, 0);
FieldByName('OutPutQty5').Value := strtofloatdef(OutPutQty5.Text, 0);
FieldByName('OutPutQty6').Value := strtofloatdef(OutPutQty6.Text, 0);
FieldByName('OutPutQty7').Value := strtofloatdef(OutPutQty7.Text, 0);
Post;
end;
MCIID := Trim(maxno); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
FCIID := Trim(maxno);
//<2F><><EFBFBD>浲<EFBFBD><E6B5B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
with ADOCmd do
begin
Close;
sql.Clear;
sql.Add('delete Tat_Cloth_knitter where CIID=' + quotedstr(maxno));
sql.Add('insert into Tat_Cloth_knitter(CIID,CKID,knittid,knitter,OutPutQty)');
sql.Add('values(' + quotedstr(maxno) + ',' + quotedstr(maxno + '1') + ',' + quotedstr(SCPerson.Hint) + ',' + quotedstr(SCPerson.Text) + ',' + quotedstr(IntToStr(StrtoIntdef(OutPutQty1.Text, 0))) + ')');
sql.Add('insert into Tat_Cloth_knitter(CIID,CKID,knittid,knitter,OutPutQty)');
sql.Add('values(' + quotedstr(maxno) + ',' + quotedstr(maxno + '2') + ',' + quotedstr(JBSCPerson.Hint) + ',' + quotedstr(JBSCPerson.Text) + ',' + quotedstr(IntToStr(StrtoIntdef(OutPutQty2.Text, 0))) + ')');
execsql;
end;
////////////////// <20><><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD><C3B5><EFBFBD>Ϣ //////////////////
with CDS_2 do
begin
First;
while not Eof do
begin
if Trim(CDS_2.fieldbyname('CIFID').AsString) = '' then
begin
if not GetLSNo(ADOTmp, maxno, 'JC', 'Tat_Cloth_Inspect_Flaw', 5, 1) then
raise Exception.Create('<27><>ȡ<EFBFBD>õ<EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>');
end
else
begin
maxno := Trim(CDS_2.fieldbyname('CIFID').AsString);
end;
with ADOCmd do
begin
Close;
SQL.Clear;
sql.Add('select * from Tat_Cloth_Inspect_Flaw ');
sql.Add(' where CIFID=''' + Trim(maxno) + '''');
Open;
end;
with ADOCmd do
begin
if Trim(CDS_2.fieldbyname('CIFID').AsString) = '' then
Append
else
Edit;
RTSetSaveDataCDS(ADOCmd, Tv2, CDS_2, 'Tat_Cloth_Inspect_Flaw', 0);
FieldByName('CIID').Value := Trim(MCIID);
FieldByName('CIFID').Value := Trim(maxno);
Post;
end;
CDS_2.Edit;
CDS_2.FieldByName('CIID').Value := Trim(MCIID);
CDS_2.FieldByName('CIFID').Value := Trim(maxno);
Next;
end;
end;
////////////////// <20><><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD><C3B5><EFBFBD>Ϣ //////////////////
///
////////////////// <20><><EFBFBD>¾<EFBFBD><C2BE>Ŵõ<C5B4><C3B5><EFBFBD>Ϣ //////////////////
with ADOCmd do
begin
Close;
sql.Clear;
sql.Add('exec P_Tat_Insp_Up @CIID=''' + trim(MCIID) + '''');
2026-10-10 17:25:31 +08:00
//assign PieceNo for every new roll; editing an existing roll keeps its number
if MNewRoll then
2026-09-11 10:45:49 +08:00
sql.Add(',@InspType=' + QuotedStr('<27><>Ʊ'))
else
sql.Add(',@InspType=' + QuotedStr('<27><><EFBFBD><EFBFBD><EFBFBD>޸<EFBFBD>'));
execsql;
end;
////////////////// <20><><EFBFBD>¾<EFBFBD><C2BE>Ŵõ<C5B4><C3B5><EFBFBD>Ϣ //////////////////
////////////////// <20><><EFBFBD>½<EFBFBD><C2BD><EFBFBD> //////////////////
with ADOCmd do
begin
Close;
sql.Clear;
sql.Add('insert into Tat_Need_Up(UType,UDataId) values(''<27><>̨<EFBFBD><CCA8><EFBFBD><EFBFBD>'',' + quotedstr(maxno) + ') ');
execsql;
end;
////////////////// <20><><EFBFBD>½<EFBFBD><C2BD><EFBFBD> //////////////////
///
ADOCmd.Connection.CommitTrans;
////////////////// <20><><EFBFBD><EFBFBD><EFBFBD>⼰<EFBFBD><E2BCB0><EFBFBD><EFBFBD> //////////////////
with ADOCmd do
begin
Close;
sql.Clear;
sql.Add('exec P_Tat_Insp_In_Stk @CIID=''' + trim(MCIID) + '''');
Open;
end;
if ADOCmd.FieldByName('intReturn').AsInteger = -1 then
begin
application.MessageBox(PChar(trim(ADOCmd.FieldByName('ShowMsg').AsString)), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
Result := False;
end
else
begin
Result := True;
end;
////////////////// <20><><EFBFBD><EFBFBD><EFBFBD>⼰<EFBFBD><E2BCB0><EFBFBD><EFBFBD> //////////////////
Result := True;
except
ADOCmd.Connection.RollbackTrans;
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
Result := False;
end;
end;
procedure TfrmTatMachInsp.SCPersonClick(Sender: TObject);
begin
inherited;
try
frmEmployeeSel := TfrmEmployeeSel.Create(self);
with frmEmployeeSel do
begin
FPost := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
if ShowModal = 1 then
begin
SCPerson.Text := frmEmployeeSel.FRName;
SCPerson.Hint := frmEmployeeSel.FRCode;
end;
end;
finally
frmEmployeeSel.Free;
end;
end;
procedure TfrmTatMachInsp.BTPrintClick(Sender: TObject);
var
fPrintFile: string;
mvalue: Double;
i: Integer;
begin
2026-09-12 17:23:29 +08:00
// CodeName.SetFocus;
Code.SetFocus;
2026-09-11 10:45:49 +08:00
if CheckData('<27>ύ') = False then
exit;
if SaveData() then
begin
InputLen.Text := '';
InputWeight.Text := '';
2026-09-12 17:23:29 +08:00
code_table_length.Text := '';
2026-09-11 10:45:49 +08:00
if Trim(Edit6.Text) = '<27><>' then
begin
PrtData(FCIID);
end;
end;
InputLen.SetFocus;
CIFBegClick(InputLen);
FOperationStatus := '<27><>Ʊ';
InitJYGrid();
InitCDGrid('');
FCIID := '';
2026-09-22 17:26:06 +08:00
// Code.Text := '';
2026-09-11 10:45:49 +08:00
carno.Text := '';
SCPerson.Text := '';
JBSCPerson.Text := '';
JBSCPerson3.Text := '';
JBSCPerson4.Text := '';
JBSCPerson5.Text := '';
JBSCPerson6.Text := '';
JBSCPerson7.Text := '';
OutPutQty1.Text := '';
OutPutQty2.Text := '';
OutPutQty3.Text := '';
OutPutQty4.Text := '';
OutPutQty5.Text := '';
OutPutQty6.Text := '';
OutPutQty7.Text := '';
2026-09-14 17:17:52 +08:00
weaver_name.Text := '';
weaver_name.Hint := '';
points.Text := '';
2026-09-11 10:45:49 +08:00
end;
procedure TfrmTatMachInsp.PrtData(MCIID: string);
var
fPrintFile, FLBName: string;
begin
with ADOQueryPrint do
begin
Close;
SQL.Clear;
sql.Add(' EXEC P_Tat_Insp_Prt_Lab ');
SQL.Add(' @CIID=''' + 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;
FLBName := Trim(ADOQueryPrint.fieldbyname('LBName').AsString);
ExportFtErpFile(FLBName + '.rmf', ADOTmp);
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\' + FLBName + '.rmf';
if FileExists(fPrintFile) then
begin
RM1.LoadFromFile(fPrintFile);
RM1.DefaultCopies := strtointdef(trim(ComboBox1.Text), 1);
RM1.PrintReport;
end
else
begin
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>' + fPrintFile), '<27><>ʾ', 0);
end;
end;
procedure TfrmTatMachInsp.SpeedButton1Click(Sender: TObject);
var
fsj: string;
begin
fsj := Trim(TSpeedButton(Sender).Hint);
if Trim(fsj) = '' then
Exit;
if TEdit(FindComponent(Trim(TSpeedButton(Sender).Hint))).Name = 'KuangHao' then
Exit;
fsj := Trim(TEdit(FindComponent(Trim(TSpeedButton(Sender).Hint))).Text);
TEdit(FindComponent(Trim(TSpeedButton(Sender).Hint))).Text := fsj + Trim(TSpeedButton(Sender).Caption);
TEdit(FindComponent(Trim(TSpeedButton(Sender).Hint))).SelectAll;
end;
procedure TfrmTatMachInsp.SpeedButton113Click(Sender: TObject);
begin
inherited;
panel3.Visible := False;
end;
procedure TfrmTatMachInsp.SpeedButton12Click(Sender: TObject);
var
fsj: string;
begin
fsj := Trim(TEdit(FindComponent(Trim(TSpeedButton(Sender).Hint))).Text);
if Trim(fsj) = '' then
Exit;
TEdit(FindComponent(Trim(TSpeedButton(Sender).Hint))).Text := Copy(fsj, 1, Length(fsj) - 1);
TEdit(FindComponent(Trim(TSpeedButton(Sender).Hint))).SelectAll;
end;
procedure TfrmTatMachInsp.SpeedButton13Click(Sender: TObject);
var
i: Integer;
begin
if CheckData('<27>õ<EFBFBD>') = False then
exit;
FCIFName := Trim(TSpeedButton(Sender).Hint);
MovePanel1.Visible := True;
lblCIFName.Caption := Trim(FCIFName);
//<2F><>ʾ<EFBFBD><CABE><EFBFBD>ּ<EFBFBD><D6BC><EFBFBD>
CIFBeg.Text := InputLen.Text;
with Panel3 do
begin
for i := 0 to ControlCount - 1 do
begin
if Controls[i] is TSpeedButton then
begin
TSpeedButton(Controls[i]).Hint := Trim(CIFBeg.Name);
end;
end;
end;
end;
2026-09-12 17:23:29 +08:00
procedure TfrmTatMachInsp.weaver_nameClick(Sender: TObject);
begin
try
frmEmployeeSel := TfrmEmployeeSel.Create(self);
with frmEmployeeSel do
begin
FPost := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
if ShowModal = 1 then
begin
weaver_name.Text := frmEmployeeSel.FRName;
weaver_name.Hint := frmEmployeeSel.FRCode;
end;
end;
finally
frmEmployeeSel.Free;
end;
end;
2026-09-11 10:45:49 +08:00
procedure TfrmTatMachInsp.cxButtonEdit1PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
begin
try
frmEmployeeSel := TfrmEmployeeSel.Create(self);
with frmEmployeeSel do
begin
FPost := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
if ShowModal = 1 then
begin
SCPerson.Text := frmEmployeeSel.FRName;
SCPerson.Hint := frmEmployeeSel.FRCode;
end;
end;
finally
frmEmployeeSel.Free;
end;
end;
2026-09-11 17:23:39 +08:00
//procedure TfrmTatMachInsp.Button10Click(Sender: TObject);
//begin
// try
// frmSCPersonColor5 := TfrmSCPersonColor5.Create(self);
// with frmSCPersonColor5 do
// begin
// if ShowModal = 1 then
// begin
//// with ADOTmp do
//// begin
//// Close;
//// sql.Clear;
//// sql.Add('SELECT A.* FROM Bs_Cloth_Info A where A.C_name=''' + Trim(FName) + '''');
//// Open;
//// end;
//// Self.Code.Text := ADOTmp.fieldbyname('C_Code').AsString;
// Self.Code.Text := FName;
// Self.CodeName.Text := Trim(FName2);
//// Self.MF.Text := ADOTmp.fieldbyname('C_Width').AsString;
//// Self.KZ.Text := ADOTmp.fieldbyname('C_GramWeight').AsString;
////
//// Self.SPEC.Text := ADOTmp.fieldbyname('C_SPEC').AsString;
// end;
// end;
// finally
// frmSCPersonColor5.close;
// end;
//// fmainid := '';
//// fsubid := '';
//// Label14.Caption := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
//end;
2026-09-11 10:45:49 +08:00
procedure TfrmTatMachInsp.Button10Click(Sender: TObject);
2026-09-11 17:23:39 +08:00
var
FCode, FProductName: string;
2026-09-11 10:45:49 +08:00
begin
2026-09-11 17:23:39 +08:00
FCode := '';
FProductName := '';
2026-09-11 10:45:49 +08:00
try
2026-09-11 17:23:39 +08:00
frmSCPersonColor5 := TfrmSCPersonColor5.Create(Self);
try
if frmSCPersonColor5.ShowModal = 1 then
begin
FCode := Trim(frmSCPersonColor5.FName);
FProductName := Trim(frmSCPersonColor5.FName2);
end;
finally
frmSCPersonColor5.Close;
end;
if FCode <> '' then
2026-09-11 10:45:49 +08:00
begin
2026-09-11 17:23:39 +08:00
Self.Code.Text := FCode;
Self.CodeName.Text := FProductName;
with Self.ADOTmp do
2026-09-11 10:45:49 +08:00
begin
2026-09-11 17:23:39 +08:00
Close;
SQL.Clear;
SQL.Add('SELECT A.* FROM Bs_Cloth_Info A WHERE A.C_Code = ' + QuotedStr(FCode));
Open;
end;
2026-09-11 10:45:49 +08:00
2026-09-11 17:23:39 +08:00
if not Self.ADOTmp.IsEmpty then
begin
Self.Code.Text := Self.ADOTmp.FieldByName('C_Code').AsString;
Self.CodeName.Text := Self.ADOTmp.FieldByName('C_Name').AsString;
Self.MF.Text := Self.ADOTmp.FieldByName('C_Width').AsString;
Self.KZ.Text := Self.ADOTmp.FieldByName('C_GramWeight').AsString;
Self.SPEC.Text := Self.ADOTmp.FieldByName('C_SPEC').AsString;
2026-09-24 17:22:46 +08:00
Self.C_LongitudeBatchNo.Text := ADOTmp.fieldbyname('C_LongitudeBatchNo').AsString;
Self.C_LatitudeBatchNo.Text := ADOTmp.fieldbyname('C_LatitudeBatchNo').AsString;
2026-09-11 10:45:49 +08:00
end;
end;
finally
2026-09-11 17:23:39 +08:00
if Assigned(frmSCPersonColor5) then
frmSCPersonColor5.Close;
2026-09-11 10:45:49 +08:00
end;
2026-09-11 17:23:39 +08:00
FMainId := '';
FSubId := '';
Label14.Caption := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
2026-09-11 10:45:49 +08:00
end;
2026-09-29 17:27:52 +08:00
procedure TfrmTatMachInsp.BtnConClick(Sender: TObject);
begin
try
frmTatConSel := TfrmTatConSel.Create(Self);
if frmTatConSel.ShowModal = 1 then
begin
with frmTatConSel.CDS_1 do
begin
ClearGlobal();
FOperationStatus := '<27><>Ʊ';
FConNo := Trim(FieldByName('ConNo').AsString);
FConMId := Trim(FieldByName('ConMId').AsString);
FConSId := Trim(FieldByName('ConSId').AsString);
FC_Code := Trim(FieldByName('C_Code').AsString);
FC_Name := Trim(FieldByName('C_Name').AsString);
FC_Spec := Trim(FieldByName('C_Spec').AsString);
FC_Color := Trim(FieldByName('C_Color').AsString);
FC_ColorNo := Trim(FieldByName('C_ColorNo').AsString);
FC_StyleNo := Trim(FieldByName('C_StyleNo').AsString);
FC_Width := Trim(FieldByName('C_Width').AsString);
FC_GramWeight := Trim(FieldByName('C_GramWeight').AsString);
FC_Pattern := Trim(FieldByName('C_Pattern').AsString);
Code.Text := FC_Code;
CodeName.Text := FC_Name;
SPEC.Text := FC_Spec;
MF.Text := FC_Width;
KZ.Text := FC_GramWeight;
Coefficient.Text := '0';
Label14.Caption := Trim(FieldByName('ConNo').AsString);
with ADOTmp do
begin
Close;
SQL.Clear;
SQL.Add('SELECT * FROM Bs_Cloth_Info WHERE C_Code = ' + QuotedStr(FC_Code));
Open;
end;
if not ADOTmp.IsEmpty then
begin
C_LongitudeBatchNo.Text := Trim(ADOTmp.FieldByName('C_LongitudeBatchNo').AsString);
C_LatitudeBatchNo.Text := Trim(ADOTmp.FieldByName('C_LatitudeBatchNo').AsString);
end
else
begin
C_LongitudeBatchNo.Text := '';
C_LatitudeBatchNo.Text := '';
end;
SetDdetails();
InitJYGrid();
InitCDGrid('');
InputLen.SetFocus;
CIFBegClick(InputLen);
end;
end;
finally
frmTatConSel.Free;
end;
end;
2026-09-11 10:45:49 +08:00
procedure TfrmTatMachInsp.Button1Click(Sender: TObject);
var
mvalue: Double;
begin
if Trim(CIFBeg.Text) <> '' then
begin
if Trim(CIFEnd.Text) <> '' then
begin
if StrToFloat(CIFEnd.Text) < StrToFloat(CIFBeg.Text) then
begin
Application.MessageBox('<27>õ<EFBFBD>λ<EFBFBD><CEBB>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
Exit;
end;
end;
end;
if CIFQty.Text <> '' then
begin
if TryStrToFloat(CIFQty.Text, mvalue) = False then
begin
Application.MessageBox('<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
Exit;
end;
end;
with CDS_2 do
begin
Append;
if RadioGroup1.ItemIndex = 5 then
FieldByName('CIFName').Value := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' + Trim(FCIFName)
else if RadioGroup1.ItemIndex = 4 then
FieldByName('CIFName').Value := '<27><>ƥ' + Trim(FCIFName)
else
FieldByName('CIFName').Value := Trim(FCIFName);
FieldByName('CIFbeg').Value := Trim(CIFBeg.Text);
FieldByName('CIFEnd').Value := Trim(CIFEnd.Text);
FieldByName('CIFPoints').Value := 0;
if RadioGroup1.ItemIndex > -1 then
begin
if RadioGroup1.ItemIndex < 3 then
begin
FieldByName('CIFPoints').Value := RadioGroup1.ItemIndex + 1;
end
else
begin
FieldByName('CIFPoints').Value := 4;
end;
end;
FieldByName('CIFQty').Value := StrToFloatdef(trim(CIFQty.Text), 0);
2026-09-12 17:23:29 +08:00
if FindField('weaver_code') <> nil then
FieldByName('weaver_code').AsString := Trim(Self.weaver_name.Hint);
if FindField('weaver_name') <> nil then
FieldByName('weaver_name').AsString := Trim(Self.weaver_name.Text);
if FindField('points') <> nil then
FieldByName('points').AsFloat := StrToFloatDef(Trim(Self.points.Text), 0);
2026-09-14 17:17:52 +08:00
if FindField('CIFNumber') <> nil then
FieldByName('CIFNumber').AsString := Trim(Self.CIFNumber.Text);
2026-09-11 10:45:49 +08:00
Post;
end;
CIFBeg.Text := '';
CIFEnd.Text := '';
CIFQty.Text := '';
MovePanel1.Visible := False;
cxPageControl1.ActivePageIndex := 0;
2026-09-14 17:17:52 +08:00
weaver_name.Text := '';
weaver_name.Hint := '';
points.Text := '';
2026-09-11 10:45:49 +08:00
end;
procedure TfrmTatMachInsp.edtScanKeyPress(Sender: TObject; var Key: Char);
begin
if Key = #13 then
begin
if trim(edtScan.Text) = '' then
exit;
if trim(edtScan.Text) = FPCId then
exit;
ClearGlobal();
FOperationStatus := '<27><>Ʊ';
InitLCK(edtScan.Text);
InitJYGrid();
InputLen.SetFocus;
end;
end;
procedure TfrmTatMachInsp.CIFBegClick(Sender: TObject);
var
i: Integer;
begin
panel3.Visible := true;
with Panel3 do
begin
for i := 0 to ControlCount - 1 do
begin
if Controls[i] is TSpeedButton then
begin
TSpeedButton(Controls[i]).Hint := Trim(TEdit(Sender).Name);
end;
end;
end;
end;
procedure TfrmTatMachInsp.CIFEndChange(Sender: TObject);
var
mvalue: Double;
begin
if Trim(CIFBeg.Text) <> '' then
begin
if TryStrToFloat(CIFBeg.Text, mvalue) = False then
begin
Application.MessageBox('<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
Exit;
end;
end
else
begin
Exit;
end;
if Trim(CIFEnd.Text) <> '' then
begin
if TryStrToFloat(CIFEnd.Text, mvalue) = False then
begin
Application.MessageBox('<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
Exit;
end;
end
else
begin
Exit;
end;
CIFQty.Text := FloatToStr(StrToFloat(CIFEnd.Text) - StrToFloat(CIFBeg.Text));
end;
procedure TfrmTatMachInsp.Edit6Click(Sender: TObject);
begin
if Trim(Edit6.Text) = '' then
begin
Edit6.Text := '<27><>';
end
else
begin
Edit6.Text := '';
end;
end;
procedure TfrmTatMachInsp.MinLenExit(Sender: TObject);
begin
SetINIFile();
end;
procedure TfrmTatMachInsp.MJstr3KeyPress(Sender: TObject; var Key: Char);
begin
if Key = #13 then
begin
Key := #0;
SelectNext(ActiveControl as TWinControl, True, True);
end;
end;
procedure TfrmTatMachInsp.Button2Click(Sender: TObject);
begin
RadioGroup1.ItemIndex := -1;
end;
procedure TfrmTatMachInsp.Button3Click(Sender: TObject);
begin
if Panel6.Visible then
Panel6.Visible := False
else
Panel6.Visible := True;
end;
procedure TfrmTatMachInsp.edtScanClick(Sender: TObject);
var
i: Integer;
begin
Panel3.Visible := True;
with Panel3 do
begin
for i := 0 to ControlCount - 1 do
begin
if Controls[i] is TSpeedButton then
begin
TSpeedButton(Controls[i]).Hint := Trim(TEdit(Sender).Name);
end;
end;
end;
end;
procedure TfrmTatMachInsp.NetWeightKeyPress(Sender: TObject; var Key: Char);
begin
if Key = #13 then
begin
BTPrint.Click;
end;
end;
procedure TfrmTatMachInsp.FormCreate(Sender: TObject);
begin
inherited;
IsCommopen := false;
end;
procedure TfrmTatMachInsp.lblLenUnitClick(Sender: TObject);
begin
// if Trim(lblLenUnit.Caption) = 'M' then
// SetUnit('Y')
// else
// SetUnit('M');
end;
procedure TfrmTatMachInsp.Button4Click(Sender: TObject);
begin
MovePanel1.Visible := false;
end;
procedure TfrmTatMachInsp.Button5Click(Sender: TObject);
begin
inherited;
// try
// frmTatClothInfoSel := TfrmTatClothInfoSel.Create(Application);
// with frmTatClothInfoSel do
// begin
// if ShowModal = 1 then
// begin
// Self.Code.Text := frmTatClothInfoSel.CDS_1.fieldbyname('C_Code').AsString;
// Self.CodeName.Text := frmTatClothInfoSel.CDS_1.fieldbyname('C_Name').AsString;
// Self.MF.Text := frmTatClothInfoSel.CDS_1.fieldbyname('C_Width').AsString;
// Self.KZ.Text := frmTatClothInfoSel.CDS_1.fieldbyname('C_GramWeight').AsString;
//
// Self.SPEC.Text := frmTatClothInfoSel.CDS_1.fieldbyname('C_SPEC').AsString;
//
// end;
// end;
// finally
// frmTatClothInfoSel.Free;
// end;
try
frmSCPersonColor := TfrmSCPersonColor.Create(self);
with frmSCPersonColor do
begin
if ShowModal = 1 then
begin
with ADOTmp do
begin
Close;
sql.Clear;
sql.Add('SELECT A.* FROM Bs_Cloth_Info A where A.C_name=''' + Trim(FName) + '''');
Open;
end;
Self.Code.Text := ADOTmp.fieldbyname('C_Code').AsString;
Self.CodeName.Text := ADOTmp.fieldbyname('C_Name').AsString;
Self.MF.Text := ADOTmp.fieldbyname('C_Width').AsString;
Self.KZ.Text := ADOTmp.fieldbyname('C_GramWeight').AsString;
Self.SPEC.Text := ADOTmp.fieldbyname('C_SPEC').AsString;
end;
end;
finally
frmSCPersonColor.close;
end;
fmainid := '';
fsubid := '';
Label14.Caption := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
end;
procedure TfrmTatMachInsp.ToolButton3Click(Sender: TObject);
begin
if CDS_3.IsEmpty then
Exit;
PrtData(CDS_3.fieldbyname('CIID').AsString);
end;
procedure TfrmTatMachInsp.ToolButton4Click(Sender: TObject);
begin
try
frmZDYHelp := TfrmZDYHelp.Create(Application);
with frmZDYHelp do
begin
MainType := '<27><>֯';
flag := 'WFBCD';
flagname := '<27>õ<EFBFBD>';
fnote := True;
V1Note.Caption := 'Ӣ<><D3A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
if ShowModal = 1 then
begin
Self.InitCDPanel();
end;
end;
finally
frmZDYHelp.Free;
end;
end;
procedure TfrmTatMachInsp.ToolButton5Click(Sender: TObject);
begin
if CDS_3.IsEmpty then
Exit;
if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
Exit;
ADOCmd.Connection.BeginTrans;
try
with ADOCmd do
begin
Close;
Sql.Clear;
Sql.Add('exec P_Tat_Cloth_ReIn ');
Sql.Add('@StkIds=' + quotedstr(Trim(CDS_3.fieldbyname('CIID').AsString)));
Sql.Add(',@IOIDS=' + quotedstr(trim('')));
Sql.Add(',@FillId=' + Quotedstr(DCode));
Sql.Add(',@Filler=' + Quotedstr(DName));
// ShowMessage(sql.Text);
Open;
end;
if ADOCmd.FieldByName('intReturn').AsInteger = -1 then
begin
raise Exception.Create(pchar(trim(ADOCmd.FieldByName('ShowMsg').AsString)));
end;
with ADOCmd do
begin
Close;
sql.Clear;
sql.Add('insert into Tat_Need_Up(UType,UDataId) values(''<27><><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE>'',' + quotedstr(Trim(CDS_3.fieldbyname('CIID').AsString)) + ') ');
ExecSQL;
end;
with ADOCmd do
begin
Close;
Sql.Clear;
Sql.Add('exec P_Tat_Insp_Del ');
Sql.Add('@CIIDS=' + quotedstr(Trim(CDS_3.fieldbyname('CIID').AsString)));
Sql.Add(',@DCode=' + Quotedstr(DCode));
Sql.Add(',@DName=' + Quotedstr(DName));
Open;
end;
if ADOCmd.FieldByName('intReturn').AsInteger = -1 then
begin
raise Exception.Create(pchar(trim(ADOCmd.FieldByName('ShowMsg').AsString)));
end;
ADOCmd.Connection.CommitTrans;
CDS_3.Delete;
application.MessageBox('ɾ<><C9BE><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
except
ADOCmd.Connection.RollbackTrans;
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
end;
end;
procedure TfrmTatMachInsp.ToolButton6Click(Sender: TObject);
begin
if CDS_3.IsEmpty then
Exit;
with ADOTmp do
begin
Close;
sql.Clear;
sql.Add('select * from Tat_Cloth_IO where StkId=''' + Trim(CDS_3.fieldbyname('CIID').AsString) + ''' and IOFlag=''<27><><EFBFBD><EFBFBD>''');
Open;
end;
if not ADOTmp.IsEmpty then
begin
Application.MessageBox('<27>Ѳ<EFBFBD><D1B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݲ<EFBFBD><DDB2><EFBFBD>ɾ<EFBFBD><C9BE>!', '<27><>ʾ', 0);
Exit;
end;
with ADOTmp do
begin
Close;
sql.Clear;
sql.Add('select * from Tat_Cloth_IO where StkId=''' + Trim(CDS_3.fieldbyname('CIID').AsString) + ''' and IOFlag=''<27><><EFBFBD><EFBFBD>''');
Open;
end;
if not ADOTmp.IsEmpty then
begin
Application.MessageBox('<27>Ѳ<EFBFBD><D1B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݲ<EFBFBD><DDB2><EFBFBD>ɾ<EFBFBD><C9BE>!', '<27><>ʾ', 0);
Exit;
end;
InitJTM(CDS_3.fieldbyname('CIID').AsString);
end;
procedure TfrmTatMachInsp.ToolButton7Click(Sender: TObject);
begin
WriteCxGrid(trim(Self.Caption) + 'Tv1', Tv1, 'ó<>׼<EFBFBD><D7BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
WriteCxGrid(trim(Self.Caption) + 'Tv2', Tv2, 'ó<>׼<EFBFBD><D7BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
WriteCxGrid(trim(Self.Caption) + 'Tv3', Tv3, 'ó<>׼<EFBFBD><D7BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
end;
procedure TfrmTatMachInsp.ToolButton8Click(Sender: TObject);
begin
Close;
end;
procedure TfrmTatMachInsp.edtChenClick(Sender: TObject);
begin
if Trim(TEdit(Sender).Text) = '' then
begin
TEdit(Sender).Text := '<27><>';
end
else
begin
TEdit(Sender).Text := '';
end;
SetINIFile();
end;
2026-09-24 17:22:46 +08:00
procedure TfrmTatMachInsp.edtMaxClick(Sender: TObject);
begin
if Trim(TEdit(Sender).Text) = '' then
TEdit(Sender).Text := '<27><>'
else
TEdit(Sender).Text := '';
end;
2026-09-11 10:45:49 +08:00
procedure TfrmTatMachInsp.edtYJClick(Sender: TObject);
begin
if Trim(TEdit(Sender).Text) = '' then
begin
TEdit(Sender).Text := '<27><>';
end
else
begin
TEdit(Sender).Text := '';
end;
end;
procedure TfrmTatMachInsp.Button6Click(Sender: TObject);
begin
if ScrollBox1.Visible then
ScrollBox1.Visible := False
else
ScrollBox1.Visible := True;
end;
procedure TfrmTatMachInsp.Button7Click(Sender: TObject);
2026-10-10 17:25:31 +08:00
var
K: Integer;
2026-09-11 10:45:49 +08:00
begin
inherited;
2026-10-10 17:25:31 +08:00
//update weaver meters on click: allocate for the highest selected weaver
K := 0;
if Trim(SCPerson.Text) <> '' then
K := 1;
if Trim(JBSCPerson.Text) <> '' then
K := 2;
if Trim(JBSCPerson3.Text) <> '' then
K := 3;
if Trim(JBSCPerson4.Text) <> '' then
K := 4;
if K = 0 then
begin
Application.MessageBox('<27><><EFBFBD><EFBFBD>ѡ<EFBFBD>񵲳<EFBFBD><F1B5B2B3><EFBFBD>!', '<27><>ʾ', 0);
Exit;
2026-09-11 10:45:49 +08:00
end;
2026-10-10 17:25:31 +08:00
AllocWeaverMeter(K);
2026-09-11 10:45:49 +08:00
end;
procedure TfrmTatMachInsp.Button8Click(Sender: TObject);
begin
// if Panel7.Visible then
// Panel7.Visible := False
// else
// Panel7.Visible := True;
end;
2026-10-16 17:21:20 +08:00
function TfrmTatMachInsp.SelBoundProduct(AMCNO: string): string;
var
frm, OldFrm: TfrmSCPersonColor;
begin
Result := '';
OldFrm := frmSCPersonColor;
frm := TfrmSCPersonColor.Create(Self);
try
frm.FType := '<27><>̨<EFBFBD><CCA8>Ʒ';
frm.FlagStr := Trim(AMCNO);
frm.Caption := '<27><>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IJ<EFBFBD>Ʒ';
if frm.ShowModal = 1 then
Result := Trim(frm.FName);
finally
frm.Free;
//<2F><>ԭȫ<D4AD>ֱ<EFBFBD><D6B1><EFBFBD><EFBFBD><EFBFBD>FormDestroy<6F><79><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>nil<69><6C><EFBFBD><EFBFBD><EFBFBD><EFBFBD>with frmSCPersonColor<6F><72>finally<6C><79><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
frmSCPersonColor := OldFrm;
end;
end;
2026-09-11 10:45:49 +08:00
procedure TfrmTatMachInsp.Button9Click(Sender: TObject);
2026-10-12 17:23:40 +08:00
var
2026-10-16 17:21:20 +08:00
MCode, MCode2: string;
2026-09-11 10:45:49 +08:00
begin
try
frmSCPersonColor := TfrmSCPersonColor.Create(self);
with frmSCPersonColor do
begin
FType := '<27><>̨<EFBFBD><CCA8>';
if ShowModal = 1 then
begin
carno.text := trim(fname);
2026-10-16 17:21:20 +08:00
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̨<EFBFBD>󶨵IJ<F3B6A8B5>Ʒ<EFBFBD><C6B7>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>ֱֵ<D6B5>Ӹ<EFBFBD><D3B8>ǣ<EFBFBD><C7A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒʱ<C6B7><CAB1><EFBFBD>û<EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĸ<EFBFBD>
2026-10-12 17:23:40 +08:00
MCode := '';
2026-10-16 17:21:20 +08:00
MCode2 := '';
2026-10-12 17:23:40 +08:00
with Self.ADOTmp do
begin
Close;
SQL.Clear;
2026-10-16 17:21:20 +08:00
SQL.Add('SELECT A.C_CodeName, ISNULL(B.C_Name,'''') AS C_Name, ');
SQL.Add(' A.C_CodeName2, ISNULL(C.C_Name,'''') AS C_Name2 ');
SQL.Add('FROM Bs_Machine A ');
SQL.Add('LEFT JOIN Bs_Cloth_Info B ON B.C_Code = A.C_CodeName ');
SQL.Add('LEFT JOIN Bs_Cloth_Info C ON C.C_Code = A.C_CodeName2 ');
SQL.Add('WHERE A.MCNO=' + QuotedStr(Trim(fname)));
2026-10-12 17:23:40 +08:00
Open;
if not IsEmpty then
2026-10-16 17:21:20 +08:00
begin
2026-10-12 17:23:40 +08:00
MCode := Trim(FieldByName('C_CodeName').AsString);
2026-10-16 17:21:20 +08:00
MCode2 := Trim(FieldByName('C_CodeName2').AsString);
end;
2026-10-12 17:23:40 +08:00
end;
2026-10-16 17:21:20 +08:00
//ֻ<>ڲ<EFBFBD>Ʒ2<C6B7><32><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>ͬ<EFBFBD><CDAC>ֱ<EFBFBD>Ӵ<EFBFBD><D3B4><EFBFBD>
if (MCode = '') and (MCode2 <> '') then
MCode := MCode2;
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ťѡ<C5A5>񴰣<EFBFBD><F1B4B0A3><EFBFBD>ѡ<EFBFBD>ĸ<EFBFBD><C4B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĸ<EFBFBD><C4B8><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD>򲻴<EFBFBD><F2B2BBB4><EFBFBD>
if (MCode <> '') and (MCode2 <> '') then
MCode := SelBoundProduct(Trim(fname));
2026-10-12 17:23:40 +08:00
if MCode <> '' then
begin
with Self.ADOTmp do
begin
Close;
SQL.Clear;
SQL.Add('SELECT A.* FROM Bs_Cloth_Info A WHERE A.C_Code=' + QuotedStr(MCode));
Open;
end;
if not Self.ADOTmp.IsEmpty then
begin
Self.Code.Text := Self.ADOTmp.FieldByName('C_Code').AsString;
Self.CodeName.Text := Self.ADOTmp.FieldByName('C_Name').AsString;
Self.MF.Text := Self.ADOTmp.FieldByName('C_Width').AsString;
Self.KZ.Text := Self.ADOTmp.FieldByName('C_GramWeight').AsString;
Self.SPEC.Text := Self.ADOTmp.FieldByName('C_SPEC').AsString;
Self.C_LongitudeBatchNo.Text := Self.ADOTmp.fieldbyname('C_LongitudeBatchNo').AsString;
Self.C_LatitudeBatchNo.Text := Self.ADOTmp.fieldbyname('C_LatitudeBatchNo').AsString;
FMainId := '';
FSubId := '';
Label14.Caption := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
end;
end;
2026-09-11 10:45:49 +08:00
end;
end;
finally
frmSCPersonColor.close;
end;
end;
procedure TfrmTatMachInsp.carnoBtnClick(Sender: TObject);
begin
inherited;
try
frmSCPersonColor := TfrmSCPersonColor.Create(self);
with frmSCPersonColor do
begin
FType := '<27><>̨<EFBFBD><CCA8>';
if ShowModal = 1 then
begin
carno.text := trim(fname);
end;
end;
finally
frmSCPersonColor.close;
end;
end;
procedure TfrmTatMachInsp.carnoClick(Sender: TObject);
begin
inherited;
try
frmSCPersonColor := TfrmSCPersonColor.Create(self);
with frmSCPersonColor do
begin
FType := '<27><>̨<EFBFBD><CCA8>';
if ShowModal = 1 then
begin
carno.text := trim(fname);
end;
end;
finally
frmSCPersonColor.close;
end;
end;
end.