unit U_ClothInfoInput;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData, cxDataStorage,
  cxEdit, DB, cxDBData, ADODB, DBClient, cxGridLevel, cxGridCustomTableView,
  cxGridTableView, cxGridDBTableView, cxClasses, cxControls, cxGridCustomView,
  cxGrid, ComCtrls, ToolWin, cxGridCustomPopupMenu, cxGridPopupMenu, cxTextEdit,
  cxButtonEdit, StdCtrls, ExtCtrls, cxCurrencyEdit, BtnEdit, U_BaseList,
  cxLookAndFeels, cxLookAndFeelPainters, dxSkinsCore, dxSkinsDefaultPainters,
  cxNavigator, dxDateRanges, dxBarBuiltInMenu, cxCheckBox, cxDropDownEdit,
  dxSkinBasic, 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, dxSkinOffice2016Colorful,
  dxSkinOffice2016Dark, dxSkinOffice2019Black, dxSkinOffice2019Colorful,
  dxSkinOffice2019DarkGray, dxSkinOffice2019White, dxSkinPumpkin, dxSkinSeven,
  dxSkinSevenClassic, dxSkinSharp, dxSkinSharpPlus, dxSkinSilver,
  dxSkinSpringtime, dxSkinStardust, dxSkinSummer2008, dxSkinTheAsphaltWorld,
  dxSkinTheBezier, dxSkinValentine, dxSkinVisualStudio2013Blue,
  dxSkinVisualStudio2013Dark, dxSkinVisualStudio2013Light, dxSkinVS2010,
  dxSkinWhiteprint, dxSkinWXI, dxSkinXmas2008Blue, cxContainer, cxLabel, cxPC,
  dxScrollbarAnnotations, cxMaskEdit, Vcl.Menus, cxButtons;

type
  TfrmClothInfoInput = class(TForm)
    ToolBar1: TToolBar;
    TbSave: TToolButton;
    TBClose: TToolButton;
    ADOQueryCmd: TADOQuery;
    ADOQueryTemp: TADOQuery;
    TbUpFile: TToolButton;
    CDS_1: TClientDataSet;
    DS_1: TDataSource;
    GPM_1: TcxGridPopupMenu;
    cxPageControl1: TcxPageControl;
    cxTabSheet1: TcxTabSheet;
    cxTabSheet2: TcxTabSheet;
    cxTabSheet3: TcxTabSheet;
    cxTabSheet4: TcxTabSheet;
    cxGrid2: TcxGrid;
    Tv1: TcxGridDBTableView;
    Tv11fs_Name: TcxGridDBColumn;
    Tv11fs_spel: TcxGridDBColumn;
    Tv1fs_unit: TcxGridDBColumn;
    Tv11fs_rate: TcxGridDBColumn;
    Tv11fs_precautions: TcxGridDBColumn;
    cxGridLevel1: TcxGridLevel;
    cxTabSheet5: TcxTabSheet;
    cxGrid1: TcxGrid;
    Tv2: TcxGridDBTableView;
    Tv2fp_Name: TcxGridDBColumn;
    Tv2fp_spel: TcxGridDBColumn;
    Tv2fp_unit: TcxGridDBColumn;
    Tv2fp_rate: TcxGridDBColumn;
    Tv2fp_precautions: TcxGridDBColumn;
    cxGridDBColumn16: TcxGridDBColumn;
    cxGridDBColumn17: TcxGridDBColumn;
    cxGridDBColumn18: TcxGridDBColumn;
    cxGridLevel2: TcxGridLevel;
    cxTabSheet6: TcxTabSheet;
    cxGrid3: TcxGrid;
    Tv3: TcxGridDBTableView;
    Tv3gj_Name: TcxGridDBColumn;
    Tv3gj_spel: TcxGridDBColumn;
    Tv3gj_unit: TcxGridDBColumn;
    TV3gj_rate: TcxGridDBColumn;
    Tv3gj_precautions: TcxGridDBColumn;
    cxGridDBColumn26: TcxGridDBColumn;
    cxGridDBColumn27: TcxGridDBColumn;
    cxGridDBColumn28: TcxGridDBColumn;
    cxGridLevel3: TcxGridLevel;
    Panel1: TPanel;
    C_GramWeight: TcxTextEdit;
    F_Width: TcxTextEdit;
    cxLabel37: TcxLabel;
    cxLabel38: TcxLabel;
    cxLabel39: TcxLabel;
    cxLabel41: TcxLabel;
    cxLabel43: TcxLabel;
    cxLabel45: TcxLabel;
    cxLabel46: TcxLabel;
    cxLabel47: TcxLabel;
    cxLabel48: TcxLabel;
    Material: TcxTextEdit;
    LatitudeSlope: TcxTextEdit;
    FinishingStandards: TcxTextEdit;
    C_COLOR: TcxTextEdit;
    C_Width: TcxTextEdit;
    F_GramWeight: TcxTextEdit;
    C_FinishLatitudeDensity: TcxTextEdit;
    Panel2: TPanel;
    cxLabel10: TcxLabel;
    cxLabel11: TcxLabel;
    cxLabel12: TcxLabel;
    cxLabel13: TcxLabel;
    cxLabel14: TcxLabel;
    cxLabel15: TcxLabel;
    cxLabel16: TcxLabel;
    cxLabel17: TcxLabel;
    cxLabel18: TcxLabel;
    cxLabel19: TcxLabel;
    cxLabel20: TcxLabel;
    cxLabel7: TcxLabel;
    cxLabel8: TcxLabel;
    cxLabel9: TcxLabel;
    qx_WaterContent: TcxTextEdit;
    qx_Add_Name: TcxTextEdit;
    qx_Precautions: TcxTextEdit;
    qx_temperature4: TcxTextEdit;
    qx_temperature2: TcxTextEdit;
    qx_temperature1: TcxTextEdit;
    qx_temperature3: TcxTextEdit;
    qx_temperature5: TcxTextEdit;
    qx_speed: TcxTextEdit;
    qx_ReduceAmplitude: TcxTextEdit;
    Panel3: TPanel;
    cxLabel1: TcxLabel;
    cxLabel2: TcxLabel;
    cxLabel21: TcxLabel;
    cxLabel22: TcxLabel;
    cxLabel23: TcxLabel;
    cxLabel24: TcxLabel;
    cxLabel25: TcxLabel;
    cxLabel26: TcxLabel;
    cxLabel27: TcxLabel;
    cxLabel28: TcxLabel;
    cxLabel3: TcxLabel;
    cxLabel4: TcxLabel;
    cxLabel5: TcxLabel;
    cxLabel55: TcxLabel;
    cxLabel56: TcxLabel;
    cxLabel57: TcxLabel;
    cxLabel58: TcxLabel;
    cxLabel59: TcxLabel;
    cxLabel6: TcxLabel;
    cxLabel60: TcxLabel;
    cxLabel61: TcxLabel;
    cxLabel62: TcxLabel;
    cxLabel63: TcxLabel;
    cxLabel64: TcxLabel;
    cxLabel65: TcxLabel;
    dx_OutFanSpeed: TcxTextEdit;
    dx_temperature1: TcxTextEdit;
    dx_WidthAmplitude: TcxTextEdit;
    dx_temperature5: TcxTextEdit;
    dx_temperature9: TcxTextEdit;
    dx_RosePower: TcxTextEdit;
    dx_BrushSuperRate: TcxTextEdit;
    dx_Precautions: TcxTextEdit;
    dx_UpSuperRate: TcxTextEdit;
    dx_speed: TcxTextEdit;
    dx_TubePress: TcxTextEdit;
    dx_temperature6: TcxTextEdit;
    dx_CycleFanSpeed: TcxTextEdit;
    dx_DownSuperRate: TcxTextEdit;
    dx_temperature3: TcxTextEdit;
    dx_temperature4: TcxTextEdit;
    dx_temperature7: TcxTextEdit;
    dx_temperature8: TcxTextEdit;
    dx_temperature10: TcxTextEdit;
    dx_temperature2: TcxTextEdit;
    Panel4: TPanel;
    cxLabel100: TcxLabel;
    cxLabel101: TcxLabel;
    cxLabel102: TcxLabel;
    cxLabel103: TcxLabel;
    cxLabel104: TcxLabel;
    cxLabel105: TcxLabel;
    cxLabel106: TcxLabel;
    cxLabel109: TcxLabel;
    cxLabel110: TcxLabel;
    cxLabel111: TcxLabel;
    cxLabel82: TcxLabel;
    cxLabel83: TcxLabel;
    cxLabel84: TcxLabel;
    cxLabel85: TcxLabel;
    cxLabel86: TcxLabel;
    cxLabel87: TcxLabel;
    cxLabel88: TcxLabel;
    cxLabel89: TcxLabel;
    cxLabel90: TcxLabel;
    cxLabel91: TcxLabel;
    cxLabel92: TcxLabel;
    cxLabel93: TcxLabel;
    cxLabel94: TcxLabel;
    cxLabel95: TcxLabel;
    cxLabel96: TcxLabel;
    cxLabel97: TcxLabel;
    cxLabel98: TcxLabel;
    cxLabel99: TcxLabel;
    fs_OutFanSpeed: TcxTextEdit;
    fs_temperature1: TcxTextEdit;
    fs_WidthAmplitude: TcxTextEdit;
    fs_temperature5: TcxTextEdit;
    fs_temperature9: TcxTextEdit;
    fs_RosePower: TcxTextEdit;
    fs_BrushSuperRate: TcxTextEdit;
    fs_Precautions: TcxTextEdit;
    fs_UpSuperRate: TcxTextEdit;
    fs_speed: TcxTextEdit;
    fs_TubePress: TcxTextEdit;
    fs_temperature6: TcxTextEdit;
    fs_CycleFanSpeed: TcxTextEdit;
    fs_DownSuperRate: TcxTextEdit;
    fs_temperature3: TcxTextEdit;
    fs_temperature4: TcxTextEdit;
    fs_temperature7: TcxTextEdit;
    fs_temperature8: TcxTextEdit;
    fs_temperature10: TcxTextEdit;
    fs_temperature2: TcxTextEdit;
    fs_CarPress: TcxTextEdit;
    fs_PressWaterContent: TcxTextEdit;
    Panel5: TPanel;
    cxLabel107: TcxLabel;
    cxLabel108: TcxLabel;
    cxLabel112: TcxLabel;
    cxLabel29: TcxLabel;
    cxLabel30: TcxLabel;
    cxLabel31: TcxLabel;
    cxLabel32: TcxLabel;
    cxLabel33: TcxLabel;
    cxLabel34: TcxLabel;
    cxLabel35: TcxLabel;
    cxLabel36: TcxLabel;
    cxLabel49: TcxLabel;
    cxLabel50: TcxLabel;
    cxLabel51: TcxLabel;
    cxLabel52: TcxLabel;
    cxLabel53: TcxLabel;
    cxLabel54: TcxLabel;
    cxLabel66: TcxLabel;
    cxLabel67: TcxLabel;
    cxLabel68: TcxLabel;
    cxLabel69: TcxLabel;
    cxLabel70: TcxLabel;
    cxLabel71: TcxLabel;
    cxLabel72: TcxLabel;
    cxLabel73: TcxLabel;
    cxLabel74: TcxLabel;
    cxLabel75: TcxLabel;
    cxLabel76: TcxLabel;
    cxLabel77: TcxLabel;
    cxLabel78: TcxLabel;
    cxLabel79: TcxLabel;
    cxLabel80: TcxLabel;
    cxLabel81: TcxLabel;
    fp_OutFanSpeed: TcxTextEdit;
    fp_temperature1: TcxTextEdit;
    fp_WidthAmplitude: TcxTextEdit;
    fp_temperature5: TcxTextEdit;
    fp_temperature9: TcxTextEdit;
    fp_RosePower: TcxTextEdit;
    fp_BrushSuperRate: TcxTextEdit;
    fp_Precautions: TcxTextEdit;
    fp_UpSuperRate: TcxTextEdit;
    fp_speed: TcxTextEdit;
    fp_TubePress: TcxTextEdit;
    fp_temperature6: TcxTextEdit;
    fp_CycleFanSpeed: TcxTextEdit;
    fp_DownSuperRate: TcxTextEdit;
    fp_temperature3: TcxTextEdit;
    fp_temperature4: TcxTextEdit;
    fp_temperature7: TcxTextEdit;
    fp_temperature8: TcxTextEdit;
    fp_temperature10: TcxTextEdit;
    fp_temperature2: TcxTextEdit;
    fp_LeftHeight: TcxTextEdit;
    fp_RightHeight: TcxTextEdit;
    fp_PumbMixElectricFrequency: TcxTextEdit;
    fp_SystemPress: TcxTextEdit;
    fp_MixElectricFrequency: TcxTextEdit;
    fp_GasFlow: TcxTextEdit;
    Panel6: TPanel;
    cxLabel116: TcxLabel;
    cxLabel117: TcxLabel;
    cxLabel118: TcxLabel;
    cxLabel119: TcxLabel;
    cxLabel120: TcxLabel;
    cxLabel121: TcxLabel;
    cxLabel122: TcxLabel;
    cxLabel123: TcxLabel;
    cxLabel124: TcxLabel;
    cxLabel125: TcxLabel;
    cxLabel126: TcxLabel;
    cxLabel127: TcxLabel;
    cxLabel128: TcxLabel;
    cxLabel129: TcxLabel;
    cxLabel130: TcxLabel;
    cxLabel131: TcxLabel;
    cxLabel132: TcxLabel;
    cxLabel133: TcxLabel;
    cxLabel134: TcxLabel;
    cxLabel135: TcxLabel;
    cxLabel136: TcxLabel;
    cxLabel137: TcxLabel;
    cxLabel138: TcxLabel;
    cxLabel139: TcxLabel;
    cxLabel140: TcxLabel;
    cxLabel141: TcxLabel;
    cxLabel142: TcxLabel;
    cxLabel143: TcxLabel;
    gj_temperature1: TcxTextEdit;
    gj_WidthAmplitude: TcxTextEdit;
    gj_temperature5: TcxTextEdit;
    gj_temperature9: TcxTextEdit;
    gj_RosePower: TcxTextEdit;
    gj_BrushSuperRate: TcxTextEdit;
    gj_Precautions: TcxTextEdit;
    gj_UpSuperRate: TcxTextEdit;
    gj_speed: TcxTextEdit;
    gj_TubePress: TcxTextEdit;
    gj_temperature6: TcxTextEdit;
    gj_CycleFanSpeed: TcxTextEdit;
    gj_DownSuperRate: TcxTextEdit;
    gj_temperature3: TcxTextEdit;
    gj_temperature4: TcxTextEdit;
    gj_temperature7: TcxTextEdit;
    gj_temperature8: TcxTextEdit;
    gj_temperature10: TcxTextEdit;
    gj_temperature2: TcxTextEdit;
    gj_LeftHeight: TcxTextEdit;
    gj_RightHeight: TcxTextEdit;
    gj_OutFanSpeed: TcxTextEdit;
    cxtabsheet7: TcxTabSheet;
    cxLabel114: TcxLabel;
    F_FinishLatitudeDensity: TcxTextEdit;
    panel7: TPanel;
    cxLabel115: TcxLabel;
    cxLabel144: TcxLabel;
    cxLabel145: TcxLabel;
    cxLabel146: TcxLabel;
    cxLabel147: TcxLabel;
    cxLabel154: TcxLabel;
    cxLabel155: TcxLabel;
    cxLabel156: TcxLabel;
    zm_inoutSpeed: TcxTextEdit;
    zm_needle: TcxTextEdit;
    zm_Precautions: TcxTextEdit;
    zm_frequency: TcxTextEdit;
    zm_WidthAmplitude: TcxTextEdit;
    cxLabel148: TcxLabel;
    qx_Add_Number: TcxTextEdit;
    cxLabel149: TcxLabel;
    cxLabel150: TcxLabel;
    C_Code: TcxTextEdit;
    GPM_2: TcxGridPopupMenu;
    DS_2: TDataSource;
    cds_2: TClientDataSet;
    GPM_3: TcxGridPopupMenu;
    DS_3: TDataSource;
    CDS_3: TClientDataSet;
    Tv3Column1: TcxGridDBColumn;
    Tv1Column1: TcxGridDBColumn;
    Tv2Column1: TcxGridDBColumn;
    cxGrid4: TcxGrid;
    TV4: TcxGridDBTableView;
    cxGridLevel4: TcxGridLevel;
    Panel8: TPanel;
    Panel9: TPanel;
    Label20: TLabel;
    cxGridPopupMenu1: TcxGridPopupMenu;
    DS_GY: TDataSource;
    CDS_GY: TClientDataSet;
    Panel10: TPanel;
    Panel11: TPanel;
    Label1: TLabel;
    ToolBar2: TToolBar;
    TbQX: TToolButton;
    TbDX: TToolButton;
    TbFS: TToolButton;
    TbFP: TToolButton;
    TbGJ: TToolButton;
    TbZM: TToolButton;
    TbDelete: TToolButton;
    C_Name: TcxTextEdit;
    dx_UnpackingMethod: TcxComboBox;
    dx_OpenAmplitude: TcxComboBox;
    dx_RollMethod: TcxComboBox;
    fs_UnpackingMethod: TcxComboBox;
    fs_OpenAmplitude: TcxComboBox;
    fs_RollMethod: TcxComboBox;
    zm_UnpackingMethod: TcxComboBox;
    zm_RollMethod: TcxComboBox;
    cxLabel151: TcxLabel;
    cxLabel152: TcxLabel;
    cxLabel153: TcxLabel;
    cxLabel157: TcxLabel;
    cxLabel158: TcxLabel;
    fs_meter: TcxTextEdit;
    fs_useGlub: TcxTextEdit;
    fs_waterDistribution: TcxTextEdit;
    fs_useOneGlub: TcxTextEdit;
    fs_useOneMeter: TcxTextEdit;
    cxLabel159: TcxLabel;
    fp_useOneMeter: TcxTextEdit;
    cxLabel160: TcxLabel;
    fp_useOneGlub: TcxTextEdit;
    cxLabel161: TcxLabel;
    gj_useOneMeter: TcxTextEdit;
    cxLabel162: TcxLabel;
    gj_useOneGlub: TcxTextEdit;
    qx_UnpackingMethod: TcxComboBox;
    qx_RollMethod: TcxComboBox;
    zm_wagCloth: TcxTextEdit;
    fp_RollMethod: TcxComboBox;
    fp_UnpackingMethod: TcxComboBox;
    gj_RollMethod: TcxComboBox;
    gj_UnpackingMethod: TcxComboBox;
    fp_OpenAmplitude: TcxComboBox;
    gj_OpenAmplitude: TcxComboBox;
    ToolBar3: TToolBar;
    TbAdd21: TToolButton;
    TbDel21: TToolButton;
    ToolBar4: TToolBar;
    TbAdd1: TToolButton;
    TbDel1: TToolButton;
    ToolBar5: TToolBar;
    TbAdd3: TToolButton;
    TbDel3: TToolButton;
    TbCPReplace: TcxButton;
    TbDXReplace: TcxButton;
    TbFSReplace: TcxButton;
    TbFPReplace: TcxButton;
    TbGJReplace: TcxButton;
    cxButton1: TcxButton;
    cxButton2: TcxButton;
    TbDXClear: TcxButton;
    cxButton4: TcxButton;
    TbGJClear: TcxButton;
    cxTabSheet8: TcxTabSheet;
    cxTabSheet9: TcxTabSheet;
    cxTabSheet10: TcxTabSheet;
    cxTabSheet11: TcxTabSheet;
    Panel12: TPanel;
    cxLabel163: TcxLabel;
    cxLabel164: TcxLabel;
    cxLabel165: TcxLabel;
    cxLabel166: TcxLabel;
    cxLabel167: TcxLabel;
    cxLabel168: TcxLabel;
    cxLabel169: TcxLabel;
    cxLabel170: TcxLabel;
    cxLabel171: TcxLabel;
    cxLabel172: TcxLabel;
    cxLabel173: TcxLabel;
    cxLabel174: TcxLabel;
    cxLabel175: TcxLabel;
    cxLabel176: TcxLabel;
    cxLabel177: TcxLabel;
    cxLabel178: TcxLabel;
    cxLabel179: TcxLabel;
    cxLabel180: TcxLabel;
    cxLabel181: TcxLabel;
    cxLabel182: TcxLabel;
    cxLabel183: TcxLabel;
    cxLabel184: TcxLabel;
    cxLabel185: TcxLabel;
    cxLabel186: TcxLabel;
    cxLabel187: TcxLabel;
    dx_OutFanSpeed2: TcxTextEdit;
    dx_temperature12: TcxTextEdit;
    dx_WidthAmplitude2: TcxTextEdit;
    dx_temperature52: TcxTextEdit;
    dx_temperature92: TcxTextEdit;
    dx_RosePower2: TcxTextEdit;
    dx_BrushSuperRate2: TcxTextEdit;
    dx_Precautions2: TcxTextEdit;
    dx_UpSuperRate2: TcxTextEdit;
    dx_speed2: TcxTextEdit;
    dx_TubePress2: TcxTextEdit;
    dx_temperature62: TcxTextEdit;
    dx_CycleFanSpeed2: TcxTextEdit;
    dx_DownSuperRate2: TcxTextEdit;
    dx_temperature32: TcxTextEdit;
    dx_temperature42: TcxTextEdit;
    dx_temperature72: TcxTextEdit;
    dx_temperature82: TcxTextEdit;
    dx_temperature102: TcxTextEdit;
    dx_temperature22: TcxTextEdit;
    dx_UnpackingMethod2: TcxComboBox;
    dx_OpenAmplitude2: TcxComboBox;
    dx_RollMethod2: TcxComboBox;
    TbDX2Replace: TcxButton;
    TbDX2Clear: TcxButton;
    Panel13: TPanel;
    cxLabel188: TcxLabel;
    cxLabel189: TcxLabel;
    cxLabel190: TcxLabel;
    cxLabel191: TcxLabel;
    cxLabel192: TcxLabel;
    cxLabel193: TcxLabel;
    cxLabel194: TcxLabel;
    cxLabel195: TcxLabel;
    cxLabel196: TcxLabel;
    cxLabel197: TcxLabel;
    cxLabel198: TcxLabel;
    cxLabel199: TcxLabel;
    cxLabel200: TcxLabel;
    cxLabel201: TcxLabel;
    cxLabel202: TcxLabel;
    cxLabel203: TcxLabel;
    cxLabel204: TcxLabel;
    cxLabel205: TcxLabel;
    cxLabel206: TcxLabel;
    cxLabel207: TcxLabel;
    cxLabel208: TcxLabel;
    cxLabel209: TcxLabel;
    cxLabel210: TcxLabel;
    cxLabel211: TcxLabel;
    cxLabel212: TcxLabel;
    dx_OutFanSpeed3: TcxTextEdit;
    dx_temperature13: TcxTextEdit;
    dx_WidthAmplitude3: TcxTextEdit;
    dx_temperature53: TcxTextEdit;
    dx_temperature93: TcxTextEdit;
    dx_RosePower3: TcxTextEdit;
    dx_BrushSuperRate3: TcxTextEdit;
    dx_Precautions3: TcxTextEdit;
    dx_UpSuperRate3: TcxTextEdit;
    dx_speed3: TcxTextEdit;
    dx_TubePress3: TcxTextEdit;
    dx_temperature63: TcxTextEdit;
    dx_CycleFanSpeed3: TcxTextEdit;
    dx_DownSuperRate3: TcxTextEdit;
    dx_temperature33: TcxTextEdit;
    dx_temperature43: TcxTextEdit;
    dx_temperature73: TcxTextEdit;
    dx_temperature83: TcxTextEdit;
    dx_temperature103: TcxTextEdit;
    dx_temperature23: TcxTextEdit;
    dx_UnpackingMethod3: TcxComboBox;
    dx_OpenAmplitude3: TcxComboBox;
    dx_RollMethod3: TcxComboBox;
    TbDX3Replace: TcxButton;
    TbDX3Clear: TcxButton;
    Panel14: TPanel;
    cxLabel213: TcxLabel;
    cxLabel214: TcxLabel;
    cxLabel215: TcxLabel;
    cxLabel216: TcxLabel;
    cxLabel217: TcxLabel;
    cxLabel218: TcxLabel;
    cxLabel219: TcxLabel;
    cxLabel220: TcxLabel;
    cxLabel221: TcxLabel;
    cxLabel222: TcxLabel;
    cxLabel223: TcxLabel;
    cxLabel224: TcxLabel;
    cxLabel225: TcxLabel;
    cxLabel226: TcxLabel;
    cxLabel227: TcxLabel;
    cxLabel228: TcxLabel;
    cxLabel229: TcxLabel;
    cxLabel230: TcxLabel;
    cxLabel231: TcxLabel;
    cxLabel232: TcxLabel;
    cxLabel233: TcxLabel;
    cxLabel234: TcxLabel;
    cxLabel235: TcxLabel;
    cxLabel236: TcxLabel;
    cxLabel237: TcxLabel;
    cxLabel238: TcxLabel;
    cxLabel239: TcxLabel;
    cxLabel240: TcxLabel;
    gj_temperature12: TcxTextEdit;
    gj_WidthAmplitude2: TcxTextEdit;
    gj_temperature52: TcxTextEdit;
    gj_temperature92: TcxTextEdit;
    gj_RosePower2: TcxTextEdit;
    gj_BrushSuperRate2: TcxTextEdit;
    gj_Precautions2: TcxTextEdit;
    gj_UpSuperRate2: TcxTextEdit;
    gj_speed2: TcxTextEdit;
    gj_TubePress2: TcxTextEdit;
    gj_temperature62: TcxTextEdit;
    gj_CycleFanSpeed2: TcxTextEdit;
    gj_DownSuperRate2: TcxTextEdit;
    gj_temperature32: TcxTextEdit;
    gj_temperature42: TcxTextEdit;
    gj_temperature72: TcxTextEdit;
    gj_temperature82: TcxTextEdit;
    gj_temperature102: TcxTextEdit;
    gj_temperature22: TcxTextEdit;
    gj_LeftHeight2: TcxTextEdit;
    gj_RightHeight2: TcxTextEdit;
    gj_OutFanSpeed2: TcxTextEdit;
    cxLabel241: TcxLabel;
    gj_useOneMeter2: TcxTextEdit;
    cxLabel242: TcxLabel;
    gj_useOneGlub2: TcxTextEdit;
    gj_RollMethod2: TcxComboBox;
    gj_UnpackingMethod2: TcxComboBox;
    gj_OpenAmplitude2: TcxComboBox;
    TbGJ2Replace: TcxButton;
    TbGJ2Clear: TcxButton;
    ToolBar6: TToolBar;
    ToolButton1: TToolButton;
    ToolButton2: TToolButton;
    cxGrid5: TcxGrid;
    Tv5: TcxGridDBTableView;
    cxGridDBColumn3: TcxGridDBColumn;
    cxGridDBColumn4: TcxGridDBColumn;
    cxGridDBColumn5: TcxGridDBColumn;
    cxGridDBColumn6: TcxGridDBColumn;
    cxGridDBColumn7: TcxGridDBColumn;
    cxGridDBColumn8: TcxGridDBColumn;
    cxGridDBColumn9: TcxGridDBColumn;
    cxGridDBColumn10: TcxGridDBColumn;
    cxGridDBColumn12: TcxGridDBColumn;
    cxGridLevel5: TcxGridLevel;
    Panel15: TPanel;
    cxLabel243: TcxLabel;
    cxLabel244: TcxLabel;
    cxLabel245: TcxLabel;
    cxLabel246: TcxLabel;
    cxLabel247: TcxLabel;
    cxLabel248: TcxLabel;
    cxLabel249: TcxLabel;
    cxLabel250: TcxLabel;
    cxLabel251: TcxLabel;
    cxLabel252: TcxLabel;
    cxLabel253: TcxLabel;
    cxLabel254: TcxLabel;
    cxLabel255: TcxLabel;
    cxLabel256: TcxLabel;
    cxLabel257: TcxLabel;
    cxLabel258: TcxLabel;
    cxLabel259: TcxLabel;
    cxLabel260: TcxLabel;
    cxLabel261: TcxLabel;
    cxLabel262: TcxLabel;
    cxLabel263: TcxLabel;
    cxLabel264: TcxLabel;
    cxLabel265: TcxLabel;
    cxLabel266: TcxLabel;
    cxLabel267: TcxLabel;
    cxLabel268: TcxLabel;
    cxLabel269: TcxLabel;
    cxLabel270: TcxLabel;
    gj_temperature13: TcxTextEdit;
    gj_WidthAmplitude3: TcxTextEdit;
    gj_temperature53: TcxTextEdit;
    gj_temperature93: TcxTextEdit;
    gj_RosePower3: TcxTextEdit;
    gj_BrushSuperRate3: TcxTextEdit;
    gj_Precautions3: TcxTextEdit;
    gj_UpSuperRate3: TcxTextEdit;
    gj_speed3: TcxTextEdit;
    gj_TubePress3: TcxTextEdit;
    gj_temperature63: TcxTextEdit;
    gj_CycleFanSpeed3: TcxTextEdit;
    gj_DownSuperRate3: TcxTextEdit;
    gj_temperature33: TcxTextEdit;
    gj_temperature43: TcxTextEdit;
    gj_temperature73: TcxTextEdit;
    gj_temperature83: TcxTextEdit;
    gj_temperature103: TcxTextEdit;
    gj_temperature23: TcxTextEdit;
    gj_LeftHeight3: TcxTextEdit;
    gj_RightHeight3: TcxTextEdit;
    gj_OutFanSpeed3: TcxTextEdit;
    cxLabel271: TcxLabel;
    gj_useOneMeter3: TcxTextEdit;
    cxLabel272: TcxLabel;
    gj_useOneGlub3: TcxTextEdit;
    gj_RollMethod3: TcxComboBox;
    gj_UnpackingMethod3: TcxComboBox;
    gj_OpenAmplitude3: TcxComboBox;
    TbGJ3Replace: TcxButton;
    TbGJ3Clear: TcxButton;
    ToolBar7: TToolBar;
    ToolButton3: TToolButton;
    ToolButton4: TToolButton;
    cxGrid6: TcxGrid;
    Tv6: TcxGridDBTableView;
    cxGridDBColumn13: TcxGridDBColumn;
    cxGridDBColumn14: TcxGridDBColumn;
    cxGridDBColumn15: TcxGridDBColumn;
    cxGridDBColumn19: TcxGridDBColumn;
    cxGridDBColumn20: TcxGridDBColumn;
    cxGridDBColumn21: TcxGridDBColumn;
    cxGridDBColumn22: TcxGridDBColumn;
    cxGridDBColumn23: TcxGridDBColumn;
    cxGridDBColumn24: TcxGridDBColumn;
    cxGridLevel6: TcxGridLevel;
    DS_3_2: TDataSource;
    DS_3_3: TDataSource;
    CDS_3_2: TClientDataSet;
    CDS_3_3: TClientDataSet;
    TbFB: TToolButton;
    TbAdd: TToolButton;
    TV4GYNO: TcxGridDBColumn;
    TV4GYName: TcxGridDBColumn;
    TV4GYGX: TcxGridDBColumn;
    TV4DTMID: TcxGridDBColumn;
    cxLabel273: TcxLabel;
    cxLabel42: TcxLabel;
    C_washWidth: TcxTextEdit;
    TV4F_Code: TcxGridDBColumn;
    cxLabel40: TcxLabel;
    CINote: TcxTextEdit;
    ToolButton5: TToolButton;
    cxLabel44: TcxLabel;
    DTMPSlist: TcxTextEdit;
    cxLabel113: TcxLabel;
    DTMID: TcxTextEdit;
    procedure FormShow(Sender: TObject);
    procedure TBCloseClick(Sender: TObject);
    procedure TbSaveClick(Sender: TObject);
    procedure CYColorKeyPress(Sender: TObject; var Key: Char);
    procedure CYJGGYBtnDnClick(Sender: TObject);
    procedure C_WidthBtnDnClick(Sender: TObject);
    procedure C_WidthBtnUpClick(Sender: TObject);
    procedure TbUpFileClick(Sender: TObject);
//    procedure C_FromNameBtnUpClick(Sender: TObject);
//    procedure TbQXClick(Sender: TObject);
//    procedure TbDXClick(Sender: TObject);
    procedure Tv1Column1PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
//    procedure TbDeleteClick(Sender: TObject);
//    procedure TbFSClick(Sender: TObject);
//    procedure TbFPClick(Sender: TObject);
//    procedure TbGJClick(Sender: TObject);
//    procedure TbZMClick(Sender: TObject);
    procedure Tv11fs_unitPropertiesEditValueChanged(Sender: TObject);
    procedure Tv2fp_unitPropertiesEditValueChanged(Sender: TObject);
//    procedure Tv3gj_unitPropertiesEditValueChanged(Sender: TObject);
//    procedure fs_meterPropertiesChange(Sender: TObject);
//    procedure TbAdd2Click(Sender: TObject);
//    procedure TbDel2Click(Sender: TObject);
    procedure Tv2fp_NamePropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
//    procedure TbAdd1Click(Sender: TObject);
//    procedure TbDel1Click(Sender: TObject);
//    procedure TbAdd3Click(Sender: TObject);
//    procedure TbDel3Click(Sender: TObject);
    procedure Tv11fs_NamePropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
    procedure Tv3gj_NamePropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
//    procedure TbCPReplaceClick(Sender: TObject);
//    procedure TbDXReplaceClick(Sender: TObject);
//    procedure TbFSReplaceClick(Sender: TObject);
//    procedure TbFPReplaceClick(Sender: TObject);
//    procedure TbGJReplaceClick(Sender: TObject);
//    procedure cxButton1Click(Sender: TObject);
//    procedure cxButton2Click(Sender: TObject);
//    procedure TbDXClearClick(Sender: TObject);
//    procedure cxButton4Click(Sender: TObject);
//    procedure TbGJClearClick(Sender: TObject);
//    procedure TbDX2ReplaceClick(Sender: TObject);
//    procedure TbDX2ClearClick(Sender: TObject);
//    procedure TbDX3ReplaceClick(Sender: TObject);
//    procedure TbDX3ClearClick(Sender: TObject);
//    procedure TbGJ3ClearClick(Sender: TObject);
//    procedure TbGJ2ClearClick(Sender: TObject);
//    procedure ToolButton1Click(Sender: TObject);
//    procedure ToolButton3Click(Sender: TObject);
//    procedure ToolButton2Click(Sender: TObject);
//    procedure ToolButton4Click(Sender: TObject);
//    procedure cxGridDBColumn4PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
//    procedure cxGridDBColumn14PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
//    procedure cxGridDBColumn6PropertiesEditValueChanged(Sender: TObject);
//    procedure cxGridDBColumn19PropertiesEditValueChanged(Sender: TObject);
//    procedure TbGJ2ReplaceClick(Sender: TObject);
//    procedure TbGJ3ReplaceClick(Sender: TObject);
//    procedure TbFBClick(Sender: TObject);
    procedure TbAddClick(Sender: TObject);
    procedure TbDeleteClick(Sender: TObject);
    procedure ToolButton5Click(Sender: TObject);
    procedure TV4CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
    procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);

  private
    canshu1: string;
    Fint: Integer;
    procedure InitGrid();
    procedure ArrangeTabsByDataset;
    function SaveData(): Boolean;
//    function FindLastEditedTextEdit(AParent: TWinControl; const AHint: string): string;
//    procedure FillAllTextEditsWithValue(AParent: TWinControl; const AHint, AValue: string; AExclude: TcxTextEdit = nil);
//    procedure ClearAllTextEditsByHint(AParent: TWinControl; const AHint: string; AExclude: TcxTextEdit = nil);
    { Private declarations }
  public
    FBCIID, FCTID, FProcessID: string;
    CopyInt: Integer;

    { Public declarations }
  end;

var
  frmClothInfoInput: TfrmClothInfoInput;

implementation

uses
  U_DataLink, U_RTFun, U_iniParam, U_ZDYHelp, U_AttachmentUpload, U_ClothInfoSel,
  U_ProductInfoSel, U_CraftSel;

{$R *.dfm}

procedure TfrmClothInfoInput.ArrangeTabsByDataset;
var
  I: Integer;
  TabSheet: TcxTabSheet;
  CurrentIndex: Integer;
begin
  // 固定第一个页面 A
  cxTabSheet1.PageIndex := 0;
  cxTabSheet1.Visible := True;

  // 初始化隐藏所有其他页面
  for I := 1 to cxPageControl1.PageCount - 1 do
    cxPageControl1.Pages[I].TabVisible := False;

//  // 检查数据集是否激活
//  if not (CDS_GX.Active and (CDS_GX.RecordCount > 0)) then
//    Exit;
//
//  // 设置当前索引（从1开始，0已被A占用）
//  CurrentIndex := 1;
//
//  // 按序号排序数据集
//  CDS_GX.IndexFieldNames := 'serialno';
//  CDS_GX.First;
//
//  // 遍历数据集并设置页面
//  while not CDS_GX.Eof do
//  begin
//    // 根据工序名查找对应的页面
//    for I := 0 to cxPageControl1.PageCount - 1 do
//    begin
//      TabSheet := cxPageControl1.Pages[I] as TcxTabSheet;
//      // 匹配工序名且不是第一个固定页面
//      if (Trim(TabSheet.Caption) = CDS_GX.FieldByName('gxname').AsString) and (TabSheet <> cxTabSheet1) then
//      begin
//        TabSheet.PageIndex := CurrentIndex;
//        TabSheet.TabVisible := True;
//        Inc(CurrentIndex);
//        Break;
//      end;
//    end;
//    CDS_GX.Next;
//  end;
//  // 刷新页面控件
//  cxPageControl1.Invalidate;
end;

procedure TfrmClothInfoInput.InitGrid();
var
  i: integer;
begin

  with ADOQueryTemp do
  begin
    Close;
    SQL.Clear;
    SQL.Add('select * from BS_Cloth_Dye_Technics where BCIID=''' + Trim(FBCIID) + '''');

    Open;
  end;
  SCreateCDS(ADOQueryTemp, CDS_GY);
  SInitCDSData(ADOQueryTemp, CDS_GY);

  with ADOQueryTemp do
  begin
    Close;
    SQL.Clear;
    SQL.Add('select * from Bs_Cloth_info where BCIID=''' + Trim(FBCIID) + '''');
    Open;
  end;
  SCSHData(ADOQueryTemp, Panel1, 2);
//  with ADOQueryTemp do
//  begin
//    Close;
//    SQL.Clear;
//    SQL.Add('select * from Bs_Cloth_GY_Main where BCIID=''' + Trim(FBCIID) + '''');
//    Open;
//  end;
//
//  SCSHData(ADOQueryTemp, Panel2, 2);
//  SCSHData(ADOQueryTemp, Panel3, 2);
//  SCSHData(ADOQueryTemp, Panel4, 2);
//  SCSHData(ADOQueryTemp, Panel5, 2);
//  SCSHData(ADOQueryTemp, Panel6, 2);
//  SCSHData(ADOQueryTemp, Panel7, 2);
//
//  SCSHData(ADOQueryTemp, Panel12, 2);
//  SCSHData(ADOQueryTemp, Panel13, 2);
//  SCSHData(ADOQueryTemp, Panel14, 2);
//  SCSHData(ADOQueryTemp, Panel15, 2);
//
//  with ADOQueryTemp do
//  begin
//    Close;
//    sql.Clear;
//    sql.Add('select A.*  from Bs_Cloth_GY_sub A ');
//    sql.Add(' where gytype=''防水'' and A.BCIID=''' + Trim(FBCIID) + '''');
//    Open;
//  end;
//  SCreateCDS(ADOQueryTemp, CDS_1);
//  SInitCDSData(ADOQueryTemp, CDS_1);
//
//  with ADOQueryTemp do
//  begin
//    Close;
//    sql.Clear;
//    sql.Add('select A.*  from Bs_Cloth_GY_sub A ');
//    sql.Add(' where gytype=''发泡'' and A.BCIID=''' + Trim(FBCIID) + '''');
//    Open;
//  end;
//  SCreateCDS(ADOQueryTemp, CDS_2);
//  SInitCDSData(ADOQueryTemp, CDS_2);
//
//  with ADOQueryTemp do
//  begin
//    Close;
//    sql.Clear;
//    sql.Add('select A.*  from Bs_Cloth_GY_sub A ');
//    sql.Add(' where gytype=''一次刮胶'' and A.BCIID=''' + Trim(FBCIID) + '''');
//    Open;
//  end;
//  SCreateCDS(ADOQueryTemp, CDS_3);
//  SInitCDSData(ADOQueryTemp, CDS_3);
//
//  with ADOQueryTemp do
//  begin
//    Close;
//    sql.Clear;
//    sql.Add('select A.*  from Bs_Cloth_GY_sub A ');
//    sql.Add(' where gytype=''二次刮胶'' and A.BCIID=''' + Trim(FBCIID) + '''');
//    Open;
//  end;
//  SCreateCDS(ADOQueryTemp, CDS_3_2);
//  SInitCDSData(ADOQueryTemp, CDS_3_2);
//
//  with ADOQueryTemp do
//  begin
//    Close;
//    sql.Clear;
//    sql.Add('select A.*  from Bs_Cloth_GY_sub A ');
//    sql.Add(' where gytype=''三次刮胶'' and A.BCIID=''' + Trim(FBCIID) + '''');
//    Open;
//  end;
//  SCreateCDS(ADOQueryTemp, CDS_3_3);
//  SInitCDSData(ADOQueryTemp, CDS_3_3);
//
//  with ADOQueryTemp do
//  begin
//    Close;
//    sql.Clear;
//    sql.Add('select A.*  from Bs_Cloth_GX A ');
//    sql.Add(' where  A.BCIID=''' + Trim(FBCIID) + '''');
//    Open;
//  end;
//  SCreateCDS(ADOQueryTemp, CDS_GX);
//  SInitCDSData(ADOQueryTemp, CDS_GX);
//  C_FromName.TxtCode := Trim(ADOQueryTemp.fieldbyname('FromBCIID').AsString);
//  C_FromName.Text := Trim(ADOQueryTemp.fieldbyname('C_FromName').AsString);

end;

procedure TfrmClothInfoInput.FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
begin
  if Key = VK_ESCAPE then  // VK_ESCAPE 是 ESC 键的常量
  begin
    Key := 0;  // 清除按键，防止继续传递
    Close;     // 或者 ModalResult := mrCancel;
  end;
end;

procedure TfrmClothInfoInput.FormShow(Sender: TObject);
var
  MaxBCIID, TechnicsID, MaxBCPID: string;
//  Maxid1, maxid2, maxid3, maxgx: string;
begin
  InitGrid();
  ReadCxGrid(self.Caption + 'TV4', Tv4, '产品信息录入');
  ArrangeTabsByDataset;
  if CopyInt = 2 then    //复制
  begin
    FBCIID := '';
    C_Code.text := '自动生成';
    with CDS_GY do
    begin
      First;
      while not Eof do
      begin
        Edit;
        CDS_GY.fieldbyname('TechnicsID').AsString := '';
        Post;
        Next;
      end;
    end;
//    with CDS_1 do
//    begin
//      First;
//      while not Eof do
//      begin
//        Edit;
//        CDS_1.fieldbyname('BCPID').AsString := '';
//        Post;
//        Next;
//      end;
//    end;
//    with CDS_2 do
//    begin
//      First;
//      while not Eof do
//      begin
//        Edit;
//        CDS_2.fieldbyname('BCPID').AsString := '';
//        Post;
//        Next;
//      end;
//    end;
//    with CDS_3 do
//    begin
//      First;
//      while not Eof do
//      begin
//        Edit;
//        CDS_3.fieldbyname('BCPID').AsString := '';
//        Post;
//        Next;
//      end;
//    end;
//    with CDS_3_2 do
//    begin
//      First;
//      while not Eof do
//      begin
//        Edit;
//        CDS_3_2.fieldbyname('BCPID').AsString := '';
//        Post;
//        Next;
//      end;
//    end;
//    with CDS_3_3 do
//    begin
//      First;
//      while not Eof do
//      begin
//        Edit;
//        CDS_3_3.fieldbyname('BCPID').AsString := '';
//        Post;
//        Next;
//      end;
//    end;

  end;
  if CopyInt = 1 then   //查看
  begin
    TbSave.Enabled := False;
    TbUpFile.Enabled := False;
    TbQX.Enabled := False;
    TbDX.Enabled := False;
    TbFS.Enabled := False;
    TbFP.Enabled := False;
    TbGJ.Enabled := False;
    TbZM.Enabled := False;
    TbDelete.Enabled := False;
  end;

  KeyPreview := True;

end;

//procedure TfrmClothInfoInput.fs_meterPropertiesChange(Sender: TObject);
//var
//  mfs_meter, mfs_useOneMeter, mfs_useGlub: Double;
//begin
//  if fs_meter.Text <> '' then
//  begin
//    mfs_meter := StrToFloat(fs_meter.Text);
//  end
//  else
//  begin
//    fs_meter.Text := '0';
//    mfs_meter := 0;
//  end;
//
//  if fs_useOneMeter.Text <> '' then
//  begin
//    mfs_useOneMeter := StrToFloat(fs_useOneMeter.Text);
//  end
//  else
//  begin
//    fs_useOneMeter.Text := '0';
//    mfs_useOneMeter := 0;
//  end;
//  ///计算部分
//  mfs_useGlub := mfs_meter * mfs_useOneMeter / 1000;
//  fs_useGlub.Text := FloatToStr(mfs_useGlub);
//end;

procedure TfrmClothInfoInput.TBCloseClick(Sender: TObject);
begin
  Close;
end;

function TfrmClothInfoInput.SaveData(): Boolean;
var
//  MaxBCIID, MaxProcessID, MaxBCPID: string;
//  Maxid1, maxid2, maxid3, maxgx: string;
  MaxBCIID, MaxTechnicsID: string;
begin
  try
    ADOQueryCmd.Connection.BeginTrans;
////////////////       保存主表          //////////////////////
    if Trim(FBCIID) = '' then
    begin
      if GetLSNo(ADOQueryCmd, MaxBCIID, 'Y', 'BS_Cloth_Info', 4, 1) = False then
      begin
        Result := False;
        ADOQueryCmd.Connection.RollbackTrans;
        Application.MessageBox('取最大号失败！', '提示', 0);
        Exit;
      end;
    end
    else
    begin
      MaxBCIID := Trim(FBCIID);
    end;
    with ADOQueryCmd do
    begin
      Close;
      SQL.Clear;
      sql.Add('select * from BS_Cloth_Info where BCIID=''' + Trim(MaxBCIID) + '''');
      Open;
    end;
    with ADOQueryCmd do
    begin
      if Trim(FBCIID) = '' then
      begin
        Append;
        FieldByName('EditId').Value := Trim(DCode);
        FieldByName('EDITER').Value := Trim(DName);
        FieldByName('EDITTIME').Value := SGetServerDateTime(ADOQueryTemp);

      end
      else
      begin
        Edit;
        FieldByName('EDITER').Value := Trim(DName);
        FieldByName('EDITTIME').Value := SGetServerDateTime(ADOQueryTemp);
      end;
      FieldByName('BCIID').Value := Trim(MaxBCIID);
      FieldByName('CTID').Value := Trim(FCTID);

      if trim(C_Code.Text) = '自动生成' then
        C_Code.Text := Trim(MaxBCIID);
      RTSetsavedata(ADOQueryCmd, 'BS_Cloth_Info', panel1, 2);
      CDS_GY.First;
      FieldByName('F_Name').Value := CDS_GY.FieldByName('F_Name').Value;
//      FieldByName('DTMID').Value := CDS_GY.FieldByName('DTMID').Value;
      Post;
    end;
////////////////       保存主表          //////////////////////
///
///  ////////////////       保存子表          //////////////////////
    with CDS_GY do
    begin
      First;
      while not Eof do
      begin
        if Trim(CDS_GY.fieldbyname('TechnicsID').AsString) = '' then
        begin
          if GetLSNo(ADOQueryTemp, MaxTechnicsID, 'GY', 'Bs_Cloth_Dye_Technics', 5, 1) = False then
          begin
            ADOQueryCmd.Connection.RollbackTrans;
            Application.MessageBox('取配比子流水号失败！', '提示', 0);
            Exit;
          end;
        end
        else
        begin
          MaxTechnicsID := Trim(CDS_GY.fieldbyname('TechnicsID').AsString);
        end;
        with ADOQueryCmd do
        begin
          Close;
          SQL.Clear;
          sql.Add('select * from Bs_Cloth_Dye_Technics where ');
          sql.Add('  TechnicsID=''' + Trim(MaxTechnicsID) + '''');
          Open;
        end;
        with ADOQueryCmd do
        begin
          if Trim(CDS_GY.fieldbyname('TechnicsID').AsString) = '' then
          begin
            Append;
          end
          else
          begin
            Edit;
          end;

          FieldByName('BCIID').Value := Trim(MaxBCIID);
          FieldByName('TechnicsID').Value := Trim(MaxTechnicsID);
          FieldByName('C_Code').Value := Trim(C_Code.Text);
          FieldByName('C_Name').Value := Trim(C_Name.Text);
          RTSetSaveDataCDS(ADOQueryCmd, Tv4, CDS_GY, 'Bs_Cloth_Dye_Technics', 0);
          Post;
        end;
        CDS_GY.Edit;
        CDS_GY.FieldByName('BCIID').Value := Trim(MaxBCIID);
        CDS_GY.FieldByName('TechnicsID').Value := Trim(MaxTechnicsID);
        Next;
      end;
    end;
///  ////////////////       保存子表          //////////////////////
//    with ADOQueryCmd do
//    begin
//      Close;
//      SQL.Clear;
//      sql.Add('delete BS_Cloth_Info_Link where ToID=''' + Trim(MaxBCIID) + '''');
//      ExecSQL;
//    end;

//    with ADOQueryCmd do
//    begin
//      Close;
//      SQL.Clear;
//      sql.Add('select * from BS_Cloth_Info_Link  where 1=2');
//      Open;
//    end;
//    with ADOQueryCmd do
//    begin
//      Append;
//      FieldByName('ToID').Value := Trim(MaxBCIID);
//      FieldByName('FromID').Value := Trim(C_FromName.TxtCode);
//      Post;
//    end;

//    with ADOQueryTemp do
//    begin
//      Close;
//      sql.Clear;
//      sql.Add('select count(*) as AA from BS_Cloth_Info where C_Code=''' + Trim(C_Code.Text) + '''');
//      Open;
//      if FieldByName('AA').AsInteger > 1 then
//      begin
//        ADOQueryCmd.Connection.RollbackTrans;
//        Result := False;
//        Application.MessageBox('编号重复！', '提示', 0);
//        Exit;
//      end;
//    end;
//
//    with ADOQueryCmd do
//    begin
//      Close;
//      SQL.Clear;
//      sql.Add('select * from Bs_Cloth_GY_Main where BCIID=''' + Trim(FBCIID) + '''');
//      Open;
//    end;
//    with ADOQueryCmd do
//    begin
//      if Trim(FBCIID) = '' then
//      begin
//        Append;
//
//      end
//      else
//      begin
//        Edit;
//
//      end;
//      FieldByName('BCIID').Value := Trim(MaxBCIID);
//      RTSetsavedata(ADOQueryCmd, 'Bs_Cloth_GY_Main', panel2, 2);
//      RTSetsavedata(ADOQueryCmd, 'Bs_Cloth_GY_Main', panel3, 2);
//      RTSetsavedata(ADOQueryCmd, 'Bs_Cloth_GY_Main', panel4, 2);
//      RTSetsavedata(ADOQueryCmd, 'Bs_Cloth_GY_Main', panel5, 2);
//      RTSetsavedata(ADOQueryCmd, 'Bs_Cloth_GY_Main', panel6, 2);
//      RTSetsavedata(ADOQueryCmd, 'Bs_Cloth_GY_Main', panel7, 2);
//
//      RTSetsavedata(ADOQueryCmd, 'Bs_Cloth_GY_Main', panel12, 2);
//      RTSetsavedata(ADOQueryCmd, 'Bs_Cloth_GY_Main', panel13, 2);
//      RTSetsavedata(ADOQueryCmd, 'Bs_Cloth_GY_Main', panel14, 2);
//      RTSetsavedata(ADOQueryCmd, 'Bs_Cloth_GY_Main', panel15, 2);
//      Post;
//    end;

////////////////       保存主表          //////////////////////
///
///
///
///
///  /////////////////       保存工序子表          //////////////////////
//    with CDS_GY do
//    begin
//      First;
//      while not Eof do
//      begin
//
//        if Trim(CDS_GY.fieldbyname('GXID').AsString) = '' then
//        begin
//          if GetLSNo(ADOQueryTemp, maxgx, 'GX', 'Bs_Cloth_GX', 5, 1) = False then
//          begin
//            ADOQueryCmd.Connection.RollbackTrans;
//            Application.MessageBox('取配比子流水号失败！', '提示', 0);
//            Exit;
//          end;
//        end
//        else
//        begin
//          maxgx := Trim(CDS_GY.fieldbyname('GXID').AsString);
//        end;
//        with ADOQueryCmd do
//        begin
//          Close;
//          SQL.Clear;
//          sql.Add('select * from Bs_Cloth_GX where ');
//          sql.Add('  GXID=''' + Trim(maxgx) + '''');
//          Open;
//        end;
//        with ADOQueryCmd do
//        begin
//          if Trim(CDS_GY.fieldbyname('GXID').AsString) = '' then
//          begin
//            Append;
//
//          end
//          else
//          begin
//            Edit;
//          end;
//
//          FieldByName('BCIID').Value := Trim(MaxBCIID);
//          FieldByName('GXID').Value := Trim(maxgx);
//          RTSetSaveDataCDS(ADOQueryCmd, Tv4, CDS_GY, 'Bs_Cloth_GX', 0);
//          Post;
//        end;
//        CDS_GY.Edit;
//        CDS_GY.FieldByName('BCIID').Value := Trim(MaxBCIID);
//        CDS_GY.FieldByName('GXID').Value := Trim(maxgx);
//
//        Next;
//      end;
//    end;
//////////////////       保存工序子表          //////////////////////
////////////////////       保存防水子表          //////////////////////
//    with CDS_1 do
//    begin
//      First;
//      while not Eof do
//      begin
//
//        if Trim(CDS_1.fieldbyname('BCPID').AsString) = '' then
//        begin
//          if GetLSNo(ADOQueryTemp, Maxid1, 'FS', 'Bs_Cloth_GY_Sub', 5, 1) = False then
//          begin
//            ADOQueryCmd.Connection.RollbackTrans;
//            Application.MessageBox('取配比子流水号失败！', '提示', 0);
//            Exit;
//          end;
//        end
//        else
//        begin
//          Maxid1 := Trim(CDS_1.fieldbyname('BCPID').AsString);
//        end;
//
//        with ADOQueryCmd do
//        begin
//          Close;
//          SQL.Clear;
//          sql.Add('select * from Bs_Cloth_GY_Sub where ');
//          sql.Add('  BCPID=''' + Trim(Maxid1) + '''');
//          Open;
//        end;
//        with ADOQueryCmd do
//        begin
//          if Trim(CDS_1.fieldbyname('BCPID').AsString) = '' then
//          begin
//            Append;
//
//          end
//          else
//          begin
//            Edit;
//
//          end;
//          FieldByName('GYType').Value := '防水';
//          FieldByName('BCIID').Value := Trim(MaxBCIID);
//          FieldByName('BCPID').Value := Trim(Maxid1);
//          RTSetSaveDataCDS(ADOQueryCmd, Tv1, CDS_1, 'Bs_Cloth_GY_Sub', 0);
//          Post;
//        end;
//        CDS_1.Edit;
//        CDS_1.FieldByName('BCIID').Value := Trim(MaxBCIID);
//        CDS_1.FieldByName('BCPID').Value := Trim(Maxid1);
//
//        Next;
//      end;
//    end;
//////////////////       保存子表          //////////////////////
////////////////////       保存发泡子表          //////////////////////
//    with CDS_2 do
//    begin
//      First;
//      while not Eof do
//      begin
//
//        if Trim(CDS_2.fieldbyname('BCPID').AsString) = '' then
//        begin
//          if GetLSNo(ADOQueryTemp, maxid2, 'FP', 'Bs_Cloth_GY_Sub', 5, 1) = False then
//          begin
//            ADOQueryCmd.Connection.RollbackTrans;
//            Application.MessageBox('取配比子流水号失败！', '提示', 0);
//            Exit;
//          end;
//        end
//        else
//        begin
//          maxid2 := Trim(CDS_2.fieldbyname('BCPID').AsString);
//        end;
//        with ADOQueryCmd do
//        begin
//          Close;
//          SQL.Clear;
//          sql.Add('select * from Bs_Cloth_GY_Sub where ');
//          sql.Add('  BCPID=''' + Trim(maxid2) + '''');
//          Open;
//        end;
//        with ADOQueryCmd do
//        begin
//          if Trim(CDS_2.fieldbyname('BCPID').AsString) = '' then
//          begin
//            Append;
//
//          end
//          else
//          begin
//            Edit;
//
//          end;
//          FieldByName('GYType').Value := '发泡';
//          FieldByName('BCIID').Value := Trim(MaxBCIID);
//          FieldByName('BCPID').Value := Trim(maxid2);
//          RTSetSaveDataCDS(ADOQueryCmd, Tv2, CDS_2, 'Bs_Cloth_GY_Sub', 0);
//          Post;
//        end;
//        CDS_2.Edit;
//        CDS_2.FieldByName('BCIID').Value := Trim(MaxBCIID);
//        CDS_2.FieldByName('BCPID').Value := Trim(maxid2);
//
//        Next;
//      end;
//    end;
//////////////////       保存发泡子表          //////////////////////
/////
/////  //////////////////       保存一次刮胶子表          //////////////////////
//    with CDS_3 do
//    begin
//      First;
//      while not Eof do
//      begin
////        if copyInt = 1 then
////        begin
////          CDS_3.Edit;
//////          CDS_GX.fieldbyname('GXID').AsString := '';
//////          CDS_1.fieldbyname('BCPID').AsString := '';
//////          CDS_2.fieldbyname('BCPID').AsString := '';
////          CDS_3.fieldbyname('BCPID').AsString := '';
////        end;
//        if Trim(CDS_3.fieldbyname('BCPID').AsString) = '' then
//        begin
//          if GetLSNo(ADOQueryTemp, maxid3, 'GJ', 'Bs_Cloth_GY_Sub', 5, 1) = False then
//          begin
//            ADOQueryCmd.Connection.RollbackTrans;
//            Application.MessageBox('取配比子流水号失败！', '提示', 0);
//            Exit;
//          end;
//        end
//        else
//        begin
//          maxid3 := Trim(CDS_3.fieldbyname('BCPID').AsString);
//        end;
//        with ADOQueryCmd do
//        begin
//          Close;
//          SQL.Clear;
//          sql.Add('select * from Bs_Cloth_GY_Sub where ');
//          sql.Add('  BCPID=''' + Trim(maxid3) + '''');
//          Open;
//        end;
//        with ADOQueryCmd do
//        begin
//          if Trim(CDS_3.fieldbyname('BCPID').AsString) = '' then
//          begin
//            Append;
//
//          end
//          else
//          begin
//            Edit;
//
//          end;
//          FieldByName('GYType').Value := '一次刮胶';
//          FieldByName('BCIID').Value := Trim(MaxBCIID);
//          FieldByName('BCPID').Value := Trim(maxid3);
//          RTSetSaveDataCDS(ADOQueryCmd, Tv3, CDS_3, 'Bs_Cloth_GY_Sub', 0);
//          Post;
//        end;
//        CDS_3.Edit;
//        CDS_3.FieldByName('BCIID').Value := Trim(MaxBCIID);
//        CDS_3.FieldByName('BCPID').Value := Trim(maxid3);
//
//        Next;
//      end;
//    end;
//////////////////       保存一次刮胶子表          //////////////////////
/////  //////////////////       保存二次刮胶子表          //////////////////////
//    with CDS_3_2 do
//    begin
//      First;
//      while not Eof do
//      begin
//        if copyInt = 1 then
//        begin
//          CDS_3_2.Edit;
//          CDS_3_2.fieldbyname('BCPID').AsString := '';
//        end;
//        if Trim(CDS_3_2.fieldbyname('BCPID').AsString) = '' then
//        begin
//          if GetLSNo(ADOQueryTemp, maxid3, 'GJ', 'Bs_Cloth_GY_Sub', 5, 1) = False then
//          begin
//            ADOQueryCmd.Connection.RollbackTrans;
//            Application.MessageBox('取配比子流水号失败！', '提示', 0);
//            Exit;
//          end;
//        end
//        else
//        begin
//          maxid3 := Trim(CDS_3_2.fieldbyname('BCPID').AsString);
//        end;
//        with ADOQueryCmd do
//        begin
//          Close;
//          SQL.Clear;
//          sql.Add('select * from Bs_Cloth_GY_Sub where ');
//          sql.Add('  BCPID=''' + Trim(maxid3) + '''');
//          Open;
//        end;
//        with ADOQueryCmd do
//        begin
//          if Trim(CDS_3_2.fieldbyname('BCPID').AsString) = '' then
//          begin
//            Append;
//
//          end
//          else
//          begin
//            Edit;
//
//          end;
//          FieldByName('GYType').Value := '二次刮胶';
//          FieldByName('BCIID').Value := Trim(MaxBCIID);
//          FieldByName('BCPID').Value := Trim(maxid3);
//          RTSetSaveDataCDS(ADOQueryCmd, Tv3, CDS_3_2, 'Bs_Cloth_GY_Sub', 0);
//          Post;
//        end;
//        CDS_3_2.Edit;
//        CDS_3_2.FieldByName('BCIID').Value := Trim(MaxBCIID);
//        CDS_3_2.FieldByName('BCPID').Value := Trim(maxid3);
//
//        Next;
//      end;
//    end;
//////////////////       保存二次刮胶子表          //////////////////////
/////  //////////////////       保存三次刮胶子表          //////////////////////
//    with CDS_3_3 do
//    begin
//      First;
//      while not Eof do
//      begin
//        if copyInt = 1 then
//        begin
//          CDS_3_3.Edit;
////          CDS_GX.fieldbyname('GXID').AsString := '';
////          CDS_1.fieldbyname('BCPID').AsString := '';
////          CDS_2.fieldbyname('BCPID').AsString := '';
//          CDS_3_3.fieldbyname('BCPID').AsString := '';
//        end;
//        if Trim(CDS_3_3.fieldbyname('BCPID').AsString) = '' then
//        begin
//          if GetLSNo(ADOQueryTemp, maxid3, 'GJ', 'Bs_Cloth_GY_Sub', 5, 1) = False then
//          begin
//            ADOQueryCmd.Connection.RollbackTrans;
//            Application.MessageBox('取配比子流水号失败！', '提示', 0);
//            Exit;
//          end;
//        end
//        else
//        begin
//          maxid3 := Trim(CDS_3_3.fieldbyname('BCPID').AsString);
//        end;
//        with ADOQueryCmd do
//        begin
//          Close;
//          SQL.Clear;
//          sql.Add('select * from Bs_Cloth_GY_Sub where ');
//          sql.Add('  BCPID=''' + Trim(maxid3) + '''');
//          Open;
//        end;
//        with ADOQueryCmd do
//        begin
//          if Trim(CDS_3_3.fieldbyname('BCPID').AsString) = '' then
//          begin
//            Append;
//
//          end
//          else
//          begin
//            Edit;
//
//          end;
//          FieldByName('GYType').Value := '三次刮胶';
//          FieldByName('BCIID').Value := Trim(MaxBCIID);
//          FieldByName('BCPID').Value := Trim(maxid3);
//          RTSetSaveDataCDS(ADOQueryCmd, Tv3, CDS_3_3, 'Bs_Cloth_GY_Sub', 0);
//          Post;
//        end;
//        CDS_3_3.Edit;
//        CDS_3_3.FieldByName('BCIID').Value := Trim(MaxBCIID);
//        CDS_3_3.FieldByName('BCPID').Value := Trim(maxid3);
//
//        Next;
//      end;
//    end;
////////////////       保存三次刮胶子表          //////////////////////


    ADOQueryCmd.Connection.CommitTrans;
    FBCIID := MaxBCIID;
    Result := True;
  except
    Result := False;
    ADOQueryCmd.Connection.RollbackTrans;
    Application.MessageBox('保存失败!', '提示', 0);
  end;
end;

procedure TfrmClothInfoInput.CYJGGYBtnDnClick(Sender: TObject);
begin
  TBtnEditC(Sender).Text := '';
end;

procedure TfrmClothInfoInput.TbDeleteClick(Sender: TObject);
begin
  if CDS_GY.IsEmpty then
    Exit;

  if Trim(CDS_GY.fieldbyname('TechnicsID').AsString) <> '' then
  begin
    if Application.MessageBox('确定要删除数据吗？', '提示', 32 + 4) <> IDYES then
      Exit;
    with ADOQueryCmd do
    begin
      Close;
      sql.Clear;
      sql.Add('delete BS_Cloth_Dye_Technics where TechnicsID=''' + Trim(CDS_GY.fieldbyname('TechnicsID').AsString) + '''');
      ExecSQL;
    end;
  end;
  CDS_GY.Delete;
  if CDS_GY.IsEmpty then
  begin
    DTMPSlist.Text := '';
    DTMID.Text := '';
  end;
end;

procedure TfrmClothInfoInput.TbSaveClick(Sender: TObject);
var
  MC_Code: string;
begin
  if C_Name.Text = '' then
  begin
    Application.MessageBox('产品名称不能为空！', '提示', 0);
    Exit;
  end;
//  if trim(C_Code.Text) = '' then
//  begin
//
//    if GetLSNo(ADOQueryCmd, MC_Code, 'C', 'BS_Cloth_Info', 4, 0) = False then
//    begin
//      Application.MessageBox('取最成品编号失败!', '提示', 0);
//      Exit;
//    end;
//    C_Code.Text := MC_Code;
//
//  end;
  if (CopyInt = 0) or (CopyInt = 2) then   //新增    复制
  begin
    with ADOQueryCmd do
    begin
      Close;
      sql.Clear;
      SQL.Add(' select * from BS_Cloth_Info where C_Name = ' + QuotedStr(Trim(C_Name.Text)));
      Open;
    end;
  end
  else if CopyInt = 3 then  //修改
  begin
    with ADOQueryCmd do
    begin
      Close;
      sql.Clear;
      SQL.Add(' select * from BS_Cloth_Info where C_Name = ' + QuotedStr(Trim(C_Name.Text)));
      sql.Add(' and BCIID <> ' + QuotedStr(Trim(FBCIID)));
      Open;
    end;
  end;

  if not ADOQueryCmd.IsEmpty then
  begin
    Application.MessageBox('产品名称重复！', '提示信息', MB_OK);
    exit;
  end;

  if SaveData() then
  begin
    Application.MessageBox('保存成功！', '提示', 0);
    ModalResult := 1;
  end;
end;

//procedure TfrmClothInfoInput.TbFSClick(Sender: TObject);
//var
//  i: Integer;
//begin
//
//  i := CDS_GY.RecordCount;      //当前的dataset有多少行记录
//  i := i + 1;
//
//  if CDS_GY.Locate('GXName', '防水', []) = True then
//  begin
//    Application.MessageBox('已存在防水工序!', '提示', 0);
//    Exit;
//  end;
//  if i > 11 then
//  begin
//    Application.MessageBox('已增至最大行数！', '提示信息', MB_OK);
//    exit;
//  end;
////  CopyAddRow(Tv1, CDS_1);
//  with CDS_GY do
//  begin
//    Append;
//    FieldByName('SerialNo').Value := i;
//    FieldByName('GXName').Value := '防水';
//    Post;
//  end;
//
//  ArrangeTabsByDataset;
//end;
//
//procedure TfrmClothInfoInput.TbQXClick(Sender: TObject);
//var
//  i: Integer;
//begin
//
//  i := CDS_GY.RecordCount;      //当前的dataset有多少行记录
//  i := i + 1;
//
//  if CDS_GY.Locate('GXName', '清洗', []) = True then
//  begin
//    Application.MessageBox('已存在清洗工序!', '提示', 0);
//    Exit;
//  end;
//  if i > 11 then
//  begin
//    Application.MessageBox('已增至最大行数！', '提示信息', MB_OK);
//    exit;
//  end;
////  CopyAddRow(Tv1, CDS_1);
//  with CDS_GY do
//  begin
//    Append;
//    FieldByName('SerialNo').Value := i;
//    FieldByName('GXName').Value := '清洗';
//    Post;
//  end;
//
//  ArrangeTabsByDataset;
//end;
//
//procedure TfrmClothInfoInput.TbDXClick(Sender: TObject);
//var
//  i: Integer;
//begin
//
//  i := CDS_GY.RecordCount;      //当前的dataset有多少行记录
//  i := i + 1;
//
//  if CDS_GY.Locate('GXName', '一次定型', []) = True then
//  begin
//    if CDS_GY.Locate('GXName', '二次定型', []) = True then
//    begin
//      if CDS_GY.Locate('GXName', '三次定型', []) = True then
//      begin
//        Application.MessageBox('已存在三次定型工序!', '提示', 0);
//        Exit;
//      end
//      else
//      begin
//        with CDS_GY do
//        begin
//          Append;
//          FieldByName('SerialNo').Value := i;
//          FieldByName('GXName').Value := '三次定型';
//          Post;
//        end;
//      end;
//    end
//    else
//    begin
//      with CDS_GY do
//      begin
//        Append;
//        FieldByName('SerialNo').Value := i;
//        FieldByName('GXName').Value := '二次定型';
//        Post;
//      end;
//    end;
//  end
//  else
//  begin
//    with CDS_GY do
//    begin
//      Append;
//      FieldByName('SerialNo').Value := i;
//      FieldByName('GXName').Value := '一次定型';
//      Post;
//    end;
//  end;
//
//  if i > 11 then
//  begin
//    Application.MessageBox('已增至最大行数！', '提示信息', MB_OK);
//    exit;
//  end;
//
//  ArrangeTabsByDataset;
//end;
//
//procedure TfrmClothInfoInput.TbDXReplaceClick(Sender: TObject);
//begin
//  FillAllTextEditsWithValue(panel3, '定型烘箱温度', FindLastEditedTextEdit(panel3, '定型烘箱温度'));
//end;
//
//procedure TfrmClothInfoInput.TbFBClick(Sender: TObject);
//var
//  i: Integer;
//begin
//
//  i := CDS_GY.RecordCount;      //当前的dataset有多少行记录
//  i := i + 1;
//  if CDS_GY.Locate('GXName', '翻布', []) = True then
//  begin
//    Application.MessageBox('已存在翻布工序!', '提示', 0);
//    Exit;
//  end;
//  if i > 11 then
//  begin
//    Application.MessageBox('已增至最大行数！', '提示信息', MB_OK);
//    exit;
//  end;
//
////  CopyAddRow(Tv1, CDS_1);
//  with CDS_GY do
//  begin
//    Append;
//
//    FieldByName('GXName').Value := '翻布';
//    Post;
//  end;
//
//  ArrangeTabsByDataset;
//end;
//
//procedure TfrmClothInfoInput.TbFPClick(Sender: TObject);
//var
//  i: Integer;
//begin
//
//  i := CDS_GY.RecordCount;      //当前的dataset有多少行记录
//  i := i + 1;
//
//  if CDS_GY.Locate('GXName', '发泡', []) = True then
//  begin
//    Application.MessageBox('已存在发泡工序!', '提示', 0);
//    Exit;
//  end;
//  if i > 11 then
//  begin
//    Application.MessageBox('已增至最大行数！', '提示信息', MB_OK);
//    exit;
//  end;
//
//
////  CopyAddRow(Tv1, CDS_1);
//  with CDS_GY do
//  begin
//    Append;
////    FieldByName('SerialNo').Value := i;
//    FieldByName('GXName').Value := '发泡';
//    Post;
//  end;
//
//  ArrangeTabsByDataset;
//end;
//
//procedure TfrmClothInfoInput.TbFPReplaceClick(Sender: TObject);
//begin
//  FillAllTextEditsWithValue(panel5, '发泡烘箱温度', FindLastEditedTextEdit(panel5, '发泡烘箱温度'));
//end;

//procedure TfrmClothInfoInput.TbGJClick(Sender: TObject);
//var
//  i: Integer;
//begin
//
//  i := CDS_GY.RecordCount;      //当前的dataset有多少行记录
//  i := i + 1;
//
//  if CDS_GY.Locate('GXName', '一次刮胶', []) = True then
//  begin
//    if CDS_GY.Locate('GXName', '二次刮胶', []) = True then
//    begin
//      if CDS_GY.Locate('GXName', '三次刮胶', []) = True then
//      begin
//        Application.MessageBox('已存在三次刮胶工序!', '提示', 0);
//        Exit;
//      end
//      else
//      begin
//        with CDS_GY do
//        begin
//          Append;
////          FieldByName('SerialNo').Value := i;
//          FieldByName('GXName').Value := '三次刮胶';
//          Post;
//        end;
//      end;
//    end
//    else
//    begin
//      with CDS_GY do
//      begin
//        Append;
////        FieldByName('SerialNo').Value := i;
//        FieldByName('GXName').Value := '二次刮胶';
//        Post;
//      end;
//    end;
//  end
//  else
//  begin
//    with CDS_GY do
//    begin
//      Append;
////      FieldByName('SerialNo').Value := i;
//      FieldByName('GXName').Value := '一次刮胶';
//      Post;
//    end;
//  end;
//  if i > 11 then
//  begin
//    Application.MessageBox('已增至最大行数！', '提示信息', MB_OK);
//    exit;
//  end;
//
//  ArrangeTabsByDataset;
//end;

//procedure TfrmClothInfoInput.TbGJReplaceClick(Sender: TObject);
//begin
//  FillAllTextEditsWithValue(panel6, '刮胶烘箱温度', FindLastEditedTextEdit(panel6, '刮胶烘箱温度'));
//end;

//procedure TfrmClothInfoInput.TbZMClick(Sender: TObject);
//var
//  i: Integer;
//begin
//  i := CDS_GY.RecordCount;      //当前的dataset有多少行记录
//  i := i + 1;
//
//  if CDS_GY.Locate('GXName', '轧毛', []) = True then
//  begin
//    Application.MessageBox('已存在轧毛工序!', '提示', 0);
//    Exit;
//  end;
//  if i > 11 then
//  begin
//    Application.MessageBox('已增至最大行数！', '提示信息', MB_OK);
//    exit;
//  end;
////  CopyAddRow(Tv1, CDS_1);
//  with CDS_GY do
//  begin
//    Append;
////    FieldByName('SerialNo').Value := i;
//    FieldByName('GXName').Value := '轧毛';
//    Post;
//  end;
//
//  ArrangeTabsByDataset;
//end;
//
//procedure TfrmClothInfoInput.ToolButton1Click(Sender: TObject);
//begin
//  with CDS_3_2 do
//  begin
//    Append;
//    CDS_3_2.FieldByName('serialno').Value := CDS_3_2.RecordCount + 1;
//    CDS_3_2.FieldByName('gj_unit').Value := '%';
//    Post;
//  end;
//end;
//
//procedure TfrmClothInfoInput.ToolButton2Click(Sender: TObject);
//var
//  i: Integer;
//begin
//  if not CDS_3_2.IsEmpty then
//  begin
//
//    if Application.MessageBox('确定要删除数据吗？', '提示', 32 + 4) = IDYES then
//    begin
//      if Trim(CDS_3_2.fieldbyname('BCPID').AsString) <> '' then
//      begin
//        with ADOQueryCmd do
//        begin
//          Close;
//          sql.Clear;
//          sql.Add('delete BS_Cloth_GY_Sub where BCPID=''' + Trim(CDS_3_2.fieldbyname('BCPID').AsString) + '''');
//          ExecSQL;
//        end;
//      end;
//      CDS_3_2.Delete;
//    end
//    else
//      exit;
//
//    i := 0;
//    CDS_3_2.First;
//    while not CDS_3_2.Eof do
//    begin
//      i := i + 1;
//      CDS_3_2.Edit;
//      CDS_3_2.fieldByName('serialno').value := i;
//      CDS_3_2.Post;
//      CDS_3_2.Next;
//    end;
//  end
//  else
//  begin
//    Application.MessageBox('无可删除数据!', '提示', 0);
//    Exit;
//  end;
//end;
//
//procedure TfrmClothInfoInput.ToolButton3Click(Sender: TObject);
//begin
//  with CDS_3_3 do
//  begin
//    Append;
//    CDS_3_3.FieldByName('serialno').Value := CDS_3_3.RecordCount + 1;
//    CDS_3_3.FieldByName('gj_unit').Value := '%';
//    Post;
//  end;
//end;

//procedure TfrmClothInfoInput.ToolButton4Click(Sender: TObject);
//var
//  i: Integer;
//begin
//  if not CDS_3_3.IsEmpty then
//  begin
//
//    if Application.MessageBox('确定要删除数据吗？', '提示', 32 + 4) = IDYES then
//    begin
//      if Trim(CDS_3_3.fieldbyname('BCPID').AsString) <> '' then
//      begin
//        with ADOQueryCmd do
//        begin
//          Close;
//          sql.Clear;
//          sql.Add('delete BS_Cloth_GY_Sub where BCPID=''' + Trim(CDS_3_3.fieldbyname('BCPID').AsString) + '''');
//          ExecSQL;
//        end;
//      end;
//      CDS_3_3.Delete;
//    end
//    else
//      exit;
//
//    i := 0;
//    CDS_3_3.First;
//    while not CDS_3_3.Eof do
//    begin
//      i := i + 1;
//      CDS_3_3.Edit;
//      CDS_3_3.fieldByName('serialno').value := i;
//      CDS_3_3.Post;
//      CDS_3_3.Next;
//    end;
//  end
//  else
//  begin
//    Application.MessageBox('无可删除数据!', '提示', 0);
//    Exit;
//  end;
//end;

//procedure TfrmClothInfoInput.TbDeleteClick(Sender: TObject);
//begin
//  if CDS_GY.IsEmpty then
//    Exit;
//  if Application.MessageBox('确定要删除数据吗？', '提示', 32 + 4) <> IDYES then
//    Exit;
//////////////////////////////////////// 子表更新开始//////////////////////
////  if Trim(CDS_GX.fieldbyname('GXID').AsString) <> '' then
////  begin
//  with ADOQueryCmd do
//  begin
//    Close;
//    sql.Clear;
//    sql.Add('delete Bs_Cloth_GY_Sub where BCIID=''' + Trim(CDS_GY.fieldbyname('BCIID').AsString) + '''');
//    sql.Add('and gyType=''' + Trim(CDS_GY.fieldbyname('gxName').AsString) + '''');
//    ExecSQL;
//  end;
//  if CDS_GY.fieldByName('gxname').Value = '清洗' then
//  begin
//    //防水子表更新
//    with ADOQueryTemp do
//    begin
//      Close;
//      sql.Clear;
//      sql.Add('select A.*  from Bs_Cloth_GY_sub A ');
//      sql.Add(' where gytype=''防水'' and A.BCIID=''' + Trim(FBCIID) + '''');
//      Open;
//    end;
//    SCreateCDS(ADOQueryTemp, CDS_1);
//    SInitCDSData(ADOQueryTemp, CDS_1);
//  end
//  else if CDS_GY.fieldByName('gxname').Value = '发泡' then
//  begin
//    //发泡子表更新
//    with ADOQueryTemp do
//    begin
//      Close;
//      sql.Clear;
//      sql.Add('select A.*  from Bs_Cloth_GY_sub A ');
//      sql.Add(' where gytype=''发泡'' and A.BCIID=''' + Trim(FBCIID) + '''');
//      Open;
//    end;
//    SCreateCDS(ADOQueryTemp, CDS_2);
//    SInitCDSData(ADOQueryTemp, CDS_2);
//  end
//  else if CDS_GY.fieldByName('gxname').Value = '一次刮胶' then
//  begin
//    //刮胶子表更新
//    with ADOQueryTemp do
//    begin
//      Close;
//      sql.Clear;
//      sql.Add('select A.*  from Bs_Cloth_GY_sub A ');
//      sql.Add(' where gytype=''一次刮胶'' and A.BCIID=''' + Trim(FBCIID) + '''');
//      Open;
//    end;
//    SCreateCDS(ADOQueryTemp, CDS_3);
//    SInitCDSData(ADOQueryTemp, CDS_3);
////    end;
//  end
//  else if CDS_GY.fieldByName('gxname').Value = '二次刮胶' then
//  begin
//    //二次刮胶子表更新
//    with ADOQueryTemp do
//    begin
//      Close;
//      sql.Clear;
//      sql.Add('select A.*  from Bs_Cloth_GY_sub A ');
//      sql.Add(' where gytype=''二次刮胶'' and A.BCIID=''' + Trim(FBCIID) + '''');
//      Open;
//    end;
//    SCreateCDS(ADOQueryTemp, CDS_3_2);
//    SInitCDSData(ADOQueryTemp, CDS_3_2);
////    end;
//  end
//  else if CDS_GY.fieldByName('gxname').Value = '三次刮胶' then
//  begin
//    //三次刮胶子表更新
//    with ADOQueryTemp do
//    begin
//      Close;
//      sql.Clear;
//      sql.Add('select A.*  from Bs_Cloth_GY_sub A ');
//      sql.Add(' where gytype=''三次刮胶'' and A.BCIID=''' + Trim(FBCIID) + '''');
//      Open;
//    end;
//    SCreateCDS(ADOQueryTemp, CDS_3_3);
//    SInitCDSData(ADOQueryTemp, CDS_3_3);
////    end;
//  end;
////  else
////  begin
////    CDS_GX.Delete;
////  end;
//////////////////////////////////////// 子表更新结束//////////////////////
///////////////////////////主表更新开始/////////////////////////////////
//  with ADOQueryCmd do
//  begin
//    Close;
//    sql.Clear;
//    sql.Add('select * from Bs_Cloth_GY_Main where BCIID=''' + Trim(CDS_GY.fieldbyname('BCIID').AsString) + '''');
//    open;
//  end;
//  if CDS_GY.fieldByName('gxname').Value = '清洗' then
//  begin
//    SClearData(panel2, 2);
//    qx_UnpackingMethod.Text := '';
//    qx_RollMethod.Text := '';
//  end
//  else if CDS_GY.fieldByName('gxname').Value = '一次定型' then
//  begin
//    SClearData(panel3, 2);
//    dx_UnpackingMethod.Text := '';
//    dx_RollMethod.Text := '';
//    dx_OpenAmplitude.Text := '';
//  end
//  else if CDS_GY.fieldByName('gxname').Value = '二次定型' then
//  begin
//    SClearData(panel12, 2);
//    dx_UnpackingMethod2.Text := '';
//    dx_RollMethod2.Text := '';
//    dx_OpenAmplitude2.Text := '';
//  end
//  else if CDS_GY.fieldByName('gxname').Value = '三次定型' then
//  begin
//    SClearData(panel13, 2);
//    dx_UnpackingMethod3.Text := '';
//    dx_RollMethod3.Text := '';
//    dx_OpenAmplitude3.Text := '';
//  end
//  else if CDS_GY.fieldByName('gxname').Value = '防水' then
//  begin
//    SClearData(panel4, 2);
//    fs_UnpackingMethod.Text := '';
//    fs_RollMethod.Text := '';
//    fs_OpenAmplitude.Text := '';
//  end
//  else if CDS_GY.fieldByName('gxname').Value = '发泡' then
//  begin
//    SClearData(panel5, 2);
//    fp_UnpackingMethod.Text := '';
//    fp_RollMethod.Text := '';
//    fp_OpenAmplitude.Text := '';
//  end
//  else if CDS_GY.fieldByName('gxname').Value = '一次刮胶' then
//  begin
//    SClearData(panel6, 2);
//    gj_UnpackingMethod.Text := '';
//    gj_RollMethod.Text := '';
//    gj_OpenAmplitude.Text := '';
//  end
//  else if CDS_GY.fieldByName('gxname').Value = '二次刮胶' then
//  begin
//    SClearData(panel14, 2);
//    gj_UnpackingMethod2.Text := '';
//    gj_RollMethod2.Text := '';
//    gj_OpenAmplitude2.Text := '';
//  end
//  else if CDS_GY.fieldByName('gxname').Value = '三次刮胶' then
//  begin
//    SClearData(panel15, 2);
//    gj_UnpackingMethod3.Text := '';
//    gj_RollMethod3.Text := '';
//    gj_OpenAmplitude3.Text := '';
//  end
//  else if CDS_GY.fieldByName('gxname').Value = '轧毛' then
//  begin
//    SClearData(panel7, 2);
//    zm_UnpackingMethod.Text := '';
//  end;
//  with ADOQueryCmd do
//  begin
//    Close;
//    sql.Clear;
//    sql.Add('delete Bs_Cloth_GX where GXID=''' + Trim(CDS_GY.fieldbyname('GXID').AsString) + '''');
//    ExecSQL;
//  end;
////  showMessage();
//  CDS_GY.Delete;
//
//  if Trim(CDS_GY.fieldbyname('GXID').AsString) <> '' then
//  begin
//    SaveData();
//  end;
///////////////////////////////////主表更新结束//////////////////////////////////
//  ArrangeTabsByDataset;
//end;

//procedure TfrmClothInfoInput.TbAdd1Click(Sender: TObject);
//begin
//  with CDS_1 do
//  begin
//    Append;
//    CDS_1.FieldByName('serialno').Value := CDS_1.RecordCount + 1;
//    CDS_1.FieldByName('fs_unit').Value := '%';
//    Post;
//  end;
//end;

//procedure TfrmClothInfoInput.TbAdd2Click(Sender: TObject);
//begin
//  with CDS_2 do
//  begin
//    Append;
//    CDS_2.FieldByName('serialno').Value := CDS_2.RecordCount + 1;
//    CDS_2.FieldByName('fp_unit').Value := '%';
//    Post;
//  end;
//end;

//procedure TfrmClothInfoInput.TbAdd3Click(Sender: TObject);
//begin
//  with CDS_3 do
//  begin
//    Append;
//    CDS_3.FieldByName('serialno').Value := CDS_3.RecordCount + 1;
//    CDS_3.FieldByName('gj_unit').Value := '%';
//    Post;
//  end;
//end;

procedure TfrmClothInfoInput.TbAddClick(Sender: TObject);
begin
  try
    frmCraftSel := TfrmCraftSel.Create(Application);
    with frmCraftSel do
    begin
      if ShowModal = 1 then
      begin
        with frmCraftSel.CDS_1 do
        begin
          First;
          while Locate('SSel', True, []) do
          begin
            with Self.CDS_GY do
            begin
              Append;
              FieldByName('DTMNO').Value := FrmCraftSel.CDS_1.FieldByName('dtmNO').Value;
              FieldByName('DTMID').Value := FrmCraftSel.CDS_1.FieldByName('DTMID').Value;
              FieldByName('DTMName').Value := FrmCraftSel.CDS_1.FieldByName('DTMName').Value;
              FieldByName('DTMPSlist').Value := FrmCraftSel.CDS_1.FieldByName('DTMPSlist').Value;
            end;
            frmCraftSel.CDS_1.Delete;
          end;
        end;
      end;
    end;
  finally
    frmCraftSel.Free;
  end;
end;

//procedure TfrmClothInfoInput.TbDel1Click(Sender: TObject);
//var
//  i: Integer;
//begin
//  if not CDS_1.IsEmpty then
//  begin
//
//    if Application.MessageBox('确定要删除数据吗？', '提示', 32 + 4) = IDYES then
//    begin
//      if Trim(CDS_1.fieldbyname('BCPID').AsString) <> '' then
//      begin
//        with ADOQueryCmd do
//        begin
//          Close;
//          sql.Clear;
//          sql.Add('delete BS_Cloth_GY_Sub where BCPID=''' + Trim(CDS_1.fieldbyname('BCPID').AsString));
//          ExecSQL;
//        end;
//      end;
//      CDS_1.Delete;
//    end
//    else
//      exit;
//
//    i := 0;
//    CDS_1.First;
//    while not CDS_1.Eof do
//    begin
//      i := i + 1;
//      CDS_1.Edit;
//      CDS_1.fieldByName('serialno').value := i;
//      CDS_1.Post;
//      CDS_1.Next;
//    end;
//  end
//  else
//  begin
//    Application.MessageBox('无可删除数据!', '提示', 0);
//    Exit;
//  end;
//end;

//procedure TfrmClothInfoInput.TbDel2Click(Sender: TObject);
//var
//  i: Integer;
//begin
//  if not CDS_3.IsEmpty then
//  begin
//
//    if Application.MessageBox('确定要删除数据吗？', '提示', 32 + 4) = IDYES then
//    begin
//      if Trim(CDS_3.fieldbyname('BCPID').AsString) <> '' then
//      begin
//        with ADOQueryCmd do
//        begin
//          Close;
//          sql.Clear;
//          sql.Add('delete BS_Cloth_GY_Sub where BCPID=''' + Trim(CDS_3.fieldbyname('BCPID').AsString) + '''');
//          ExecSQL;
//        end;
//      end;
//      CDS_3.Delete;
//    end
//    else
//      exit;
//
//    i := 0;
//    CDS_3.First;
//    while not CDS_3.Eof do
//    begin
//      i := i + 1;
//      CDS_3.Edit;
//      CDS_3.fieldByName('serialno').value := i;
//      CDS_3.Post;
//      CDS_3.Next;
//    end;
//  end
//  else
//  begin
//    Application.MessageBox('无可删除数据!', '提示', 0);
//    Exit;
//  end;
//end;
//
//procedure TfrmClothInfoInput.TbDel3Click(Sender: TObject);
//var
//  i: Integer;
//begin
//  if not CDS_3.IsEmpty then
//  begin
//
//    if Application.MessageBox('确定要删除数据吗？', '提示', 32 + 4) = IDYES then
//    begin
//      if Trim(CDS_3.fieldbyname('BCPID').AsString) <> '' then
//      begin
//        with ADOQueryCmd do
//        begin
//          Close;
//          sql.Clear;
//          sql.Add('delete BS_Cloth_GY_Sub where BCPID=''' + Trim(CDS_3.fieldbyname('BCPID').AsString) + '''');
//          ExecSQL;
//        end;
//      end;
//      CDS_3.Delete;
//    end
//    else
//      exit;
//
//    i := 0;
//    CDS_3.First;
//    while not CDS_3.Eof do
//    begin
//      i := i + 1;
//      CDS_3.Edit;
//      CDS_3.fieldByName('serialno').value := i;
//      CDS_3.Post;
//      CDS_3.Next;
//    end;
//  end
//  else
//  begin
//    Application.MessageBox('无可删除数据!', '提示', 0);
//    Exit;
//  end;
//end;

//procedure TfrmClothInfoInput.C_FromNameBtnUpClick(Sender: TObject);
//begin
//  try
//    frmClothInfoSel := TfrmClothInfoSel.Create(Application);
//    with frmClothInfoSel do
//    begin
//      FCTType := '坯布';
//      if ShowModal = 1 then
//      begin
//        C_FromName.TxtCode := Trim(CDS_1.fieldbyname('BCIID').AsString);
//        C_FromName.Text := Trim(CDS_1.fieldbyname('C_Name').AsString);
//      end;
//    end;
//  finally
//    frmClothInfoSel.Free;
//  end;
//end;
//
//procedure TfrmClothInfoInput.TbCPReplaceClick(Sender: TObject);
//begin
//  FillAllTextEditsWithValue(panel2, '清洗水温', FindLastEditedTextEdit(panel2, '清洗水温'));
//end;

//function TfrmClothInfoInput.FindLastEditedTextEdit(AParent: TWinControl; const AHint: string): string;
//var
//  i: Integer;
//  AControl: TControl;
//begin
//  Result := '';
//  for i := 0 to AParent.ControlCount - 1 do
//  begin
//    AControl := AParent.Controls[i];
//    if (AControl is TcxTextEdit) and ((AControl as TcxTextEdit).Hint = AHint) and ((AControl as TcxTextEdit).Text <> '') then  // 仅检查非空输入框
//    begin
//      Result := (AControl as TcxTextEdit).text;  // 返回最后一个非空控件（简单实现）
//    end;
//  end;
//end;

//function TfrmClothInfoInput.FindLastEditedTextEdit(AParent: TWinControl; const AHint: string): string;
//var
//  i, j: Integer;
//  AControl: TControl;
//  SortedControls: TList;
//  TempControl: TControl;
//begin
//  Result := '';
//
//  // 如果没有子控件，直接返回空
//  if AParent.ControlCount = 0 then
//    Exit;
//
//  // 使用 TList 存储控件（兼容旧版 Delphi）
//  SortedControls := TList.Create;
//  try
//    // 将所有子控件添加到列表
//    for i := 0 to AParent.ControlCount - 1 do
//      SortedControls.Add(AParent.Controls[i]);
//
//    // 手动排序：按 Top（Y坐标）和 Left（X坐标）升序排列
//    for i := 0 to SortedControls.Count - 1 do
//    begin
//      for j := i + 1 to SortedControls.Count - 1 do
//      begin
//        // 比较两个控件的 Top 和 Left
//        if (TControl(SortedControls[i]).Top > TControl(SortedControls[j]).Top) or ((TControl(SortedControls[i]).Top = TControl(SortedControls[j]).Top) and (TControl(SortedControls[i]).Left > TControl(SortedControls[j]).Left)) then
//        begin
//          // 交换位置
//          TempControl := TControl(SortedControls[i]);
//          SortedControls[i] := SortedControls[j];
//          SortedControls[j] := TempControl;
//        end;
//      end;
//    end;
//
//    // 遍历排序后的控件
//    for i := 0 to SortedControls.Count - 1 do
//    begin
//      AControl := TControl(SortedControls[i]);
//      if (AControl is TcxTextEdit) and (TcxTextEdit(AControl).Hint = AHint) and (TcxTextEdit(AControl).Text <> '') then
//      begin
//        Result := TcxTextEdit(AControl).Text; // 最后一个符合条件的会被保留
//      end;
//    end;
//  finally
//    SortedControls.Free;
//  end;
//end;

//procedure TfrmClothInfoInput.FillAllTextEditsWithValue(AParent: TWinControl; const AHint, AValue: string; AExclude: TcxTextEdit = nil);  // 可选：排除特定控件
//var
//  i: Integer;
//  AControl: TControl;
//  ATextEdit: TcxTextEdit;
//begin
//  for i := 0 to AParent.ControlCount - 1 do
//  begin
//    AControl := AParent.Controls[i];
//    if (AControl is TcxTextEdit) and ((AControl as TcxTextEdit).Text = '') then
//    begin
//      ATextEdit := AControl as TcxTextEdit;
//      if (ATextEdit.Hint = AHint) and (ATextEdit <> AExclude) then
//        ATextEdit.Text := AValue;
//    end;
//  end;
//end;

//procedure TfrmClothInfoInput.ClearAllTextEditsByHint(AParent: TWinControl; const AHint: string; AExclude: TcxTextEdit = nil);
//var
//  i: Integer;
//  AControl: TControl;
//begin
//  for i := 0 to AParent.ControlCount - 1 do
//  begin
//    AControl := AParent.Controls[i];
//    // 检查是否是 TcxTextEdit，并且 Hint 匹配，且不是排除的控件
//    if (AControl is TcxTextEdit) and (TcxTextEdit(AControl).Hint = AHint) and (TcxTextEdit(AControl) <> AExclude) then
//    begin
//      TcxTextEdit(AControl).Text := ''; // 直接清空
//    end;
//  end;
//end;

//procedure TfrmClothInfoInput.cxButton1Click(Sender: TObject);
//begin
//  ClearAllTextEditsByHint(panel4, '防水烘箱温度');
//end;
//
//procedure TfrmClothInfoInput.cxButton2Click(Sender: TObject);
//begin
//  ClearAllTextEditsByHint(panel2, '清洗水温');
//end;
//
//procedure TfrmClothInfoInput.TbDXClearClick(Sender: TObject);
//begin
//  ClearAllTextEditsByHint(panel3, '定型烘箱温度');
//end;
//
//procedure TfrmClothInfoInput.cxButton4Click(Sender: TObject);
//begin
//  ClearAllTextEditsByHint(panel5, '发泡烘箱温度');
//end;
//
//procedure TfrmClothInfoInput.TbGJ2ClearClick(Sender: TObject);
//begin
//  ClearAllTextEditsByHint(panel14, '刮胶烘箱温度');
//end;
//
//procedure TfrmClothInfoInput.TbGJ2ReplaceClick(Sender: TObject);
//begin
//  FillAllTextEditsWithValue(panel14, '刮胶烘箱温度', FindLastEditedTextEdit(panel14, '刮胶烘箱温度'));
//end;
//
//procedure TfrmClothInfoInput.TbGJ3ClearClick(Sender: TObject);
//begin
//  ClearAllTextEditsByHint(panel15, '刮胶烘箱温度');
//end;
//
//procedure TfrmClothInfoInput.TbGJ3ReplaceClick(Sender: TObject);
//begin
//  FillAllTextEditsWithValue(panel15, '刮胶烘箱温度', FindLastEditedTextEdit(panel15, '刮胶烘箱温度'));
//end;
//
//procedure TfrmClothInfoInput.TbGJClearClick(Sender: TObject);
//begin
//  ClearAllTextEditsByHint(panel6, '刮胶烘箱温度');
//end;
//
//procedure TfrmClothInfoInput.TbDX2ClearClick(Sender: TObject);
//begin
//  ClearAllTextEditsByHint(panel12, '定型烘箱温度');
//end;
//
//procedure TfrmClothInfoInput.TbDX2ReplaceClick(Sender: TObject);
//begin
//  FillAllTextEditsWithValue(panel12, '定型烘箱温度', FindLastEditedTextEdit(panel12, '定型烘箱温度'));
//end;
//
//procedure TfrmClothInfoInput.TbDX3ClearClick(Sender: TObject);
//begin
//  ClearAllTextEditsByHint(panel13, '定型烘箱温度');
//end;
//
//procedure TfrmClothInfoInput.TbDX3ReplaceClick(Sender: TObject);
//begin
//  FillAllTextEditsWithValue(panel13, '定型烘箱温度', FindLastEditedTextEdit(panel13, '定型烘箱温度'));
//end;
//
//procedure TfrmClothInfoInput.TbFSReplaceClick(Sender: TObject);
//begin
//  FillAllTextEditsWithValue(panel4, '防水烘箱温度', FindLastEditedTextEdit(panel4, '防水烘箱温度'));
//end;

procedure TfrmClothInfoInput.CYColorKeyPress(Sender: TObject; var Key: Char);
begin
  if Key = #13 then
  begin
    Key := #0;
    SelectNext(ActiveControl as TWinControl, True, True);
  end;
end;

procedure TfrmClothInfoInput.C_WidthBtnDnClick(Sender: TObject);
begin
  TBtnEditC(Sender).Text := '';
  TBtnEditC(Sender).TxtCode := '';
end;

procedure TfrmClothInfoInput.C_WidthBtnUpClick(Sender: TObject);
var
  fsj: string;
  FWZ: Integer;
begin
  fsj := Trim(TEdit(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
        TEdit(Sender).Text := Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
      end;
    end;
  finally
    frmZDYHelp.Free;
  end;
end;

procedure TfrmClothInfoInput.TbUpFileClick(Sender: TObject);
begin
//  if trim(C_Code.Text) = '' then
//    Exit;
//  try
//    frmAttachmentUpload := TfrmAttachmentUpload.Create(Application);
//    with frmAttachmentUpload do
//    begin
//      FEditAuthority := True;
//      fkeyNO := trim(C_Code.Text);
//      fType := '产品品档案';
//      if ShowModal = 1 then
//      begin
//
//      end;
//    end;
//  finally
//    frmAttachmentUpload.Free;
//  end;
end;

procedure TfrmClothInfoInput.ToolButton5Click(Sender: TObject);
begin
  WriteCxGrid(self.Caption + 'TV4', Tv4, '产品信息录入');
end;

procedure TfrmClothInfoInput.Tv11fs_NamePropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
begin
  try
    frmProductInfoSel := TfrmProductInfoSel.Create(Application);
    with frmProductInfoSel do
    begin
      FSTKName := '助剂';
      if ShowModal = 1 then
      begin
        with Self.CDS_1 do
        begin
          Edit;
          FieldByName('fs_Name').Value := frmProductInfoSel.CDS_1.fieldbyname('P_Name').value;
          FieldByName('fs_spel').Value := frmProductInfoSel.CDS_1.fieldbyname('P_Spec').value;
        end;
      end;
    end;
  finally
    frmProductInfoSel.Free;
  end;
end;

procedure TfrmClothInfoInput.Tv11fs_unitPropertiesEditValueChanged(Sender: TObject);
var
  s: string;
begin
  s := TcxTextEdit(Sender).EditingText;
  if (s <> '') and (s[Length(s)] <> '%') then
  begin
    Tv1.Controller.FocusedColumn.EditValue := s + '%';
  end;
end;

procedure TfrmClothInfoInput.Tv1Column1PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
begin
//  try
//    frmZDYHelp := TfrmZDYHelp.Create(Application);
//    with frmZDYHelp do
//    begin
//      flag := 'FtyType';
//      flagname := '类型';
//      if ShowModal = 1 then
//      begin
//        CDS_1.Edit;
//        CDS_1.fieldbyname('FtyType').Value := Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
//        CDS_1.Post;
//      end;
//    end;
//  finally
//    frmZDYHelp.Free;
//  end;
//  tv1.Controller.EditingController.ShowEdit();
end;

procedure TfrmClothInfoInput.Tv2fp_NamePropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
begin
  try
    frmProductInfoSel := TfrmProductInfoSel.Create(Application);
    with frmProductInfoSel do
    begin
      FSTKName := '助剂';
      if ShowModal = 1 then
      begin
        with Self.CDS_2 do
        begin
          Edit;
          FieldByName('fp_Name').Value := frmProductInfoSel.CDS_1.fieldbyname('P_Name').value;
          FieldByName('fp_spel').Value := frmProductInfoSel.CDS_1.fieldbyname('P_Spec').value;
        end;
      end;
    end;
  finally
    frmProductInfoSel.Free;
  end;
end;

procedure TfrmClothInfoInput.Tv2fp_unitPropertiesEditValueChanged(Sender: TObject);
var
  s: string;
begin
  s := TcxTextEdit(Sender).EditingText;
  if (s <> '') and (s[Length(s)] <> '%') then
  begin
    Tv2.Controller.FocusedColumn.EditValue := s + '%';
  end;
end;

procedure TfrmClothInfoInput.Tv3gj_NamePropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
begin
  try
    frmProductInfoSel := TfrmProductInfoSel.Create(Application);
    with frmProductInfoSel do
    begin
      FSTKName := '助剂';
      if ShowModal = 1 then
      begin
        with Self.CDS_3 do
        begin
          Edit;
          FieldByName('gj_Name').Value := frmProductInfoSel.CDS_1.fieldbyname('P_Name').value;
          FieldByName('gj_spel').Value := frmProductInfoSel.CDS_1.fieldbyname('P_Spec').value;
        end;
      end;
    end;
  finally
    frmProductInfoSel.Free;
  end;
end;

procedure TfrmClothInfoInput.TV4CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
begin
  if CDS_GY.IsEmpty then
  begin
    Exit;
  end
  else
  begin
    DTMPSlist.Text := CDS_GY.FieldByName('DTMPSlist').AsString;
    DTMID.Text := CDS_GY.FieldByName('DTMID').AsString;
  end;
end;

//procedure TfrmClothInfoInput.cxGridDBColumn14PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
//begin
//  try
//    frmProductInfoSel := TfrmProductInfoSel.Create(Application);
//    with frmProductInfoSel do
//    begin
//      FSTKName := '助剂';
//      if ShowModal = 1 then
//      begin
//        with Self.CDS_3_3 do
//        begin
//          Edit;
//          FieldByName('gj_Name').Value := frmProductInfoSel.CDS_1.fieldbyname('P_Name').value;
//          FieldByName('gj_spel').Value := frmProductInfoSel.CDS_1.fieldbyname('P_Spec').value;
//        end;
//      end;
//    end;
//  finally
//    frmProductInfoSel.Free;
//  end;
//end;

//procedure TfrmClothInfoInput.cxGridDBColumn19PropertiesEditValueChanged(Sender: TObject);
//var
//  s: string;
//begin
//  s := TcxTextEdit(Sender).EditingText;
//  if (s <> '') and (s[Length(s)] <> '%') then
//  begin
//    Tv6.Controller.FocusedColumn.EditValue := s + '%';
//  end;
//end;

//procedure TfrmClothInfoInput.cxGridDBColumn4PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
//begin
//  try
//    frmProductInfoSel := TfrmProductInfoSel.Create(Application);
//    with frmProductInfoSel do
//    begin
//      FSTKName := '助剂';
//      if ShowModal = 1 then
//      begin
//        with Self.CDS_3_2 do
//        begin
//          Edit;
//          FieldByName('gj_Name').Value := frmProductInfoSel.CDS_1.fieldbyname('P_Name').value;
//          FieldByName('gj_spel').Value := frmProductInfoSel.CDS_1.fieldbyname('P_Spec').value;
//        end;
//      end;
//    end;
//  finally
//    frmProductInfoSel.Free;
//  end;
//end;

//procedure TfrmClothInfoInput.cxGridDBColumn6PropertiesEditValueChanged(Sender: TObject);
//var
//  s: string;
//begin
//  s := TcxTextEdit(Sender).EditingText;
//  if (s <> '') and (s[Length(s)] <> '%') then
//  begin
//    Tv5.Controller.FocusedColumn.EditValue := s + '%';
//  end;
//end;
//
//procedure TfrmClothInfoInput.Tv3gj_unitPropertiesEditValueChanged(Sender: TObject);
//var
//  s: string;
//begin
//  s := TcxTextEdit(Sender).EditingText;
//  if (s <> '') and (s[Length(s)] <> '%') then
//  begin
//    Tv3.Controller.FocusedColumn.EditValue := s + '%';
//  end;
//end;

end.

