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

📄 quality_check.pas

📁 delphi的一个开发实例
💻 PAS
📖 第 1 页 / 共 5 页
字号:
unit Quality_Check;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, Grids, StdCtrls, ExtCtrls, Buttons, XPMenu;

type
  Tfrm_Quality_Check = class(TForm)
    Panel1: TPanel;
    Panel2: TPanel;
    SpeedButton2: TSpeedButton;
    SpeedButton3: TSpeedButton;
    Cmd_Cancel: TSpeedButton;
    Panel3: TPanel;
    Label1: TLabel;
    Panel4: TPanel;
    Edit1: TLabeledEdit;
    GroupBox1: TGroupBox;
    SpeedButton1: TSpeedButton;
    SpeedButton5: TSpeedButton;
    SpeedButton7: TSpeedButton;
    SpeedButton8: TSpeedButton;
    SpeedButton9: TSpeedButton;
    Edit4: TLabeledEdit;
    Edit_Storage_Name: TLabeledEdit;
    Edit6: TLabeledEdit;
    Edit7: TLabeledEdit;
    Edit8: TLabeledEdit;
    Edit9: TLabeledEdit;
    Edit10: TLabeledEdit;
    Edit2: TLabeledEdit;
    Edit3: TLabeledEdit;
    Panel5: TPanel;
    Panel6: TPanel;
    Panel7: TPanel;
    SpeedButton6: TSpeedButton;
    SpeedButton10: TSpeedButton;
    LabeledEdit11: TLabeledEdit;
    LabeledEdit12: TLabeledEdit;
    LabeledEdit13: TLabeledEdit;
    Panel8: TPanel;
    Label2: TLabel;
    Label3: TLabel;
    Panel9: TPanel;
    Panel10: TPanel;
    Cmd_Delete: TSpeedButton;
    Cmd_Add: TSpeedButton;
    StringGrid1: TStringGrid;
    P_check: TPanel;
    P1: TPanel;
    Cmd1: TSpeedButton;
    L1: TLabel;
    P2: TPanel;
    Cmd2: TSpeedButton;
    L2: TLabel;
    P3: TPanel;
    Cmd3: TSpeedButton;
    L3: TLabel;
    P4: TPanel;
    L4: TLabel;
    Cmd4: TSpeedButton;
    P5: TPanel;
    L5: TLabel;
    Cmd5: TSpeedButton;
    XPMenu1: TXPMenu;
    Edit11: TLabeledEdit;
    Cmd_LHDJ: TSpeedButton;
    Edit5: TLabeledEdit;
    procedure Cmd_CancelClick(Sender: TObject);
    procedure FormShow(Sender: TObject);
    procedure Cmd_AddClick(Sender: TObject);
    procedure Cmd_DeleteClick(Sender: TObject);
    procedure StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
      Rect: TRect; State: TGridDrawState);
    procedure StringGrid1DblClick(Sender: TObject);
    procedure Edit1DblClick(Sender: TObject);
    procedure Edit1KeyPress(Sender: TObject; var Key: Char);
    procedure Edit8KeyPress(Sender: TObject; var Key: Char);
    procedure Edit8DblClick(Sender: TObject);
    procedure Cmd1Click(Sender: TObject);
    procedure Cmd2Click(Sender: TObject);
    procedure Cmd3Click(Sender: TObject);
    procedure Cmd4Click(Sender: TObject);
    procedure Cmd5Click(Sender: TObject);
    procedure Cmd_LHDJClick(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure SpeedButton1Click(Sender: TObject);
    procedure SpeedButton5Click(Sender: TObject);
    procedure SpeedButton9Click(Sender: TObject);
    procedure SpeedButton8Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  frm_Quality_Check: Tfrm_Quality_Check;
  iColcount,Total_Count:integer;
  Pcol,Prow:integer;
  ss,tempstr:string;
implementation

uses Data, func, Goods_Check, Public_Don, Stock_Write_Check, Supply_Monad,
  Storage_Select, Login_Man, ChildShop_Select;

{$R *.dfm}

procedure Tfrm_Quality_Check.Cmd_CancelClick(Sender: TObject);
var
    i,j,icol:integer;
    Check_Flag:string;
begin
    frm_Public_Don:=Tfrm_Public_Don.Create(self);
    frm_Public_Don.ShowModal;
    //保存草稿
    if Public_Do='Stock_0007' then
    begin
        if Public_Do_Result='01' then
        begin
            with frm_data.ClientDataSet2 do
            begin
                Close;
                CommandText:='';
                Commandtext:='Select * from [V_Stock_Quality_View] where Receipt_No='''+Trim(Edit2.Text)+'''';
                try
                    Open;
                    Check_Flag:=frm_data.ClientDataSet2.FieldValues['Check_Result'];
                    if Check_Flag='0' then
                    begin
                        Application.MessageBox('单据还没有完全审核,不能过帐',pchar(application.Title),mb_iconwarning);
                        Exit;
                    end;
                    if Check_Flag='1' then
                    begin
                        try
                            with frm_data.ClientDataSet_Add do
                            begin
                                Close;
                                Commandtext:='';
                                Commandtext:='Update [Quality_Check] set Gather_Name='''+Trim(Edit4.Text)+''',Storage_NO='''+Trim(Edit5.Text)+''',Transactor='''+Trim(Edit6.Text)+''',Shop_NO='''+Trim(Edit7.Text)+''',Proposer='''+Trim(Edit8.Text)+''',Condense='''+Trim(Edit9.Text)+''',Quality_Remark='''+Trim(Edit10.Text)+''',Contract_No='''+Trim(Edit11.Text)+''' where Stock_No='''+Trim(Edit2.Text)+'''';
                                try
                                    Execute;
                                    try
                                        for i:=1 to Total_Count do
                                        begin
                                            with frm_data.ClientDataSet_Add do
                                            begin
                                                Close;
                                                CommandText:='';
                                                CommandText:='update [Quality_Check_detail] set Total_Amount='''+Trim(StringGrid1.Cells[3,i])+''',Regular_Amount='''+Trim(StringGrid1.Cells[4,i])+''',Un_Regular_Amount='''+Trim(StringGrid1.Cells[5,i])+''',Check_Remark='''+Trim(StringGrid1.Cells[6,i])+''' where Stock_NO='''+Trim(Edit2.Text)+'''Goods_NO='''+Trim(StringGrid1.Cells[1,i])+'''';
                                                try
                                                    Execute;
                                                except
                                                    Application.MessageBox('保存[质量验收单明细]时连接服务器数据库失败,请检查连接网络是否正常,请确认!',pchar(application.Title),mb_iconwarning);
                                                    Exit;
                                                end;
                                            end;
                                        end;
                                        with frm_data.ClientDataSet_Add do
                                        begin
                                            Close;
                                            Commandtext:='';
                                            Commandtext:='Update [Receipt] set Flag_sign=''单据'' where Receipt_No='''+Trim(Edit2.Text)+'''';
                                            try
                                                Execute;
                                                Application.MessageBox('[质量验收单]单据过帐完毕!,请确认!',pchar(application.Title),mb_iconwarning);
                                            except
                                                Application.MessageBox('保存[质量验收单审核表]时连接服务器数据库失败,请检查连接网络是否正常,请确认!',pchar(application.Title),mb_iconwarning);
                                                Exit;
                                            end;
                                        end;
                                    except
                                        Application.MessageBox('保存[质量验收单明细]时循环失败,请检查连接网络是否正常,请确认!',pchar(application.Title),mb_iconwarning);
                                        Exit;
                                    end;
                                except
                                    Application.MessageBox('保存[质量验收单]时连接服务器数据库失败,请检查连接网络是否正常,请确认!',pchar(application.Title),mb_iconwarning);
                                    Exit;
                                end;
                            end;
                        except
                            Application.MessageBox('保存[质量验收单]时失败,请检查连接网络是否正常,请确认!',pchar(application.Title),mb_iconwarning);
                            Exit;
                        end;
                    end;
                except
                    Application.MessageBox('系统错误,连接服务器数据库出错,检查连接网络是否正常?请确认!',pchar(application.Title),mb_iconwarning);
                    Exit;
                end;
            end;
        end;
        //保存为草稿
        if Public_Do_Result='02' then
        begin
            try
                if Trim(Edit1.Text)='' then
                begin
                    Application.MessageBox('操作错误,【录单日期】不能为空!,请确认!',pchar(application.Title),mb_iconwarning);
                    Edit1.SetFocus;
                    Exit;
                end;
                if Trim(Edit2.Text)='' then
                begin
                    Application.MessageBox('操作错误,【单据编号】不能为空!,请确认!',pchar(application.Title),mb_iconwarning);
                    Edit2.SetFocus;
                    Exit;
                end;
                if Trim(Edit3.Text)='' then
                begin
                    Application.MessageBox('操作错误,【来货登记号】不能为空!,请确认!',pchar(application.Title),mb_iconwarning);
                    Edit3.SetFocus;
                    Exit;
                end;
                if Trim(Edit4.Text)='' then
                begin
                    Application.MessageBox('操作错误,【供货单位】不能为空!,请确认!',pchar(application.Title),mb_iconwarning);
                    Edit4.SetFocus;
                    Exit;
                end;
                if Trim(Edit5.Text)='' then
                begin
                    Application.MessageBox('操作错误,【验货仓库】不能为空!,请确认!',pchar(application.Title),mb_iconwarning);
                    Edit5.SetFocus;
                    Exit;
                end;
                if Trim(Edit6.Text)='' then
                begin
                    Application.MessageBox('操作错误,【经手人】不能为空!,请确认!',pchar(application.Title),mb_iconwarning);
                    Edit6.SetFocus;
                    Exit;
                end;
                if Trim(Edit8.Text)='' then
                begin
                    Application.MessageBox('操作错误,【制单人】不能为空!,请确认!',pchar(application.Title),mb_iconwarning);
                    Edit8.SetFocus;
                    Exit;
                end;
                for i:=1 to Total_Count-1 do
                begin
                    if StringGrid1.Cells[1,i]='' then

⌨️ 快捷键说明

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