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

📄 tas520_02.pas.svn-base

📁 这是一个功能齐全的,代码完整的ERP企业信息管理系统,现在上传和大家分享
💻 SVN-BASE
📖 第 1 页 / 共 4 页
字号:
  edtPerson.Text:=qryTas520.FieldByName('T520_019').AsString;
  edtDays.Text:=qryTas520.FieldByName('T520_005').AsString;  //预计工时
  cbUnit.ItemIndex:=qryTas520.FieldByName('T520_004').AsInteger;  //时间单位
  edtFactDays.Text:='0';
  edtFactDays.Text:=qryTas520.FieldByName('T520_008').AsString;  //实际工时

  edtFromDate.Clear;
  edtToDate.Clear;
  edtFactFromDate.Clear;
  edtFactToDate.Clear;
  edtFromDate.Date:=qryTas520.FieldByName('T520_006').Value;  //预计开始日期
  edtToDate.Date:=qryTas520.FieldByName('T520_007').Value;  //预计完成日期
  if not qryTas520.FieldByName('T520_009').IsNull then
    edtFactFromDate.Date:=qryTas520.FieldByName('T520_009').Value;  //实际开始日期
  if not qryTas520.FieldByName('T520_010').IsNull then
    edtFactToDate.Date:=qryTas520.FieldByName('T520_010').Value;  //实际完成日期
  memResolvent.Text:=qryTas520.FieldByName('T520_011').AsString;  //工单说明
  edtCreateDate.Text:=qryTas520.FieldByName('T520_012').AsString;  //制单日期
  edtCreateBy.Text:=qryTas520.FieldByName('T520_013').AsString;  //制单人员
  edtUpdateDate.Text:=qryTas520.FieldByName('T520_014').AsString;  //修改日期
  edtUpdateBy.Text:=qryTas520.FieldByName('T520_015').AsString;  //修改人员
  edtName.Text:=qryTas520.FieldByName('T510_002').AsString;  //任务名称
  edtPriority.Text:=qryTas520.FieldByName('T510_005').AsString;  //优先级别
  edtMacNo.Text:=qryTas520.FieldByName('T510_018').AsString;

  edtStatus.Text:=qryTas520.FieldByName('T120_003').AsString;
  edtClass.Text:=qryTas520.FieldByName('T100_002').AsString;
  edtCust.Text:=qryTas520.FieldByName('O150_002').AsString;
  edtCustName.Text:=qryTas520.FieldByName('O150_003').AsString;
  edtPhone.Text:=qryTas520.FieldByName('O150_005').AsString;
  edtAddress.Text:=qryTas520.FieldByName('O150_012').AsString;
  edtEmail.Text:=qryTas520.FieldByName('O150_007').AsString;
  edtContact.Text:=qryTas520.FieldByName('O151_002').AsString;
  edtPost.Text:=qryTas520.FieldByName('O151_004').AsString;
  edtItem.Text:=qryTas520.FieldByName('I150_002').AsString;
  edtItemName.Text:=qryTas520.FieldByName('I150_003').AsString;
  edtModel.Text:=qryTas520.FieldByName('I150_004').AsString;
  edtItemClass.Text:=qryTas520.FieldByName('I120_003').AsString;
  edtMaker.Text:=qryTas520.FieldByName('M150_002').AsString;
  edtMakerName.Text:=qryTas520.FieldByName('M150_003').AsString;

  if not Active then Exit;
  if ActSave.Enabled then Exit;
  ActNext.Enabled:=not qryTas520.Eof;
  ActLast.Enabled:=not qryTas520.Eof;
  ActFirst.Enabled:=not qryTas520.Bof;
  ActPrior.Enabled:=not qryTas520.Bof;
end;

procedure TTas520_02Form.SaveData;
var
  ADate:TDateTime;
  S:String;
  I,J:Integer;
begin
  inherited;
//确定(&O)
  if edtCode.Enabled then
  begin
    if (trim(edtCode.Text)='') and (not AIsAutoCode) then
    begin
      ShowMsg('UMS10000283');  //工单编号不能为空
      edtCode.SetFocus;
      Abort;
    end;
    if trim(edtCode.Text)<>AOldCode then
    begin
      if IsExists('select 1 from TAS520 where T520_001='+''''+edtCode.Text+'''') then
      begin
        ShowMsg('UMS10000284');  //工单编号已存在,请重新输入
        edtCode.SetFocus;
        Abort;
      end;
    end;
  end;
  if trim(edtTasks.Text)='' then
  begin
    ShowMsg('UMS10000277');  //任务编号不能为空
    edtTasks.SetFocus;
    Abort;
  end;
  if AOldTasks<>edtTasks.Text then
  begin
    if not qryTas510.Locate('T510_001',edtTasks.Text,[]) then
    begin
      ShowMsg('UMS10000285');  //输入的任务编号无效
      edtTasks.SetFocus;
      Abort;
    end;
  end;
  if trim(edtPerson.Text)='' then
  begin
    ShowMsg('UMS10000286');  //执行人员不能为空
    edtPerson.SetFocus;
    Abort;
  end;
  if (trim(edtDays.Text)='') or (trim(edtDays.Text)='0') then
  begin
    ShowMsg('UMS10000287');  //预计工时不能为空或零
    edtDays.SetFocus;
    Abort;
  end;
  if (trim(edtFromDate.Text)='') or (trim(edtToDate.Text)='') then
  begin
    ShowMsg('UMS10000288');  //预计开始或完成日期不能为空
    if trim(edtFromDate.Text)='' then
      edtFromDate.SetFocus
    else
      edtToDate.SetFocus;
    Abort;
  end;
  if edtToDate.Date<edtFromDate.Date then
  begin
    ShowMsg('UMS10000289');  //预计完成日期不能小于预计开始日期
    edtToDate.SetFocus;
    Abort;
  end;
  edtPerson.SetFocus;
  SetFocus;
  //执行人員不能重復
  for I:=0 to ANoStrList.Count-1 do
  begin
    S:=ANoStrList[I];
    for J:=I+1 to ANoStrList.Count-1 do
    begin
      if S=ANoStrList[J] then
      begin
        ShowMsg('UMS10000323');  //执行人员不能重复
        edtPerson.SetFocus;
        Abort;
      end;
    end;
  end;

  if AMode='ADD' then
  begin
    qryTas520.Insert;
    qryTas520.FieldByName('T520_012').AsString:=edtCreateDate.Text;  //制单日期
    qryTas520.FieldByName('T520_013').AsString:=edtCreateBy.Text;  //制单人员
    qryTas520.FieldByName('T520_014').AsString:=edtUpdateDate.Text;  //修改日期
    qryTas520.FieldByName('T520_015').AsString:=edtUpdateBy.Text;  //修改人员
  end else
  begin
    ADate:=GetServerDate;
    qryTas520.Edit;
    qryTas520.FieldByName('T520_014').Value:=ADate;  //修改日期
    qryTas520.FieldByName('T520_015').Value:=AUserName;  //修改人员
  end;
  qryTas520.FieldByName('T520_002').Value:=edtTasks.Text;  //任务编号
  qryTas520.FieldByName('T520_003').Value:=GetPerson(ANoStrList,1);  //执行人员
  qryTas520.FieldByName('T520_004').Value:=cbUnit.ItemIndex;  //时间单位
  qryTas520.FieldByName('T520_005').Value:=edtDays.Text;  //预计工时
  qryTas520.FieldByName('T520_006').Value:=edtFromDate.Date;  //预计开始日期
  qryTas520.FieldByName('T520_007').Value:=edtToDate.Date;  //预计完成日期
//  qryTas520.FieldByName('T520_008').Value:=edtFactDays.Text;  //实际工时
//  qryTas520.FieldByName('T520_009').Value:=edtFactFromDate.Date;  //实际开始日期
//  qryTas520.FieldByName('T520_010').Value:=edtFactToDate.Date;  //实际完成日期
  qryTas520.FieldByName('T520_011').Value:=memResolvent.Text;  //工单说明
  if AMode='ADD' then qryTas520.FieldByName('T520_016').Value:=qryTas510.FieldByName('T510_003').Value;  //任务状态
  if AIsReturn then qryTas520.FieldByName('T520_016').Value:=3;  //任务状态
  qryTas520.FieldByName('T520_017').Value:=ANoStrList.Count;  //執行人数
  qryTas520.FieldByName('T520_018').Value:=GetPerson(ACodeStrList,0);  //執行员号
  qryTas520.FieldByName('T520_019').Value:=GetPerson(ANameStrList,0);  //執行员名
  try
//    if AMode='ADD' then
//    begin
      if (edtCode.Text='') and (AIsAutoCode) then edtCode.Text:=GetAutoCode('TAS520');
//    end;
    if AOldCode<>edtCode.Text then qryTas520.FieldByName('T520_001').Value:=edtCode.Text;  //工单编号
    qryTas520.Post;
    UpdateTasksInfo(edtTasks.Text);  //更新任务计划信息(实际工时、工单总数)
    //当修改工单改变了原任务编号,则同时修改原任务的相关信息
    if (AOldTasks<>'') and (AOldTasks<>edtTasks.Text) then UpdateTasksInfo(AOldTasks);
    SetButtonState(False);
    ActRefresh.Execute;
    qryTas520AfterScroll(qryTas520);
    if (AMode='ADD') and (not AIsReturn) then
    begin
      if ShowDialog('['+edtCode.Text+'] '+GetDBString('UMS10000309'),1)=IDYES then  //记录保存成功,是否继续增加新记录?
      begin
        ActInsert.Execute;
      end;
    end else
      ModalResult:=1;
  except
    ShowMsg(SYSDM.ADOC.Errors[0].Description,1);
    Abort;
  end;
end;

procedure TTas520_02Form.qryTas520T520_004GetText(Sender: TField;
  var Text: String; DisplayText: Boolean);
begin
  inherited;
  if qryTas520.IsEmpty then Exit;
  case Sender.AsInteger of
    0:Text:=AUnit[0];  //时
    1:Text:=AUnit[1];  //天
    2:Text:=AUnit[2];  //周
    3:Text:=AUnit[3];  //月
  end;
end;

procedure TTas520_02Form.edtDaysExit(Sender: TObject);
begin
  inherited;
  try
    if trim(edtDays.Text)='' then edtDays.Text:='1';
    StrToFloat(edtDays.Text);
  except
    ShowMsg('UMS10000322');  //输入的值无效,请输入数字
    Abort;
  end;
end;

procedure TTas520_02Form.ReportGetValue(const ParName: String;var ParValue: Variant);
var
  ACustNo:Integer;
  AItemNo:Integer;
  ASerialNo:string;
  ACustItemInfo:TCustItemInfo;
  ACustomerInfo:TCustomerInfo;
  ADays:string;
begin
  ACustNo:=SYSDM.frDBDataSet1.DataSet.FieldByName('T510_016').AsInteger;
  AItemNo:=SYSDM.frDBDataSet1.DataSet.FieldByName('T510_017').AsInteger;
  ASerialNo:=SYSDM.frDBDataSet1.DataSet.FieldByName('T510_018').AsString;
  if ACustNo=0 then   //空白报表时
  begin
    ADays:=AUnit[StrToInt(GetSysParams('TAS0001'))];
  end else
  begin
    ADays:=AUnit[qryTas520T520_004.AsInteger];
    GetCustomerInfo(ACustNo,AItemNo,ASerialNo,ACustomerInfo);
    GetCustItemInfo(ACustNo,AItemNo,ASerialNo,ACustItemInfo);
  end;

  if ParName='USENM'           then ParValue:=AUserName
  else if ParName='PRNDT'      then ParValue:=GetDBString('COM00006006')  //列印日期
  else if ParName='PRNNM'      then ParValue:=GetDBString('COM00006007')  //列印人員
  else if ParName='REPNM'      then ParValue:=AReportTitle

  else if ParName='Phone'      then ParValue:=ACustomerInfo.CustPhone
  else if ParName='Email'      then ParValue:=ACustomerInfo.CustEmail
  else if ParName='Address'    then ParValue:=ACustomerInfo.CustAddress
  else if ParName='Contact'    then ParValue:=ACustomerInfo.CustContact
  else if ParName='Posit'      then ParValue:=ACustomerInfo.CustPosition
  else if ParName='ADays'      then ParValue:=ADays

  else if ParName='Reference'  then ParValue:=ACustItemInfo.Reference  //控制器号
  else if ParName='InstallDate' then ParValue:=ACustItemInfo.InstallDate  //安装日期
  else if ParName='StartDate'  then ParValue:=ACustItemInfo.StartDate  //免费保养开始日期
  else if ParName='EndDate'    then ParValue:=ACustItemInfo.EndDate  //免费保养结束日期
  else if ParName='FromDate'   then ParValue:=ACustItemInfo.FromDate  //收费保养开始日期
  else if ParName='ToDate'     then ParValue:=ACustItemInfo.ToDate  //收费保养结束日期

  else if ParName='Summary'    then ParValue:=GetDBString('TAS52001107')  //以下由執行任務者填寫
  else if ParName='Operation'  then ParValue:=GetDBString('TAS52001110')  //技術人員
  else if ParName='Manager'    then ParValue:=GetDBString('TAS52001111')  //主管簽署
  else if ParName='Customer'   then ParValue:=GetDBString('TAS52001112')  //客戶簽署
  else if ParName='T520_001'   then ParValue:=qryTas520T520_001.DisplayLabel  //工單編號
  else if ParName='T520_002'   then ParValue:=qryTas520T520_002.DisplayLabel  //任務編號
  else if ParName='T510_002'   then ParValue:=qryTas520T510_002.DisplayLabel  //任務名稱
  else if ParName='T100_002'   then ParValue:=qryTas520T100_002.DisplayLabel  //任務類別
  else if ParName='T510_005'   then ParValue:=qryTas520T510_005.DisplayLabel  //優先級別
  else if ParName='T520_019'   then ParValue:=qryTas520T520_019.DisplayLabel  //執行人員
  else if ParName='T520_005'   then ParValue:=qryTas520T520_005.DisplayLabel  //預計工時
  else if ParName='T520_006'   then ParValue:=GetDBString('TAS52001120')  //開始日期
  else if ParName='T520_007'   then ParValue:=GetDBString('TAS52001121')  //完成日期
  else if ParName='T120_003'   then ParValue:=qryTas520T120_003.DisplayLabel  //任務狀態
  else if ParName='O150_002'   then ParValue:=qryTas520O150_002.DisplayLabel  //客戶編號
  else if ParName='O150_003'   then ParValue:=qryTas520O150_003.DisplayLabel  //客戶名稱

  else if ParName='O150_005'   then ParValue:=qryTas520O150_005.DisplayLabel  //電話號碼
  else if ParName='O150_007'   then ParValue:=qryTas520O150_007.DisplayLabel  //電子郵件
  else if ParName='O150_012'   then ParValue:=qryTas520O150_012.DisplayLabel  //客戶地址
  else if ParName='O151_002'   then ParValue:=qryTas520O151_002.DisplayLabel  //聯繫人名
  else if ParName='O151_004'   then ParValue:=qryTas520O151_004.DisplayLabel  //職務名稱
  else if ParName='I150_002'   then ParValue:=qryTas520I150_002.DisplayLabel  //機床類型
  else if ParName='T510_018'   then ParValue:=qryTas520T510_018.DisplayLabel  //機身編號
  else if ParName='I150_004'   then ParValue:=qryTas520I150_004.DisplayLabel  //規格型號
  else if ParName='I120_003'   then ParValue:=qryTas520I120_003.DisplayLabel  //産品類別
  else if ParName='M150_002'   then ParValue:=qryTas520M150_002.DisplayLabel  //製造商號
  else if ParName='T510_019'   then ParValue:=qryTas520T510_019.DisplayLabel  //任務說明
  else if ParName='T530_004'   then ParValue:=GetDBString('TAS52001135')  //實際工時
  else if ParName='T530_005'   then ParValue:=GetDBString('TAS52001136')  //開始日期時間
  else if ParName='T530_006'   then ParValue:=GetDBString('TAS52001137')  //完成日期時間
  else if ParName='T530_003'   then ParValue:=GetDBString('TAS52001138')  //完工比率
  else if ParName='T530_016'   then ParValue:=GetDBString('TAS52001139')  //協助公司
  else if ParName='T530_017'   then ParValue:=GetDBString('TAS52001140')  //協助人員
  else if ParName='T530_018'   then ParValue:=GetDBString('TAS52001141')  //協助工時
  else if ParName='T530_008'   then ParValue:=GetDBString('TAS52001142')  //匯報內容
  else if ParName='T530_009'   then ParValue:=GetDBString('TAS52001143')  //拖期原因
  else if ParName='T530_010'   then ParValue:=GetDBString('TAS52001144')  //原因說明
  else if ParName='T530_015'   then ParValue:=GetDBString('TAS52001145')  //后續處理

  else if ParName='T520_004'   then ParValue:=qryTas520T520_004.DisplayLabel
  else if ParName='T520_008'   then ParValue:=qryTas520T520_008.DisplayLabel
  else if ParName='T520_009'   then ParValue:=qryTas520T520_009.DisplayLabel
  else if ParName='T520_010'   then ParValue:=qryTas520T520_010.DisplayLabel
end;

procedure TTas520_02Form.qryTas520CalcFields(DataSet: TDataSet);
var
  ACustNo,AItemNo:Integer;
  AMacNo:string;
  ACustomerInfo:TCustomerInfo;
begin
  inherited;
  ACustNo:=qryTas520T510_016.Value;
  AItemNo:=qryTas520T510_017.Value;
  AMacNo:=qryTas520T510_018.Value;
  GetCustomerInfo(ACustNo,AItemNo,AMacNo,ACustomerInfo);
  qryTas520O150_005.Value:=ACustomerInfo.CustPhone;
  qryTas520O150_007.Value:=ACustomerInfo.CustEmail;
  qryTas520O150_012.Value:=ACustomerInfo.CustAddress;
  qryTas520O151_002.Value:=ACustomerInfo.CustContact;
  qryTas520O151_004.Value:=ACustomerInfo.CustPosition;
end;

procedure TTas520_02Form.memResolventExit(Sender: TObject);
begin
  inherited;
  if AMode='ADD' then
    AIsUpdated:=not (memResolvent.Text=qryTas510.FieldByName('T510_019').AsString)  //任务说明
  else 
    AIsUpdated:=not (memResolvent.Text=qryTas520.FieldByName('T520_011').AsString);  //任务说明
end;

initialization
  RegisterClass(TTas520_02Form);

finalization
  UnRegisterClass(TTas520_02Form);

end.

⌨️ 快捷键说明

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