unit U_WireInspection; interface uses Windows, Messages, SysUtils, 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, IniFiles, Menus, cxButtonEdit, cxLookAndFeels, cxLookAndFeelPainters, cxNavigator; type TfrmWireInspection = class(TForm) cxGridPopupMenu1: TcxGridPopupMenu; DataSource1: TDataSource; Order_MJ: TClientDataSet; ADOCmd: TADOQuery; RMDB_Main: TRMDBDataSet; RM2: TRMGridReport; DS_MJCD: TDataSource; CDS_MJCD: TClientDataSet; DS_MJID: TDataSource; CDS_MJID: TClientDataSet; ADOQueryPrint: TADOQuery; cxGridPopupMenu2: TcxGridPopupMenu; ADOQueryMainDSC: TADOQuery; 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; Panel7: TPanel; RM3: TRMGridReport; ADOTmp: TADOQuery; Panel5: TPanel; ToolBar1: TToolBar; ToolButton1: TToolButton; TBClose: TToolButton; cxGrid3: TcxGrid; Tv3: TcxGridDBTableView; cxGridDBColumn1: TcxGridDBColumn; v3Column2: TcxGridDBColumn; v3Column3: TcxGridDBColumn; cxGridLevel2: TcxGridLevel; CDS_LSNO: TClientDataSet; DataSource2: TDataSource; Panel6: TPanel; btnSampleSel: TButton; PopupMenu1: TPopupMenu; N1: TMenuItem; N2: TMenuItem; OrdNote: TRichEdit; Panel2: TPanel; Label5: TLabel; Label3: TLabel; JYGW: TEdit; BTPrint: TButton; XNO: TEdit; Button6: TButton; v3Column1: TcxGridDBColumn; Label26: TLabel; Label34: TLabel; Edit6: TEdit; ComboBox1: TComboBox; Button5: TButton; Label4: TLabel; ZXZL: TEdit; Label6: TLabel; ZGZL: TEdit; Button1: TButton; Label7: TLabel; KS: TEdit; Label8: TLabel; YRNo: TEdit; Button3: TButton; YRWeight: TEdit; v3Column4: TcxGridDBColumn; v3Column5: TcxGridDBColumn; v3Column6: TcxGridDBColumn; v3Column7: TcxGridDBColumn; procedure FormDestroy(Sender: TObject); procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure TBCloseClick(Sender: TObject); procedure FormShow(Sender: TObject); procedure BTPrintClick(Sender: TObject); procedure SpeedButton1Click(Sender: TObject); procedure SpeedButton12Click(Sender: TObject); procedure cxGridDBColumn2PropertiesChange(Sender: TObject); procedure Button5Click(Sender: TObject); procedure SpeedButton49Click(Sender: TObject); procedure KSClick(Sender: TObject); procedure Edit6Click(Sender: TObject); procedure MJstr3KeyPress(Sender: TObject; var Key: Char); procedure ScanClick(Sender: TObject); procedure FormCreate(Sender: TObject); procedure Tv2CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean); procedure btnSampleSelClick(Sender: TObject); procedure N1Click(Sender: TObject); procedure N2Click(Sender: TObject); procedure v3Column9PropertiesEditValueChanged(Sender: TObject); procedure v3Column5PropertiesEditValueChanged(Sender: TObject); procedure Button1Click(Sender: TObject); private { Private declarations } FFFMJID, FOperationStatus, ZJmaxno: string; FMainId, FSubId, FMJCode, FMJName, FMJColor, FMJSpec, FMJBatchNo, FMJZGZL, FMJZXZL, FMJFactoryName: string; // 产品信息 isCommopen, IsJsMessage: boolean; procedure InitInspectionRecord(); //刷新检验信息 function CheckData(CKType: string): Boolean; //校验数据 function SaveData(): Boolean; //保存数据 procedure ScanOrder(); //扫描订单 procedure ClearGlobal(MStatus: string); //清除全局ID procedure PrintCKMDG(MRKOrdID: string); //打印入库单 procedure PrtData(FMJID: string); //打印卷标签 procedure OpenCom(DllName: string); procedure CloseCom(DllName: string); procedure On1201(var Message: Tmessage); message 1201; procedure On1301(var Message: Tmessage); message 1301; public fmanage,SMainId: string; { Public declarations } end; var frmWireInspection: TfrmWireInspection; newh, newh1: hwnd; IniFile: TIniFile; implementation uses U_DataLink, U_Fun, U_ZDYHelp, U_iniParam, U_SCPerson, U_CPSel,U_LSSCListSel, U_YarnRack; {$R *.dfm} function TfrmWireInspection.CheckData(CKType: string): Boolean; var mvalue: Double; begin try if ((Trim(FMainId) = '') and (Trim(FMJCode) = '')) then raise Exception.Create('请选择计划单!'); if Trim(CKType) = '提交' then begin if Trim(XNO.Text) = '' then raise Exception.Create('箱号不能为空!'); if Trim(YRNo.Text) = '' then raise Exception.Create('纱架号不能为空!'); if StrToFloatdef(trim(YRWeight.Text), 0) = 0 then raise Exception.Create('纱架重量不能为空!'); if StrToFloatdef(trim(JYGW.Text), 0) = 0 then raise Exception.Create('颗重不能为空!'); if StrToFloatdef(trim(ZXZL.Text), 0) = 0 then raise Exception.Create('纸箱重量不能为空!'); if StrToFloatdef(trim(ZGZL.Text), 0) = 0 then raise Exception.Create('纸管重量不能为空!'); end; Result := True; except Result := false; application.MessageBox(PChar(Exception(ExceptObject).Message), '提示信息', 0); end; end; procedure TfrmWireInspection.ClearGlobal(MStatus: string); begin if MStatus = '扫描' then begin FMainId := ''; FSubId := ''; FFFMJID := ''; FMJCode := ''; JYGW.Text := ''; end; if MStatus = '提交' then begin JYGW.Text := ''; FOperationStatus := ''; FFFMJID := ''; end; end; procedure TfrmWireInspection.PrintCKMDG(MRKOrdID: string); var fPrintFile: string; Txt, fImagePath: string; Moudle: THandle; Makebar: TMakebar; Mixtext: TMixtext; begin with ADOQueryPrint do begin Close; SQL.Clear; sql.Add(' exec P_Print_RKMDGangNo '); SQL.Add(' @RKOrdID=''' + Trim(MRKOrdID) + ''''); Open; end; try Moudle := LoadLibrary('MakeQRBarcode.dll'); @Makebar := GetProcAddress(Moudle, 'Make'); @Mixtext := GetProcAddress(Moudle, 'MixText'); Txt := Trim(ADOQueryPrint.fieldbyname('RKOrdID').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; ExportFtErpFile('验布工仓库码单.rmf', ADOTmp); fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\验布工仓库码单.rmf'; if FileExists(fPrintFile) then begin RMVariables['QRBARCODE'] := fImagePath; RM2.LoadFromFile(fPrintFile); Rm2.DefaultCopies := 1; RM2.ShowReport; end else begin Application.MessageBox(PChar('没有找' + fPrintFile), '提示', 0); Exit; end; end; procedure TfrmWireInspection.ScanOrder(); begin with ADOTmp do begin Close; sql.Clear; sql.Add('select A.* from YT_Plan_Main A'); sql.Add(' where isnull(Status,''0'')=''1'' '); sql.Add(' and MainId=''' + Trim(SMainId) + ''' '); Open; end; if not ADOTmp.IsEmpty then begin FMainId := Trim(ADOTmp.fieldbyname('MainId').AsString); FMJCode := Trim(ADOTmp.fieldbyname('Y_Code').AsString); FMJName := Trim(ADOTmp.fieldbyname('Y_CodeName').AsString); FMJSpec := Trim(ADOTmp.fieldbyname('Y_Spec').AsString); FMJBatchNo := Trim(ADOTmp.fieldbyname('BatchNo').AsString); FMJZGZL := Trim(ADOTmp.fieldbyname('ZGZL').AsString); FMJZXZL := Trim(ADOTmp.fieldbyname('ZXZL').AsString); FMJFactoryName := Trim(ADOTmp.fieldbyname('FactoryName').AsString); OrdNote.Text := '供应商:' + FMJFactoryName + #13; OrdNote.Text := OrdNote.Text + '品名:' + FMJName + #13; OrdNote.Text := OrdNote.Text + '规格:' + FMJSpec + #13; OrdNote.Text := OrdNote.Text + '批号:' + FMJBatchNo + #13; OrdNote.Text := OrdNote.Text + '纸管重量:' + FMJZGZL + #13; OrdNote.Text := OrdNote.Text + '纸箱重量:' + FMJZXZL + #13; ZGZL.Text := FMJZGZL; ZXZL.Text := FMJZXZL; end else begin ClearGlobal('扫描生产计划单'); end; InitInspectionRecord(); end; procedure TfrmWireInspection.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('找不到 ' + trim(DllName) + ' 文件!'), '提示'); end; end; procedure TfrmWireInspection.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('打开串口失败!'), '提示'); end else IsCommOpen := true; end else begin IsCommOpen := false; end; finally // FreeLibrary(Th); end; end else begin IsCommOpen := false; application.MessageBox(Pchar('找不到 ' + trim(DllName) + ' 文件!'), '提示'); end; end; procedure TfrmWireInspection.FormDestroy(Sender: TObject); begin frmWireInspection := nil; end; procedure TfrmWireInspection.On1301(var Message: Tmessage); begin end; procedure TfrmWireInspection.On1201(var Message: Tmessage); begin end; procedure TfrmWireInspection.FormClose(Sender: TObject; var Action: TCloseAction); begin Action := caFree; end; procedure TfrmWireInspection.InitInspectionRecord(); begin with ADOTmp do begin Close; SQL.Clear; sql.Add('select A.*'); sql.Add('from JY_YT A where mainid=''' + trim(FMainId) + ''' '); sql.Add(' and DATEDIFF(HH,Filltime,GETDATE())<2'); sql.Add('order by A.filltime desc'); Open; end; SCreateCDS20(ADOTmp, CDS_MJID); SInitCDSData20(ADOTmp, CDS_MJID); end; procedure TfrmWireInspection.TBCloseClick(Sender: TObject); begin Close; end; procedure TfrmWireInspection.FormShow(Sender: TObject); begin // if IsINIFile() then // ReadINIFile() // else // WriteINIFile; end; function TfrmWireInspection.SaveData(): Boolean; var maxno, FMJID, BZID, strsql: string; FMJLen: Double; begin FMJID := ''; try ADOCmd.Connection.BeginTrans; ///保存主表 with ADOCmd do begin Close; sql.Clear; SQL.Add('select * from JY_YT where JYId=''' + Trim(FMJID) + ''''); Open; end; with ADOCmd do begin if Trim(FMJID) = '' then begin Append; if GetLSNo(ADOTmp, maxno, 'T' + Trim(SCXFlag), 'JY_YT', 4, 1) = False then begin ADOCmd.Connection.RollbackTrans; Application.MessageBox('生成流水号异常!', '提示', 0); BTPrint.Enabled := True; exit; end; end else begin maxno := Trim(FMJID); Edit; end; FieldByName('MainId').value := Trim(FMainId); FieldByName('SubId').value := Trim(FSubId); FieldByName('Y_Code').value := Trim(FMJCode); FieldByName('Y_CodeName').value := Trim(FMJName); FieldByName('Y_Color').value := Trim(FMJColor); FieldByName('Y_Spec').value := Trim(FMJSpec); FieldByName('BatchNo').value := Trim(FMJBatchNo); FieldByName('JYID').Value := Trim(maxno); FieldByName('CRType').Value := '已入库'; FieldByName('Valie').Value := 'Y'; FieldByName('XNO').Value := Trim(XNO.Text); FieldByName('YRNo').Value := Trim(YRNo.Text); FieldByName('YRWeight').Value := StrToFloatdef(trim(YRWeight.Text), 0); FieldByName('JYGW').Value := StrToFloatdef(trim(JYGW.Text), 0); //重量 FieldByName('ZXZL').Value := StrToFloatdef(trim(ZXZL.Text), 0); FieldByName('ZGZL').Value := StrToFloatdef(trim(ZGZL.Text), 0); if Trim(FMJID) = '' then begin FieldByName('Filler').Value := Trim(DName); FieldByName('FillCode').Value := Trim(DCode); FieldByName('FillTime').Value := SGetServerDateTime(ADOTmp); end else begin FieldByName('Editer').Value := Trim(DName); FieldByName('EditCode').Value := Trim(DCode); FieldByName('EditTime').Value := SGetServerDateTime(ADOTmp); 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_YT @JYID=''' + trim(FMJID) + ''''); execsql; end; ////////////////////////出入库及库存///////////////////////////////////// ADOCmd.Connection.CommitTrans; Result := True; except Result := False; ADOCmd.Connection.RollbackTrans; Application.MessageBox('保存失败!', '提示', 0); BTPrint.Enabled := True; end; end; procedure TfrmWireInspection.BTPrintClick(Sender: TObject); var fPrintFile: string; mvalue: Double; i: Integer; begin BTPrint.Enabled := False; XNO.SetFocus; if CheckData('提交') = False then begin BTPrint.Enabled := True; exit; end; if JYGW.Text = '' then begin BTPrint.Enabled := True; Application.MessageBox('请输入颗重!', '提示', 0); Exit; end; if GetLSNo(ADOTmp, ZJmaxno, 'ZJ', 'JY_YT', 3, 1) = False then begin Application.MessageBox('生成流水号异常!', '提示', 0); BTPrint.Enabled := True; exit; end; for i := 1 to StrToInt(KS.Text) do begin if SaveData() then begin PrtData(FFFMJID); end else begin BTPrint.Enabled := True; end; sleep(200); end; InitInspectionRecord(); ClearGlobal('提交'); KSClick(JYGW); BTPrint.Enabled := True; end; procedure TfrmWireInspection.PrtData(FMJID: string); var fPrintFile: string; Txt, fImagePath: string; Moudle: THandle; Makebar: TMakebar; Mixtext: TMixtext; begin with ADOQueryPrint do begin Close; SQL.Clear; sql.Add(' EXEC P_JY_Print_YTLab '); SQL.Add(' @JYID=''' + Trim(FMJID) + ''''); Open; end; if ADOQueryPrint.IsEmpty then begin application.MessageBox('标签内容未找到!', '提示信息', MB_ICONERROR); BTPrint.Enabled := True; 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); BTPrint.Enabled := True; exit; end; ExportFtErpFile(Trim('加弹标签.rmf'), ADOTmp); fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\加弹标签.rmf'; 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 TfrmWireInspection.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 TfrmWireInspection.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 TfrmWireInspection.cxGridDBColumn2PropertiesChange(Sender: TObject); var fsj: string; begin fsj := Trim(Order_MJ.fieldbyname('SubId').AsString); Order_MJ.DisableControls; with Order_MJ do begin First; while not Eof do begin if Trim(Order_MJ.fieldbyname('SubId').AsString) <> fsj then begin Edit; FieldByName('SSel').Value := False; end; Next; end; end; Order_MJ.EnableControls; Order_MJ.Locate('SubId', fsj, []); end; procedure TfrmWireInspection.Button5Click(Sender: TObject); var fPrintFile: string; i: Integer; mvalue: Double; begin if CDS_MJID.IsEmpty then Exit; PrtData(CDS_MJID.fieldbyname('LSID').AsString); end; procedure TfrmWireInspection.SpeedButton49Click(Sender: TObject); begin Panel3.Visible := False; end; procedure TfrmWireInspection.KSClick(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 TfrmWireInspection.Edit6Click(Sender: TObject); begin if Trim(Edit6.Text) = '' then begin Edit6.Text := '√'; end else begin Edit6.Text := ''; end; end; procedure TfrmWireInspection.MJstr3KeyPress(Sender: TObject; var Key: Char); begin if Key = #13 then begin Key := #0; SelectNext(ActiveControl as TWinControl, True, True); end; end; procedure TfrmWireInspection.ScanClick(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 TfrmWireInspection.FormCreate(Sender: TObject); begin IsCommopen := false; IsJsMessage := false; end; procedure TfrmWireInspection.Tv2CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean); begin if CDS_MJCD.IsEmpty then Exit; if Trim(CDS_MJCD.fieldbyname('MCID').AsString) = '' then begin if Application.MessageBox('确定要删除数据吗?', '提示', 32 + 4) <> IDYES then Exit; CDS_MJCD.Delete; end; end; procedure TfrmWireInspection.btnSampleSelClick(Sender: TObject); begin try frmLSSCListSel:=TfrmLSSCListSel.Create(Self); with frmLSSCListSel do begin if ShowModal=1 then begin SMainId:=Trim(FMainid); end; end; finally frmLSSCListSel.close; end; end; procedure TfrmWireInspection.N1Click(Sender: TObject); begin if CDS_MJID.IsEmpty then Exit; with ADOCmd do begin Close; sql.Clear; sql.Add('update jy_ls set zjstatus=''质检'',ZJTime=getdate(),ZJPerson=''' + trim(DName) + ''' '); sql.Add('where lsid=''' + trim(CDS_MJID.fieldbyname('lsid').AsString) + ''' '); ExecSQl; end; PrtData(CDS_MJID.fieldbyname('LSID').AsString); InitInspectionRecord(); end; procedure TfrmWireInspection.N2Click(Sender: TObject); begin if CDS_MJID.IsEmpty then Exit; with ADOCmd do begin Close; sql.Clear; sql.Add('update jy_ls set zjstatus=''质检'',ZJTime=getdate(),ZJPerson=''' + trim(DName) + ''' '); sql.Add('where zjno=''' + trim(CDS_MJID.fieldbyname('zjno').AsString) + ''' '); ExecSQl; end; with ADOCmd do begin Close; sql.Clear; sql.Add('select * from jy_ls where zjno=''' + trim(CDS_MJID.fieldbyname('zjno').AsString) + ''' '); Open; First; while not Eof do begin PrtData(ADOCmd.fieldbyname('LSID').AsString); Next; end; end; InitInspectionRecord(); end; procedure TfrmWireInspection.v3Column9PropertiesEditValueChanged(Sender: TObject); var mvalues: string; begin mvalues := TCXTextEdit(Sender).Text; with CDS_MJID do begin edit; fieldbyname('LSKZ').Value := mvalues; post; end; tv3.Controller.EditingController.ShowEdit(); with ADOCmd do begin Close; sql.Clear; sql.Add('Update JY_LS Set LSKZ=''' + trim(mvalues) + ''' '); sql.Add('where LSID=''' + Trim(CDS_MJID.fieldbyname('LSID').AsString) + ''''); ExecSQL; end; end; procedure TfrmWireInspection.v3Column5PropertiesEditValueChanged(Sender: TObject); var mvalues: string; begin mvalues := TCXTextEdit(Sender).Text; with CDS_MJID do begin edit; fieldbyname('LSLen2').Value := mvalues; post; end; tv3.Controller.EditingController.ShowEdit(); with ADOCmd do begin Close; sql.Clear; sql.Add('Update JY_LS Set LSLen2=''' + trim(mvalues) + ''' '); sql.Add('where LSID=''' + Trim(CDS_MJID.fieldbyname('LSID').AsString) + ''''); sql.Add('Update CK_LS_CR Set LSLen2=''' + trim(mvalues) + ''' '); sql.Add('where LSID=''' + Trim(CDS_MJID.fieldbyname('LSID').AsString) + ''''); ExecSQL; end; end; procedure TfrmWireInspection.Button1Click(Sender: TObject); var maxno: string; begin if GetLSNo(ADOTmp, maxno, 'X', 'JY_YT', 3, 1) = False then begin Application.MessageBox('生成流水号异常!', '提示', 0); exit; end; XNO.Text := maxno; end; end.