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

📄 umanage_fad.pas

📁 delphi的一个开发实例
💻 PAS
📖 第 1 页 / 共 4 页
字号:
                                                                    Application.MessageBox('系统在保存[非运营性出库单明细表]数据时候,服务器数据库连接错误,请重新连接,请确认!',pchar(application.Title),mb_iconwarning);
                                                                    Exit;
                                                                end;
                                                            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;
                                    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;
                Application.MessageBox('恭喜你!【非运营性出库单】草稿单据保存操作成功,请确认!',pchar(application.Title),mb_iconwarning);
            except
                Application.MessageBox('添加操作失败,请检查连接网络是否正常,请确认!',pchar(application.Title),mb_iconwarning);
                Exit;
            end;
        end;
        if Public_Do_Result='03' then
        begin
            Close;
        end;
    end;
    //操作草稿单据
    if Public_Do='Business_Storage_Out' then
    begin
        if Public_Do_Result='01' then //保存单据
        begin
            with frm_data.ClientDataSet2 do
            begin
                try
                    Close;
                    CommandText:='';
                    Commandtext:='Select * from [V_Storage_Out_View] where Receipt_No='''+Trim(List_NO)+'''';
                    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
                        with frm_data.ClientDataSet_Add do
                        begin
                            Close;
                            CommandText:='';
                            CommandText:='Update [Out_strip] set Gatrher_monad='''+Trim(Edit3.Text)+''',Storage_NO='''+Trim(Edit4.Text)+''',Transactor='''+Trim(Edit5.Text)+''',Out_Type='''+Trim(Edit11.Text)+''',Business_NO='''+Trim(Edit10.Text)+''',Condense='''+Trim(Edit8.Text)+''',Out_Remark='''+Trim(Edit9.Text)+''' where Out_NO='''+Trim(List_No)+'''';
                            Execute;
                            for i:=1 to Total_Count-1 do
                            begin
                                try
                                    begin
                                        with frm_data.ClientDataSet_Add do
                                        begin
                                            Close;
                                            frm_data.ClientDataSet_Add.CommandText:='';
                                            CommandText:='update [Out_strip_detail] set amount='''+Trim(StringGrid1.Cells[5,i])+''' where Out_NO='''+Trim(List_NO)+''' and Goods_NO='''+Trim(StringGrid1.Cells[1,i])+'''';
                                            Execute;
                                        end;
                                    end;
                                except
                                    Application.MessageBox('保存单据明细时失败,请检查连接网络是否正常,请确认!',pchar(application.Title),mb_iconwarning);
                                    Exit;
                                end;
                            end;
                            Application.MessageBox('单据过帐完毕!',pchar(application.Title),mb_iconwarning);
                            try
                                with frm_data.ClientDataSet_Add do
                                begin
                                    Close;
                                    Commandtext:='';
                                    Commandtext:='Update [Receipt] set Flag_sign=''单据'' where Receipt_No='''+Trim(List_NO)+'''';
                                    Execute;
                                    try
                                        Stock_States_Total;
                                    except
                                        Application.MessageBox('系统错误,修改库存状况时出错!请检查连接网络是否正常,请确认!',pchar(application.Title),mb_iconwarning);
                                        Exit;
                                    end;
                                end;
                            except
                                Application.MessageBox('系统错误,请检查连接网络是否正常,请确认!',pchar(application.Title),mb_iconwarning);
                                Exit;
                            end;
                        end;
                    end;
                except
                     Application.MessageBox('系统错误,不能过帐',pchar(application.Title),mb_iconwarning);
                     Exit;
                end;
            end;
        end;
        if Public_Do_Result='03' then
        begin
            Close;
        end;
    end;
    frm_Public_Don.Free;
end;

procedure Tfrm_Umanage_Fad.Edit1DblClick(Sender: TObject);
begin
    Edit1.Text:=ForMatDateTime('yyyy''-''mm''-''dd',now);
end;

procedure Tfrm_Umanage_Fad.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
    if key=#13 then
        Edit1.Text:=ForMatDateTime('yyyy''-''mm''-''dd',now);
end;

procedure Tfrm_Umanage_Fad.Edit7KeyPress(Sender: TObject; var Key: Char);
begin
    if key=#13 then
        Edit7.Text:=Handle_Man;
end;

procedure Tfrm_Umanage_Fad.Edit7DblClick(Sender: TObject);
begin
    Edit7.Text:=Handle_Man;
end;

procedure Tfrm_Umanage_Fad.StringGrid1DrawCell(Sender: TObject; ACol,
  ARow: Integer; Rect: TRect; State: TGridDrawState);
begin
    with sender as TStringGrid do
    begin
        if (GDFocused in state) then
        begin
            Pcol:=Acol;
            Prow:=ARow;
            func.String_Col:=ARow;
        end;
    end;
end;

procedure Tfrm_Umanage_Fad.StringGrid1DblClick(Sender: TObject);
var
    openstr:string;
    S1,s2,s3:string;
begin
    if Trim(Edit2.Text)='' then
    begin
        Application.MessageBox('操作失败,【单据编号】不能为空!',pchar(application.Title),mb_iconwarning);
        Edit2.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 ((PCol=1) or (PCol=2))then //表示选择的是商品编号 选择的是第一列
    begin
        Goods_Check_str:='';
        frm_Goods_Check:=Tfrm_Goods_Check.Create(self);
        frm_Goods_Check.ShowModal;
        if Goods_Check_str='Storage_Umanage_Fad' then
        begin
            try
                with frm_data.ClientDataSet_Add do
                begin
                    Close;
                    CommandText:='';
                    CommandText:='select * from [Goods_Information]  where Goods_No='''+Goods_No_Str+'''';
                    Open;
                    StringGrid1.Cells[1,String_Col]:=frm_data.ClientDataSet_Add.FieldValues['Goods_NO'];//商品名称
                    StringGrid1.Cells[2,String_Col]:=frm_data.ClientDataSet_Add.FieldValues['Goods_Name'];//商品名称
                    StringGrid1.Cells[14,String_Col]:=frm_data.ClientDataSet_Add.FieldValues['Goods_Modal']; //类别名称
                    StringGrid1.Cells[15,String_Col]:=frm_data.ClientDataSet_Add.FieldValues['Goods_Cards']; //品牌名称
                    StringGrid1.Cells[16,String_Col]:=frm_data.ClientDataSet_Add.FieldValues['Goods_Brand']; //品种名称
                    StringGrid1.Cells[17,String_Col]:=frm_data.ClientDataSet_Add.FieldValues['Norms_Type'];//规格型号名称
                    StringGrid1.Cells[18,String_Col]:=frm_data.ClientDataSet_Add.FieldValues['Goods_Sphere'];//球面度数
                    StringGrid1.Cells[19,String_Col]:=frm_data.ClientDataSet_Add.FieldValues['Goods_Column'];//柱面度数
                    StringGrid1.Cells[20,String_Col]:=frm_data.ClientDataSet_Add.FieldValues['Goods_Color'];//颜色名称
                    StringGrid1.Cells[21,String_Col]:=frm_data.ClientDataSet_Add.FieldValues['Goods_Coding'];//商品条玛
                    StringGrid1.Cells[22,String_Col]:=frm_data.ClientDataSet_Add.FieldValues['Enroll_Brand'];//注册商标
                    StringGrid1.Cells[23,String_Col]:=frm_data.ClientDataSet_Add.FieldValues['Factory'];//生产厂家
                    StringGrid1.Cells[24,String_Col]:=frm_data.ClientDataSet_Add.FieldValues['Base_Monad'];//基本单位
                    StringGrid1.Cells[25,String_Col]:=frm_data.ClientDataSet_Add.FieldValues['Valid_Day']; //有效日期
                    StringGrid1.Cells[26,String_Col]:=frm_data.ClientDataSet_Add.FieldValues['Remark'];  //商品说明
                end;
            except
                application.MessageBox('操作失败,请检查连接网络是否正常?请确认!',pchar(application.Title),mb_iconwarning);
            end;
        end;
        frm_Goods_Check.Free;
    end;
end;


procedure Tfrm_Umanage_Fad.SpeedButton5Click(Sender: TObject);
begin
    Check_Storage:='';Check_Storage_Result:='';
    Check_Storage:='Storage_Umanage_Fad';
    frm_Storage_Select:=Tfrm_Storage_Select.Create(self);
    frm_Storage_Select.ShowModal;
    Edit_Storage_Name.Text:=Trim(Check_Storage_Result);
    Edit4.Text:=Trim(Check_Storage_Result_NO);
    frm_Storage_Select.Free;
end;

procedure Tfrm_Umanage_Fad.SpeedButton9Click(Sender: TObject);
begin
    Employe_Check:='';
    Employe_Check:='Storage_Umanage_Fad';
    Employe_Check_Result:='';
    frm_Login_Man:=Tfrm_Login_Man.Create(self);
    frm_Login_Man.Caption:='经手人选择';
    frm_Login_Man.ShowModal;
    Edit5.Text:=Employe_Check_Result;
    frm_Login_Man.Free;
end;

procedure Tfrm_Umanage_Fad.SpeedButton8Click(Sender: TObject);
begin
    ChildShop_Str:='';
    ChildShop_Result_NO:='';
    ChildShop_Result_Name:='';
    ChildShop_Str:='Storage_Umanage_Fad';
    frm_ChildShop_Select:=Tfrm_ChildShop_Select.Create(self);
    frm_ChildShop_Select.ShowModal;
    Edit6.Text:=ChildShop_Result_NO;
    frm_ChildShop_Select.Free;
end;

procedure Tfrm_Umanage_Fad.Cmd_AddClick(Sender: TObject);
var
    i:integer;
begin
    StringGrid1.RowCount:=StringGrid1.RowCount+1;
    Total_Count:=StringGrid1.RowCount;
    for i:=1 to StringGrid1.RowCount-1 do
    begin
        StringGrid1.Cells[0,i]:=IntTostr(i); //表示第0列第i行
    end;
end;

procedure Tfrm_Umanage_Fad.Cmd_DeleteClick(Sender: TObject);
var
    i:shortint;
begin
    if StringGrid1.col<>0 then
    begin
        StringGrid1.Rows[StringGrid1.Row].Clear; //删除选中行的所有列 ,用右键弹出菜单
        DeleteRow(StringGrid1.Row);
        //stredit.Text := '';
        //stredit.Visible:=false;

⌨️ 快捷键说明

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