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

📄 sccgssb.pas

📁 一个仓库管理中的子系统--采购子系统
💻 PAS
📖 第 1 页 / 共 2 页
字号:
unit sccgssb;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, ComCtrls, ExtCtrls, Grids, Buttons, DBGrids;

var MyRowCount,sqbRCount:Integer;
type
  TjhssForm = class(TForm)
    Panel1: TPanel;
    Label2: TLabel;
    yxnxLabel: TLabel;
    Label4: TLabel;
    Label5: TLabel;
    bzsjEdit: TEdit;
    bzsjDate: TDateTimePicker;
    Label7: TLabel;
    rwmcLabel: TLabel;
    Label1: TLabel;
    Panel2: TPanel;
    bzfzrCombo: TComboBox;
    shrCombo: TComboBox;
    Label9: TLabel;
    Label8: TLabel;
    Label10: TLabel;
    pzrCombo: TComboBox;
    Label11: TLabel;
    Label12: TLabel;
    Label13: TLabel;
    bzfzrqzEdit: TEdit;
    shrqEdit: TEdit;
    pzrqEdit: TEdit;
    bzfzrqzDate: TDateTimePicker;
    shrqDate: TDateTimePicker;
    pzrqDate: TDateTimePicker;
    Label16: TLabel;
    sqbidCombo: TComboBox;
    lshEdit: TEdit;
    StringGrid2: TStringGrid;
    jhyCombo: TComboBox;
    jhyzdcjCombo: TComboBox;
    BitBtn1: TBitBtn;
    ycdhrqDate: TDateTimePicker;
    BitBtn2: TBitBtn;
    StatusBar1: TStatusBar;
    procedure StringGrid2DrawCell(Sender: TObject; ACol, ARow: Integer;
      Rect: TRect; State: TGridDrawState);
    procedure StringGrid2SelectCell(Sender: TObject; ACol, ARow: Integer;
      var CanSelect: Boolean);
    procedure jhyComboChange(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure bzsjDateCloseUp(Sender: TObject);
    procedure jhyzdcjComboChange(Sender: TObject);
    procedure ycdhrqDateCloseUp(Sender: TObject);
    procedure bzfzrqzDateCloseUp(Sender: TObject);
    procedure shrqDateCloseUp(Sender: TObject);
    procedure pzrqDateCloseUp(Sender: TObject);
    procedure BitBtn1Click(Sender: TObject);
    procedure sqbidComboKeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure sqbidComboChange(Sender: TObject);
    procedure FormActivate(Sender: TObject);
  private
  procedure InitstringGrid;
    { Private declarations }
  public
  Function  readkcsl(cpbhstr:string):string;
  Procedure Postjhssxb;
  procedure postjhsszb;
  Procedure SetSgridEMode;
  Procedure InitSGridHead;
  procedure InitjhssForm;
    { Public declarations }
  end;

var
  jhssForm: TjhssForm;

implementation
uses datamodule,sqquery,sqbinput;
{$R *.DFM}

Function TjhssForm.Readkcsl(cpbhstr:string):string;
begin
   with datamodule1.PublicQuery1 do
   begin
   sql.Clear;
   sql.Add('select sl From dbo.c_zckb');
   sql.add('where id='+''''+cpbhstr+'''');
   prepare;
   open;
   if recordcount=0 then
   Result:='0'
   else
   Result:=FieldByName('sl').asstring;
   close;
   end;
end;


procedure TjhssForm.InitstringGrid;
var I,J:Integer;
begin
     For I:=0 to stringGrid2.ColCount-1 do
     For J:=1 to stringGrid2.RowCount-1 do
     if (I=6) or (I=9) or (I=10) or (I=13) then
     stringGrid2.Cells[I,J]:='0.0'
     else
     if I=0 then
     stringGrid2.Cells[I,J]:=inttostr(J)
     else
     StringGrid2.Cells[I,J]:='';
end;

Procedure TjhssForm.Postjhssxb;
var I:integer;
begin
  with dataModule1 do
  begin
   For I:=0 to sqbRCount-1 do
   begin
   with stringGrid2 do
   begin
   with ssjhxbTable do
   begin
   open;
   append;
   FieldByName('sqbid').asstring:=sqbidCombo.Text;
   FieldByName('tjqr').asstring:='0';
   FieldByname('jhy').asstring:=cells[1,I+1];
   FieldByName('cpmc').asstring:=cells[2,I+1];
   FieldByName('xhgg').asstring:=cells[3,I+1];
   FieldByName('cpbh').asstring:=cells[4,I+1];
   FieldByName('jldw').asstring:=cells[5,I+1];
   FieldByName('sbsl').asFloat:=strTofloat(cells[6,I+1]);
   FieldByName('sbrq').asstring:=sqinputForm.GetDate709(cells[7,I+1]);
   FieldByName('kcsl').asfloat:=strTofloat(cells[9,I+1]);
   FieldByName('xcgsl').asFloat:=strToFloat(cells[10,I+1]);
   FieldByName('ycdhsj').asstring:=sqinputForm.GetDate709(Cells[11,I+1]);
   FieldByName('xqdw').asstring:=cells[12,I+1];
   FieldByName('sccj').asstring:=cells[8,I+1];
   FieldByName('cgslhs').asFloat:=StrToFloat(cells[13,I+1]);
   FieldByName('Bz').asstring:=cells[15,I+1];
   Post;
   end;
   with publicquery3 do
   begin
   Requestlive:=True;
   close;
   sql.Clear;
   sql.Add('Select * From dbo.a_cghzglb');
   sql.Add('where sqbid='+''''+sqbidCombo.text+''''+' and cpbh='+''''+stringGrid2.Cells[4,I+1]+'''');
   prepare;
   open;
   if RecordCount=0 then
   begin
   showmessage('There are not any Records!');
   break;
   end;
   edit;
   FieldByName('jhy').asstring:=cells[1,I+1];
   FieldByName('sbrq').asstring:=sqinputForm.GetDate709(cells[7,I+1]);
   FieldByName('kcsl').AsFloat:=strToFloat(Cells[9,I+1]);
   FieldByName('sxsl').AsFloat:=strtoFloat(cells[10,I+1]);
   FieldByName('cgslhs').AsFloat:=strToFloat(cells[13,I+1]);
   FieldByName('ycdhsj').AsString:=cells[11,I+1];
   post;
   end;
   end;// "with stringgrid2 do"
   end;//For 循环
   publicquery3.close;
   end;//"with datamodule1 do"
end;

procedure TjhssForm.postjhsszb;
begin
   with datamodule1.ssjhzbTable do
   begin
   open;
   append;
   FieldByname('sqbid').asstring:=sqbidCombo.text;
   FieldByname('rwmc').asstring:=rwmcLabel.Caption;
   FieldByname('yxnx').asstring:=yxnxlabel.Caption;
   FieldByname('lsh').asstring:=lshedit.Text;
   FieldByName('bzsj').asstring:=sqinputForm.GetDate709(bzsjEdit.Text);
   FieldByname('bzfzr').asstring:=bzfzrCombo.Text;
   FieldByname('bzqzrq').asstring:=sqinputForm.GetDate709(bzfzrqzEdit.Text);
   FieldByname('shr').asstring:=shrCombo.Text;
   FieldByname('pzr').asstring:=pzrCombo.Text;
   FieldByname('shrq').asstring:=sqinputForm.GetDate709(shrqEdit.Text);
   FieldByname('pzrq').asstring:=sqinputForm.GetDate709(pzrqEdit.Text);
   post;
   end;
   with datamodule1.publicquery3 do
   begin
   requestlive:=true;
   sql.Clear;
   sql.Add('select scssb_flag from dbo.a_cgsqzb');
   sql.Add('where sqbid='+''''+sqbidCombo.text+'''');
   open;
   edit;
   FieldByName('scssb_flag').asstring:='1';
   post;
   close;
   end;
end;

procedure  TjhssForm.SetSgridEMode;
begin
    with stringGrid2 do
    begin
    if (GoEditing in Options) then
    Options:=Options-[GoEditing];
    end;
end;

procedure  TjhssForm.InitSGridHead;
begin
    with StringGrid2 do
       begin
       cells[1,0]:='计划员';
       Cells[2,0]:='产品名称';
       cells[3,0]:='型号规格';
       cells[4,0]:='产品编号';
       cells[5,0]:='计量单位';
       cells[6,0]:='申请数量';
       cells[7,0]:='申请时间';
       cells[8,0]:='申请部门指定生产厂家';
       cells[9,0]:='库存数量';
       cells[10,0]:='需采购数量';
       cells[11,0]:='预测到货时间';
       cells[12,0]:='需求单位';
       cells[13,0]:='采购数量核实';
       Cells[14,0]:='备注'
       end;
end;

Procedure TjhssForm.InitjhssForm;
var I:integer;
sqdwstr,sqrqstr:string;
begin
    with dataModule1 do
    begin
    with publicquery1 do
    begin
    sql.Clear;
    sql.Add('select * from dbo.a_cgsqzb');
    sql.Add('where sqbid='+''''+sqbidComBo.text+'''');
    prepare;
    open;
    rwmcLabel.Caption:=FieldByname('rwmc').asstring;
    yxnxLabel.Caption:=FieldByname('yxnx').asstring;
    lshEdit.Text:=FieldByname('lsh').asstring;
    sqdwstr:=FieldByname('sqdw').asstring;
    sqrqstr:=fieldbyName('sqrq').asstring;
    end;
    with Publicquery2 do
    begin
    sql.Clear;
    sql.Add('select * from dbo.a_cgsqxb');
    sql.Add('where sqbid='+''''+sqbidComBo.text+'''');
    prepare;
    open;
    first;
    sqbRCount:=publicquery2.RecordCount;

⌨️ 快捷键说明

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