unit U_ShuttleClothGYInPut; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData, cxDataStorage, cxEdit, DB, cxDBData, cxGridLevel, cxGridCustomTableView, cxGridTableView, cxGridDBTableView, cxClasses, cxControls, cxGridCustomView, cxGrid, cxMemo, cxRichEdit, ComCtrls, cxContainer, cxTextEdit, cxMaskEdit, cxButtonEdit, StdCtrls, ToolWin, DBClient, ADODB, ExtCtrls, BtnEdit, cxDropDownEdit, StrUtils, cxPC, ShellAPI, cxCalendar, Math, RichEdit, cxLookAndFeels, cxLookAndFeelPainters, dxBarBuiltInMenu, cxNavigator, RM_System, RM_Dataset, RM_Common, RM_Class, RM_GridReport, RM_e_Xls, RM_e_Graphic, RM_e_Jpeg, cxCheckBox, Menus, dxSkinsCore, dxSkinsDefaultPainters, dxSkinscxPCPainter, cxImage, cxDBEdit, getpic, IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient, IdFTP, dxSkinBlack, dxSkinBlue, dxSkinBlueprint, dxSkinCaramel, dxSkinCoffee, dxSkinDarkRoom, dxSkinDarkSide, dxSkinDevExpressDarkStyle, dxSkinDevExpressStyle, dxSkinFoggy, dxSkinGlassOceans, dxSkinHighContrast, dxSkiniMaginary, dxSkinLilian, dxSkinLiquidSky, dxSkinLondonLiquidSky, dxSkinMcSkin, dxSkinMetropolis, dxSkinMetropolisDark, dxSkinMoneyTwins, dxSkinOffice2007Black, dxSkinOffice2007Blue, dxSkinOffice2007Green, dxSkinOffice2007Pink, dxSkinOffice2007Silver, dxSkinOffice2010Black, dxSkinOffice2010Blue, dxSkinOffice2010Silver, dxSkinOffice2013DarkGray, dxSkinOffice2013LightGray, dxSkinOffice2013White, dxSkinPumpkin, dxSkinSeven, dxSkinSevenClassic, dxSkinSharp, dxSkinSharpPlus, dxSkinSilver, dxSkinSpringTime, dxSkinStardust, dxSkinSummer2008, dxSkinTheAsphaltWorld, dxSkinValentine, dxSkinVS2010, dxSkinWhiteprint, dxSkinXmas2008Blue; type TfrmClothGYInPut = class(TForm) ToolBar1: TToolBar; TBSave: TToolButton; TBClose: TToolButton; ADOQueryTemp: TADOQuery; DS_YarnJX: TDataSource; CDS_YarnJX: TClientDataSet; ADOQueryCmd: TADOQuery; ScrollBox1: TScrollBox; Label2: TLabel; Label3: TLabel; Label4: TLabel; Label16: TLabel; Label26: TLabel; Label54: TLabel; QDDate: TDateTimePicker; P_Color: TEdit; P_Code: TcxButtonEdit; P_CodeName: TEdit; Label7: TLabel; OrderNo: TEdit; ConSubId: TEdit; Ku_Hao: TEdit; Label9: TLabel; Ku_NeiQty: TEdit; Label20: TLabel; P_MF: TEdit; Label27: TLabel; JX_Wai: TEdit; Label21: TLabel; cxPageControl1: TcxPageControl; cxTabSheet1: TcxTabSheet; cxTabSheet2: TcxTabSheet; cxTabSheet4: TcxTabSheet; GroupBox1: TGroupBox; GroupBox2: TGroupBox; cxGrid2: TcxGrid; TV2: TcxGridDBTableView; cxGridDBColumn6: TcxGridDBColumn; cxGridDBColumn9: TcxGridDBColumn; cxGridDBColumn10: TcxGridDBColumn; cxGridLevel1: TcxGridLevel; V2Column1: TcxGridDBColumn; CDS_YarnWX: TClientDataSet; DS_YarnWX: TDataSource; cxGrid1: TcxGrid; TV1: TcxGridDBTableView; cxGridDBColumn1: TcxGridDBColumn; cxGridDBColumn2: TcxGridDBColumn; cxGridDBColumn3: TcxGridDBColumn; cxGridDBColumn4: TcxGridDBColumn; cxGridLevel2: TcxGridLevel; ScrollBox2: TScrollBox; Label11: TLabel; Label28: TLabel; Label10: TLabel; SJ_WM: TEdit; Label34: TLabel; QI_1: TEdit; QI_2: TEdit; QI_3: TEdit; QI_4: TEdit; QI_5: TEdit; QI_6: TEdit; QI_7: TEdit; QI_8: TEdit; Zong_9: TEdit; Zong_10: TEdit; Zong_11: TEdit; Zong_12: TEdit; Zong_13: TEdit; Zong_14: TEdit; Zong_15: TEdit; Zong_16: TEdit; QI_17: TEdit; QI_18: TEdit; QI_19: TEdit; QI_20: TEdit; QI_21: TEdit; QI_22: TEdit; QI_23: TEdit; QI_24: TEdit; Zong_25: TEdit; Zong_26: TEdit; Zong_27: TEdit; Zong_28: TEdit; Zong_29: TEdit; Zong_30: TEdit; Zong_31: TEdit; Zong_32: TEdit; Qi_33: TEdit; Qi_34: TEdit; Qi_35: TEdit; Qi_36: TEdit; Qi_37: TEdit; Qi_38: TEdit; Qi_39: TEdit; Qi_40: TEdit; Zong_41: TEdit; Zong_42: TEdit; Zong_43: TEdit; Zong_44: TEdit; Zong_45: TEdit; Zong_46: TEdit; Zong_47: TEdit; Zong_48: TEdit; cxTabSheet3: TcxTabSheet; cxGrid4: TcxGrid; TV4: TcxGridDBTableView; cxGridDBColumn5: TcxGridDBColumn; cxGridDBColumn7: TcxGridDBColumn; cxGridLevel3: TcxGridLevel; CDS_QZ: TClientDataSet; DS_QZ: TDataSource; ToolBar2: TToolBar; ToolButton1: TToolButton; ToolButton2: TToolButton; ChuanZong: TMemo; cxTabSheet5: TcxTabSheet; ScrollBox3: TScrollBox; Y_Note_PLJ: TMemo; Y_Note_PLW: TMemo; cxStyleRepository1: TcxStyleRepository; cxStyle1: TcxStyle; TV1Column1: TcxGridDBColumn; TV2Column1: TcxGridDBColumn; P_Note: TMemo; qi_11: TEdit; qi_12: TEdit; qi_13: TEdit; qi_14: TEdit; Qi_9: TEdit; Qi_10: TEdit; RMDB_WS: TRMDBDataSet; CDS_PWS: TClientDataSet; CDS_PJS: TClientDataSet; RMDB_JS: TRMDBDataSet; RMDB_Main: TRMDBDataSet; CDS_PM: TClientDataSet; RM1: TRMGridReport; RMXLSExport1: TRMXLSExport; RMJPEGExport1: TRMJPEGExport; TV4Column1: TcxGridDBColumn; PopupMenu1: TPopupMenu; N1: TMenuItem; Panel1: TPanel; Label49: TLabel; Edit1: TEdit; cds_qz2: TClientDataSet; N2: TMenuItem; N3: TMenuItem; Label37: TLabel; Label40: TLabel; JSKZ: TEdit; LLKZ: TEdit; Label17: TLabel; Label19: TLabel; M1: TEdit; M4: TEdit; Label23: TLabel; Label25: TLabel; M2: TEdit; M5: TEdit; Label29: TLabel; Label30: TLabel; M3: TEdit; M6: TEdit; Label1: TLabel; logs: TMemo; Picture4: TcxDBImage; Button1: TButton; ADOQueryImage: TADOQuery; DataSource1: TDataSource; IdFTP1: TIdFTP; TV1Column2: TcxGridDBColumn; TV2Column2: TcxGridDBColumn; YWBian: TMemo; Label15: TLabel; GYTYPE: TcxButtonEdit; Label5: TLabel; Label6: TLabel; zjprice: TEdit; procedure TBCloseClick(Sender: TObject); procedure FormShow(Sender: TObject); procedure TBSaveClick(Sender: TObject); procedure C_CodeNamePropertiesButtonClick(Sender: TObject; AButtonIndex: Integer); procedure C_CodePropertiesButtonClick(Sender: TObject; AButtonIndex: Integer); procedure PiKgQtyChange(Sender: TObject); procedure C_CodeKeyPress(Sender: TObject; var Key: Char); procedure ConNoKeyPress(Sender: TObject; var Key: Char); procedure cxGridDBColumn2PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer); procedure cxGridDBColumn6PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer); procedure ToolButton1Click(Sender: TObject); procedure cxPageControl1Change(Sender: TObject); procedure ToolButton2Click(Sender: TObject); procedure ScrollBox3MouseWheel(Sender: TObject; Shift: TShiftState; WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean); procedure Qi_34KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); procedure Qi_33KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); procedure QI_1KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); procedure QI_17KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); procedure QI_20KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); procedure QI_4KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); procedure Zong_41KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); procedure Zong_42KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); procedure Zong_28KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); procedure Zong_25KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); procedure Zong_12KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); procedure Zong_9KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); procedure Qi_35KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); procedure Qi_36KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); procedure QI_2KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); procedure QI_5KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); procedure QI_18KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); procedure QI_21KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); procedure Zong_10KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); procedure Zong_13KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); procedure Zong_26KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); procedure Zong_29KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); procedure Zong_44KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); procedure Zong_43KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); procedure Qi_37KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); procedure Qi_38KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); procedure Zong_45KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); procedure Zong_46KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); procedure Zong_30KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); procedure Zong_27KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); procedure Zong_14KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); procedure Zong_11KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); procedure QI_22KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); procedure QI_19KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); procedure QI_6KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); procedure QI_3KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); procedure Qi_39KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); procedure Qi_40KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); procedure Zong_47KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); procedure Zong_48KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); procedure QI_7KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); procedure QI_8KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); procedure QI_23KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); procedure QI_24KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); procedure Zong_15KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); procedure Zong_16KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); procedure Zong_31KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); procedure Zong_32KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); procedure CHEJIANPropertiesButtonClick(Sender: TObject; AButtonIndex: Integer); procedure N1Click(Sender: TObject); procedure Edit1KeyPress(Sender: TObject; var Key: Char); procedure N2Click(Sender: TObject); procedure N3Click(Sender: TObject); procedure Button1Click(Sender: TObject); procedure Picture4DblClick(Sender: TObject); procedure GYTYPEPropertiesButtonClick(Sender: TObject; AButtonIndex: Integer); private FXS, Fint, FRcore: Integer; procedure InitData(); function CheckData(): Boolean; procedure UPGYD(MMainId: string); procedure SCGYD(MMainId: string); procedure InitImage(); procedure SetXH(); procedure LookImage(FileName: string); procedure ZDYHelp(FButn: TcxButtonEdit; LType: string); procedure RichEditLineSpacing( //设置编辑框的行距 mRichEdit: TRichEdit; //Rich编辑框 mLineSpacingRule: Byte //行距 0~2 ); function SaveData(): Boolean; { Private declarations } public PState, FCopyInt: Integer; FMainId, FConNo, PType, FSubId: string; { Public declarations } end; var frmClothGYInPut: TfrmClothGYInPut; newh: hwnd; implementation uses U_DataLink, U_ZDYHelp, U_RTFun, U_ZdyAttachGYS, U_ContractListNXSel, U_CompressionFun, U_FjList_RZ, U_ZdyAttachment, U_ContractListSel, U_CPSel; {$R *.dfm} procedure TfrmClothGYInPut.SetXH(); var i: Integer; begin end; procedure TfrmClothGYInPut.LookImage(FileName: string); var sFieldName: string; // ff: TADOBlobStream; // FJStream : TMemoryStream; begin sFieldName := leftbstr(ExtractFilePath(Application.ExeName), 1) + ':\图片查看'; if not DirectoryExists(pchar(sFieldName)) then CreateDirectory(pchar(sFieldName), nil); sFieldName := sFieldName + '\' + trim(FileName); try IdFTP1.Host := ReadINIFileStr('SYSTEMSET.INI', 'SERVER', '服务器地址', '127.0.0.1'); IdFTP1.Username := 'three'; IdFTP1.Password := '641010'; IdFTP1.Connect(); except ; end; if IdFTP1.Connected then begin // Panel2.Caption:='正在下载数据,请稍等...'; // Panel2.Visible:=true; // application.ProcessMessages; try IdFTP1.Get('768\' + Trim(FileName), sFieldName, true, false); except // Panel2.Visible:=false; Application.MessageBox('客户图样文件不存在', '提示', MB_ICONWARNING); IdFTP1.Quit; Exit; end; end else begin // Panel2.Visible:=false; Application.MessageBox('无法连接文件服务器', '提示', MB_ICONWARNING); IdFTP1.Quit; Exit; end; // Panel2.Visible:=false; if IdFTP1.Connected then IdFTP1.Quit; ShellExecute(Handle, 'open', PChar(sFieldName), '', '', SW_SHOWNORMAL); end; procedure TfrmClothGYInPut.InitImage(); begin with ADOQueryImage do begin close; sql.Clear; sql.Add('select * from TP_File A'); sql.Add('where WBID=' + quotedstr(Trim(orderno.Text))); open; end; end; procedure TfrmClothGYInPut.SCGYD(MMainId: string); var fPrintFile, fImagePath2: string; i, j, k: integer; begin fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\织造工艺单.rmf'; ExportFtErpFile('织造工艺单.rmf', ADOQueryTemp); with ADOQueryTemp do begin Close; sql.Clear; sql.Add('select * from PD_Plan_Main A inner join PD_Plan_Sub B on A.Mainid=B.MainId where A.MainId=' + Quotedstr(Trim(MMainId))); Open; end; SCreateCDS20(ADOQueryTemp, CDS_PM); SInitCDSData20(ADOQueryTemp, CDS_PM); with ADOQueryTemp do begin Close; sql.Clear; sql.Add('select * from PD_Plan_Yarn where PYType=''经丝'' and MainId=' + Quotedstr(Trim(MMainId))); Open; end; SCreateCDS20(ADOQueryTemp, CDS_PJS); SInitCDSData20(ADOQueryTemp, CDS_PJS); with ADOQueryTemp do begin Close; sql.Clear; sql.Add('select * from PD_Plan_Yarn where PYType=''纬丝'' and MainId=' + Quotedstr(Trim(MMainId))); Open; end; SCreateCDS20(ADOQueryTemp, CDS_PWS); SInitCDSData20(ADOQueryTemp, CDS_PWS); if FileExists(fPrintFile) then begin RM1.LoadFromFile(fPrintFile); fImagePath2 := ExtractFilePath(Application.ExeName) + 'image\label0001.jpg'; if FileExists(fImagePath2) then DeleteFile(fImagePath2); fImagePath2 := ExtractFilePath(Application.ExeName) + 'image\label.jpg'; RM1.PrepareReport; RM1.ExportTo(RMJPEGExport1, fImagePath2); end else begin Application.MessageBox(PChar('没有找' + fPrintFile), '提示', 0); end; end; procedure TfrmClothGYInPut.UPGYD(MMainId: string); var OpenDiaLog: TOpenDialog; fFileName: string; fFilePath: string; maxNo: string; FJStream: TMemoryStream; mfileSize: integer; mCreationTime: TdateTime; mWriteTime: TdateTime; begin try adoqueryCmd.Connection.BeginTrans; fFilePath := ExtractFilePath(Application.ExeName) + 'image\label0001.jpg'; fFileName := 'label.jpg'; application.ProcessMessages; if GetLSNo(ADOQueryCmd, maxNo, 'FJ', 'TP_File', 4, 1) = False then begin adoqueryCmd.Connection.RollbackTrans; Application.MessageBox('取最大号失败!', '提示', 0); Exit; end; //获取文件信息 GetFileInfo(fFilePath, mfileSize, mCreationTime, mWriteTime); with adoqueryCmd do begin close; sql.Clear; sql.Add('delete from TP_File '); sql.Add('where TFType=''织造工艺单'' and WBID=' + quotedstr(Trim(MMainId))); execsql; end; try FJStream := TMemoryStream.Create; with adoqueryCmd do begin close; sql.Clear; sql.Add('select * from TP_File '); sql.Add('where TFID=' + quotedstr(trim(maxNo))); open; append; fieldbyname('TFID').Value := trim(maxNo); fieldbyname('WBID').Value := Trim(MMainId); fieldbyname('TFType').Value := trim('织造工艺单'); fieldbyname('Filler').Value := trim(DName); fieldbyname('FileName').Value := trim(fFileName); fieldbyname('TFDate').Value := mWriteTime; FJStream.LoadFromFile(fFilePath); CompressionStream(FJStream); tblobfield(FieldByName('Filesother')).LoadFromStream(FJStream); post; end; finally FJStream.Free; end; adoqueryCmd.Connection.CommitTrans; except adoqueryCmd.Connection.RollbackTrans; application.MessageBox('附件保存失败!', '提示信息', 0); end; end; procedure TfrmClothGYInPut.RichEditLineSpacing( //设置编辑框的行距 mRichEdit: TRichEdit; //Rich编辑框 mLineSpacingRule: Byte //行距 0~2 ); var vParaFormat2: ParaFormat2; begin if not Assigned(mRichEdit) then Exit; FillChar(vParaFormat2, SizeOf(vParaFormat2), 0); vParaFormat2.cbSize := SizeOf(ParaFormat2); vParaFormat2.dwMask := PFM_LINESPACING; vParaFormat2.bLineSpacingRule := mLineSpacingRule; vParaFormat2.dyLineSpacing := Ord(True); mRichEdit.Perform(EM_SETPARAFORMAT, 0, Longint(@vParaFormat2)); end; function TfrmClothGYInPut.CheckData(): Boolean; var mvalue, FReal: Double; maxConNo: string; begin try if QDDate.Checked = False then raise Exception.Create('制单日期不能为空!'); Result := True; except Result := false; application.MessageBox(PChar(Exception(ExceptObject).Message), '提示信息', 0); end; end; procedure TfrmClothGYInPut.TBCloseClick(Sender: TObject); begin ModalResult := 1; end; procedure TfrmClothGYInPut.InitData(); var PBNO, PBFlag, maxConNo: string; FXHInt: Integer; begin /////////////////刷新产品信息///////////////////////// with ADOQueryTemp do begin Close; SQL.Clear; sql.Add(' select A.*,B.* from PD_GY_Main A inner join PD_GY_Sub B on A.MainId=B.MainId'); if PState = 1 then begin sql.Add(' where A.MainId=' + Quotedstr(Trim(FMainId))); end; if PState = 0 then begin sql.Add(' where 1<>1 '); end; //ShowMessage(SQL.Text); Open; end; SCSHData(ADOQueryTemp, ScrollBox1, 1); SCSHData(ADOQueryTemp, ScrollBox1, 2); SCSHData(ADOQueryTemp, ScrollBox2, 2); SCSHData(ADOQueryTemp, ScrollBox3, 2); /////////////////刷新产品信息///////////////////////// /////////////////刷新穿综信息///////////////////////// // with ADOQueryTemp do // begin // Close; // sql.Clear; // sql.Add('select * from PD_Plan_CZ where MainId=''' + Trim(FMainId) + ''''); // Open; // end; // SCreateCDS20(ADOQueryTemp, CDS_Sub); // SInitCDSData20(ADOQueryTemp, CDS_Sub); // if CDS_Sub.IsEmpty then // begin // for FXHInt := 1 to 5 do // begin // with CDS_Sub do // begin // Append; // fieldbyname('XHao').value := FXHInt; // end; // end; // end; /////////////////刷新穿综信息///////////////////////// /////////////////刷新起综工艺单信息///////////////////////// with ADOQueryTemp do begin Close; sql.Clear; sql.Add('select * from PD_GY_QZ where MainId=''' + Trim(FMainId) + ''''); Open; end; SCreateCDS20(ADOQueryTemp, CDS_QZ); SInitCDSData20(ADOQueryTemp, CDS_QZ); /////////////////刷新起综工艺单信息///////////////////////// /////////////////刷新经丝///////////////////////// with ADOQueryTemp do begin Close; sql.Clear; sql.Add('select * from PD_GY_Yarn where PYType=''经丝'' and MainId=''' + Trim(FMainId) + ''''); Open; end; SCreateCDS20(ADOQueryTemp, CDS_YarnJX); SInitCDSData20(ADOQueryTemp, CDS_YarnJX); Y_Note_PLJ.Text := Trim(ADOQueryTemp.FieldByName('Y_Note_PL').AsString); if PState = 0 then begin with CDS_YarnJX do begin Append; FieldByName('PYXH').Value := '甲'; Post; Append; FieldByName('PYXH').Value := '乙'; Post; Append; FieldByName('PYXH').Value := '丙'; Post; Append; FieldByName('PYXH').Value := '丁'; Post; Append; FieldByName('PYXH').Value := '戊'; Post; Append; FieldByName('PYXH').Value := '己'; Post; end; end; /////////////////刷新经丝///////////////////////// /////////////////刷新纬丝///////////////////////// with ADOQueryTemp do begin Close; sql.Clear; sql.Add('select * from PD_GY_Yarn where PYType=''纬丝'' and MainId=''' + Trim(FMainId) + ''''); Open; end; SCreateCDS20(ADOQueryTemp, CDS_YarnWX); SInitCDSData20(ADOQueryTemp, CDS_YarnWX); Y_Note_PLW.Text := Trim(ADOQueryTemp.FieldByName('Y_Note_PL').AsString); if PState = 0 then begin with CDS_YarnWX do begin Append; FieldByName('PYXH').Value := '甲'; Post; Append; FieldByName('PYXH').Value := '乙'; Post; Append; FieldByName('PYXH').Value := '丙'; Post; Append; FieldByName('PYXH').Value := '丁'; Post; Append; FieldByName('PYXH').Value := '戊'; Post; Append; FieldByName('PYXH').Value := '己'; Post; end; end; /////////////////刷新纬丝///////////////////////// if PState = 0 then begin QDDate.DateTime := SGetServerDate(ADOQueryTemp); QDDate.Checked := True; end; if PState = 1 then begin OrderNo.Enabled := False; end; if FCopyInt = 1 then begin FMainId := ''; OrderNo.Enabled := True; OrderNo.Text := ''; /////////////////清除原料ID///////////////////////// CDS_YarnJX.DisableControls; with CDS_YarnJX do begin First; while not Eof do begin Edit; FieldByName('MainId').Value := ''; FieldByName('SubId').Value := ''; FieldByName('PYId').Value := ''; Post; Next; end; end; CDS_YarnJX.EnableControls; CDS_YarnWX.DisableControls; with CDS_YarnWX do begin First; while not Eof do begin Edit; FieldByName('MainId').Value := ''; FieldByName('SubId').Value := ''; FieldByName('PYId').Value := ''; Post; Next; end; end; CDS_YarnWX.EnableControls; CDS_QZ.DisableControls; with CDS_QZ do begin First; while not Eof do begin Edit; FieldByName('MainId').Value := ''; FieldByName('SubId').Value := ''; FieldByName('QZID').Value := ''; Post; Next; end; end; CDS_QZ.EnableControls; /////////////////清除原料ID///////////////////////// end; if Trim(OrderNo.Text) = '' then begin if GetLSNo(ADOQueryCmd, maxConNo, 'GY', 'PD_Plan_Main', 4, 1) = False then begin raise Exception.Create('生成流水号异常!!'); end; OrderNo.Text := maxConNo; end; end; procedure TfrmClothGYInPut.ZDYHelp(FButn: TcxButtonEdit; LType: string); begin end; procedure TfrmClothGYInPut.FormShow(Sender: TObject); begin ToolBar2.Visible := False; InitData(); InitImage(); // Y_Note_PLW.SelectAll; // RichEditLineSpacing(Y_Note_PLW, 0); // Y_Note_PLJ.SelectAll; // RichEditLineSpacing(Y_Note_PLJ, 0); // YWBian.SelectAll; // RichEditLineSpacing(YWBian, 0); end; function TfrmClothGYInPut.SaveData(): Boolean; var maxno, maxsubno, maxpbno, maxpzno, maxsjno, czmaxno, Qzmaxno: string; begin try ADOQueryCmd.Connection.BeginTrans; ///////////////////////////////////保存主表////////////////////////////// if Trim(FMainId) = '' then begin if GetLSNo(ADOQueryCmd, maxno, 'Y', 'PD_GY_Main', 4, 1) = False then begin ADOQueryCmd.Connection.RollbackTrans; Application.MessageBox('生成流水号异常!', '提示', 0); exit; end; end else begin maxno := Trim(FMainId); end; with ADOQueryCmd do begin Close; sql.Clear; SQL.Add('select * from PD_GY_Main where MainId=''' + Trim(FMainId) + ''''); Open; end; with ADOQueryCmd do begin if Trim(FMainId) = '' then begin Append; end else begin Edit; end; FieldByName('MainId').Value := Trim(maxno); RTSetsavedata(ADOQueryCmd, 'PD_GY_Main', ScrollBox1, 1); if Trim(FMainId) = '' then begin FieldByName('Filler').Value := Trim(DName); end else begin FieldByName('Editer').Value := Trim(DName); FieldByName('EditTime').Value := SGetServerDateTime(ADOQueryTemp); end; Post; end; with ADOQueryTemp do begin Close; sql.Clear; sql.Add('select * from PD_GY_Main where OrderNo=''' + Trim(OrderNo.Text) + ''''); Open; end; if ADOQueryTemp.RecordCount > 1 then begin ADOQueryCmd.Connection.RollbackTrans; Application.MessageBox('工艺单号重复!', '提示', 0); Exit; end; ///////////////////////////////////保存主表////////////////////////////// ///////////////////////////////////保存子表////////////////////////////// if Trim(FSubId) = '' then begin if GetLSNo(ADOQueryTemp, maxsubno, 'YS', 'PD_GY_Sub', 4, 1) = False then begin ADOQueryCmd.Connection.RollbackTrans; Application.MessageBox('取子流水号失败!', '提示', 0); Exit; end; end else begin maxsubno := Trim(FSubId); end; with ADOQueryCmd do begin Close; SQL.Clear; sql.Add('select * from PD_GY_Sub where '); sql.Add(' SubId=''' + Trim(maxsubno) + ''''); Open; end; with ADOQueryCmd do begin if Trim(FSubId) = '' then Append else Edit; FieldByName('MainId').Value := Trim(maxno); FieldByName('SubId').Value := Trim(maxsubno); RTSetsavedata(ADOQueryCmd, 'PD_GY_Sub', ScrollBox1, 2); RTSetsavedata(ADOQueryCmd, 'PD_GY_Sub', ScrollBox2, 2); RTSetsavedata(ADOQueryCmd, 'PD_GY_Sub', ScrollBox3, 2); Post; end; ///////////////////////////////////保存子表////////////////////////////// ///////////////////////////////////经丝组合////////////////////////////// if FRcore = 1 then begin with ADOQueryCmd do begin Close; sql.Clear; sql.Add('delete PD_GY_Yarn where SubId=''' + Trim(maxsubno) + ''''); ExecSQL; end; end; with CDS_YarnJX do begin First; while not Eof do begin if Trim(CDS_YarnJX.fieldbyname('PYId').AsString) = '' then begin if GetLSNo(ADOQueryTemp, maxpbno, 'PY', 'PD_GY_Yarn', 4, 1) = False then begin ADOQueryCmd.Connection.RollbackTrans; Application.MessageBox('经丝组合流水号失败!', '提示', 0); Exit; end; end else begin maxpbno := Trim(CDS_YarnJX.fieldbyname('PYId').AsString); end; with ADOQueryCmd do begin Close; SQL.Clear; sql.Add('select * from PD_GY_Yarn where '); sql.Add(' PYId=''' + Trim(maxpbno) + ''''); Open; end; with ADOQueryCmd do begin if Trim(CDS_YarnJX.fieldbyname('PYId').AsString) = '' then begin Append; FieldByName('Filler').Value := Trim(DName); FieldByName('FillTime').Value := SGetServerDateTime(ADOQueryTemp); end else begin Edit; FieldByName('Editer').Value := Trim(DName); FieldByName('EditTime').Value := SGetServerDateTime(ADOQueryTemp); end; FieldByName('PYType').Value := '经丝'; FieldByName('MainId').Value := Trim(maxno); FieldByName('SubId').Value := Trim(maxsubno); FieldByName('PYID').Value := Trim(maxpbno); FieldByName('Y_Note_PL').Value := Trim(Y_Note_PLJ.Text); RTSetSaveDataCDS(ADOQueryCmd, Tv1, CDS_YarnJX, 'PD_GY_Yarn', 0); Post; end; CDS_YarnJX.Edit; CDS_YarnJX.FieldByName('SubId').Value := Trim(maxsubno); CDS_YarnJX.FieldByName('MainId').Value := Trim(maxno); CDS_YarnJX.FieldByName('PYId').Value := Trim(maxpbno); Next; end; end; ///////////////////////////////////经丝组合////////////////////////////// ///////////////////////////////////纬丝组合////////////////////////////// with CDS_YarnWX do begin First; while not Eof do begin if Trim(CDS_YarnWX.fieldbyname('PYId').AsString) = '' then begin if GetLSNo(ADOQueryTemp, maxpbno, 'PY', 'PD_GY_Yarn', 4, 1) = False then begin ADOQueryCmd.Connection.RollbackTrans; Application.MessageBox('纬丝组合流水号失败!', '提示', 0); Exit; end; end else begin maxpbno := Trim(CDS_YarnWX.fieldbyname('PYId').AsString); end; with ADOQueryCmd do begin Close; SQL.Clear; sql.Add('select * from PD_GY_Yarn where '); sql.Add(' PYId=''' + Trim(maxpbno) + ''''); Open; end; with ADOQueryCmd do begin if Trim(CDS_YarnWX.fieldbyname('PYId').AsString) = '' then begin Append; FieldByName('Filler').Value := Trim(DName); FieldByName('FillTime').Value := SGetServerDateTime(ADOQueryTemp); end else begin Edit; FieldByName('Editer').Value := Trim(DName); FieldByName('EditTime').Value := SGetServerDateTime(ADOQueryTemp); end; FieldByName('PYType').Value := '纬丝'; FieldByName('MainId').Value := Trim(maxno); FieldByName('SubId').Value := Trim(maxsubno); FieldByName('PYID').Value := Trim(maxpbno); FieldByName('Y_Note_PL').Value := Trim(Y_Note_PLW.Text); RTSetSaveDataCDS(ADOQueryCmd, Tv2, CDS_YarnWX, 'PD_GY_Yarn', 0); Post; end; CDS_YarnJX.Edit; CDS_YarnJX.FieldByName('SubId').Value := Trim(maxsubno); CDS_YarnJX.FieldByName('MainId').Value := Trim(maxno); CDS_YarnJX.FieldByName('PYId').Value := Trim(maxpbno); Next; end; end; ///////////////////////////////////纬丝组合////////////////////////////// /////////////////////////////////穿综组合////////////////////////////// // with CDS_Sub do // begin // First; YLYLaing // while not Eof do // begin // if Trim(CDS_Sub.fieldbyname('CZID').AsString) = '' then // begin // if GetLSNo(ADOQueryCmd, czmaxno, 'CZ', 'PD_Plan_CZ', 4, 1) = False then // begin // ADOQueryCmd.Connection.RollbackTrans; // Application.MessageBox('取子流水号失败!', '提示', 0); // Exit; // end; // end // else // begin // czmaxno := Trim(CDS_Sub.fieldbyname('CZID').AsString); // end; // with ADOQueryCmd do // begin // Close; // SQL.Clear; // sql.Add('select * from PD_Plan_CZ where CZID=''' + Trim(czmaxno) + ''''); // Open; // end; // with ADOQueryCmd do // begin // if Trim(CDS_Sub.fieldbyname('CZID').AsString) = '' then // Append // else // Edit; // FieldByName('MainId').Value := Trim(maxno); // FieldByName('SubId').Value := Trim(maxsubno); // FieldByName('CZID').Value := Trim(czmaxno); // RTSetSaveDataCDS(ADOQueryCmd, Tv3, CDS_Sub, 'PD_Plan_CZ', 0); // Post; // end; // CDS_Sub.Edit; // CDS_Sub.FieldByName('CZID').Value := Trim(czmaxno); // // Next; // end; // end; /////////////////////////////////穿综组合////////////////////////////// ///////////////////////////////////起综工艺单////////////////////////////// with CDS_QZ do begin First; while not Eof do begin if Trim(CDS_QZ.fieldbyname('QZID').AsString) = '' then begin if GetLSNo(ADOQueryCmd, Qzmaxno, 'QZ', 'PD_GY_QZ', 4, 1) = False then begin ADOQueryCmd.Connection.RollbackTrans; Application.MessageBox('取子流水号失败!', '提示', 0); Exit; end; end else begin Qzmaxno := Trim(CDS_QZ.fieldbyname('QZID').AsString); end; with ADOQueryCmd do begin Close; SQL.Clear; sql.Add('select * from PD_GY_QZ where QZID=''' + Trim(Qzmaxno) + ''''); Open; end; with ADOQueryCmd do begin if Trim(CDS_QZ.fieldbyname('QZID').AsString) = '' then Append else Edit; FieldByName('MainId').Value := Trim(maxno); FieldByName('SubId').Value := Trim(maxsubno); FieldByName('QZID').Value := Trim(Qzmaxno); RTSetSaveDataCDS(ADOQueryCmd, Tv4, CDS_QZ, 'PD_GY_QZ', 0); Post; end; CDS_QZ.Edit; CDS_QZ.FieldByName('QZID').Value := Trim(Qzmaxno); Next; end; end; ///////////////////////////////////起综工艺单////////////////////////////// /////////////////////////////////更新是否开轴////////////////////////////// ADOQueryCmd.Connection.CommitTrans; FMainId := Trim(maxno); FSubId := Trim(maxsubno); Result := True; except Result := False; ADOQueryCmd.Connection.RollbackTrans; Application.MessageBox('保存失败!', '提示', 0); end; end; procedure TfrmClothGYInPut.TBSaveClick(Sender: TObject); var FReal: Double; maxConNo: string; I: Integer; begin QDDate.SetFocus; if CheckData() = False then begin exit; end; with CDS_QZ do begin First; I := 1; while not Eof do begin with CDS_QZ do begin Edit; FieldByName('XuNo').Value := I; Post; end; I := I + 1; Next; end; end; if SaveData() then begin // SCGYD(Trim(FMainId)); // Sleep(150); // UPGYD(Trim(FMainId)); Application.MessageBox('保存成功!', '提示', 0); ModalResult := 1; end; end; procedure TfrmClothGYInPut.C_CodeNamePropertiesButtonClick(Sender: TObject; AButtonIndex: Integer); var fsj: string; FWZ: Integer; begin fsj := Trim(TcxButtonEdit(Sender).Hint); FWZ := Pos('/', fsj); try frmZDYHelp := TfrmZDYHelp.Create(Application); with frmZDYHelp do begin flag := Copy(fsj, 1, FWZ - 1); flagname := Copy(fsj, FWZ + 1, Length(fsj) - FWZ); if ShowModal = 1 then begin TcxButtonEdit(Sender).Text := Trim(ClientDataSet1.fieldbyname('ZDYName').AsString); end; end; finally frmZDYHelp.Free; end; end; procedure TfrmClothGYInPut.C_CodePropertiesButtonClick(Sender: TObject; AButtonIndex: Integer); begin try frmCPSel := TfrmCPSel.Create(Application); with frmCPSel do begin if ShowModal = 1 then begin p_Code.Text := frmCPSel.CDS_Main.fieldbyname('CYNo').AsString; p_CodeName.Text := frmCPSel.CDS_Main.fieldbyname('CYName').AsString; p_Color.Text := frmCPSel.CDS_Main.fieldbyname('CYColor').AsString; /////////////////刷新经丝///////////////////////// with ADOQueryTemp do begin Close; sql.Clear; sql.Add('select B.* from CP_YDang A LEFT JOIN CP_Plan_Yarn B ON B.Y_CYID=A.CYID '); SQL.Add(' where B.PYType=''经丝'' and A.CYNo=''' + Trim(frmCPSel.CDS_Main.Fieldbyname('CYNo').AsString) + ''''); Open; end; if not ADOQueryTemp.IsEmpty then begin SCreateCDS20(ADOQueryTemp, CDS_YarnJX); SInitCDSData20(ADOQueryTemp, CDS_YarnJX); Y_Note_PLJ.Text := Trim(ADOQueryTemp.FieldByName('Y_Note_PL').AsString); if (PState = 1) and (FCopyInt <> 1) then begin FRcore := 1; end; end; /////////////////刷新经丝///////////////////////// /////////////////刷新纬丝///////////////////////// with ADOQueryTemp do begin Close; sql.Clear; sql.Add('select B.* from CP_YDang A LEFT JOIN CP_Plan_Yarn B ON B.Y_CYID=A.CYID '); SQL.Add(' where B.PYType=''纬丝'' and A.CYNo=''' + Trim(frmCPSel.CDS_Main.Fieldbyname('CYNo').AsString) + ''''); Open; end; if not ADOQueryTemp.IsEmpty then begin SCreateCDS20(ADOQueryTemp, CDS_YarnWX); SInitCDSData20(ADOQueryTemp, CDS_YarnWX); Y_Note_PLW.Text := Trim(ADOQueryTemp.FieldByName('Y_Note_PL').AsString); if (PState = 1) and (FCopyInt <> 1) then begin FRcore := 1; end; end; /////////////////刷新纬丝///////////////////////// /////////////////清除原料ID///////////////////////// CDS_YarnJX.DisableControls; with CDS_YarnJX do begin First; while not Eof do begin Edit; FieldByName('MainId').Value := ''; FieldByName('SubId').Value := ''; FieldByName('PYId').Value := ''; Post; Next; end; end; CDS_YarnJX.EnableControls; CDS_YarnWX.DisableControls; with CDS_YarnWX do begin First; while not Eof do begin Edit; FieldByName('MainId').Value := ''; FieldByName('SubId').Value := ''; FieldByName('PYId').Value := ''; Post; Next; end; end; CDS_YarnWX.EnableControls; /////////////////清除原料ID///////////////////////// end; end; finally frmCPSel.Free; end; end; procedure TfrmClothGYInPut.PiKgQtyChange(Sender: TObject); var FC_Qty, FPiKgQty: Double; begin // FC_Qty := StrToFloatDef(C_Qty.Text, 0); // FPiKgQty := StrToFloatDef(PiKgQty.Text, 0); // if FPiKgQty > 0 then // PiQty.Text := IntToStr(Ceil(FC_Qty / FPiKgQty)) // else // PiQty.Text := '0'; end; procedure TfrmClothGYInPut.C_CodeKeyPress(Sender: TObject; var Key: Char); begin if Key = #13 then begin Key := #0; SelectNext(ActiveControl as TWinControl, True, True); end; end; procedure TfrmClothGYInPut.ConNoKeyPress(Sender: TObject; var Key: Char); begin if Key = #13 then begin Key := #0; SelectNext(ActiveControl as TWinControl, True, True); end; end; procedure TfrmClothGYInPut.cxGridDBColumn2PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer); begin try frmZDYHelp := TfrmZDYHelp.Create(Application); with frmZDYHelp do begin flag := 'SXYCLName_JS'; flagname := '经纬丝名称'; fnote := True; V1Note.Caption := '类别'; if ShowModal = 1 then begin Self.CDS_YarnJX.Edit; Self.CDS_YarnJX.FieldByName('Y_Name').Value := Trim(ClientDataSet1.fieldbyname('ZDYName').AsString); end; end; finally frmZDYHelp.Free; end; end; procedure TfrmClothGYInPut.cxGridDBColumn6PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer); begin try frmZDYHelp := TfrmZDYHelp.Create(Application); with frmZDYHelp do begin flag := 'SXYCLName_JS'; flagname := '经纬丝名称'; fnote := True; V1Note.Caption := '类别'; if ShowModal = 1 then begin Self.CDS_YarnWX.Edit; Self.CDS_YarnWX.FieldByName('Y_Name').Value := Trim(ClientDataSet1.fieldbyname('ZDYName').AsString); end; end; finally frmZDYHelp.Free; end; end; procedure TfrmClothGYInPut.ToolButton1Click(Sender: TObject); var i, j: Integer; begin case cxPageControl1.ActivePageIndex of 3: begin for j := 0 to 5 do begin i := CDS_QZ.RecordCount; i := i + 1; with CDS_QZ do begin Append; FieldByName('SSEL').Value := FALSE; FieldByName('XuNO').Value := i; Post; end; end; end; end; end; procedure TfrmClothGYInPut.cxPageControl1Change(Sender: TObject); begin if cxPageControl1.ActivePageIndex = 3 then begin ToolBar2.Visible := True; end else ToolBar2.Visible := False; end; procedure TfrmClothGYInPut.ToolButton2Click(Sender: TObject); begin if CDS_QZ.IsEmpty then exit; if CDS_QZ.Locate('ssel', True, []) = False then begin Application.MessageBox('没有选择数据!', '提示', 0); Exit; end; if Application.MessageBox('确定要作废数据吗?作废后数据不能恢复。', '提示', 32 + 4) <> IDYES then Exit; CDS_QZ.DisableControls; with CDS_QZ do begin First; while not Eof do begin if CDS_QZ.FieldByName('SSel').AsBoolean = True then begin if Trim(CDS_QZ.fieldbyname('QZID').AsString) <> '' then with ADOQueryCmd do begin Close; sql.Clear; sql.Add('delete PD_Plan_QZ where QZID=''' + Trim(CDS_QZ.fieldbyname('QZID').AsString) + ''''); ExecSQL; end; CDS_QZ.Delete; end else Next; end; end; CDS_QZ.EnableControls; end; procedure TfrmClothGYInPut.ScrollBox3MouseWheel(Sender: TObject; Shift: TShiftState; WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean); begin if WheelDelta < 0 then ScrollBox3.Perform(WM_VSCROLL, SB_LINEDOWN, 0) else ScrollBox3.Perform(WM_VSCROLL, SB_LINEUP, 0); end; procedure TfrmClothGYInPut.Qi_34KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin if Key = vk_Left then ; if Key = vk_up then Qi_33.SetFocus; if Key = vk_RIGHT then QI_17.SetFocus; if Key = vk_down then Zong_41.SetFocus; end; procedure TfrmClothGYInPut.Qi_33KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin if Key = vk_Left then ; if Key = vk_up then ; if Key = vk_RIGHT then QI_1.SetFocus; if Key = vk_down then Qi_34.SetFocus; end; procedure TfrmClothGYInPut.QI_1KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin if Key = vk_Left then Qi_33.SetFocus; if Key = vk_up then ; if Key = vk_RIGHT then Qi_35.SetFocus; if Key = vk_down then QI_4.SetFocus; end; procedure TfrmClothGYInPut.QI_17KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin if Key = vk_Left then Qi_34.SetFocus; if Key = vk_up then QI_4.SetFocus; if Key = vk_RIGHT then Qi_36.SetFocus; if Key = vk_down then QI_20.SetFocus; end; procedure TfrmClothGYInPut.QI_20KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin if Key = vk_Left then Qi_34.SetFocus; if Key = vk_up then QI_17.SetFocus; if Key = vk_RIGHT then Qi_36.SetFocus; if Key = vk_down then Zong_9.SetFocus; end; procedure TfrmClothGYInPut.QI_4KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin if Key = vk_Left then Qi_33.SetFocus; if Key = vk_up then QI_1.SetFocus; if Key = vk_RIGHT then Qi_35.SetFocus; if Key = vk_down then QI_17.SetFocus; end; procedure TfrmClothGYInPut.Zong_41KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin if Key = vk_Left then ; if Key = vk_up then ; if Key = vk_RIGHT then Zong_9.SetFocus; if Key = vk_down then Zong_42.SetFocus; end; procedure TfrmClothGYInPut.Zong_42KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin if Key = vk_Left then ; if Key = vk_up then Zong_41.SetFocus; if Key = vk_RIGHT then Zong_25.SetFocus; if Key = vk_down then ; end; procedure TfrmClothGYInPut.Zong_28KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin if Key = vk_Left then Zong_42.SetFocus; if Key = vk_up then Zong_25.SetFocus; if Key = vk_RIGHT then Zong_44.SetFocus; if Key = vk_down then ; end; procedure TfrmClothGYInPut.Zong_25KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin if Key = vk_Left then Zong_42.SetFocus; if Key = vk_up then Zong_12.SetFocus; if Key = vk_RIGHT then Zong_44.SetFocus; if Key = vk_down then Zong_28.SetFocus; end; procedure TfrmClothGYInPut.Zong_12KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin if Key = vk_Left then Zong_41.SetFocus; if Key = vk_up then Zong_9.SetFocus; if Key = vk_RIGHT then Zong_43.SetFocus; if Key = vk_down then Zong_25.SetFocus; end; procedure TfrmClothGYInPut.Zong_9KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin if Key = vk_Left then Zong_41.SetFocus; if Key = vk_up then QI_20.SetFocus; if Key = vk_RIGHT then Zong_43.SetFocus; if Key = vk_down then Zong_12.SetFocus; end; procedure TfrmClothGYInPut.Qi_35KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin if Key = vk_Left then QI_1.SetFocus; if Key = vk_up then ; if Key = vk_RIGHT then QI_2.SetFocus; if Key = vk_down then Qi_36.SetFocus; end; procedure TfrmClothGYInPut.Qi_36KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin if Key = vk_Left then QI_17.SetFocus; if Key = vk_up then Qi_35.SetFocus; if Key = vk_RIGHT then QI_18.SetFocus; if Key = vk_down then Zong_43.SetFocus; end; procedure TfrmClothGYInPut.QI_2KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin if Key = vk_Left then Qi_35.SetFocus; if Key = vk_up then ; if Key = vk_RIGHT then Qi_37.SetFocus; if Key = vk_down then QI_5.SetFocus; end; procedure TfrmClothGYInPut.QI_5KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin if Key = vk_Left then Qi_35.SetFocus; if Key = vk_up then QI_2.SetFocus; if Key = vk_RIGHT then Qi_37.SetFocus; if Key = vk_down then QI_18.SetFocus; end; procedure TfrmClothGYInPut.QI_18KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin if Key = vk_Left then Qi_36.SetFocus; if Key = vk_up then QI_5.SetFocus; if Key = vk_RIGHT then Qi_38.SetFocus; if Key = vk_down then QI_21.SetFocus; end; procedure TfrmClothGYInPut.QI_21KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin if Key = vk_Left then Qi_36.SetFocus; if Key = vk_up then QI_18.SetFocus; if Key = vk_RIGHT then Qi_38.SetFocus; if Key = vk_down then Zong_10.SetFocus; end; procedure TfrmClothGYInPut.Zong_10KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin if Key = vk_Left then Zong_43.SetFocus; if Key = vk_up then QI_21.SetFocus; if Key = vk_RIGHT then Zong_45.SetFocus; if Key = vk_down then Zong_13.SetFocus; end; procedure TfrmClothGYInPut.Zong_13KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin if Key = vk_Left then Zong_43.SetFocus; if Key = vk_up then Zong_10.SetFocus; if Key = vk_RIGHT then Zong_45.SetFocus; if Key = vk_down then Zong_26.SetFocus; end; procedure TfrmClothGYInPut.Zong_26KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin if Key = vk_Left then Zong_44.SetFocus; if Key = vk_up then Zong_13.SetFocus; if Key = vk_RIGHT then Zong_46.SetFocus; if Key = vk_down then Zong_29.SetFocus; end; procedure TfrmClothGYInPut.Zong_29KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin if Key = vk_Left then Zong_44.SetFocus; if Key = vk_up then Zong_26.SetFocus; if Key = vk_RIGHT then Zong_46.SetFocus; if Key = vk_down then ; end; procedure TfrmClothGYInPut.Zong_44KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin if Key = vk_Left then Zong_25.SetFocus; if Key = vk_up then Zong_43.SetFocus; if Key = vk_RIGHT then Zong_26.SetFocus; if Key = vk_down then ; end; procedure TfrmClothGYInPut.Zong_43KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin if Key = vk_Left then Zong_9.SetFocus; if Key = vk_up then Qi_36.SetFocus; if Key = vk_RIGHT then Zong_10.SetFocus; if Key = vk_down then Zong_44.SetFocus; end; procedure TfrmClothGYInPut.Qi_37KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin if Key = vk_Left then QI_2.SetFocus; if Key = vk_up then ; if Key = vk_RIGHT then QI_3.SetFocus; if Key = vk_down then Qi_38.SetFocus; end; procedure TfrmClothGYInPut.Qi_38KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin if Key = vk_Left then QI_18.SetFocus; if Key = vk_up then Qi_37.SetFocus; if Key = vk_RIGHT then QI_19.SetFocus; if Key = vk_down then Zong_45.SetFocus; end; procedure TfrmClothGYInPut.Zong_45KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin if Key = vk_Left then Zong_10.SetFocus; if Key = vk_up then Qi_38.SetFocus; if Key = vk_RIGHT then Zong_11.SetFocus; if Key = vk_down then Zong_46.SetFocus; end; procedure TfrmClothGYInPut.Zong_46KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin if Key = vk_Left then Zong_26.SetFocus; if Key = vk_up then Zong_45.SetFocus; if Key = vk_RIGHT then Zong_27.SetFocus; if Key = vk_down then ; end; procedure TfrmClothGYInPut.Zong_30KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin if Key = vk_Left then Zong_46.SetFocus; if Key = vk_up then Zong_27.SetFocus; if Key = vk_RIGHT then Zong_48.SetFocus; if Key = vk_down then ; end; procedure TfrmClothGYInPut.Zong_27KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin if Key = vk_Left then Zong_46.SetFocus; if Key = vk_up then Zong_14.SetFocus; if Key = vk_RIGHT then Zong_48.SetFocus; if Key = vk_down then Zong_30.SetFocus; end; procedure TfrmClothGYInPut.Zong_14KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin if Key = vk_Left then Zong_45.SetFocus; if Key = vk_up then Zong_11.SetFocus; if Key = vk_RIGHT then Zong_47.SetFocus; if Key = vk_down then Zong_27.SetFocus; end; procedure TfrmClothGYInPut.Zong_11KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin if Key = vk_Left then Zong_45.SetFocus; if Key = vk_up then QI_22.SetFocus; if Key = vk_RIGHT then Zong_47.SetFocus; if Key = vk_down then Zong_14.SetFocus; end; procedure TfrmClothGYInPut.QI_22KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin if Key = vk_Left then Qi_38.SetFocus; if Key = vk_up then QI_19.SetFocus; if Key = vk_RIGHT then Qi_40.SetFocus; if Key = vk_down then Zong_11.SetFocus; end; procedure TfrmClothGYInPut.QI_19KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin if Key = vk_Left then Qi_38.SetFocus; if Key = vk_up then QI_6.SetFocus; if Key = vk_RIGHT then Qi_40.SetFocus; if Key = vk_down then QI_22.SetFocus; end; procedure TfrmClothGYInPut.QI_6KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin if Key = vk_Left then Qi_37.SetFocus; if Key = vk_up then QI_3.SetFocus; if Key = vk_RIGHT then Qi_39.SetFocus; if Key = vk_down then QI_19.SetFocus; end; procedure TfrmClothGYInPut.QI_3KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin if Key = vk_Left then Qi_37.SetFocus; if Key = vk_up then ; if Key = vk_RIGHT then Qi_39.SetFocus; if Key = vk_down then QI_6.SetFocus; end; procedure TfrmClothGYInPut.Qi_39KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin if Key = vk_Left then QI_3.SetFocus; if Key = vk_up then ; if Key = vk_RIGHT then ; if Key = vk_down then Qi_40.SetFocus; end; procedure TfrmClothGYInPut.Qi_40KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin if Key = vk_Left then QI_19.SetFocus; if Key = vk_up then Qi_39.SetFocus; if Key = vk_RIGHT then ; if Key = vk_down then Zong_47.SetFocus; end; procedure TfrmClothGYInPut.Zong_47KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin if Key = vk_Left then Zong_11.SetFocus; if Key = vk_up then Qi_40.SetFocus; if Key = vk_RIGHT then Zong_15.SetFocus; if Key = vk_down then Zong_48.SetFocus; end; procedure TfrmClothGYInPut.Zong_48KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin if Key = vk_Left then Zong_27.SetFocus; if Key = vk_up then Zong_47.SetFocus; if Key = vk_RIGHT then Zong_31.SetFocus; if Key = vk_down then ; end; procedure TfrmClothGYInPut.QI_7KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin if Key = vk_Left then Qi_39.SetFocus; if Key = vk_up then ; if Key = vk_RIGHT then ; if Key = vk_down then QI_8.SetFocus; end; procedure TfrmClothGYInPut.QI_8KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin if Key = vk_Left then Qi_39.SetFocus; if Key = vk_up then QI_7.SetFocus; if Key = vk_RIGHT then ; if Key = vk_down then QI_23.SetFocus; end; procedure TfrmClothGYInPut.QI_23KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin if Key = vk_Left then Qi_40.SetFocus; if Key = vk_up then QI_8.SetFocus; if Key = vk_RIGHT then ; if Key = vk_down then QI_24.SetFocus; end; procedure TfrmClothGYInPut.QI_24KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin if Key = vk_Left then Qi_40.SetFocus; if Key = vk_up then QI_23.SetFocus; if Key = vk_RIGHT then ; if Key = vk_down then Zong_15.SetFocus; end; procedure TfrmClothGYInPut.Zong_15KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin if Key = vk_Left then Zong_47.SetFocus; if Key = vk_up then QI_24.SetFocus; if Key = vk_RIGHT then ; if Key = vk_down then Zong_16.SetFocus; end; procedure TfrmClothGYInPut.Zong_16KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin if Key = vk_Left then Zong_47.SetFocus; if Key = vk_up then Zong_15.SetFocus; if Key = vk_RIGHT then ; if Key = vk_down then Zong_31.SetFocus; end; procedure TfrmClothGYInPut.Zong_31KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin if Key = vk_Left then Zong_48.SetFocus; if Key = vk_up then Zong_16.SetFocus; if Key = vk_RIGHT then ; if Key = vk_down then Zong_32.SetFocus; end; procedure TfrmClothGYInPut.Zong_32KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin if Key = vk_Left then Zong_48.SetFocus; if Key = vk_up then Zong_31.SetFocus; if Key = vk_RIGHT then ; if Key = vk_down then ; end; procedure TfrmClothGYInPut.CHEJIANPropertiesButtonClick(Sender: TObject; AButtonIndex: Integer); var fsj: string; FWZ: Integer; begin fsj := Trim(TcxButtonEdit(Sender).Hint); FWZ := Pos('/', fsj); try frmZDYHelp := TfrmZDYHelp.Create(Application); with frmZDYHelp do begin flag := Copy(fsj, 1, FWZ - 1); flagname := Copy(fsj, FWZ + 1, Length(fsj) - FWZ); if ShowModal = 1 then begin TcxButtonEdit(Sender).Text := Trim(ClientDataSet1.fieldbyname('ZDYName').AsString); end; end; finally frmZDYHelp.Free; end; end; procedure TfrmClothGYInPut.N1Click(Sender: TObject); var i, j, t, fxh: Integer; FQZGLV, t1: string; begin if CDS_QZ.IsEmpty then Exit; if CDS_QZ.Locate('SSel', True, []) = False then begin Application.MessageBox('没有选择数据', '提示', 0); Exit; end; t1 := '1'; if InputQuery('复制次数', ' 请输入复制次数到 ', t1) then begin end else begin exit; end; t := StrToIntdef(t1, 1); // with ADOQueryTemp do // begin // Close; // sql.Clear; // sql.Add('select * from PD_Plan_QZ where 1<>1'); // Open; // end; // SCreateCDS20(ADOQueryTemp, CDS_QZ2); // SInitCDSData20(ADOQueryTemp, CDS_QZ2); case cxPageControl1.ActivePageIndex of 3: begin CDS_QZ.DisableControls; for j := 0 to t - 1 do begin with CDS_QZ do begin First; while not Eof do begin if CDS_QZ.fieldbyname('SSEL').AsBoolean then begin FQZGLV := CDS_QZ.FIELDBYNAME('DZZQZGL').AsString; fxh := CDS_QZ.FIELDBYNAME('xuno').AsInteger; i := CDS_QZ.RecordCount; i := i + 1; with CDS_QZ do begin Append; FieldByName('SSEL').Value := FALSE; FieldByName('XuNO').Value := i; FieldByName('DZZQZGL').Value := FQZGLV; Post; end; CDS_QZ.locate('XuNO', fxh, []); end; Next; CDS_QZ.EnableControls; end; // while CDS_QZ.Locate('SSel', True, []) = True do // begin // // FQZGLV := CDS_QZ.FIELDBYNAME('DZZQZGL').AsString; // i := CDS_QZ.RecordCount; // i := i + 1; // Edit; // CDS_QZ.FieldByName('ssel').value := FALSE; // // with CDS_QZ do // begin // Append; // FieldByName('SSEL').Value := FALSE; // FieldByName('XuNO').Value := i; // FieldByName('DZZQZGL').Value := FQZGLV; // Post; // end; // // end; end; end; end; end; end; procedure TfrmClothGYInPut.Edit1KeyPress(Sender: TObject; var Key: Char); var i, j: Integer; begin if Key = #13 then begin case cxPageControl1.ActivePageIndex of 3: begin if Edit1.Text <> '' then begin i := CDS_QZ.RecordCount; i := i + 1; with CDS_QZ do begin Append; FieldByName('SSEL').Value := FALSE; FieldByName('XuNO').Value := i; FieldByName('DZZQZGL').Value := Trim(Edit1.Text); Post; end; Edit1.Text := ''; end; end; end; end; SetXH(); end; procedure TfrmClothGYInPut.N2Click(Sender: TObject); begin SelOKNo(CDS_QZ, True); end; procedure TfrmClothGYInPut.N3Click(Sender: TObject); begin SelOKNo(CDS_QZ, False); end; procedure TfrmClothGYInPut.Button1Click(Sender: TObject); begin if OrderNo.Text = '' then begin Application.MessageBox('单号不能为空', '提示', 0); Exit; end; FormGetPic := TFormGetPic.create(self); with FormGetPic do begin fFlileFlag := '768'; fkeyNo := trim(orderno.Text); pat1 := 'FileName'; pic1 := 'FilesOther'; FTFType := 'GY'; if showmodal = 1 then begin end; free; end; Initimage(); end; procedure TfrmClothGYInPut.Picture4DblClick(Sender: TObject); begin if TcxDBImage(Sender).Picture.Height = 0 then exit; LookImage(ADOQueryImage.fieldbyname(TcxDBImage(Sender).Hint).asstring); end; procedure TfrmClothGYInPut.GYTYPEPropertiesButtonClick(Sender: TObject; AButtonIndex: Integer); var fsj: string; FWZ: Integer; begin fsj := Trim(TcxButtonEdit(Sender).Hint); FWZ := Pos('/', fsj); try frmZDYHelp := TfrmZDYHelp.Create(Application); with frmZDYHelp do begin flag := Copy(fsj, 1, FWZ - 1); flagname := Copy(fsj, FWZ + 1, Length(fsj) - FWZ); if ShowModal = 1 then begin TcxButtonEdit(Sender).Text := Trim(ClientDataSet1.fieldbyname('ZDYName').AsString); end; end; finally frmZDYHelp.Free; end; end; end.