unit U_JTSJY220725; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls, ComCtrls, ToolWin, DB, ADODB, Buttons, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData, cxDataStorage, cxEdit, cxDBData, cxGridLevel, cxGridCustomTableView, cxGridTableView, cxGridDBTableView, cxClasses, cxControls, cxGridCustomView, cxGrid, DBClient, RM_Dataset, RM_System, RM_Common, RM_Class, RM_GridReport, IniFiles, cxLookAndFeels, cxLookAndFeelPainters, cxNavigator; type TfrmJTSJY220725 = class(TForm) CPInfo: TRichEdit; ADOQueryTemp: TADOQuery; Panel3: TPanel; Panel4: TPanel; Panel2: TPanel; SQty: TEdit; Label4: TLabel; Button3: TButton; Panel8: TPanel; Panel9: TPanel; Label1: TLabel; ZGH: TEdit; ZGHLab: TLabel; ZGL: TEdit; ZGLLab: TLabel; Panel6: TPanel; btnSampleSel: TButton; Button1: TButton; Panel10: TPanel; cxGrid3: TcxGrid; Tv3: TcxGridDBTableView; cxGridDBColumn1: TcxGridDBColumn; v3Column1: TcxGridDBColumn; v3Column2: TcxGridDBColumn; cxGridLevel2: TcxGridLevel; Panel7: 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; v3Column4: TcxGridDBColumn; ADOCmd: TADOQuery; ClientDataSet1: TClientDataSet; DataSource1: TDataSource; ZGFH: TEdit; ZGFHLab1: TLabel; ZGFHLab2: TLabel; v3Column3: TcxGridDBColumn; RM2: TRMGridReport; RMDB_Main: TRMDBDataSet; ADOQueryPrint: TADOQuery; Panel1: TPanel; Label14: TLabel; ComboBox1: TComboBox; Edit13: TEdit; Label15: TLabel; Button2: TButton; Panel5: TPanel; Label2: TLabel; MachNO: TComboBox; Tv3Column1: TcxGridDBColumn; Label7: TLabel; Label9: TLabel; ZGQty: TEdit; Label3: TLabel; Y_Type: TComboBox; ZGLH: TEdit; ZGLH2: TLabel; ZGLH1: TLabel; ZGHuangLab: TLabel; ZGHuangBLab2: TLabel; ZGHuangBLab1: TLabel; ZGHuang: TEdit; ZGHuangB: TEdit; JTNote: TEdit; Label5: TLabel; ZGRYS: TEdit; Label6: TLabel; procedure FormDestroy(Sender: TObject); procedure btnSampleSelClick(Sender: TObject); procedure TBCloseClick(Sender: TObject); procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure Button1Click(Sender: TObject); procedure ZGHClick(Sender: TObject); procedure SQtyClick(Sender: TObject); procedure SpeedButton1Click(Sender: TObject); procedure SpeedButton12Click(Sender: TObject); procedure Button3Click(Sender: TObject); procedure FormShow(Sender: TObject); procedure Edit13Click(Sender: TObject); procedure Button2Click(Sender: TObject); procedure ZGQtyClick(Sender: TObject); procedure cxGridDBColumn1CustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean); private ZGKS, SJKS, ZGZL, ZXZL, FactoryName, Y_CodeName, Y_Spec, Y_CodeNameCP, BatchNo, FFFMJID, DZCDYDllName, FTSStr: string; FCK, OKInt: Integer; function SaveData(DataType: string): Boolean; procedure InitGrid(); procedure InitJP(FName: string); procedure PrtData(FMJID: string); procedure OpenCom(DllName: string); procedure CloseCom(DllName: string); procedure On1201(var Message: Tmessage); message 1201; procedure TSInfo(TSStr: string); { Private declarations } public { Public declarations } end; var frmJTSJY220725: TfrmJTSJY220725; newh, newh1: hwnd; IniFile: TIniFile; implementation uses U_DataLink, U_RTFun, U_Fun, U_CPSel, U_iniParam, U_SCPerson, U_TSOKNO; {$R *.dfm} procedure TfrmJTSJY220725.FormDestroy(Sender: TObject); begin frmJTSJY220725 := nil; end; procedure TfrmJTSJY220725.On1201(var Message: Tmessage); var i1, i2: integer; FMJMaoZ: Double; begin i1 := Message.WParam; i2 := Message.LParam; FMJMaoZ := RoundFloat(i1 * i2 / 100000, 2); SQty.Text := floattostr(FMJMaoZ); end; procedure TfrmJTSJY220725.btnSampleSelClick(Sender: TObject); var i: Integer; begin try frmCPSel := TfrmCPSel.Create(Self); with frmCPSel do begin if ShowModal = 1 then begin CPInfo.Hint := FHMainId; end; end; finally frmCPSel.Close; end; with ADOQueryTemp do begin Close; sql.Clear; sql.Add('select * from YT_Plan_Main where Mainid=''' + Trim(CPInfo.Hint) + ''''); Open; end; with ADOQueryTemp do begin Y_CodeName := Trim(fieldbyname('Y_CodeName').AsString); Y_Spec := Trim(fieldbyname('Y_Spec').AsString); BatchNo := Trim(fieldbyname('BatchNo').AsString); Y_CodeNameCP := Trim(fieldbyname('Y_CodeNameCP').AsString); ZGKS := Trim(fieldbyname('ZGKS').AsString); SJKS := Trim(fieldbyname('SJKS').AsString); ZGZL := Trim(fieldbyname('ZGZL').AsString); ZXZL := Trim(fieldbyname('ZXZL').AsString); FactoryName := Trim(fieldbyname('FactoryName').AsString); end; ADOQueryTemp.Close; CPInfo.Text := ' ' + #13 + '原丝品名:' + Trim(Y_CodeName) + #13 + #13 + '规格:' + Trim(Y_Spec) + #13 + #13 + '批号:' + Trim(BatchNo) + #13 + #13 + '成品品名:' + Trim(Y_CodeNameCP) + #13 + #13 + '纸管重量:' + Trim(ZGZL) + #13 + #13 + '纸箱重量:' + Trim(ZXZL) + #13 + #13 + '纸管颗数:' + Trim(ZGKS); //+ #13 + #13 //+'板颗数:'+Trim(SJKS); ZGQty.Text := ZGKS; with Panel8 do begin for i := 0 to Panel8.ControlCount - 1 do begin if Controls[i].Tag = 2 then begin Controls[i].Visible := False; end; if Controls[i] is TEdit then begin TEdit(Controls[i]).Text := ''; end; end; end; with ADOQueryTemp do begin Close; sql.Clear; sql.Add('select * from YT_Plan_Rule where Mainid=''' + Trim(CPInfo.Hint) + ''' and RType=''颜色'' and isnull(RName,'''')<>'''' '); Open; end; i := ADOQueryTemp.RecordCount; with ADOQueryTemp do begin First; while not Eof do begin if Trim(ADOQueryTemp.fieldbyname('RName').AsString) = '红' then begin ZGH.Visible := True; ZGHLab.Visible := True; if i = 1 then begin ZGH.Text := '√'; end; end else if Trim(ADOQueryTemp.fieldbyname('RName').AsString) = '蓝' then begin ZGL.Visible := True; ZGLLab.Visible := True; if i = 1 then begin ZGL.Text := '√'; end; end else if Trim(ADOQueryTemp.fieldbyname('RName').AsString) = '黄' then begin ZGHuang.Visible := True; ZGHuangLab.Visible := True; if i = 1 then begin ZGHuang.Text := '√'; end; end else if Trim(ADOQueryTemp.fieldbyname('RName').AsString) = '粉黑' then begin ZGFH.Visible := True; ZGFHLab1.Visible := True; ZGFHLab2.Visible := True; if i = 1 then begin ZGFH.Text := '√'; end; end else if Trim(ADOQueryTemp.fieldbyname('RName').AsString) = '黄白' then begin ZGHuangB.Visible := True; ZGHuangBLab1.Visible := True; ZGHuangBLab2.Visible := True; if i = 1 then begin ZGHuangB.Text := '√'; end; end else if Trim(ADOQueryTemp.fieldbyname('RName').AsString) = '绿灰' then begin ZGLH.Visible := True; ZGLH1.Visible := True; ZGLH2.Visible := True; if i = 1 then begin ZGLH.Text := '√'; end; end else if Trim(ADOQueryTemp.fieldbyname('RName').AsString) = '任意色' then begin ZGRYS.Visible := True; if i = 1 then begin ZGRYS.Text := '√'; end; end; Next; end; end; with ADOQueryTemp do begin Close; sql.Clear; sql.Add('select * from YT_Plan_Rule where Mainid=''' + Trim(CPInfo.Hint) + ''' and RType=''机台'' and isnull(RName,'''')<>'''' '); Open; end; i := ADOQueryTemp.RecordCount; if i = 1 then begin MachNO.ItemIndex := MachNO.Items.IndexOf(ADOQueryTemp.fieldbyname('RName').AsString); MachNO.Enabled := False; end else begin MachNO.Enabled := True; MachNO.ItemIndex := -1; end; ADOQueryTemp.Close; end; procedure TfrmJTSJY220725.TBCloseClick(Sender: TObject); begin Close; end; procedure TfrmJTSJY220725.FormClose(Sender: TObject; var Action: TCloseAction); begin if FCK = 9 then begin CloseCom(DZCDYDllName) end; Action := caFree; end; procedure TfrmJTSJY220725.Button1Click(Sender: TObject); begin Close; end; procedure TfrmJTSJY220725.ZGHClick(Sender: TObject); var Fint, i: Integer; begin TEdit(Sender).Text := '√'; Fint := TEdit(Sender).TabOrder; for i := 0 to Panel8.ControlCount - 1 do begin with Panel8 do begin if Controls[i] is TEdit then begin if TEdit(Controls[i]).TabOrder <> Fint then begin TEdit(Controls[i]).Text := ''; end; end; end; end; end; procedure TfrmJTSJY220725.SQtyClick(Sender: TObject); var i: Integer; begin with Panel7 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 TfrmJTSJY220725.InitJP(FName: string); var i: Integer; begin with Panel7 do begin for i := 0 to ControlCount - 1 do begin if Controls[i] is TSpeedButton then begin TSpeedButton(Controls[i]).Hint := Trim(FName); end; end; end; end; procedure TfrmJTSJY220725.SpeedButton1Click(Sender: TObject); var fsj: string; begin fsj := Trim(TSpeedButton(Sender).Hint); if Trim(fsj) = '' 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 TfrmJTSJY220725.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; function TfrmJTSJY220725.SaveData(DataType: string): Boolean; var maxno, FMJID: string; begin FMJID := ''; try ADOCmd.Connection.BeginTrans; ///保存主表 if GetLSNo(ADOCmd, maxno, 'T' + Trim(SCXFlag), 'JY_YT', 4, 1) = False then begin ADOCmd.Connection.RollbackTrans; Application.MessageBox('生成流水号异常!', '提示', 0); exit; end; with ADOCmd do begin Close; sql.Clear; SQL.Add('select * from JY_YT where JYId=''' + Trim(FMJID) + ''''); Open; end; with ADOCmd do begin Append; FieldByName('JYID').Value := Trim(maxno); FieldByName('FactoryName').value := FactoryName; FieldByName('Y_CodeName').value := Trim(Y_CodeName); FieldByName('Y_CodeNameCP').value := Trim(Y_CodeNameCP); FieldByName('Y_Spec').value := Trim(Y_Spec); FieldByName('BatchNo').value := Trim(BatchNo); FieldByName('MachNO').value := Trim(MachNO.Text); FieldByName('Y_Type').value := Trim(Y_Type.Text); FieldByName('JTNote').value := Trim(JTNote.Text); if Trim(ZGH.Text) <> '' then begin FieldByName('ZGColor').value := '红'; end; if Trim(ZGL.Text) <> '' then begin FieldByName('ZGColor').value := '蓝'; end; if Trim(ZGFH.Text) <> '' then begin FieldByName('ZGColor').value := '粉黑'; end; if Trim(ZGLH.Text) <> '' then begin FieldByName('ZGColor').value := '绿灰'; end; if Trim(ZGHuang.Text) <> '' then begin FieldByName('ZGColor').value := '黄'; end; if Trim(ZGHuangB.Text) <> '' then begin FieldByName('ZGColor').value := '黄白'; end; if Trim(ZGRYS.Text) <> '' then begin FieldByName('ZGColor').value := '任意色'; end; FieldByName('CRType').Value := '已入库'; FieldByName('Valie').Value := 'Y'; FieldByName('ZGZL').Value := StrToFloatdef(trim(ZGZL), 0); FieldByName('ZGKS').Value := StrToFloatdef(trim(ZGQty.Text), 0); FieldByName('ZXZL').Value := StrToFloatdef(trim(ZXZL), 0); FieldByName('BZType').Value := '箱'; FieldByName('JYGW').Value := StrToFloatdef(trim(SQty.Text), 0); if Trim(FMJID) = '' then begin FieldByName('Filler').Value := Trim(DName); FieldByName('FillTime').Value := SGetServerDateTime(ADOQueryTemp); FieldByName('FillCode').Value := Trim(DCode); end else begin FieldByName('Editer').Value := Trim(DName); FieldByName('EditCode').Value := Trim(DCode); FieldByName('EditTime').Value := SGetServerDateTime(ADOQueryTemp); end; FieldByName('JTType').Value := Trim(SCXFlag); Post; end; FMJID := trim(maxno); FFFMJID := FMJID; ////////////////////////净重、出入库及库存///////////////////////////////////// with ADOCmd do begin Close; sql.Clear; sql.Add('exec P_JY_Insert_JTS @JYID=''' + trim(FMJID) + ''''); execsql; end; ////////////////////////净重、出入库及库存///////////////////////////////////// with ADOQueryTemp do begin Close; sql.Clear; SQL.Add('select * from JY_YT where JYID=''' + Trim(maxno) + ''''); Open; end; with ClientDataSet1 do begin Append; FieldByName('JYID').Value := Trim(maxno); FieldByName('ZGKS').Value := trim(ZGQty.Text); if Trim(ZGH.Text) <> '' then begin FieldByName('ZGColor').value := '红'; end; if Trim(ZGL.Text) <> '' then begin FieldByName('ZGColor').value := '蓝'; end; if Trim(ZGFH.Text) <> '' then begin FieldByName('ZGColor').value := '粉黑'; end; if Trim(ZGFH.Text) <> '' then begin FieldByName('ZGColor').value := '绿灰'; end; if Trim(ZGHuang.Text) <> '' then begin FieldByName('ZGColor').value := '黄'; end; if Trim(ZGHuangB.Text) <> '' then begin FieldByName('ZGColor').value := '黄白'; end; FieldByName('JYGW').Value := trim(SQty.Text); FieldByName('MachNO').Value := trim(MachNO.Text); FieldByName('JYNW').Value := ADOQueryTemp.fieldbyname('JYNW').Value; Post; end; ADOCmd.Connection.CommitTrans; Result := True; except Result := False; ADOCmd.Connection.RollbackTrans; Application.MessageBox('保存失败!', '提示', 0); end; end; procedure TfrmJTSJY220725.PrtData(FMJID: string); var fPrintFile: string; Txt, fImagePath: string; Moudle: THandle; Makebar: TMakebar; Mixtext: TMixtext; begin ExportFtErpFile('加弹丝标签.rmf', ADOQueryTemp); fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\加弹丝标签.rmf'; with ADOQueryPrint do begin Close; SQL.Clear; sql.Add(' EXEC P_JY_Print_YTLab ''' + Trim(FMJID) + ''''); Open; end; if ADOQueryPrint.IsEmpty then begin application.MessageBox('标签内容未找到!', '提示信息', MB_ICONERROR); exit; end; try Moudle := LoadLibrary('MakeQRBarcode.dll'); @Makebar := GetProcAddress(Moudle, 'Make'); @Mixtext := GetProcAddress(Moudle, 'MixText'); Txt := Trim(ADOQueryPrint.fieldbyname('JYID').AsString); fImagePath := ExtractFilePath(Application.ExeName) + 'image\temp.bmp'; if not DirectoryExists(pchar(ExtractFilePath(Application.ExeName) + 'image')) then CreateDirectory(pchar(ExtractFilePath(Application.ExeName) + 'image'), nil); if FileExists(fImagePath) then DeleteFile(fImagePath); Makebar(pchar(Txt), Length(Txt), 3, 3, 0, PChar(fImagePath), 3); except application.MessageBox('条形码生成失败!', '提示信息', MB_ICONERROR); exit; end; if FileExists(fPrintFile) then begin RMVariables['QRBARCODE'] := fImagePath; RM2.LoadFromFile(fPrintFile); Rm2.DefaultCopies := strtointdef(trim(ComboBox1.Text), 1); RM2.PrintReport; end else begin Application.MessageBox(PChar('没有找' + fPrintFile), '提示', 0); end; end; procedure TfrmJTSJY220725.Button3Click(Sender: TObject); var FReal: Double; FStr: string; begin if Trim(CPInfo.Text) = '' then begin TSInfo('没有选择品种!'); exit; end; if Trim(Trim(ZGRYS.Text) + Trim(ZGH.Text) + Trim(ZGL.Text) + Trim(ZGFH.Text) + Trim(ZGLH.Text) + Trim(ZGHuang.Text) + Trim(ZGHuangB.Text)) = '' then begin TSInfo('没有选择纸管颜色!'); exit; end; if Trim(ZGQty.Text) = '' then begin InitJP('ZGQty'); ZGQty.SetFocus; TSInfo('颗数不能为空!'); Exit; end; if TryStrToFloat(ZGQty.Text, FReal) = False then begin TSInfo('颗数非法数字!'); Exit; end; if Trim(SQty.Text) = '' then begin InitJP('SQty'); SQty.SetFocus; TSInfo('重量不能为空!'); Exit; end; if TryStrToFloat(SQty.Text, FReal) = False then begin TSInfo('重量非法数字!'); Exit; end; FStr := '1'; if StrToFloat(SQty.Text) < 20 then begin FStr := ''; try frmTSOKNO := TfrmTSOKNO.Create(Application); with frmTSOKNO do begin TSStr := '重量小于20,确定要继续操作吗?'; OKNOFlag := '选择'; if ShowModal = 1 then begin FStr := '1'; end; end; finally frmTSOKNO.Free; end; end; if StrToFloat(SQty.Text) > 45 then begin FStr := ''; try frmTSOKNO := TfrmTSOKNO.Create(Application); with frmTSOKNO do begin TSStr := '重量大于45,确定要继续操作吗?'; OKNOFlag := '选择'; if ShowModal = 1 then begin FStr := '1'; end; end; finally frmTSOKNO.Free; end; end; if StrToInt(ZGQty.Text) <> 6 then begin FStr := ''; try frmTSOKNO := TfrmTSOKNO.Create(Application); with frmTSOKNO do begin TSStr := '纸管颗数不等于6,确定要继续操作吗?'; OKNOFlag := '选择'; if ShowModal = 1 then begin FStr := '1'; end; end; finally frmTSOKNO.Free; end; end; if FStr = '1' then begin try frmTSOKNO := TfrmTSOKNO.Create(Application); with frmTSOKNO do begin TSStr := '确定要打印数据吗?数据打印后数据将不能修改!'; OKNOFlag := '选择'; if ShowModal = 1 then begin if SaveData('手输') then begin PrtData(Trim(FFFMJID)); SQty.Text := ''; end; end; end; finally frmTSOKNO.Free; end; end; end; procedure TfrmJTSJY220725.TSInfo(TSStr: string); var TSStr10: string; begin FTSStr := TSStr; try frmTSOKNO := TfrmTSOKNO.Create(Application); with frmTSOKNO do begin frmTSOKNO.TSStr := Self.FTSStr; frmTSOKNO.OKNOFlag := '提示'; if ShowModal = 1 then begin end; end; finally frmTSOKNO.Free; end; end; procedure TfrmJTSJY220725.InitGrid(); begin with ADOQueryTemp do begin Close; sql.Clear; sql.Add('select * from JY_YT where Convert(varchar(10),FillTime,120)=Convert(varchar(10),Getdate(),120)'); sql.Add(' and Filler=''' + Trim(DName) + ''' order by FillTime desc '); Open; end; SCreateCDS20(ADOQueryTemp, ClientDataSet1); SInitCDSData20(ADOQueryTemp, ClientDataSet1); end; procedure TfrmJTSJY220725.FormShow(Sender: TObject); begin try IniFile := TIniFile.Create(ExtractFilePath(Application.ExeName) + 'FileKPZ.INI'); DZCDYDllName := IniFile.ReadString('生产车间配置', '电子秤调用Dll文件', ''); finally IniFile.Free; end; InitGrid(); if DZCDYDllName <> '' then begin OpenCom(DZCDYDllName); end; end; procedure TfrmJTSJY220725.Edit13Click(Sender: TObject); begin if Trim(Edit13.Text) = '' then begin Edit13.Text := '√'; OpenCom(DZCDYDllName); end else begin Edit13.Text := ''; if FCK = 9 then CloseCom(DZCDYDllName) else begin Exit; end; end; end; procedure TfrmJTSJY220725.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', 500, 1); if newh < 1 then begin FCK := 1; showmessage('串口打开失败!'); Exit; end else begin FCK := 9; end; end else begin end; finally end; end else begin application.MessageBox(Pchar('找不到 ' + trim(DllName) + '串口文件!'), '提示'); end; end; procedure TfrmJTSJY220725.CloseCom(DllName: string); type TMyFunc = function(sCommName: PAnsiChar): HWND; stdcall; var Tf1: TMyFunc; Tp1: TFarProc; Th1: Thandle; //newh1:hwnd; 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('找不到 ' + trim(DllName) + ' 文件!'), '提示'); end; end; procedure TfrmJTSJY220725.Button2Click(Sender: TObject); begin if ClientDataSet1.IsEmpty then Exit; try frmTSOKNO := TfrmTSOKNO.Create(Application); with frmTSOKNO do begin TSStr := '确定要重打标签吗?'; OKNOFlag := '选择'; if ShowModal = 1 then begin Self.PrtData(Trim(ClientDataSet1.fieldbyname('JYId').AsString)); end; end; finally frmTSOKNO.Free; end; end; procedure TfrmJTSJY220725.ZGQtyClick(Sender: TObject); var i: Integer; begin with Panel7 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 TfrmJTSJY220725.cxGridDBColumn1CustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean); var id, id10: Integer; begin id := TV3.GetColumnByFieldName('JYNW').Index; //;-TV1.GroupedItemCount; id10 := TV3.GetColumnByFieldName('ZGKS').Index; //;-TV1.GroupedItemCount; if id < 0 then Exit; if AViewInfo.GridRecord.Values[id] < 20 then begin ACanvas.Brush.Color := clRed; end; if AViewInfo.GridRecord.Values[id] > 45 then begin ACanvas.Brush.Color := clRed; end; if AViewInfo.GridRecord.Values[id10] <> 6 then begin ACanvas.Brush.Color := clRed; end; end; end.