unit u_op_seae_diffctn; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, bsSkinCtrls, BusinessSkinForm, ExtCtrls, StdCtrls, ComCtrls, DBCtrls,DB, dxExEdtr, dxTL, dxDBCtrl, dxDBGrid, dxCntner, kbmMemTable, Mask, Grids, DBGrids, cxControls, cxContainer, cxEdit, cxLabel; type Tfrm_op_seae_diffctn = class(TForm) bsBusinessSkinForm1: TbsBusinessSkinForm; bsSkinPanel1: TbsSkinPanel; bsSkinButton5: TbsSkinButton; dsrWebCtn: TDataSource; dsrCtn: TDataSource; memtblwebctn: TkbmMemTable; memtblwebctnShipingBoxNo: TStringField; memtblwebctn1: TDataSource; dxDBGrid1: TdxDBGrid; dxDBGrid1Column1: TdxDBGridColumn; dxDBGrid1Column2: TdxDBGridColumn; dxDBGrid1Column3: TdxDBGridColumn; dxDBGrid1Column4: TdxDBGridColumn; dxDBGrid1Column5: TdxDBGridColumn; dxDBGrid1Column6: TdxDBGridColumn; dxDBGrid1Column7: TdxDBGridColumn; dxDBGrid1Column8: TdxDBGridColumn; dxDBGrid1Column10: TdxDBGridColumn; dxDBGrid1Column11: TdxDBGridColumn; dxDBGrid1Column12: TdxDBGridColumn; dxDBGrid1Column13: TdxDBGridColumn; dxDBGrid1Column14: TdxDBGridColumn; dxDBGrid1Column15: TdxDBGridColumn; dxDBGrid1Column16: TdxDBGridColumn; dxDBGrid1Column17: TdxDBGridColumn; cxLabel1: TcxLabel; cxLabel2: TcxLabel; procedure bsSkinButton5Click(Sender: TObject); procedure FormShow(Sender: TObject); procedure dxDBGrid1CustomDraw(Sender: TObject; ACanvas: TCanvas; ARect: TRect; ANode: TdxTreeListNode; AColumn: TdxDBTreeListColumn; const AText: String; AFont: TFont; var AColor: TColor; ASelected, AFocused: Boolean; var ADone: Boolean); procedure dxDBGrid1Column5CustomDrawCell(Sender: TObject; ACanvas: TCanvas; ARect: TRect; ANode: TdxTreeListNode; AColumn: TdxTreeListColumn; ASelected, AFocused, ANewItemRow: Boolean; var AText: String; var AColor: TColor; AFont: TFont; var AAlignment: TAlignment; var ADone: Boolean); procedure dxDBGrid1Column6CustomDrawCell(Sender: TObject; ACanvas: TCanvas; ARect: TRect; ANode: TdxTreeListNode; AColumn: TdxTreeListColumn; ASelected, AFocused, ANewItemRow: Boolean; var AText: String; var AColor: TColor; AFont: TFont; var AAlignment: TAlignment; var ADone: Boolean); procedure dxDBGrid1Column7CustomDrawCell(Sender: TObject; ACanvas: TCanvas; ARect: TRect; ANode: TdxTreeListNode; AColumn: TdxTreeListColumn; ASelected, AFocused, ANewItemRow: Boolean; var AText: String; var AColor: TColor; AFont: TFont; var AAlignment: TAlignment; var ADone: Boolean); procedure dxDBGrid1Column4CustomDrawCell(Sender: TObject; ACanvas: TCanvas; ARect: TRect; ANode: TdxTreeListNode; AColumn: TdxTreeListColumn; ASelected, AFocused, ANewItemRow: Boolean; var AText: String; var AColor: TColor; AFont: TFont; var AAlignment: TAlignment; var ADone: Boolean); procedure dxDBGrid1Column1CustomDrawCell(Sender: TObject; ACanvas: TCanvas; ARect: TRect; ANode: TdxTreeListNode; AColumn: TdxTreeListColumn; ASelected, AFocused, ANewItemRow: Boolean; var AText: String; var AColor: TColor; AFont: TFont; var AAlignment: TAlignment; var ADone: Boolean); procedure dxDBGrid1Column2CustomDrawCell(Sender: TObject; ACanvas: TCanvas; ARect: TRect; ANode: TdxTreeListNode; AColumn: TdxTreeListColumn; ASelected, AFocused, ANewItemRow: Boolean; var AText: String; var AColor: TColor; AFont: TFont; var AAlignment: TAlignment; var ADone: Boolean); procedure dxDBGrid1Column8CustomDrawCell(Sender: TObject; ACanvas: TCanvas; ARect: TRect; ANode: TdxTreeListNode; AColumn: TdxTreeListColumn; ASelected, AFocused, ANewItemRow: Boolean; var AText: String; var AColor: TColor; AFont: TFont; var AAlignment: TAlignment; var ADone: Boolean); private { Private declarations } procedure setdifcolor ; function replace(str,s1,s2:string):string; Function After(Src,S:string ) : string ; Function Before(Src,S:string):string ; Function middle( Src,S1,S2:string ) : string ; public { Public declarations } bsNo:string; procedure showchgtd(ds1,ds2:TDataSource) ; procedure Creatememtblctn; end; var frm_op_seae_diffctn: Tfrm_op_seae_diffctn; implementation {$R *.dfm} uses u_main ; procedure Tfrm_op_seae_diffctn.bsSkinButton5Click(Sender: TObject); begin close ; end; procedure Tfrm_op_seae_diffctn.setdifcolor; begin end; procedure Tfrm_op_seae_diffctn.showchgtd(ds1, ds2: TDataSource); begin dxDBGrid1.DataSource:=memtblwebctn1; showmodal ; end; //////////////////////////////////////////////// Function Tfrm_op_seae_diffctn.After(Src,S:string ) : string ; begin end; //提取字符串中指定子字符串前的字符串 Function Tfrm_op_seae_diffctn.Before(Src,S:string):string ; begin end; Function Tfrm_op_seae_diffctn.middle( Src,S1,S2:string ) : string ; begin end; function Tfrm_op_seae_diffctn.replace(str,s1,s2:string):string; begin end; procedure Tfrm_op_seae_diffctn.FormShow(Sender: TObject); begin setdifcolor; end; procedure Tfrm_op_seae_diffctn.Creatememtblctn; begin end; procedure Tfrm_op_seae_diffctn.dxDBGrid1CustomDraw(Sender: TObject; ACanvas: TCanvas; ARect: TRect; ANode: TdxTreeListNode; AColumn: TdxDBTreeListColumn; const AText: String; AFont: TFont; var AColor: TColor; ASelected, AFocused: Boolean; var ADone: Boolean); begin if trim(uppercase(ANode.Strings[dxDBGrid1Column3.Index]))<>trim(uppercase(ANode.Strings[dxDBGrid1Column12.Index])) then begin AFont.Color:=clRed; exit; end; end; procedure Tfrm_op_seae_diffctn.dxDBGrid1Column5CustomDrawCell( Sender: TObject; ACanvas: TCanvas; ARect: TRect; ANode: TdxTreeListNode; AColumn: TdxTreeListColumn; ASelected, AFocused, ANewItemRow: Boolean; var AText: String; var AColor: TColor; AFont: TFont; var AAlignment: TAlignment; var ADone: Boolean); begin if dsrCtn.DataSet.Locate('箱号',uppercase(ANode.Strings[dxDBGrid1Column3.Index]),[]) then begin if dsrCtn.DataSet.FieldByName('件数').AsInteger<>StrToFloatdef(ANode.Strings[dxDBGrid1Column5.Index],0) then begin AFont.Color:=clRed; end; end; end; procedure Tfrm_op_seae_diffctn.dxDBGrid1Column6CustomDrawCell( Sender: TObject; ACanvas: TCanvas; ARect: TRect; ANode: TdxTreeListNode; AColumn: TdxTreeListColumn; ASelected, AFocused, ANewItemRow: Boolean; var AText: String; var AColor: TColor; AFont: TFont; var AAlignment: TAlignment; var ADone: Boolean); begin if dsrCtn.DataSet.Locate('箱号',uppercase(ANode.Strings[dxDBGrid1Column3.Index]),[]) then begin if dsrCtn.DataSet.FieldByName('包装').AsString<>ANode.Strings[dxDBGrid1Column6.Index] then begin AFont.Color:=clRed; end; end; end; procedure Tfrm_op_seae_diffctn.dxDBGrid1Column7CustomDrawCell( Sender: TObject; ACanvas: TCanvas; ARect: TRect; ANode: TdxTreeListNode; AColumn: TdxTreeListColumn; ASelected, AFocused, ANewItemRow: Boolean; var AText: String; var AColor: TColor; AFont: TFont; var AAlignment: TAlignment; var ADone: Boolean); begin if dsrCtn.DataSet.Locate('箱号',uppercase(ANode.Strings[dxDBGrid1Column3.Index]),[]) then begin if FormatFloat('0.000;0.000;0',dsrCtn.DataSet.FieldByName('重量').AsFloat)<>FormatFloat('0.000;0.000;0',StrToFloatdef(ANode.Strings[dxDBGrid1Column7.Index],0)) then begin AFont.Color:=clRed; end; end; end; procedure Tfrm_op_seae_diffctn.dxDBGrid1Column4CustomDrawCell( Sender: TObject; ACanvas: TCanvas; ARect: TRect; ANode: TdxTreeListNode; AColumn: TdxTreeListColumn; ASelected, AFocused, ANewItemRow: Boolean; var AText: String; var AColor: TColor; AFont: TFont; var AAlignment: TAlignment; var ADone: Boolean); begin if memtblwebctn.FieldByName('Exist').AsString='0' then begin AFont.Color:=clRed; exit; end else if dsrCtn.DataSet.Locate('箱号',uppercase(ANode.Strings[dxDBGrid1Column3.Index]),[]) then begin if dsrCtn.DataSet.FieldByName('封号').AsString<>ANode.Strings[dxDBGrid1Column4.Index] then begin AFont.Color:=clRed; end; end; end; procedure Tfrm_op_seae_diffctn.dxDBGrid1Column1CustomDrawCell( Sender: TObject; ACanvas: TCanvas; ARect: TRect; ANode: TdxTreeListNode; AColumn: TdxTreeListColumn; ASelected, AFocused, ANewItemRow: Boolean; var AText: String; var AColor: TColor; AFont: TFont; var AAlignment: TAlignment; var ADone: Boolean); begin if memtblwebctn.FieldByName('Exist').AsString='0' then begin AFont.Color:=clRed; exit; end else if dsrCtn.DataSet.Locate('箱号',uppercase(ANode.Strings[dxDBGrid1Column3.Index]),[]) then begin if dsrCtn.DataSet.FieldByName('尺寸').AsString<>ANode.Strings[dxDBGrid1Column1.Index] then begin AFont.Color:=clRed; end; end; end; procedure Tfrm_op_seae_diffctn.dxDBGrid1Column2CustomDrawCell( Sender: TObject; ACanvas: TCanvas; ARect: TRect; ANode: TdxTreeListNode; AColumn: TdxTreeListColumn; ASelected, AFocused, ANewItemRow: Boolean; var AText: String; var AColor: TColor; AFont: TFont; var AAlignment: TAlignment; var ADone: Boolean); begin if dsrCtn.DataSet.Locate('箱号',uppercase(ANode.Strings[dxDBGrid1Column3.Index]),[]) then begin if dsrCtn.DataSet.FieldByName('箱型').AsString<>ANode.Strings[dxDBGrid1Column2.Index] then begin AFont.Color:=clRed; end; end; end; procedure Tfrm_op_seae_diffctn.dxDBGrid1Column8CustomDrawCell( Sender: TObject; ACanvas: TCanvas; ARect: TRect; ANode: TdxTreeListNode; AColumn: TdxTreeListColumn; ASelected, AFocused, ANewItemRow: Boolean; var AText: String; var AColor: TColor; AFont: TFont; var AAlignment: TAlignment; var ADone: Boolean); begin if dsrCtn.DataSet.Locate('箱号',uppercase(ANode.Strings[dxDBGrid1Column3.Index]),[]) then begin if FormatFloat('0.000;0.000;0',dsrCtn.DataSet.FieldByName('尺码').AsFloat)<>FormatFloat('0.000;0.000;0',StrToFloatdef(ANode.Strings[dxDBGrid1Column8.Index],0)) then begin AFont.Color:=clRed; end; end; end; end.