unit U_YarnElasticityWeighing; 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, cxContainer, cxTextEdit, cxMaskEdit, cxButtonEdit, dxSkinsCore, dxSkinsDefaultPainters, dxDateRanges, U_BaseList; type TfrmYarnElasticityWeighing = class(TfrmBaseList) CPInfo: TRichEdit; ADOQueryTemp: TADOQuery; Panel3: TPanel; Panel4: TPanel; Panel2: TPanel; SQty: TEdit; Label4: TLabel; Button3: TButton; Panel9: TPanel; 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; 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; Label9: TLabel; edt_BoxCount: TEdit; Label3: TLabel; Grade: TComboBox; Panel11: TPanel; Label5: TLabel; edt_YarnRackNo: TEdit; Label6: TLabel; edt_YarnRackWeight: TEdit; Label7: TLabel; ClientDataSetYS: TClientDataSet; Panel8: TPanel; ZG5C1: TLabel; ZG5C2: TLabel; ZG4C2: TLabel; ZG4C1: TLabel; ZG6C2: TLabel; ZG6C1: TLabel; ZG1C1: TLabel; ZG1C2: TLabel; ZG2C1: TLabel; ZG2C2: TLabel; ZG3C1: TLabel; ZG3C2: TLabel; ZG1: TEdit; ZG2: TEdit; ZG5: TEdit; ZG4: TEdit; ZG3: TEdit; ZG6: TEdit; Panel12: TPanel; Label8: TLabel; edt_YarnTubeWeight: TEdit; Tv3Column2: TcxGridDBColumn; Label1: TLabel; PacketType: TEdit; Label10: TLabel; btn_YarnTubeType: TcxButtonEdit; Button7: TButton; Panel13: TPanel; btnSampleSel: TButton; Button4: TButton; Button5: TButton; Button6: TButton; Button1: TButton; Button8: TButton; Button9: TButton; Button10: TButton; Tv3Column3: TcxGridDBColumn; 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 Button4Click(Sender: TObject); procedure ZG1Click(Sender: TObject); procedure edt_YarnRackNoKeyPress(Sender: TObject; var Key: Char); procedure Button5Click(Sender: TObject); procedure Button6Click(Sender: TObject); procedure cxButtonEdit1PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer); procedure Button7Click(Sender: TObject); procedure Button9Click(Sender: TObject); procedure Button10Click(Sender: TObject); procedure Button8Click(Sender: TObject); private FMainid, FOrderNo, FFtyNO, FFtyName, FY_Code, FY_Name, FY_Spec, FY_Color, FBatchNo, FYE_Code, FYE_Name: string; FYarnTubeColor, FPaperBoxWeight, FBoxCount, FYarnRackCount: string; FFFMJID: string; IsCommopen: boolean; procedure InitYarnTubeColor(MColor: string);//刷新纸管颜色 function TestData(): Boolean; //验证数据 procedure GetYarnTube(MTube: string);//获取纱管重量 procedure InitJP(FName: string); //刷新数字键盘 function SaveData(DataType: string): Boolean; //保存数据 procedure InitGrid(); //刷新检验数据 function TSInfo(MOKNOFlag, MTSStr: string): Boolean; //提示用子窗体 procedure PrtData(MYIID: string); //打印标签 procedure OpenCom(DllName: string); procedure CloseCom(DllName: string); procedure On1201(var Message: Tmessage); message 1201; //电子称 public { Public declarations } end; var frmYarnElasticityWeighing: TfrmYarnElasticityWeighing; newh, newh1: hwnd; implementation uses U_DataLink, U_iniParam, U_RTFun, U_SCPerson, U_SCPersonColor, U_TSOKNO, U_ZDYHelp, U_CPSelBig; {$R *.dfm} procedure TfrmYarnElasticityWeighing.GetYarnTube(MTube: string); begin with ADOQueryTemp do begin Close; sql.Clear; sql.Add('select A.*,ZJM=dbo.getPinYin(A.ZdyName) from KH_ZDY A where A.Type=''YarnTubeType'' and ZDYName=' + quotedstr(MTube)); Open; end; btn_YarnTubeType.Text := Trim(ADOQueryTemp.fieldbyname('ZDYName').AsString); edt_YarnTubeWeight.Text := Trim(ADOQueryTemp.fieldbyname('Note').AsString); end; function TfrmYarnElasticityWeighing.TestData(): Boolean; begin try if Trim(edt_YarnRackNo.Text) = '' then raise Exception.Create('丝架号不能为空!'); if Self.edt_YarnRackNo.Text <> '木架' then begin with ADOQueryTemp do begin Close; sql.Clear; sql.Add('select YRNo,YRWeight from YE_YarnRack where YRNo= ' + QuotedStr(Self.edt_YarnRackNo.Text)); Open; end; if ADOQueryTemp.IsEmpty then raise Exception.Create('丝架号不存在!'); end; if Trim(CPInfo.Text) = '' then raise Exception.Create('没有选择品种!'); if (Trim(ZG1.Text) = '') and (Trim(ZG2.Text) = '') and (Trim(ZG3.Text) = '') and (Trim(ZG4.Text) = '') and (Trim(ZG5.Text) = '') and (Trim(ZG6.Text) = '') then raise Exception.Create('没有选择纸管颜色!'); if Trim(btn_YarnTubeType.Text) = '' then raise Exception.Create('纸管类型不能为空!'); if Trim(edt_YarnTubeWeight.Text) = '' then raise Exception.Create('纸管重量不能为空!'); if StrToFloatdef(edt_BoxCount.Text, 0) = 0 then begin InitJP('edt_BoxCount'); raise Exception.Create('颗数不能为0!'); end; if StrToFloatdef(SQty.Text, 0) = 0 then begin InitJP('SQty'); raise Exception.Create('重量不能为0!'); end; Result := True; except Result := false; TSInfo('提示', Exception(ExceptObject).Message); end; end; procedure TfrmYarnElasticityWeighing.InitYarnTubeColor(MColor: string); var i: Integer; begin with ADOQueryTemp do begin Close; sql.Clear; sql.Add('select * from YE_YarnTube_Color '); if trim(MColor) = '' then sql.Add(' where IsUse=1') else sql.Add(' where ColorName=' + QuotedStr(MColor)); Open; end; SCreateCDS(ADOQueryTemp, ClientDataSetYS); SInitCDSData(ADOQueryTemp, ClientDataSetYS); FYarnTubeColor := ''; for i := 1 to 6 do begin if ClientDataSetYS.Locate('Sindex', i, []) then begin TEdit(FindComponent('ZG' + inttostr(i))).Visible := True; TLabel(FindComponent('ZG' + inttostr(i) + 'C1')).Visible := True; TLabel(FindComponent('ZG' + inttostr(i) + 'C2')).Visible := True; TEdit(FindComponent('ZG' + inttostr(i))).Hint := ClientDataSetYS.fieldbyname('ColorName').AsString; TLabel(FindComponent('ZG' + inttostr(i) + 'C1')).Color := ClientDataSetYS.fieldbyname('ColorData1').AsInteger; TLabel(FindComponent('ZG' + inttostr(i) + 'C2')).Color := ClientDataSetYS.fieldbyname('ColorData2').AsInteger; if (trim(MColor) <> '') and (i = 1) then begin TEdit(FindComponent('ZG' + inttostr(i))).Text := '√'; FYarnTubeColor := ClientDataSetYS.fieldbyname('ColorName').AsString; end else TEdit(FindComponent('ZG' + inttostr(i))).Text := ''; end else begin TEdit(FindComponent('ZG' + inttostr(i))).Visible := False; TLabel(FindComponent('ZG' + inttostr(i) + 'C1')).Visible := False; TLabel(FindComponent('ZG' + inttostr(i) + 'C2')).Visible := False; TEdit(FindComponent('ZG' + inttostr(i))).Text := ''; end; end; end; procedure TfrmYarnElasticityWeighing.FormDestroy(Sender: TObject); begin inherited; frmYarnElasticityWeighing := nil; end; procedure TfrmYarnElasticityWeighing.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 TfrmYarnElasticityWeighing.btnSampleSelClick(Sender: TObject); var i: Integer; begin FYarnTubeColor := ''; try frmCPSelBig := TfrmCPSelBig.Create(Self); with frmCPSelBig do begin if ShowModal = 1 then begin CPInfo.Hint := FHMainId; btn_YarnTubeType.Text := ''; edt_YarnTubeWeight.Text := ''; end; end; finally frmCPSelBig.Close; end; with ADOQueryTemp do begin Close; sql.Clear; sql.Add('select * from YE_Plan_Main where Mainid=''' + Trim(CPInfo.Hint) + ''''); Open; end; with ADOQueryTemp do begin FOrderNo := Trim(fieldbyname('OrderNo').AsString); FMainid := Trim(fieldbyname('Mainid').AsString); FFtyNo := Trim(fieldbyname('FtyNo').AsString); FFtyName := Trim(fieldbyname('FtyName').AsString); FY_Code := Trim(fieldbyname('Y_Code').AsString); FY_Name := Trim(fieldbyname('Y_Name').AsString); FYE_Code := Trim(fieldbyname('YE_Code').AsString); FYE_Name := Trim(fieldbyname('YE_Name').AsString); FY_Spec := Trim(fieldbyname('Y_Spec').AsString); FY_Color := Trim(fieldbyname('Y_Color').AsString); FBatchNo := Trim(fieldbyname('BatchNo').AsString); FBoxCount := Trim(fieldbyname('BoxCount').AsString); FYarnRackCount := Trim(fieldbyname('YarnRackCount').AsString); FPaperBoxWeight := Trim(fieldbyname('PaperBoxWeight').AsString); end; ADOQueryTemp.Close; CPInfo.Text := ' ' + #13 + '原丝品名:' + Trim(FY_Name) + #13 + #13; CPInfo.Text := CPInfo.Text + '规格:' + Trim(FY_Spec) + #13 + #13; CPInfo.Text := CPInfo.Text + '原丝颜色:' + Trim(FY_Color) + #13 + #13; CPInfo.Text := CPInfo.Text + '成品品名:' + Trim(FYE_Name) + #13 + #13; CPInfo.Text := CPInfo.Text + '批号:' + #13 + Trim(FBatchNo) + #13 + #13; CPInfo.Text := CPInfo.Text + '纸箱重量:' + Trim(FPaperBoxWeight) + #13 + #13; CPInfo.Text := CPInfo.Text + '纸管颗数:' + Trim(FBoxCount); edt_BoxCount.Text := FBoxCount; //////////////////////////////// with ADOQueryTemp do begin Close; sql.Clear; sql.Add('select * from YE_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; InitYarnTubeColor(''); edt_YarnRackNo.SetFocus; end; procedure TfrmYarnElasticityWeighing.TBCloseClick(Sender: TObject); begin Close; end; procedure TfrmYarnElasticityWeighing.FormClose(Sender: TObject; var Action: TCloseAction); begin inherited; CloseCom(DZCDYDllName); Action := caFree; end; procedure TfrmYarnElasticityWeighing.Button1Click(Sender: TObject); begin Close; end; procedure TfrmYarnElasticityWeighing.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 TfrmYarnElasticityWeighing.SQtyClick(Sender: TObject); begin InitJP(Trim(TEdit(Sender).Name)); end; procedure TfrmYarnElasticityWeighing.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; TEdit(FindComponent(FName)).SetFocus; end; procedure TfrmYarnElasticityWeighing.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 TfrmYarnElasticityWeighing.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 TfrmYarnElasticityWeighing.SaveData(DataType: string): Boolean; var maxno, FMJID: string; begin FMJID := ''; try ADOCmd.Connection.BeginTrans; ///保存主表 if GetLSNo(ADOCmd, maxno, 'YE' + Trim(SCXFlag), 'YE_Yarn_Inspect', 4, 1) = False then raise Exception.Create(pchar('生成流水号异常!')); with ADOCmd do begin Close; sql.Clear; SQL.Add('select * from YE_Yarn_Inspect where YIID=''' + Trim(FMJID) + ''''); Open; end; with ADOCmd do begin Append; FieldByName('FillID').Value := Trim(DCode); FieldByName('Filler').Value := Trim(DName); FieldByName('FillTime').Value := SGetServerDateTime(ADOQueryTemp); FieldByName('YIID').Value := Trim(maxno); FieldByName('OrderNo').Value := Trim(FOrderNo); FieldByName('Mainid').Value := Trim(FMainid); FieldByName('FtyNo').value := FFtyNo; FieldByName('FtyName').value := FFtyName; FieldByName('Y_Code').value := Trim(FY_Code); FieldByName('Y_Name').value := Trim(FY_Name); FieldByName('Y_Spec').value := Trim(FY_Spec); FieldByName('Y_Color').value := Trim(FY_Color); FieldByName('BatchNo').value := Trim(FBatchNo); FieldByName('YE_Code').value := Trim(FYE_Code); FieldByName('YE_Name').value := Trim(FYE_Name); FieldByName('MachNO').value := Trim(MachNO.Text); FieldByName('Grade').value := Trim(Grade.Text); FieldByName('YarnTubeColor').value := Trim(FYarnTubeColor); FieldByName('YIIOFlag').Value := '未入库'; FieldByName('YarnTubeType').Value := trim(btn_YarnTubeType.Text); //纸管类型 FieldByName('YarnTubeWeight').Value := StrToFloatdef(trim(edt_YarnTubeWeight.Text), 0); //纸管重量 FieldByName('BoxCount').Value := StrToFloatdef(trim(edt_BoxCount.Text), 0); //装箱数量 FieldByName('PaperBoxWeight').Value := StrToFloatdef(trim(FPaperBoxWeight), 0); //纸箱重量 FieldByName('YarnRackWeight').Value := StrToFloatdef(trim(edt_YarnRackWeight.Text), 0); //丝架重量 FieldByName('YarnRackNo').Value := trim(edt_YarnRackNo.Text); FieldByName('PacketType').Value := trim(PacketType.Text); FieldByName('GrossWeight').Value := StrToFloatdef(trim(SQty.Text), 0); FieldByName('NetWeight').Value := 0; FieldByName('YIMachNo').Value := Trim(SCXFlag); Post; end; FMJID := trim(maxno); FFFMJID := FMJID; ////////////////////////净重、出入库及库存///////////////////////////////////// with ADOCmd do begin Close; sql.Clear; sql.Add('exec P_YE_Insp_In_Stk @YIID=''' + trim(FMJID) + ''''); open; end; if ADOCmd.FieldByName('intReturn').AsInteger = -1 then raise Exception.Create(pchar(trim(ADOCmd.FieldByName('ShowMsg').AsString))); ////////////////////////净重、出入库及库存///////////////////////////////////// with ADOQueryTemp do begin Close; sql.Clear; SQL.Add('select * from YE_Yarn_Inspect where YIID=''' + Trim(maxno) + ''''); Open; end; with ClientDataSet1 do begin Append; FieldByName('YIID').Value := Trim(maxno); FieldByName('BoxCount').Value := trim(edt_BoxCount.Text); FieldByName('YarnTubeType').Value := trim(btn_YarnTubeType.Text); FieldByName('YarnTubeColor').value := FYarnTubeColor; FieldByName('YarnTubeWeight').Value := trim(edt_YarnTubeWeight.Text); FieldByName('GrossWeight').Value := ADOQueryTemp.fieldbyname('GrossWeight').Value; FieldByName('NetWeight').Value := ADOQueryTemp.fieldbyname('NetWeight').Value; FieldByName('MachNO').Value := ADOQueryTemp.fieldbyname('MachNO').Value; Post; end; ADOCmd.Connection.CommitTrans; Result := True; except Result := False; ADOCmd.Connection.RollbackTrans; application.MessageBox(PChar(Exception(ExceptObject).Message), '提示信息', 0); end; end; procedure TfrmYarnElasticityWeighing.PrtData(MYIID: string); var fPrintFile: string; begin ExportFtErpFile('加弹丝标签.rmf', ADOQueryTemp); fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\加弹丝标签.rmf'; with ADOQueryPrint do begin Close; SQL.Clear; sql.Add(' exec P_YE_Insp_Prt_Lab ''' + Trim(MYIID) + ''''); Open; end; if ADOQueryPrint.IsEmpty then begin application.MessageBox('标签内容未找到!', '提示信息', MB_ICONERROR); exit; end; if FileExists(fPrintFile) then begin RM2.LoadFromFile(fPrintFile); Rm2.DefaultCopies := strtointdef(trim(ComboBox1.Text), 1); RM2.PrintReport; end else begin Application.MessageBox(PChar('没有找' + fPrintFile), '提示', 0); end; end; procedure TfrmYarnElasticityWeighing.Button3Click(Sender: TObject); var FReal: Double; FStr: string; begin if TestData() = false then exit; if TSInfo('选择', '确定要打印数据吗?数据打印后数据将不能修改!') then begin if SaveData('手输') then begin PrtData(Trim(FFFMJID)); SQty.Text := ''; end; end; end; function TfrmYarnElasticityWeighing.TSInfo(MOKNOFlag, MTSStr: string): Boolean; begin try frmTSOKNO := TfrmTSOKNO.Create(Application); with frmTSOKNO do begin frmTSOKNO.TSStr := MTSStr; frmTSOKNO.OKNOFlag := MOKNOFlag; if ShowModal = 1 then begin Result := retbol; end; end; finally frmTSOKNO.Free; end; end; procedure TfrmYarnElasticityWeighing.InitGrid(); begin with ADOQueryTemp do begin Close; sql.Clear; sql.Add('select * from YE_Yarn_Inspect where Convert(varchar(10),FillTime,120)=Convert(varchar(10),Getdate(),120)'); sql.Add(' and Filler=''' + Trim(DName) + ''' order by FillTime desc '); Open; end; SCreateCDS(ADOQueryTemp, ClientDataSet1); SInitCDSData(ADOQueryTemp, ClientDataSet1); end; procedure TfrmYarnElasticityWeighing.FormShow(Sender: TObject); var fsj: string; begin inherited; fsj := 'select Name=ZdyName from KH_Zdy where Type=''Grade'' '; SInitComBoxBySql(ADOQueryTemp, Grade, True, fsj); InitYarnTubeColor(''); FYarnTubeColor := ''; InitGrid(); if DZCDYDllName <> '' then begin OpenCom(DZCDYDllName); end; end; procedure TfrmYarnElasticityWeighing.Edit13Click(Sender: TObject); begin if Trim(Edit13.Text) = '' then begin Edit13.Text := '√'; OpenCom(DZCDYDllName); end else begin Edit13.Text := ''; CloseCom(DZCDYDllName) end; end; procedure TfrmYarnElasticityWeighing.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 TfrmYarnElasticityWeighing.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 TfrmYarnElasticityWeighing.Button2Click(Sender: TObject); begin if ClientDataSet1.IsEmpty then Exit; if TSInfo('选择', '确定要重打标签吗?') then begin PrtData(Trim(ClientDataSet1.fieldbyname('YIID').AsString)); end; end; procedure TfrmYarnElasticityWeighing.Button4Click(Sender: TObject); begin try frmSCPerson := TfrmSCPerson.Create(self); with frmSCPerson do begin FType := '纱架'; if ShowModal = 1 then begin Self.edt_YarnRackWeight.Text := FYarnRackWeight; Self.edt_YarnRackNo.Text := FYarnRackNo; Self.PacketType.Text := '纱架'; self.edt_BoxCount.Text := '60'; end; end; finally frmSCPerson.close; end; end; procedure TfrmYarnElasticityWeighing.ZG1Click(Sender: TObject); var Fint, i: Integer; begin TEdit(Sender).Text := '√'; FYarnTubeColor := TEdit(Sender).Hint; 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 TfrmYarnElasticityWeighing.edt_YarnRackNoKeyPress(Sender: TObject; var Key: Char); begin if Key = #13 then begin with ADOQueryTemp do begin Close; sql.Clear; sql.Add('select YRNo,YRWeight from YE_YarnRack where YRNo= ' + QuotedStr(Self.edt_YarnRackNo.Text)); Open; end; if ADOQueryTemp.IsEmpty then begin Self.edt_YarnRackWeight.Text := ''; Self.edt_YarnRackNo.Text := ''; self.edt_BoxCount.Text := ''; end else begin Self.edt_YarnRackWeight.Text := ADOQueryTemp.fieldbyname('YRWeight').asstring; Self.edt_YarnRackNo.Text := ADOQueryTemp.fieldbyname('YRNo').asstring; self.edt_BoxCount.Text := '60'; end; end; end; procedure TfrmYarnElasticityWeighing.Button5Click(Sender: TObject); begin try frmSCPerson := TfrmSCPerson.Create(self); with frmSCPerson do begin FType := '板'; if ShowModal = 1 then begin Self.edt_YarnRackWeight.Text := FYarnRackWeight; Self.edt_YarnRackNo.Text := FYarnRackNo; Self.PacketType.Text := '板'; self.edt_BoxCount.Text := '120'; end; end; finally frmSCPerson.close; end; end; procedure TfrmYarnElasticityWeighing.Button6Click(Sender: TObject); begin try frmSCPerson := TfrmSCPerson.Create(self); with frmSCPerson do begin FType := '纸箱'; if ShowModal = 1 then begin Self.edt_YarnRackWeight.Text := FYarnRackWeight; Self.edt_YarnRackNo.Text := FYarnRackNo; Self.PacketType.Text := '纸箱'; self.edt_BoxCount.Text := ''; end; end; finally frmSCPerson.close; end; end; procedure TfrmYarnElasticityWeighing.cxButtonEdit1PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer); begin try frmZDYHelp := TfrmZDYHelp.Create(Application); with frmZDYHelp do begin flag := 'YarnTubeType'; flagname := '纸管类型'; V1Name.Caption := '纸管类型'; V1Note.Caption := '纸管重量'; fnote := True; if ShowModal = 1 then begin btn_YarnTubeType.Text := Trim(ClientDataSet1.fieldbyname('ZDYName').AsString); edt_YarnTubeWeight.Text := Trim(ClientDataSet1.fieldbyname('Note').AsString); end; end; finally frmZDYHelp.Free; end; end; procedure TfrmYarnElasticityWeighing.Button7Click(Sender: TObject); begin try frmSCPersonColor := TfrmSCPersonColor.Create(self); with frmSCPersonColor do begin if ShowModal = 1 then begin FYarnTubeColor := FColor; InitYarnTubeColor(FColor); end; end; finally frmSCPersonColor.close; end; end; procedure TfrmYarnElasticityWeighing.Button8Click(Sender: TObject); begin GetYarnTube('塑料管'); end; procedure TfrmYarnElasticityWeighing.Button9Click(Sender: TObject); begin GetYarnTube('新管'); end; procedure TfrmYarnElasticityWeighing.Button10Click(Sender: TObject); begin GetYarnTube('二次管'); end; end.