⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 u_form_handstorepd.pas

📁 这是一个啤酒行业的软件
💻 PAS
字号:
unit U_Form_handStorePD;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, EasyGrid, ComCtrls, StdCtrls, Mask, ButtonExCtl,uAdoSet,
  uCheckValidate,uString;

type
  TForm_handStorePD = class(TForm)
    GroupBox1: TGroupBox;
    BtnSave: TButtonExCtl;
    BtnExit: TButtonExCtl;
    BtnFind: TButtonExCtl;
    Label3: TLabel;
    beginDate: TMaskEdit;
    _beginDate: TDateTimePicker;
    GroupBox2: TGroupBox;
    Grid1: TEasyGrid;
    ButtonExCtl1: TButtonExCtl;
    procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
    procedure BtnExitClick(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure BtnFindClick(Sender: TObject);
    procedure Grid1KeyPress(Sender: TObject; var Key: Char);
    procedure BtnSaveClick(Sender: TObject);
    procedure _beginDateCloseUp(Sender: TObject);
    procedure ButtonExCtl1Click(Sender: TObject);
  private
    { Private declarations }
    _AdoNewProduce:TuAdoSet;
    _Check:TCheckValidate;
    _str:TuString;
  public
    { Public declarations }
  end;

var
  Form_handStorePD: TForm_handStorePD;

implementation

uses U_Form_MainMenu,uGlobal,U_Form_handStorePDFind;

{$R *.dfm}

procedure TForm_handStorePD.FormCloseQuery(Sender: TObject;
  var CanClose: Boolean);
begin
       EnableWindow(Form_MainMenu.Handle,true);
       CanClose:=true;
end;

procedure TForm_handStorePD.BtnExitClick(Sender: TObject);
begin
     EnableWindow(Form_MainMenu.Handle,true);
     Close;
end;

procedure TForm_handStorePD.FormCreate(Sender: TObject);
begin
    _AdoNewProduce:=TuAdoSet.Create('newProduce',1);
    _Check:=TCheckValidate.create;
    _str:=TuString.Create;



     with _AdoNewProduce do
     begin
         setGridTitle(grid1,1,'序号',60);
         setGridTitle(grid1,2,'产品名称',140);
         setGridTitle(grid1,3,'规格',80);
         setGridTitle(grid1,4,'单位',80);
         setGridTitle(grid1,5,'成套数',90);
         setGridTitle(grid1,6,'空箱数',80);
         setGridTitle(grid1,7,'整瓶数',100);

         setGridTitle(grid1,8,'酒库名称',80);
     end;

     beginDate.Text:=formatDateTime('yyyy-mm-dd',now);
     _beginDate.Date:=strTodate(formatDateTime('yyyy-mm-dd',now));

end;

procedure TForm_handStorePD.BtnFindClick(Sender: TObject);
var
   param:TStringList;
   strsql:string;
   i:integer;
begin
   param:=TStringList.Create;
   param.clear;
   {/*
       开始检索数据
   */}
   param.Add(_whichStore);
   strSql:='select  OrderID,ProduceName,specification,UnitName  from  sale_Storage  Where  whichStore=:s1  order by  OrderID';
   _AdoNewproduce.BindToGrid(grid1,strsql,param);
   grid1.Colcount:=9;
   with _AdoNewProduce do
   begin
         setGridTitle(grid1,1,'序号',60);
         setGridTitle(grid1,2,'产品名称',140);
         setGridTitle(grid1,3,'规格',80);
         setGridTitle(grid1,4,'单位',80);
         setGridTitle(grid1,5,'成套数',90);
         setGridTitle(grid1,6,'空箱数',80);
         setGridTitle(grid1,7,'整瓶数',100);


         setGridTitle(grid1,8,'酒库名称',80);
   end;
   for i:=2 to grid1.RowCount-1 do
   begin
       grid1.cells[8,i].ForeText:=trim(_whichStore);
   end;
   grid1.Refresh;
end;

procedure TForm_handStorePD.Grid1KeyPress(Sender: TObject; var Key: Char);
begin
     if key=#13 then
     begin
        if grid1.row<grid1.RowCount-2 then
        begin
           grid1.row:=grid1.row+1;
           
        end;
     end;
end;

procedure TForm_handStorePD.BtnSaveClick(Sender: TObject);
var
    param:TStringList;
    strsql:string;

    _Checkdate:string;
    _begindate:string;
    _endDate:string;

    i:integer;
begin
    param:=TStringList.Create;
    param.Clear;
    _beginDate:= trim(begindate.text)+' 00:00:00';
    _endDate:= trim(begindate.text)+' 23:59:59';
    {/*
      2008.04.09
      入库之前先检查是否进行接班任务
    */}
    param.clear;
    param.Add(trim(formatDateTime('yyyy-mm-dd',now)));
    param.add('1');
    param.Add(trim(_whichStore));
    strsql:='select * from  sale_followStore_Flag   where  SF_CheckDate=:s1 and  SF_Flag=:s2  and  SF_whichStore=:s3';
    if _AdoNewProduce.getRecordCount(strsql,param)<=0 then
    begin
       showmessage('请首先进行接班库存盘点工作,然后在进行其他操作...');
       exit;
    end;

    {/*
      验证当天的接班数据是否存在
    */}
    param.Clear;
    param.Add(trim(_beginDate));
    param.Add(trim(_endDate));
    param.Add(_whichStore);
    strsql:='select * from  sale_handRealStore  where  (SF_Checkdate>=:s1  and  SF_Checkdate<=:s2)  and  SF_whichStore=:s3 ';
    if _AdoNewproduce.getRecordCount(strsql,param)>0 then
    begin
         showmessage('当天的交班库存已经存在...');
         exit;
    end;

    _CheckDate:=trim(begindate.text)+' '+trim(formatDateTime('hh:mm:ss',now));
    if _str.saveMessage then
    begin
      {/*
         进行存盘操作,将早晨接班盘点库存存入接班库存表newproduce-->sale_handRealStore
         这个表是每天的接班盘点表,sale_storage表是查询中间的一个表,每天库存盘点结束
         后sale_storage表清零
      */}
      for i:=2 to grid1.RowCount-2 do
      begin
          param.clear;
          param.Add(trim(grid1.cells[1,i].foretext));
          param.Add(trim(grid1.cells[2,i].foretext));
          param.Add(trim(grid1.cells[3,i].foretext));
          param.Add(trim(grid1.cells[4,i].foretext));

          if  grid1.cells[5,i].foretext<>'' then
          begin
              param.Add(trim(grid1.cells[5,i].foretext));
          end
          else
          begin
              param.Add('0');
          end;

          if  grid1.cells[6,i].foretext<>'' then
          begin
              param.Add(trim(grid1.cells[6,i].foretext));
          end
          else
          begin
              param.Add('0');
          end;

          if  grid1.cells[7,i].foretext<>'' then
          begin
              param.Add(trim(grid1.cells[7,i].foretext));
          end
          else
          begin
              param.Add('0');
          end;
          param.Add(trim(grid1.cells[8,i].foretext));
          param.Add(trim(_CheckDate));
          strsql:='insert into  sale_handRealStore(SF_OrderID,SF_produceName,SF_specification,SF_UnitName,';
          strsql:=strsql+'SF_boxNum,SF_EmptyBoxNum,SF_bottleNum,SF_WhichStore,SF_CheckDate) Values(:s1,';
          strsql:=strsql+':s2,:s3,:s4,:s5,:s6,:s7,:s8,:s9)';
          _AdoNewProduce.actionRecord(strsql,param);
      end;//for i
    end;///if
    _str.actionOK(aT_save);
       
end;

procedure TForm_handStorePD._beginDateCloseUp(Sender: TObject);
begin
    beginDate.Text:=formatDateTime('yyyy-mm-dd',_beginDate.Date);
end;

procedure TForm_handStorePD.ButtonExCtl1Click(Sender: TObject);
begin
    if Form_handStorePDFind=nil then
    begin
       EnableWindow(Form_handStorePD.Handle,false);
       Form_handStorePDFind:=TForm_handStorePDFind.Create(Application);
       Form_handStorePDFind.Show;
    end
    else
    begin
       EnableWindow(Form_handStorePD.Handle,false);
       Form_handStorePDFind.Show;
    end;
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -