unit U_CKProductBCPKCList;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData,
  cxDataStorage, cxEdit, DB, cxDBData, cxGridCustomTableView,
  cxGridTableView, cxGridBandedTableView, cxGridDBBandedTableView,
  cxGridLevel, cxClasses, cxControls, cxGridCustomView, cxGridDBTableView,
  cxGrid, StdCtrls, ComCtrls, ExtCtrls, ToolWin, cxGridCustomPopupMenu,
  cxGridPopupMenu, ADODB, DBClient, cxDropDownEdit, MovePanel, cxCheckBox,
  Menus, cxCalendar, RM_Common, RM_Class, RM_GridReport, RM_System,
  RM_Dataset, BtnEdit;

type
  TfrmCKProductBCPKCList = class(TForm)
    ToolBar1: TToolBar;
    TBRafresh: TToolButton;
    TBFind: TToolButton;
    TBExport: TToolButton;
    TBPrint: TToolButton;
    TBClose: TToolButton;
    Panel1: TPanel;
    ADOQueryCmd: TADOQuery;
    ADOQueryMain: TADOQuery;
    ADOQueryTemp: TADOQuery;
    DataSource1: TDataSource;
    cxGridPopupMenu1: TcxGridPopupMenu;
    Label3: TLabel;
    MPRTCodeName: TEdit;
    Label1: TLabel;
    Label2: TLabel;
    BegDate: TDateTimePicker;
    EndDate: TDateTimePicker;
    CDS_Main: TClientDataSet;
    Tv1: TcxGridDBTableView;
    cxGrid2Level1: TcxGridLevel;
    cxGrid2: TcxGrid;
    v2Column1: TcxGridDBColumn;
    v2Column3: TcxGridDBColumn;
    v2Column5: TcxGridDBColumn;
    v2Column6: TcxGridDBColumn;
    v1Column1: TcxGridDBColumn;
    Label5: TLabel;
    orderNo: TEdit;
    Label6: TLabel;
    MJID: TEdit;
    v1Column7: TcxGridDBColumn;
    v1Column6: TcxGridDBColumn;
    v1Column8: TcxGridDBColumn;
    v1Column9: TcxGridDBColumn;
    Label8: TLabel;
    MPRTKZ: TEdit;
    Label9: TLabel;
    MPRTMF: TEdit;
    Label7: TLabel;
    CPType: TComboBox;
    v1Column3: TcxGridDBColumn;
    v1Column2: TcxGridDBColumn;
    v1Column4: TcxGridDBColumn;
    v1Column5: TcxGridDBColumn;
    Panel4: TPanel;
    Label11: TLabel;
    Panel10: TPanel;
    Image2: TImage;
    RichEdit1: TRichEdit;
    MovePanel2: TMovePanel;
    v1Column11: TcxGridDBColumn;
    TBZD: TToolButton;
    v1Column12: TcxGridDBColumn;
    PopupMenu1: TPopupMenu;
    N1: TMenuItem;
    N2: TMenuItem;
    v1Column10: TcxGridDBColumn;
    v1Column13: TcxGridDBColumn;
    Label4: TLabel;
    Label10: TLabel;
    PRTColor: TComboBox;
    AOrdDefStr1: TComboBox;
    v1Column14: TcxGridDBColumn;
    ThreeColorBase: TcxStyleRepository;
    SHuangSe: TcxStyle;
    SkyBlue: TcxStyle;
    Default: TcxStyle;
    QHuangSe: TcxStyle;
    Red: TcxStyle;
    FontBlue: TcxStyle;
    TextSHuangSe: TcxStyle;
    FonePurple: TcxStyle;
    FoneClMaroon: TcxStyle;
    FoneRed: TcxStyle;
    RowColor: TcxStyle;
    handBlack: TcxStyle;
    cxBlue: TcxStyle;
    ToolButton1: TToolButton;
    Label12: TLabel;
    baoNo: TEdit;
    CheckBox1: TCheckBox;
    print: TToolButton;
    RMDB_Main: TRMDBDataSet;
    ADOQueryPrint: TADOQuery;
    RM2: TRMGridReport;
    ComboBox1: TComboBox;
    Label34: TLabel;
    v1Column15: TcxGridDBColumn;
    PRTKuanNO: TEdit;
    Label13: TLabel;
    v1Column16: TcxGridDBColumn;
    RKPlace1: TBtnEditA;
    Label14: TLabel;
    Button1: TButton;
    RKplace: TEdit;
    Label15: TLabel;
    v1Column17: TcxGridDBColumn;
    customerNoName: TEdit;
    Label16: TLabel;
    procedure FormDestroy(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure FormCreate(Sender: TObject);
    procedure TBRafreshClick(Sender: TObject);
    procedure ConNoMChange(Sender: TObject);
    procedure TBCloseClick(Sender: TObject);
    procedure FormShow(Sender: TObject);
    procedure TBExportClick(Sender: TObject);
    procedure TBFindClick(Sender: TObject);
    procedure MPRTCodeNameChange(Sender: TObject);
    procedure Panel10MouseMove(Sender: TObject; Shift: TShiftState; X,
      Y: Integer);
    procedure Image2Click(Sender: TObject);
    procedure Tv1MouseUp(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    procedure Tv1CellDblClick(Sender: TcxCustomGridTableView;
      ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
      AShift: TShiftState; var AHandled: Boolean);
    procedure TBZDClick(Sender: TObject);
    procedure N1Click(Sender: TObject);
    procedure N2Click(Sender: TObject);
    procedure Tv1CellClick(Sender: TcxCustomGridTableView;
      ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
      AShift: TShiftState; var AHandled: Boolean);
    procedure PRTColorChange(Sender: TObject);
    procedure AOrdDefStr1Change(Sender: TObject);
    procedure ToolButton1Click(Sender: TObject);
    procedure CheckBox1Click(Sender: TObject);
    procedure printClick(Sender: TObject);
    procedure RKPlace1BtnClick(Sender: TObject);
    procedure Button1Click(Sender: TObject);
  private
    FLeft,FTop:Integer;
    procedure InitGrid();
    function PrtData(FMJID:String):boolean;
    { Private declarations }
  public
    { Public declarations }
  end;

var
  frmCKProductBCPKCList: TfrmCKProductBCPKCList;

implementation
uses
  U_DataLink,U_Fun,U_ProductOrderListSel, U_ZDYHelp;

{$R *.dfm}
function TfrmCKProductBCPKCList.PrtData(FMJID:String):boolean;
var
   fPrintFile:String;
   Txt,fImagePath:string;
   Moudle: THandle;
   Makebar:TMakebar;
   Mixtext:TMixtext;
begin
  result:=false;
  try
    with ADOQueryPrint do
    begin
    Close;
    SQL.Clear;
    sql.Add('select QtyUnit=A.MJTypeOther,B.orderNo,B.conNo,GangNo=D.AOrddefStr1,PRTColorEng=E.Note,B.LBName ');
    sql.Add(',khConNo=(select top 1 khConNo from JYOrderCon_Main X where X.ConNO=B.conNO) ');
    sql.Add(',MPRTCodeNameEng=ISNULL((select Top 1 F.note from KH_Zdy F where F.zdyname=B.MPRTCodeName and F.Type=''PRTCodeName''),B.MPRTCodeName)');
    sql.Add(',B.MPRTCF,B.MPRTMF,B.MPRTKZ,C.SOrddefstr4,B.MPRTCodeName,B.MPRTSpec,B.MPRTKuanNO,C.*,A.* ');
    sql.Add(',Case when A.MJSJKZ*A.MJFK<>0 then Cast(A.MJQty4*1000/A.MJSJKZ/(A.MJFK/100) as int) else 0 end as MQty');
    sql.Add(' from WFB_MJJY A') ;
    sql.Add(' inner join JYOrder_Main B On A.Mainid=B.Mainid');
    sql.Add(' inner join JYOrder_Sub C on A.SubId=C.SubId');
    sql.Add(' left join KH_Zdy E on C.PRTColor=E.ZdyName and E.Type=''OrdColor'' ');
    sql.Add(' inner join JYOrder_Sub_AnPai D on A.APId=D.APId ');
    SQL.Add(' where A.MJID='''+Trim(FMJID)+'''');
    Open;
    end;

    try
      Moudle:=LoadLibrary('MakeQRBarcode.dll');
      @Makebar:=GetProcAddress(Moudle,'Make');
      @Mixtext:=GetProcAddress(Moudle,'MixText');
      Txt:=Trim(ADOQueryPrint.fieldbyname('MJID').AsString);
      fImagePath:=ExtractFilePath(Application.ExeName)+'image\temp.bmp' ;
      if not DirectoryExists(pchar(ExtractFilePath(Application.ExeName)+'image')) then
          CreateDirectory(pchar(ExtractFilePath(Application.ExeName)+'image'),nil);
      if FileExists(fImagePath) then DeleteFile(fImagePath);
      Makebar(pchar(Txt),Length(Txt),3,3,0,PChar(fImagePath),3);
    except
      application.MessageBox('条形码生成失败！','提示信息',MB_ICONERROR);
      exit;
    end;

    if Trim(ADOQueryPrint.fieldbyname('LBName').AsString)<>'' then
      fPrintFile:=ExtractFilePath(Application.ExeName)+'Report\'+Trim(ADOQueryPrint.fieldbyname('LBName').AsString)+'.rmf'
    else
      fPrintFile:=ExtractFilePath(Application.ExeName)+'Report\通用英文标签.rmf' ;
    if FileExists(fPrintFile) then
    begin
      RMVariables['QRBARCODE']:=fImagePath;
      Rm2.DefaultCopies:=strtointdef(trim(ComboBox1.Text),1);
      RM2.LoadFromFile(fPrintFile);
    //RM2.ShowReport;
      RM2.PrintReport;
    end
    else
    begin
      Application.MessageBox(PChar('没有找'+ExtractFilePath(Application.ExeName)+'Report\'+Trim(ADOQueryPrint.fieldbyname('LBName').AsString)),'提示',0);
      exit;
    end;
    result:=true;
  except
  end;
end;

procedure TfrmCKProductBCPKCList.FormDestroy(Sender: TObject);
begin
  frmCKProductBCPKCList:=nil;
end;

procedure TfrmCKProductBCPKCList.FormClose(Sender: TObject;
  var Action: TCloseAction);
begin
  Action:=caFree;
end;

procedure TfrmCKProductBCPKCList.FormCreate(Sender: TObject);
begin
  BegDate.DateTime:=SGetServerDateTime(ADOQueryTemp);
  EndDate.DateTime:=SGetServerDateTime(ADOQueryTemp)
end;

procedure TfrmCKProductBCPKCList.InitGrid();
begin
  try
    ADOQueryMain.DisableControls;
    with ADOQueryMain do
    begin
      Filtered:=False;
      Close;
      sql.Clear;
      SQL.Add('exec P_View_CPKCMX :WSQl');
      if Trim(DParameters2)<>'管理' then
      begin
      //  Parameters.ParamByName('WSQl').Value:=' and B.Filler='''+Trim(DName)+'''';
      end else
      begin
       // Parameters.ParamByName('WSQl').Value:='';
      end;
      Parameters.ParamByName('WSQl').Value:='';
      Open;
    end;
    SCreateCDS20(ADOQueryMain,CDS_Main);
    SInitCDSData20(ADOQueryMain,CDS_Main);
  finally
    ADOQueryMain.EnableControls;
  end;
end;

procedure TfrmCKProductBCPKCList.TBRafreshClick(Sender: TObject);
begin
 // BegDate.SetFocus;
  MovePanel2.Visible:=True;
  MovePanel2.Refresh;
  InitGrid();
  MovePanel2.Visible:=False;
end;

procedure TfrmCKProductBCPKCList.ConNoMChange(Sender: TObject);
begin
  if ADOQueryMain.Active then
  begin
    SDofilter(ADOQueryMain,SGetFilters(Panel1,1,2));
  end;
end;

procedure TfrmCKProductBCPKCList.TBCloseClick(Sender: TObject);
begin
  WriteCxGrid('仓库库存列表',Tv1,'成品仓库');
  Close;
end;

procedure TfrmCKProductBCPKCList.FormShow(Sender: TObject);
begin

  ReadCxGrid('仓库库存列表',Tv1,'成品仓库');
  if Trim(DParameters2)='管理' then
  begin
    TBZD.Visible:=True;
  //  ToolButton1.Visible:=true;
  end else
  begin
    TBZD.Visible:=False;
  //  ToolButton1.Visible:=false;
  end;
  //InitGrid();
end;

procedure TfrmCKProductBCPKCList.TBExportClick(Sender: TObject);
begin
  if ADOQueryMain.IsEmpty then exit;
  TcxGridToExcel('库存列表',cxGrid2);
end;

procedure TfrmCKProductBCPKCList.TBFindClick(Sender: TObject);
begin
  if ADOQueryMain.Active then
  begin
    SDofilter(ADOQueryMain,SGetFilters(Panel1,1,2));
    SCreateCDS20(ADOQueryMain,CDS_Main);
    SInitCDSData20(ADOQueryMain,CDS_Main);
  end;
end;

procedure TfrmCKProductBCPKCList.MPRTCodeNameChange(Sender: TObject);
begin
  TBFind.Click;
end;

procedure TfrmCKProductBCPKCList.Panel10MouseMove(Sender: TObject;
  Shift: TShiftState; X, Y: Integer);
begin
  ReleaseCapture;
  TWinControl(Panel4).Perform(WM_SYSCOMMAND,$F012,0);
end;

procedure TfrmCKProductBCPKCList.Image2Click(Sender: TObject);
begin
  Panel4.Visible:=False;
end;

procedure TfrmCKProductBCPKCList.Tv1MouseUp(Sender: TObject;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
  FLeft:=X;
  FTop:=Y;
end;

procedure TfrmCKProductBCPKCList.Tv1CellDblClick(
  Sender: TcxCustomGridTableView;
  ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
  AShift: TShiftState; var AHandled: Boolean);
begin
  {if Trim(TV1.Controller.FocusedColumn.DataBinding.FilterFieldName)<>'CDQK' then Exit;
  with ADOQueryTemp do
  begin
    Close;
    sql.Clear;
    sql.Add('select CDQK=dbo.F_Get_Order_SubStr(:MJID,''MJCDHZSL'')');
    Parameters.ParamByName('MJID').Value:=Trim(CDS_Main.fieldbyname('MJID').AsString);
    Open;
  end;
  with CDS_Main do
  begin
    Edit;
    FieldByName('CDQK').Value:=Trim(ADOQueryTemp.fieldbyname('CDQK').AsString);
    Post;
  end; }
  Panel4.Left:=FLeft;
  Panel4.Top:=FTop+110;
  Panel4.Visible:=True;
  Panel4.Refresh;
  Panel10.Caption:=Trim(TV1.Controller.FocusedColumn.Caption);

  RichEdit1.Text:=CDS_Main.fieldbyname(TV1.Controller.FocusedColumn.DataBinding.FilterFieldName).AsString;
end;

procedure TfrmCKProductBCPKCList.TBZDClick(Sender: TObject);
var
  FMainid,FSubId,FOrderNo,FColor,FSH,FHX,FCodeName,FMPRTMF,FMPRTKZ:String;
begin
  if CDS_Main.Locate('SSel',True,[])=False then
  begin
    Application.MessageBox('没有选择数据!','提示',0);
    Exit;
  end;
  FMainid:='';
  try
    frmProductOrderListSel:=TfrmProductOrderListSel.Create(Application);
    with frmProductOrderListSel do
    begin
      FFInt:=1;
      if ShowModal=1 then
      begin
        FMainid:=frmProductOrderListSel.Order_Main.fieldbyname('Mainid').AsString;
        FSubId:=frmProductOrderListSel.Order_Main.fieldbyname('SubId').AsString;
        FOrderNo:=frmProductOrderListSel.Order_Main.fieldbyname('OrderNo').Value;
        FCodeName:=frmProductOrderListSel.Order_Main.fieldbyname('MPRTCodeName').Value;
        FColor:=frmProductOrderListSel.Order_Main.fieldbyname('PRTColor').Value;
        if Trim(frmProductOrderListSel.Order_Main.fieldbyname('SOrddefstr1').AsString)<>'' then
          FSH:=frmProductOrderListSel.Order_Main.fieldbyname('SOrddefstr1').AsString;
        if Trim(frmProductOrderListSel.Order_Main.fieldbyname('PRTHX').AsString)<>'' then
          FHX:=frmProductOrderListSel.Order_Main.fieldbyname('PRTHX').Value;
        FMPRTMF:=frmProductOrderListSel.Order_Main.fieldbyname('MPRTMF').AsString;
        FMPRTKZ:=frmProductOrderListSel.Order_Main.fieldbyname('MPRTKZ').AsString;
      end;
    end;
  finally
    frmProductOrderListSel.Free;
  end;
  if Trim(FMainid)<>'' then
  begin
    if Application.MessageBox('确定要执行此操作吗？','提示',32+4)<>IDYES then Exit;
    MovePanel2.Visible:=True;
    MovePanel2.Refresh;
    try
      Self.ADOQueryCmd.Connection.BeginTrans;
      Self.CDS_Main.DisableControls;
      with Self.CDS_Main do
      begin
        while not Eof do
        begin
          if Self.CDS_Main.FieldByName('SSEl').AsBoolean=True then
          begin
            with Self.ADOQueryCmd do
            begin
              Close;
              sql.Clear;
              sql.Add('UPdate CK_BanCP_CR Set MainId='''+Trim(FMainid)+'''');
              sql.Add(',SubId='''+Trim(FSubId)+'''');
              sql.Add(',ZDPerson='''+Trim(DName)+''',ZDTime=getdate() ');
              sql.Add(' where CRID='+self.CDS_Main.fieldbyname('CRID').AsString);
              SQL.Add(' and CRType=''检验入库'' ');
              sql.Add('UPdate WFB_MJJY Set MainId='''+Trim(FMainid)+'''');
              sql.Add(',SubId='''+Trim(FSubId)+'''');
              //sql.Add(',ZDPerson='''+Trim(DName)+''',ZDTime=getdate() ');
              sql.Add(' where MJID='+self.CDS_Main.fieldbyname('MJID').AsString);
              ExecSQL;
            end;
            Edit;
            FieldByName('OrderNo').Value:=FOrderNo;
            FieldByName('MPRTCodeName').Value:=FCodeName;
            FieldByName('PRTColor').Value:=FColor;
            FieldByName('SOrddefstr1').Value:=FSH;
            FieldByName('PRTHX').Value:=FHX;
            FieldByName('MPRTMF').Value:=FMPRTMF;
            FieldByName('MPRTKZ').Value:=FMPRTKZ;
            Post;
          end;
          Next;
        end;
      end;
      Self.CDS_Main.EnableControls;
      Self.ADOQueryCmd.Connection.CommitTrans;
      MovePanel2.Visible:=False;
    except
      Self.ADOQueryCmd.Connection.RollbackTrans;
      MovePanel2.Visible:=False;
      Application.MessageBox('转单失败!','提示',0) ;
    end;
  end;
end;

procedure TfrmCKProductBCPKCList.N1Click(Sender: TObject);
begin
  SelOKNo(CDS_Main,True);
end;

procedure TfrmCKProductBCPKCList.N2Click(Sender: TObject);
begin
  SelOKNo(CDS_Main,False);
end;

procedure TfrmCKProductBCPKCList.Tv1CellClick(
  Sender: TcxCustomGridTableView;
  ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
  AShift: TShiftState; var AHandled: Boolean);
begin
  if CDS_Main.IsEmpty=False then
  begin
    InitOrderColor(Trim(CDS_Main.fieldbyname('MainId').AsString),PRTColor,ADOQueryTemp);
    InitBCGangNo(Trim(CDS_Main.fieldbyname('SubId').AsString),AOrdDefStr1,ADOQueryTemp);
  end;
end;

procedure TfrmCKProductBCPKCList.PRTColorChange(Sender: TObject);
begin
  TBFind.Click;
  if CDS_Main.IsEmpty=False then
  begin
    //InitOrderColor(Trim(CDS_Main.fieldbyname('MainId').AsString),PRTColor,ADOQueryTemp);
    InitBCGangNo(Trim(CDS_Main.fieldbyname('SubId').AsString),AOrdDefStr1,ADOQueryTemp);
  end;
end;

procedure TfrmCKProductBCPKCList.AOrdDefStr1Change(Sender: TObject);
begin
  TBFind.Click;
end;

procedure TfrmCKProductBCPKCList.ToolButton1Click(Sender: TObject);
begin
  IF CDS_main.IsEmpty then exit;
  orderNo.SetFocus;
  if CDS_Main.Locate('SSel',True,[])=False then
  begin
    Application.MessageBox('没有选择数据!','提示',0);
    Exit;
  end;

  ADOQueryCmd.Connection.BeginTrans;
  try
    with  CDS_Main do
    begin
      DisableControls;
      first;
      while not eof do
      begin
        IF fieldbyname('ssel').AsBoolean then
        begin
          with ADOQueryCmd do
          begin
            close;
            sql.Clear;
            sql.Add('update CK_BanCP_CR ');
            sql.Add('SET baoNO='+quotedstr(CDS_Main.fieldbyname('baoNO').AsString));
            sql.Add('where BCID='+quotedstr(CDS_Main.fieldbyname('BCID').AsString));
            sql.Add('and MJID='+quotedstr(CDS_Main.fieldbyname('MJID').AsString));
            execsql;
          end;
        end;
        next;
      end;
      first;
      EnableControls;
    end;
    ADOQueryCmd.Connection.CommitTrans;
    application.MessageBox('数据保存成功！','提示信息');
    exit;
  except
    ADOQueryCmd.Connection.RollbackTrans;
    application.MessageBox('数据保存失败！','提示信息',MB_ICONERROR);
    exit;
  end;
end;

procedure TfrmCKProductBCPKCList.CheckBox1Click(Sender: TObject);
begin
    with  CDS_Main do
    begin
      DisableControls;
      first;
      while not eof do
      begin
        edit;
        fieldbyname('ssel').Value:=checkbox1.Checked;
        post;
        next;
      end;
      first;
      EnableControls;
    end;
end;

procedure TfrmCKProductBCPKCList.printClick(Sender: TObject);
begin
  if CDS_Main.Locate('SSel',True,[])=False then
  begin
    Application.MessageBox('没有选择数据!','提示',0);
    Exit;
  end;

      with CDS_Main do
      begin
        DisableControls;
        first;
        while not Eof do
        begin
          if Self.CDS_Main.FieldByName('SSEl').AsBoolean=True then
          begin
            iF not  PrtData(CDS_Main.fieldbyname('MJID').AsString) then
            begin
              EnableControls;
              exit;
            end;
          end;
          Next;
        end;
        EnableControls;
      end;
end;

procedure TfrmCKProductBCPKCList.RKPlace1BtnClick(Sender: TObject);
begin
  try
    frmZDYHelp:=TfrmZDYHelp.Create(Application);
    with frmZDYHelp do
    begin
      flag:='KuWei';
      flagname:='库位';
      if ShowModal=1 then
      begin
        RKPlace1.Text:=Trim(ClientDataSet1.fieldbyname('ZdyName').AsString);
      end;
    end;
  finally
    frmZDYHelp.Free;
  end;
end;

procedure TfrmCKProductBCPKCList.Button1Click(Sender: TObject);
begin
 // IF trim(RKPlace1.Text)='' then exit;
    MovePanel2.Visible:=True;
    MovePanel2.Refresh;
    try
      Self.ADOQueryCmd.Connection.BeginTrans;
      Self.CDS_Main.DisableControls;
      with Self.CDS_Main do
      begin
        while not Eof do
        begin
          if Self.CDS_Main.FieldByName('SSEl').AsBoolean=True then
          begin
            with Self.ADOQueryCmd do
            begin
              Close;
              sql.Clear;
              sql.Add('UPdate CK_BanCP_CR Set RKPlace='+quotedstr(trim(RKPlace1.Text)));
              sql.Add(' where BCID='+quotedstr(trim(self.CDS_Main.fieldbyname('BCID').AsString)));
              ExecSQL;
            end;
            Edit;
            FieldByName('RKPlace').Value:=trim(rkplace1.Text);
            Post;
          end;
          Next;
        end;
      end;
      Self.CDS_Main.EnableControls;
      Self.ADOQueryCmd.Connection.CommitTrans;
      MovePanel2.Visible:=False;
    except
      Self.ADOQueryCmd.Connection.RollbackTrans;
      MovePanel2.Visible:=False;
      Application.MessageBox('转移库位失败!','提示',0) ;
    end;
end;

end.
