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

📄 storage_damage.pas

📁 delphi的一个开发实例
💻 PAS
📖 第 1 页 / 共 5 页
字号:
                ss:=copy(tempstr,1,temppos-1);
                tempstr:=copy(tempstr,temppos+1,length(tempstr)-temppos);
                if ss=Handle_Man then
                begin
                    P1.Visible:=True; L1.Caption:=LevelName1+':'+ss;
                    if ee1='' then
                    begin
                        L1.Caption:=LevelName1+':'+ss;
                        Flag1:=1;
                    end;
                    if ee1<>'' then
                    begin
                        L1.Caption:=LevelName1+':';
                        Flag1:=2;
                    end;
                end;
            end;
            Next;
        end;
        if Trim(ExamineMan2)<>'' then
        begin
            tempstr:=ExamineMan2;
            tt:=0;
            while pos(',',tempstr)>0 do //取得逗号的位置
            begin
                temppos:=pos(',',tempstr); //取得逗号的位置
                ss:=copy(tempstr,1,temppos-1);
                tempstr:=copy(tempstr,temppos+1,length(tempstr)-temppos);
                if ss=Handle_Man then
                begin
                    P2.Visible:=True;  L2.Caption:=LevelName2+':'+ss;
                    if ee2='' then
                    begin
                        L2.Caption:=LevelName2+':'+ss;
                        Flag2:=1;
                    end;
                    if ee2<>'' then
                    begin
                        L2.Caption:=LevelName2+':';
                        Flag2:=2;
                    end;
                end;
            end;
            Next;
        end;
        if Trim(ExamineMan3)<>'' then
        begin
            tempstr:=ExamineMan3;
            tt:=0;
            while pos(',',tempstr)>0 do //取得逗号的位置
            begin
                temppos:=pos(',',tempstr); //取得逗号的位置
                ss:=copy(tempstr,1,temppos-1);
                tempstr:=copy(tempstr,temppos+1,length(tempstr)-temppos);
                if ss=Handle_Man then
                begin
                    P3.Visible:=True;    L3.Caption:=LevelName3+':'+ss;
                    if ee3='' then
                    begin
                        L3.Caption:=LevelName3+':'+ss;
                        Flag3:=1;
                    end;
                    if ee3<>'' then
                    begin
                        L3.Caption:=LevelName3+':';
                        Flag3:=2;
                    end;
                end;
            end;
            Next;
        end;
        if Trim(ExamineMan4)<>'' then
        begin
            tempstr:=ExamineMan4;
            tt:=0;
            while pos(',',tempstr)>0 do //取得逗号的位置
            begin
                temppos:=pos(',',tempstr); //取得逗号的位置
                ss:=copy(tempstr,1,temppos-1);
                tempstr:=copy(tempstr,temppos+1,length(tempstr)-temppos);
                if ss=Handle_Man then
                begin
                    P4.Visible:=True; L4.Caption:=LevelName4+':'+ss;
                    if ee4='' then
                    begin
                        L4.Caption:=LevelName4+':'+ss;
                        Flag4:=1;
                    end;
                    if ee1<>'' then
                    begin
                        L4.Caption:=LevelName4+':';
                        Flag4:=2;
                    end;
                end;
            end;
            Next;
        end;
        if Trim(ExamineMan5)<>'' then
        begin
            tempstr:=ExamineMan5;
            tt:=0;
            while pos(',',tempstr)>0 do //取得逗号的位置
            begin
                temppos:=pos(',',tempstr); //取得逗号的位置
                ss:=copy(tempstr,1,temppos-1);
                tempstr:=copy(tempstr,temppos+1,length(tempstr)-temppos);
                if ss=Handle_Man then
                begin
                    P5.Visible:=True;  L5.Caption:=LevelName5+':'+ss;
                    if ee1='' then
                    begin
                        L5.Caption:=LevelName5+':'+ss;
                        Flag5:=1;
                    end;
                    if ee5<>'' then
                    begin
                        L5.Caption:=LevelName5+':';
                        Flag5:=2;
                    end;
                end;
            end;
            Next;
        end;

        with frm_data.ClientDataSet_Add do
        begin
            Close;
            CommandText:='';
            CommandText:='Select * from [V_Storage_Damage_View] where Receipt_No='''+List_No+'''';
            Open;
            k:=frm_data.ClientDataSet_Add.RecordCount;

            StringGrid1.RowCount:=k+1;
            //自动加载STRINGGRID的行数
            for K:=1 to StringGrid1.RowCount do
            begin
                StringGrid1.Cells[0,K]:=IntTostr(k); //表示第0列第i行的名称
            end;
            //******************
            Edit1.Text:=frm_data.ClientDataSet_Add.FieldByName('Copy_Date').AsString;
            Edit2.Text:=frm_data.ClientDataSet_Add.FieldByName('Receipt_No').AsString;
            Edit3.Text:=frm_data.ClientDataSet_Add.FieldByName('Storage_NO').AsString;
            Edit_Storage_Name.Text:=frm_data.ClientDataSet_Add.FieldByName('Storage_Name').AsString;
            Edit4.Text:=frm_data.ClientDataSet_Add.FieldByName('Transactor').AsString;
            Edit5.Text:=frm_data.ClientDataSet_Add.FieldByName('Shop_NO').AsString;
            Edit6.Text:=frm_data.ClientDataSet_Add.FieldByName('proposer').AsString;
            Edit7.Text:=frm_data.ClientDataSet_Add.FieldByName('Condense').AsString;
            Edit8.Text:=frm_data.ClientDataSet_Add.FieldByName('report_Remark').AsString;
            for k:=1 to k  do

            begin
                StringGrid1.Cells[1,k]:=frm_data.ClientDataSet_Add.FieldByName('Goods_NO').AsString;//商品编号
                StringGrid1.Cells[2,k]:=frm_data.ClientDataSet_Add.FieldByName('Goods_Name').AsString;//商品名称
                StringGrid1.Cells[3,k]:=frm_data.ClientDataSet_Add.FieldByName('Pass_NO').AsString;//数量
                StringGrid1.Cells[4,k]:=frm_data.ClientDataSet_Add.FieldByName('Price').AsString;//单价
                StringGrid1.Cells[5,k]:=frm_data.ClientDataSet_Add.FieldByName('amount').AsString;//金额
                StringGrid1.Cells[6,k]:=frm_data.ClientDataSet_Add.FieldByName('Money').AsString;//类别编号
                StringGrid1.Cells[7,k]:=frm_data.ClientDataSet_Add.FieldByName('Goods_Modal').AsString;//球面度数
                StringGrid1.Cells[8,k]:=frm_data.ClientDataSet_Add.FieldByName('Goods_Cards').AsString;//柱面度数
                StringGrid1.Cells[9,k]:=frm_data.ClientDataSet_Add.FieldByName('Goods_Brand').AsString;//颜色代码
                StringGrid1.Cells[10,k]:=frm_data.ClientDataSet_Add.FieldByName('Norms_Type').AsString;//颜色名称
                StringGrid1.Cells[11,k]:=frm_data.ClientDataSet_Add.FieldByName('Goods_Sphere').AsString;//商品条玛
                StringGrid1.Cells[12,k]:=frm_data.ClientDataSet_Add.FieldByName('Goods_Column').AsString;//注册商标
                StringGrid1.Cells[13,k]:=frm_data.ClientDataSet_Add.FieldByName('Goods_Color').AsString;//生产厂家
                StringGrid1.Cells[14,k]:=frm_data.ClientDataSet_Add.FieldByName('Goods_Coding').AsString;//商品简称
                StringGrid1.Cells[15,k]:=frm_data.ClientDataSet_Add.FieldByName('Enroll_Brand').AsString;//基本单位
                StringGrid1.Cells[16,k]:=frm_data.ClientDataSet_Add.FieldByName('Base_Monad').AsString;//整件单位
                StringGrid1.Cells[17,k]:=frm_data.ClientDataSet_Add.FieldByName('Valid_Month').AsString; //有效日期
                StringGrid1.Cells[18,k]:=frm_data.ClientDataSet_Add.FieldByName('Valid_Day').AsString; //有效日期
                StringGrid1.Cells[19,k]:=frm_data.ClientDataSet_Add.FieldByName('Remark').AsString;  //备注说明
                Next;
            end;
        end;
    end;
end;

procedure Tfrm_Storage_damage.FormClose(Sender: TObject;
  var Action: TCloseAction);
begin
    Action:=Cafree;
end;

procedure Tfrm_Storage_damage.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='damage_0001' then
    begin
        //直接过帐
        if Public_Do_Result='01' then
        begin
            with frm_data.ClientDataSet2 do
            begin
                Close;
                CommandText:='';
                Commandtext:='Select * from [V_Storage_Damage_View] where Receipt_No='''+Trim(Edit2.Text)+'''';
                try
                    Open;
                    if frm_data.ClientDataSet2.RecordCount>0 then
                    begin
                        Check_Flag:=frm_data.ClientDataSet2.FieldByName('Check_Result').AsString;
                        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 [report_damage] set Condense='''+Trim(Edit7.Text)+''',report_Remark='''+Trim(Edit8.Text)+''' where damage_NO='''+Trim(Edit2.Text)+'''';
                                try
                                    Execute;
                                    try
                                        for i:=1 to Total_Count-1 do
                                        begin
                                            with frm_data.ClientDataSet_Add do
                                            begin
                                                Close;
                                                frm_data.ClientDataSet_Add.CommandText:='';
                                                CommandText:='update [report_damage_detail] set amount='''+Trim(StringGrid1.Cells[5,i])+''',Money='''+Trim(StringGrid1.Cells[12,i])+''',Remark='''+Trim(StringGrid1.Cells[26,i])+''' where damage_NO='''+Trim(EDit2.Text)+''' and 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(List_NO)+'''';
                                            try
                                                Execute;
                                                try
                                                    Stock_States_Total;
                                                    Application.MessageBox('[仓库报损单]单据过帐完毕!',pchar(application.Title),mb_iconwarning);
                                                except
                                                     Application.MessageBox('修改[库存表]时失败,不能过帐,请确认!',pchar(application.Title),mb_iconwarning);
                                                     Exit;
                                                end;

⌨️ 快捷键说明

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