unit U_ShuttleClothSCInPut; 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; type TfrmClothSCInPut = class(TForm) ToolBar1: TToolBar; TBSave: TToolButton; TBClose: TToolButton; ADOQueryTemp: TADOQuery; DS_YarnJX: TDataSource; CDS_YarnJX: TClientDataSet; ADOQueryCmd: TADOQuery; ScrollBox1: TScrollBox; Label1: TLabel; Label2: TLabel; Label3: TLabel; Label14: TLabel; Label18: TLabel; Label22: TLabel; Label5: TLabel; Label4: TLabel; Label8: TLabel; Label13: TLabel; Label16: TLabel; Label26: TLabel; Label31: TLabel; Label42: TLabel; Label44: TLabel; Label45: TLabel; Label47: TLabel; Label54: TLabel; Label43: TLabel; QDDate: TDateTimePicker; SYRName: TcxButtonEdit; DeliveryDate: TDateTimePicker; P_Color: TEdit; PiQty: TEdit; Qty: TEdit; LabName: TComboBox; KHConNo: TEdit; BatchNo: TEdit; P_Spec: TRichEdit; P_KZ: TEdit; P_MF: TEdit; P_Code: TcxButtonEdit; P_CodeName: TEdit; KHName: TcxButtonEdit; YWY: TcxButtonEdit; Label7: TLabel; OrderNo: TEdit; ConNo: TcxButtonEdit; ConSubId: TEdit; Ku_Hao: TEdit; Label9: TLabel; Ku_NeiQty: TEdit; Label15: TLabel; Ku_BianQty: TEdit; Label17: TLabel; MF_Nei: TEdit; Label19: TLabel; MF_Bian: TEdit; Label20: TLabel; MF_Wai: TEdit; Label23: TLabel; JX_Nei: TEdit; Label25: TLabel; JX_Bian: TEdit; Label27: TLabel; JX_Wai: TEdit; Label21: TLabel; Label24: 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; Label6: TLabel; PiLen: TEdit; Label10: TLabel; Label12: TLabel; SJ_WM: TEdit; PB_NW: TEdit; Label29: TLabel; Label30: TLabel; FS_JM: TEdit; FS_WM: TEdit; Label32: TLabel; FS_WF: TEdit; Label33: TLabel; Label34: TLabel; FS_CFen: TEdit; Label35: TLabel; ConNoType: TComboBox; 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; YWBian: TMemo; cxStyleRepository1: TcxStyleRepository; cxStyle1: TcxStyle; Label36: TLabel; ZJPiLen: TEdit; TV1Column1: TcxGridDBColumn; lbl1: TLabel; QJXM: TEdit; lbl2: TLabel; JSXM: TEdit; TV2Column1: TcxGridDBColumn; P_Note: TMemo; Label37: TLabel; JSKZ: TEdit; Label38: TLabel; ISJSKZ: TComboBox; Label39: TLabel; kongjia: TEdit; qi_11: TEdit; qi_12: TEdit; qi_13: TEdit; qi_14: TEdit; Qi_9: TEdit; Qi_10: TEdit; Label40: TLabel; LLKZ: TEdit; Label41: TLabel; CHEJIAN: TcxButtonEdit; Label46: TLabel; YLSFXG: TComboBox; Label48: TLabel; ylxgtime: TDateTimePicker; 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; Label50: TLabel; KONGJIAWEI: 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 KHNamePropertiesButtonClick(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 ConNoPropertiesButtonClick(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 cxGridDBColumn3PropertiesEditValueChanged(Sender: TObject); 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 ISJSKZChange(Sender: TObject); procedure CHEJIANPropertiesButtonClick(Sender: TObject; AButtonIndex: Integer); procedure JSKZChange(Sender: TObject); procedure N1Click(Sender: TObject); procedure Edit1KeyPress(Sender: TObject; var Key: Char); procedure N2Click(Sender: TObject); procedure N3Click(Sender: TObject); private FXS, Fint, FRcore: Integer; procedure InitData(); function CheckData(): Boolean; procedure UPGYD(MMainId: string); procedure SCGYD(MMainId: 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 frmClothSCInPut: TfrmClothSCInPut; 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 TfrmClothSCInPut.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 TfrmClothSCInPut.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 TfrmClothSCInPut.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 TfrmClothSCInPut.CheckData(): Boolean; var mvalue, FReal: Double; maxConNo: string; begin try if Trim(ConNo.Text) = '' then raise Exception.Create('合同号不能为空!'); if Trim(OrderNo.Text) = '' then begin if GetLSNo(ADOQueryCmd, maxConNo, Trim(ConNo.Text + 'G'), 'PD_Plan_Main', 2, 0) = False then begin raise Exception.Create('生成流水号异常!!'); end; OrderNo.Text := maxConNo; end; // if Trim(p_CodeName.Text) = '' then // raise Exception.Create('产品名称不能为空!'); // if Trim(p_Code.Text) = '' then // raise Exception.Create('产品编号不能为空!'); if Trim(LabName.Text) = '' then raise Exception.Create('标签格式不能为空!'); if QDDate.Checked = False then raise Exception.Create('下单日期不能为空!'); if Trim(Qty.Text) <> '' then begin if TryStrToFloat(Qty.Text, FReal) = False then raise Exception.Create('订单数量非法数字!'); end; if Trim(PiQty.Text) = '' then raise Exception.Create('匹数不能为空!'); if TryStrToFloat(PiQty.Text, FReal) = False then raise Exception.Create('匹数非法数字!'); if Trim(PiLen.Text) = '' then raise Exception.Create('匹长不能为空!'); if TryStrToFloat(PiLen.Text, FReal) = False then raise Exception.Create('匹长非法数字!'); if TryStrToFloat(LLKZ.Text, FReal) = False then raise Exception.Create('理论克重非法数字!'); Result := True; except Result := false; application.MessageBox(PChar(Exception(ExceptObject).Message), '提示信息', 0); end; end; procedure TfrmClothSCInPut.TBCloseClick(Sender: TObject); begin ModalResult := 1; end; procedure TfrmClothSCInPut.InitData(); var PBNO, PBFlag: string; FXHInt: Integer; begin /////////////////刷新产品信息///////////////////////// with ADOQueryTemp do begin Close; SQL.Clear; sql.Add(' select A.*,B.* from PD_Plan_Main A inner join PD_Plan_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_Plan_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_Plan_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; Append; FieldByName('PYXH').Value := '庚'; Post; end; end; /////////////////刷新经丝///////////////////////// /////////////////刷新纬丝///////////////////////// with ADOQueryTemp do begin Close; sql.Clear; sql.Add('select * from PD_Plan_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; Append; FieldByName('PYXH').Value := '庚'; Post; end; end; /////////////////刷新纬丝///////////////////////// if PState = 0 then begin QDDate.DateTime := SGetServerDate(ADOQueryTemp); ylxgtime.DateTime := SGetServerDate(ADOQueryTemp); QDDate.Checked := True; DeliveryDate.Date := QDDate.DateTime; kongjia.Text := '1'; kongjiawei.Text := '0'; end; if PState = 1 then begin ConNo.Enabled := False; OrderNo.Enabled := False; end; if FCopyInt = 1 then begin FMainId := ''; ConNo.Text := ''; ConNo.Enabled := True; OrderNo.Enabled := True; OrderNo.Text := ''; YLSFXG.ItemIndex := 1; /////////////////清除原料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; end; procedure TfrmClothSCInPut.ZDYHelp(FButn: TcxButtonEdit; LType: string); begin end; procedure TfrmClothSCInPut.FormShow(Sender: TObject); begin ToolBar2.Visible := False; InitData(); // 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 TfrmClothSCInPut.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, 'SM', 'PD_Plan_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_Plan_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_Plan_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; if YLSFXG.Text = '是' then begin FieldByName('YLXGtime').value := FormatDateTime('yyyy-MM-dd', YLXGtime.DateTime); end else begin FieldByName('YLXGtime').value := NULL; end; Post; end; with ADOQueryTemp do begin Close; sql.Clear; sql.Add('select * from PD_Plan_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, 'SS', 'PD_Plan_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_Plan_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_Plan_Sub', ScrollBox1, 2); RTSetsavedata(ADOQueryCmd, 'PD_Plan_Sub', ScrollBox2, 2); RTSetsavedata(ADOQueryCmd, 'PD_Plan_Sub', ScrollBox3, 2); Post; end; ///////////////////////////////////保存子表////////////////////////////// ///////////////////////////////////经丝组合////////////////////////////// if FRcore = 1 then begin with ADOQueryCmd do begin Close; sql.Clear; sql.Add('delete PD_Plan_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_Plan_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_Plan_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_Plan_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_Plan_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_Plan_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_Plan_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_Plan_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_Plan_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_Plan_QZ', 0); Post; end; CDS_QZ.Edit; CDS_QZ.FieldByName('QZID').Value := Trim(Qzmaxno); Next; end; end; ///////////////////////////////////起综工艺单////////////////////////////// ///////////////////////////////////更新是否开轴////////////////////////////// with ADOQueryCmd do begin Close; SQL.Clear; sql.Add('UPDATE Contract_Sub SET SFKGyiDan= ''已开'' '); SQL.Add(' FROM Contract_Sub A inner join Contract_Main B on B.ConMainId=A.ConMainId '); SQL.Add(' WHERE A.P_Code=' + QuotedStr(Trim(P_Code.Text))); SQL.Add(' and B.ConNo=' + QuotedStr(Trim(ConNo.Text))); //ShowMessage(SQL.Text); ExecSQL; end; with ADOQueryCmd do begin Close; SQL.Clear; sql.Add('insert into SY_SysLog(operor,opertime,Model,acction,opevent,result) values( '); sql.Add(' ' + quotedstr(trim(DName))); sql.Add(',getdate() '); sql.Add(',' + quotedstr(trim(self.Caption))); sql.Add(',' + quotedstr(trim('织造单起综法'))); sql.Add(',' + quotedstr(trim('单号:' + trim(maxno) + ' ;QI_1=' + Trim(QI_1.Text)))); sql.Add(',' + quotedstr(trim('成功'))); sql.Add(')'); ExecSQL; end; /////////////////////////////////更新是否开轴////////////////////////////// ADOQueryCmd.Connection.CommitTrans; FMainId := Trim(maxno); FSubId := Trim(maxsubno); Result := True; except Result := False; ADOQueryCmd.Connection.RollbackTrans; Application.MessageBox('保存失败!', '提示', 0); end; end; procedure TfrmClothSCInPut.TBSaveClick(Sender: TObject); var FReal: Double; maxConNo: string; begin QDDate.SetFocus; if CheckData() = False then begin exit; end; if SaveData() then begin SCGYD(Trim(FMainId)); Sleep(150); UPGYD(Trim(FMainId)); Application.MessageBox('保存成功!', '提示', 0); ModalResult := 1; end; end; procedure TfrmClothSCInPut.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 TfrmClothSCInPut.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_Spec.Text := frmCPSel.CDS_Main.fieldbyname('CYSpec').AsString; p_Color.Text := frmCPSel.CDS_Main.fieldbyname('CYColor').AsString; p_MF.Text := frmCPSel.CDS_Main.fieldbyname('CYMF').AsString; p_KZ.Text := frmCPSel.CDS_Main.fieldbyname('CYKZ').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 TfrmClothSCInPut.KHNamePropertiesButtonClick(Sender: TObject; AButtonIndex: Integer); begin try frmZdyAttachment := TfrmZdyAttachment.Create(Application); with frmZdyAttachment do begin if ShowModal = 1 then begin KHName.Text := Trim(CDS_HZ.fieldbyname('Name').AsString); end; end; finally frmZdyAttachment.Free; end; end; procedure TfrmClothSCInPut.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 TfrmClothSCInPut.C_CodeKeyPress(Sender: TObject; var Key: Char); begin if Key = #13 then begin Key := #0; SelectNext(ActiveControl as TWinControl, True, True); end; end; procedure TfrmClothSCInPut.ConNoKeyPress(Sender: TObject; var Key: Char); begin if Key = #13 then begin Key := #0; SelectNext(ActiveControl as TWinControl, True, True); end; end; procedure TfrmClothSCInPut.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 TfrmClothSCInPut.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 TfrmClothSCInPut.ConNoPropertiesButtonClick(Sender: TObject; AButtonIndex: Integer); begin try frmContractListSel := TfrmContractListSel.Create(Application); with frmContractListSel do begin fconNo := trim(self.ConNo.Text); if ShowModal = 1 then begin Order_Main.locate('SSel', true, []); self.ConNo.Text := Trim(frmContractListSel.Order_Main.fieldbyname('ConNo').AsString); self.KHConNo.Text := Trim(frmContractListSel.Order_Main.fieldbyname('BuyConNo').AsString); self.KHName.Text := Trim(frmContractListSel.Order_Main.fieldbyname('BuyName').AsString); self.YWY.Text := Trim(frmContractListSel.Order_Main.fieldbyname('YwyName').AsString); self.P_Code.Text := trim(frmContractListSel.Order_Main.Fieldbyname('P_Code').AsString); self.P_CodeName.Text := trim(frmContractListSel.Order_Main.Fieldbyname('P_Name').AsString); self.P_Spec.Text := trim(frmContractListSel.Order_Main.Fieldbyname('P_Spec').AsString); self.P_MF.Text := trim(frmContractListSel.Order_Main.Fieldbyname('P_MF').AsString); self.P_KZ.Text := trim(frmContractListSel.Order_Main.Fieldbyname('P_KZ').AsString); self.PiQty.Text := trim(frmContractListSel.Order_Main.Fieldbyname('PiQty').AsString); self.PiLen.Text := trim(frmContractListSel.Order_Main.Fieldbyname('PiLen').AsString); self.P_Color.Text := trim(frmContractListSel.Order_Main.Fieldbyname('P_Color').AsString); // self.PiQty.Text := frmContractListSel.Order_Main.Fieldbyname('PiQty').AsString; self.Qty.Text := frmContractListSel.Order_Main.Fieldbyname('Qty').AsString; self.ConSubId.Text := trim(frmContractListSel.Order_Main.Fieldbyname('ConSubId').AsString); if trim(frmContractListSel.Order_Main.Fieldbyname('DDLX').AsString) <> '' then self.ConNoType.Text := trim(frmContractListSel.Order_Main.Fieldbyname('DDLX').AsString); self.QDDate.Date := frmContractListSel.Order_Main.FieldByName('ConDate').asdatetime; self.DeliveryDate.Date := frmContractListSel.Order_Main.FieldByName('SubDlyDate').asdatetime; SJ_WM.Text := trim(frmContractListSel.Order_Main.Fieldbyname('sjwm').AsString); LLKZ.Text := trim(frmContractListSel.Order_Main.Fieldbyname('czkz').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(frmContractListSel.Order_Main.Fieldbyname('P_Code').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); 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(frmContractListSel.Order_Main.Fieldbyname('P_Code').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); 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 frmContractListSel.Free; end; end; procedure TfrmClothSCInPut.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 TfrmClothSCInPut.cxPageControl1Change(Sender: TObject); begin if cxPageControl1.ActivePageIndex = 3 then begin ToolBar2.Visible := True; end else ToolBar2.Visible := False; end; procedure TfrmClothSCInPut.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 TfrmClothSCInPut.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 TfrmClothSCInPut.cxGridDBColumn3PropertiesEditValueChanged(Sender: TObject); var mvalue, FFieldName: string; tvalue: Double; begin if ZJPiLen.Text <> '' then begin mvalue := TcxTextEdit(Sender).EditingText; if TryStrToFloat(mvalue, tvalue) = False then begin Application.MessageBox('克数非法,无法计算!', '提示', 0); CDS_YarnJX.FieldByName('Y_Qty').Value := ''; CDS_YarnJX.FieldByName('YLYLaing').Value := ''; Exit; end; if Trim(mvalue) = '' then begin mvalue := '0'; end; FFieldName := Trim(Tv1.Controller.FocusedColumn.DataBinding.FilterFieldName); with CDS_YarnJX do begin Edit; FieldByName(FFieldName).Value := Trim(mvalue); FieldbyName('YLYLaing').Value := format('%.2f', [(FieldByName('Y_Qty').AsFloat * StrToFloatDef(PiQty.Text, 0.00) * StrToFloatDef(ZJPiLen.Text, 0.00) * 1.01) / 1000]); Post; end; tv1.Controller.EditingController.ShowEdit(); end; end; procedure TfrmClothSCInPut.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 TfrmClothSCInPut.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 TfrmClothSCInPut.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 TfrmClothSCInPut.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 TfrmClothSCInPut.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 TfrmClothSCInPut.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 TfrmClothSCInPut.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 TfrmClothSCInPut.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 TfrmClothSCInPut.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 TfrmClothSCInPut.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 TfrmClothSCInPut.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 TfrmClothSCInPut.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 TfrmClothSCInPut.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 TfrmClothSCInPut.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 TfrmClothSCInPut.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 TfrmClothSCInPut.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 TfrmClothSCInPut.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 TfrmClothSCInPut.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 TfrmClothSCInPut.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 TfrmClothSCInPut.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 TfrmClothSCInPut.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 TfrmClothSCInPut.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 TfrmClothSCInPut.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 TfrmClothSCInPut.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 TfrmClothSCInPut.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 TfrmClothSCInPut.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 TfrmClothSCInPut.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 TfrmClothSCInPut.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 TfrmClothSCInPut.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 TfrmClothSCInPut.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 TfrmClothSCInPut.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 TfrmClothSCInPut.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 TfrmClothSCInPut.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 TfrmClothSCInPut.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 TfrmClothSCInPut.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 TfrmClothSCInPut.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 TfrmClothSCInPut.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 TfrmClothSCInPut.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 TfrmClothSCInPut.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 TfrmClothSCInPut.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 TfrmClothSCInPut.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 TfrmClothSCInPut.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 TfrmClothSCInPut.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 TfrmClothSCInPut.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 TfrmClothSCInPut.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 TfrmClothSCInPut.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 TfrmClothSCInPut.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 TfrmClothSCInPut.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 TfrmClothSCInPut.ISJSKZChange(Sender: TObject); begin if Trim(ISJSKZ.text) = '是' then begin kongjia.Text := '0.5'; end else begin kongjia.Text := '1'; JSKZ.Text := ''; end; end; procedure TfrmClothSCInPut.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 TfrmClothSCInPut.JSKZChange(Sender: TObject); begin if JSKZ.Text <> '' then begin ISJSKZ.ItemIndex := 0; kongjia.Text := '0.5'; end else begin ISJSKZ.ItemIndex := 1; kongjia.Text := '1'; end; end; procedure TfrmClothSCInPut.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 TfrmClothSCInPut.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; end; procedure TfrmClothSCInPut.N2Click(Sender: TObject); begin SelOKNo(CDS_QZ, True); end; procedure TfrmClothSCInPut.N3Click(Sender: TObject); begin SelOKNo(CDS_QZ, False); end; end.