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

📄 formphschange.pas

📁 小灵通机卡分离模块的设计.建立在数据库服务器
💻 PAS
📖 第 1 页 / 共 3 页
字号:
unit FormPhschange;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, interfacesecond, Menus, DB, kbmMemTable, LWLINK, ExtCtrls,
  StdCtrls, Buttons, FrameProdInfo, ComCtrls, FramePhone, FramePhsSim,
  DBCtrls, FrameUserInfo, FramePhs;

type
  TFrmphschange = class(TFrminterfacesecond)
    PageControl1: TPageControl;
    TabSheet1: TTabSheet;
    TabSheet2: TTabSheet;
    NewPhoneInfo: TPhoneInfo;
    Panel2: TPanel;
    NewProdInfo: TProdInfo;
    Panel3: TPanel;
    Label4: TLabel;
    Label5: TLabel;
    Panel5: TPanel;
    NewPhsSimInfo: TPhsSimInfo;
    Label1: TLabel;
    Panel6: TPanel;
    DblcAcceGrad: TDBLookupComboBox;
    Label2: TLabel;
    Panel7: TPanel;
    BtnOk: TButton;
    BtnCancel: TButton;
    RgBact: TRadioGroup;
    DtpBtime: TDateTimePicker;
    DtpBtime1: TDateTimePicker;
    Panel8: TPanel;
    OldUserInfo: TUserInfo;
    Panel9: TPanel;
    NewUserInfo: TUserInfo;
    Label3: TLabel;
    Label7: TLabel;
    NewFramephsinfo: TFramephsinfo;
    Label8: TLabel;
    DsAccelog: TDataSource;
    LwlPhsSim: TLWLINK;
    DSPhsSim: TDataSource;
    LwlAcceLog: TLWLINK;
    LwlAcceLogproduce_id: TStringField;
    LwlAcceLogproduce_no: TStringField;
    LwlAcceLogorder_id: TStringField;
    LwlAcceLogaccept_id: TStringField;
    LwlAcceLogproduct_id: TStringField;
    LwlAcceLogsrv_code: TStringField;
    LwlAcceLogsub_srv: TStringField;
    LwlAcceLogaccept_lan: TStringField;
    LwlAcceLogvest_lan: TStringField;
    LwlAcceLogapply_name: TStringField;
    LwlAcceLogapply_cert: TStringField;
    LwlAcceLogapply_certno: TStringField;
    LwlAcceLogapply_tel: TStringField;
    LwlAcceLogapply_addr: TStringField;
    LwlAcceLogreq_certtype: TStringField;
    LwlAcceLogreq_certno: TStringField;
    LwlAcceLogbtime: TStringField;
    LwlAcceLogbact: TStringField;
    LwlAcceLogatime: TStringField;
    LwlAcceLogaccept_grade: TStringField;
    LwlAcceLogaccept_mode: TStringField;
    LwlAcceLogdeal_grade: TStringField;
    LwlAcceLogcharge_tache: TStringField;
    LwlAcceLogLuAcceGrad: TStringField;
    LwlPhsSimtab_brief: TStringField;
    LwlPhsSimfld_id: TStringField;
    LwlPhsSimfield_code: TStringField;
    LwlPhsSimfield_name: TStringField;
    LwlPhsSimfield_type: TStringField;
    LwlPhsSimrecord_type: TStringField;
    LwlPhsSimrecord_id: TStringField;
    LwlPhsSimnew_value: TStringField;
    LwlPhsSimold_value: TStringField;
    DsServInfo: TDataSource;
    LwlServInfo: TLWLINK;
    LwlServInfoprod_class: TStringField;
    LwlServInfosrv_code: TStringField;
    LwlServInfotable_name: TStringField;
    LwlServInfofield_modify: TStringField;
    procedure FormShow(Sender: TObject);
    procedure BtnOkClick(Sender: TObject);
    procedure NewPhoneInfoBtnNumSelClick(Sender: TObject);
    procedure NewPhoneInfoBtnGroupSelClick(Sender: TObject);
    procedure BtnCancelClick(Sender: TObject);
    procedure NewPhsSimInfoButton1Click(Sender: TObject);
  private
    iSubNumStr : string; //子号码串
    iSourflag: integer; //资源标志(0 不满足,1 满足)
    iscbh,iscls,icpbh : string;//生产编号、生产流水、产品编号
    iprodproptype : integer;  //0:合一改分离,1:分离改合一
    loldphone : string;
    lspsxf,lssimxf :string;
    ls_psnm_o,ls_psnm :string;  //记录Sim卡号 的新旧值
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Frmphschange: TFrmphschange;

implementation

uses Yyslzx,DMyyslzx,YyslFunction,NDPublic,ndfundeclare;

{$R *.dfm}

procedure TFrmphschange.FormShow(Sender: TObject);
var
  LwlUserin :TLWLink;
  i: integer;
  ls_table,ls_flag1,ls_flag2 : string;
begin
  inherited;
  iSubNumStr := '';
  PageControl1.ActivePage := TabSheet1;
  iSourflag := 1;   //默认资源满足
  DtpBtime.Date := Date();
  DtpBtime1.Time := StrtoTime('12:00:00');
  DtpBtime.Enabled:= false;
  DtpBtime1.Enabled := false;
//初始化窗口
  //==================================
  //经办人初始化
  //=================================
  NewUserInfo.ApplyInfo1.ApplyInit;

  NewProdInfo.ProdInit();
  NewPhoneInfo.PhoneInit();
  OldUserInfo.UserInit();
  NewUserInfo.UserInit();
  NewPhsSimInfo.PhsSimInit();
  NewFramephsinfo.Init;

  //如果传入参数为-1,赋空值
  if FrmYyslzx.Getscbh() <> -1 then
    iscbh:=inttostr(FrmYyslzx.Getscbh())
  else
    iscbh:='';
  if FrmYyslzx.Getscls() <> -1 then
    iscls:=inttostr(FrmYyslzx.Getscls)
  else
    iscls:='';
  if FrmYyslzx.Getcpbh() <> -1 then
    icpbh := InttoStr(FrmYyslzx.Getcpbh())
  else
    icpbh := '';

  //接受客户服务中心的客户信息
  if FrmYyslzx.GetUserinfo <> nil then
    begin
      LwlUserin:=FrmYyslzx.GetUserinfo;
      for i:=0 to LwlUserin.FieldCount-1 do
        begin
          NewUserinfo.LwlUserInfo.Fields[i].AsString:=LwlUserin.Fields[i].AsString;
        end;
      NewProdinfo.LwlProdInfo.FieldByName('owncust_id').AsString:=NewUserinfo.LwlUserInfo.FieldByName('cust_id').AsString;
      NewProdinfo.LwlProdInfo.FieldByName('usercust_id').AsString:=NewUserinfo.LwlUserInfo.FieldByName('cust_id').AsString;
    end;

//******************************************************************************
//检测多表的数据
  ls_table := 'E7/E7/A0/A0/A1/A1/J2/J2/D6/D6/B2/';    //表名简码
  ls_flag1 := '0/1/0/1/0/1/0/1/0/1/1/';    //0,1 记录  生产类型
  ls_flag2 := 'owner/owner///main/main//////';    //那种记录,E7--(owner/user) A1--(main/×××)
  if RetrieveTables(FrmYyslzx.Getscbh(),FrmYyslzx.Getscls(),FrmYyslzx.Getcpbh(),ls_table,ls_flag1,ls_flag2)<0 then
  begin
    PostMessage(self.handle, WM_CLOSE, 0, 0);
    exit;
  end;

  //检测客户信息的新数据
  GetTableInfo(OldUserinfo.LwlUserInfo,'E7','0','owner');
  if OldUserinfo.LwlUserInfo.RecordCount=0 then
    begin
      MessageDlg('缺少客户基本信息,请确认!',mtWarning,[mbOk],0);
      postmessage(self.handle, WM_CLOSE, 0, 0);
      exit;
    end;
  GetTableInfo(NewUserInfo.LwlUserInfoOld,'E7','0','owner');
  if NewUserInfo.LwlUserInfoOld.RecordCount = 0 then
    begin
      MessageDlg('缺少客户基本信息,请确认!',mtWarning,[mbOk],0);
      PostMessage(self.handle, WM_CLOSE, 0, 0);
      exit;
    end;
  //如果客户服务中心没传入客户数据
  if Lwluserin.RecordCount<=0 then
    begin
      GetTableInfo(NewUserInfo.LwlUserInfo,'E7','1','owner');
      if Newuserinfo.LwlUserInfo.RecordCount=0 then
        begin
          MessageDlg('缺少客户基本信息,请确认!',mtWarning,[mbOk],0);
          PostMessage(self.handle, WM_CLOSE, 0, 0);
          exit;
        end;
    end;
//  CopyData(NewUserInfo.LwlUserInfo,NewUserInfo.LwlUserInfoShow);
  NewPhoneInfo.iCustName := NewUserInfo.LwlUserInfo.FieldByName('cust_name').AsString;   

  //检索产品信息
  GetTableInfo(NewProdInfo.LwlProdInfoOld,'A0','0','');
  if NewProdInfo.LwlProdInfoOld.RecordCount=0 then
    begin
      MessageDlg('缺少原产品信息,请确认!',mtWarning,[mbOk],0);
      PostMessage(self.handle, WM_CLOSE, 0, 0);
      exit;
    end;
  GetTableInfo(NewprodInfo.LwlProdInfo,'A0','1','');
  if NewprodInfo.LwlProdInfo.RecordCount=0 then
    begin
      MessageDlg('缺少产品信息,请确认!',mtWarning,[mbOk],0);
      PostMessage(self.handle, WM_CLOSE, 0, 0);
      exit;
    end;

  //检索主号码信息
  GetTableInfo(NewPhoneInfo.LwlPhoneInfo,'A1','1','main');
  GetTableInfo(NewPhoneInfo.LwlPhoneInfoOld,'A1','0','main');
  if NewPhoneInfo.LwlPhoneInfo.RecordCount=0 then
    begin
      exit;
    end;
  if NewPhoneInfo.LwlPhoneInfoOld.RecordCount=0 then
    begin
      exit;
    end;
  NewPhoneInfo.iOldNum:= NewPhoneInfo.LwlPhoneInfo.FieldByName('product_no').AsString;
  NewPhoneInfo.itempNum := NewPhoneInfo.LwlPhoneInfo.FieldByName('product_no').AsString;
//**********************************
  //检索机卡分离信息
  GetTableInfo(NewPhsSimInfo.LwlPhsSimOld,'J2','0','');
  GetTableInfo(NewPhsSimInfo.LwlPhsSim,'J2','1','');
  if NewPhsSimInfo.LwlPhsSimOld.RecordCount=0 then
    begin
  //    exit;
    end;
  if NewPhsSimInfo.LwlPhsSim.RecordCount=0 then
    begin
  //    exit;
    end;
  //检索机卡合一信息
  GetTableInfo(NewFramephsinfo.Lwlphsold,'D6','O','');
  GetTableInfo(NewFramephsInfo.Lwlphs,'D6','1','');
  if NewFramephsinfo.Lwlphsold.RecordCount=0 then
    begin
  //    exit;
    end;
  if NewFramephsInfo.Lwlphs.RecordCount=0 then
    begin
  //    exit;
    end;
//************************

  //检索受理等级
   GetProdData(LwlAcceLog,iscbh,iscls,icpbh,'B2','1','');
   if lwlaccelog.RecordCount=0 then
     begin
       SetBlankData(LwlAcceLog);
       LwlAcceLog.FieldByName('accept_grade').AsString := 'C';
     end
   else
     begin
       if LwlAcceLog.FieldByName('btime').AsString <> '' then
         begin
           DtpBtime.DateTime:=strtodatetime(lwlaccelog.fieldByName('btime').AsString);
           DtpBtime1.Time:=DtpBtime.Time;
            RgBact.ItemIndex := 2;
         end;
       if LwlAccelog.FieldByName('bact').AsString='0' then
         RgBact.ItemIndex := 0
       else if LwlAcceLog.FieldByName('bact').AsString = '1' then
         RgBact.ItemIndex := 1
       else
         RgBact.ItemIndex := 2;
     end;

  //显示经办人信息
  //==========================================================================================
  OldUserInfo.ApplyInfo1.LwlApplyInfo.FieldByName('apply_name').AsString := LwlAcceLog.FieldByName('apply_name').AsString;
  OldUserInfo.ApplyInfo1.LwlApplyInfo.FieldByName('apply_cert').AsString := LwlAcceLog.FieldByName('apply_cert').AsString;
  OldUserInfo.ApplyInfo1.LwlApplyInfo.FieldByName('apply_certno').AsString := LwlAcceLog.FieldByName('apply_certno').AsString;
  OldUserInfo.ApplyInfo1.LwlApplyInfo.FieldByName('apply_tel').AsString := LwlAcceLog.FieldByName('apply_tel').AsString;
  NewUserInfo.ApplyInfo1.LwlApplyInfo.FieldByName('apply_name').AsString := LwlAcceLog.FieldByName('apply_name').AsString;
  NewUserInfo.ApplyInfo1.LwlApplyInfo.FieldByName('apply_cert').AsString := LwlAcceLog.FieldByName('apply_cert').AsString;
  NewUserInfo.ApplyInfo1.LwlApplyInfo.FieldByName('apply_certno').AsString := LwlAcceLog.FieldByName('apply_certno').AsString;
  NewUserInfo.ApplyInfo1.LwlApplyInfo.FieldByName('apply_tel').AsString := LwlAcceLog.FieldByName('apply_tel').AsString;

  //==========================================================================================


  if iscls='' then
    begin
      //判断是合一改分离,还是分离改合一
      if NewprodInfo.LwlProdInfo.FieldByName('prod_prop').AsString='B1' then
        begin
          NewPhsSimInfo.Visible:=true;
          Label1.Visible:=true;
          NewFramephsinfo.Visible:=false;
          Label8.Visible:=false;
          Label6.Caption:='机号一体机改机卡分离机';
          NewprodInfo.LwlProdInfo.FieldByName('prod_prop').AsString:='B3';
          NewprodInfo.LwlProdInfo.Edit;
          NewprodInfo.LwlProdInfo.Post;
          iprodproptype:=0;
        end
      else if NewprodInfo.LwlProdInfo.FieldByName('prod_prop').AsString='B3' then
        begin
          NewPhsSimInfo.Visible:=false;
          Label1.Visible:=false;
          NewFramephsinfo.Visible:=true;
          Label8.Visible:=true;
          Label6.Caption:='机卡分离机改机号一体机';
          NewprodInfo.LwlProdInfo.FieldByName('prod_prop').AsString:='B1';
          NewprodInfo.LwlProdInfo.Edit;
          NewprodInfo.LwlProdInfo.Post;
          iprodproptype:=1;
            //把产品信息与PHS信息进行关联
          NewFramephsinfo.Setprodinfo(NewProdInfo);
        end
      else
        begin
          MessageDlg('产品性质有问题,请确认!',mtWarning,[mbOk],0);
          PostMessage(self.handle, WM_CLOSE, 0, 0);
          exit;
        end;
    end
  else
    begin
      if NewprodInfo.LwlProdInfo.FieldByName('prod_prop').AsString='B3' then
        begin
          //检索机卡分离信息

⌨️ 快捷键说明

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