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

📄 inv150_02.pas.svn-base

📁 这是一个功能齐全的,代码完整的ERP企业信息管理系统,现在上传和大家分享
💻 SVN-BASE
📖 第 1 页 / 共 5 页
字号:
  HwSelDataForm.OpenSelData(qryHrm150,nil);
  if HwSelDataForm.ShowModal=1 then
  begin
    edtPlanner.Text:=qryHrm150.FieldByName('H150_002').AsString;
    edtPlannerName.Text:=qryHrm150.FieldByName('H150_003').AsString;
  end;
end;

procedure TInv150_02Form.sbVendID1Click(Sender: TObject);
begin
  inherited;
//主供应商查询
  if not edtVendID1.Focused then edtVendID1.SetFocus;
  HwSelDataForm:=THwSelDataForm.Create(Application);
  HwSelDataForm.OpenSelData(qryOrd150,nil);
  if HwSelDataForm.ShowModal=1 then
  begin
    edtVendID1.Text:=qryOrd150.FieldByName('O150_002').AsString;
    edtVendName1.Text:=qryOrd150.FieldByName('O150_003').AsString;
  end;
end;

procedure TInv150_02Form.sbVendID2Click(Sender: TObject);
begin
  inherited;
//次供应商查询
  if not edtVendID2.Focused then edtVendID2.SetFocus;
  HwSelDataForm:=THwSelDataForm.Create(Application);
  HwSelDataForm.OpenSelData(qryOrd150,nil);
  if HwSelDataForm.ShowModal=1 then
  begin
    edtVendID2.Text:=qryOrd150.FieldByName('O150_002').AsString;
    edtVendName2.Text:=qryOrd150.FieldByName('O150_003').AsString;
  end;
end;

procedure TInv150_02Form.edtMakeIDExit(Sender: TObject);
begin
  inherited;
//制造商号
  if not ActSave.Enabled then Exit;
  if trim(edtMakeID.Text)='' then Exit;
  if qryOrd150.Locate('O150_002',edtMakeID.Text,[]) then
  begin
    edtMakeID.Text:=qryOrd150.FieldByName('O150_002').AsString;
    edtMakeName.Text:=qryOrd150.FieldByName('O150_003').AsString;
  end else
  begin
    ShowMsg('UMS10000301');  //输入的制造商号无效
    edtMakeID.SetFocus;
    Abort;
  end;
end;

procedure TInv150_02Form.edtInvUnitExit(Sender: TObject);
begin
  inherited;
//库存单位
  if not ActSave.Enabled then Exit;
  if trim(edtInvUnit.Text)='' then Exit;
  if qryInv140.Locate('I140_002',edtInvUnit.Text,[]) then
  begin
    edtInvUnit.Text:=qryInv140.FieldByName('I140_002').AsString;
    edtInvUnitName.Text:=qryInv140.FieldByName('I140_003').AsString;
    if trim(edtPurUnit.Text)='' then
    begin
      edtPurUnit.Text:=edtInvUnit.Text;
      edtPurUnitName.Text:=edtInvUnitName.Text;
      edtPurToInv.Text:='1';
    end;
    if trim(edtOrdUnit.Text)='' then
    begin
      edtOrdUnit.Text:=edtInvUnit.Text;
      edtOrdUnitName.Text:=edtInvUnitName.Text;
      edtOrdToInv.Text:='1';
    end;
  end else
  begin
    ShowMsg('UMS10000233');  //无效的单位编号
    edtInvUnit.SetFocus;
    Abort;
  end;
end;

procedure TInv150_02Form.edtPurUnitExit(Sender: TObject);
begin
  inherited;
//采购单位
  if not ActSave.Enabled then Exit;
  if trim(edtPurUnit.Text)='' then Exit;
  if qryInv140.Locate('I140_002',edtPurUnit.Text,[]) then
  begin
    edtPurUnit.Text:=qryInv140.FieldByName('I140_002').AsString;
    edtPurUnitName.Text:=qryInv140.FieldByName('I140_003').AsString;
  end else
  begin
    ShowMsg('UMS10000233');  //无效的单位编号
    edtPurUnit.SetFocus;
    Abort;
  end;
end;

procedure TInv150_02Form.edtOrdUnitExit(Sender: TObject);
begin
  inherited;
//销售单位
  if not ActSave.Enabled then Exit;
  if trim(edtOrdUnit.Text)='' then Exit;
  if qryInv140.Locate('I140_002',edtOrdUnit.Text,[]) then
  begin
    edtOrdUnit.Text:=qryInv140.FieldByName('I140_002').AsString;
    edtOrdUnitName.Text:=qryInv140.FieldByName('I140_003').AsString;
  end else
  begin
    ShowMsg('UMS10000233');  //无效的单位编号
    edtOrdUnit.SetFocus;
    Abort;
  end;
end;

procedure TInv150_02Form.edtWhsIDExit(Sender: TObject);
begin
  inherited;
//仓库编号
  if not ActSave.Enabled then Exit;
  if trim(edtWhsID.Text)='' then Exit;
  if qryInv100.Locate('I100_002',edtWhsID.Text,[]) then
  begin
    edtWhsID.Text:=qryInv100.FieldByName('I100_002').AsString;
    edtWhsName.Text:=qryInv100.FieldByName('I100_003').AsString;
    qryInv110.Close;
    qryInv110.SQL.Clear;
    qryInv110.SQL.Add('select I110_001,I110_002,I110_003,I110_004 from INV110 where I110_002='+qryInv100.FieldByName('I100_001').AsString+' order by I110_002,I110_003');
    qryInv110.Open;
  end else
  begin
    ShowMsg('UMS10000440');  //无效的仓库编号,请重新输入
    edtWhsID.SetFocus;
    Abort;
  end;
end;

procedure TInv150_02Form.edtLocIDExit(Sender: TObject);
begin
  inherited;
//库位编号
  if not ActSave.Enabled then Exit;
  if trim(edtLocID.Text)='' then Exit;
  if not qryInv100.Locate('I100_002',edtWhsID.Text,[]) then
  begin
    ShowMsg('UMS10000445');  //必须先输入正确的仓库编号
    edtWhsID.SetFocus;
    Abort;
  end;
  qryInv110.Close;
  qryInv110.SQL.Clear;
  qryInv110.SQL.Add('select I110_001,I110_002,I110_003,I110_004 from INV110 where I110_002='+qryInv100.FieldByName('I100_001').AsString+' order by I110_002,I110_003');
  qryInv110.Open;
  if qryInv110.Locate('I110_003',edtLocID.Text,[]) then
  begin
    edtLocID.Text:=qryInv110.FieldByName('I110_003').AsString;
    edtLocName.Text:=qryInv110.FieldByName('I110_004').AsString;
  end else
  begin
    ShowMsg('UMS10000475');  //无效的库位编号,请重新输入
    edtLocID.SetFocus;
    Abort;
  end;
end;

procedure TInv150_02Form.edtBuyerExit(Sender: TObject);
begin
  inherited;
//采购人员
  if not ActSave.Enabled then Exit;
  if trim(edtBuyer.Text)='' then Exit;
  if qryHrm150.Locate('H150_002',edtBuyer.Text,[]) then
  begin
    edtBuyer.Text:=qryHrm150.FieldByName('H150_002').AsString;
    edtBuyerName.Text:=qryHrm150.FieldByName('H150_003').AsString;
  end else
  begin
    ShowMsg('UMS10000482');  //无效的员工编号,请重新输入
    edtBuyer.SetFocus;
    Abort;
  end;
end;

procedure TInv150_02Form.edtPlannerExit(Sender: TObject);
begin
  inherited;
//计划人员
  if not ActSave.Enabled then Exit;
  if trim(edtPlanner.Text)='' then Exit;
  if qryHrm150.Locate('H150_002',edtPlanner.Text,[]) then
  begin
    edtPlanner.Text:=qryHrm150.FieldByName('H150_002').AsString;
    edtPlannerName.Text:=qryHrm150.FieldByName('H150_003').AsString;
  end else
  begin
    ShowMsg('UMS10000482');  //无效的员工编号,请重新输入
    edtPlanner.SetFocus;
    Abort;
  end;
end;

procedure TInv150_02Form.edtVendID1Exit(Sender: TObject);
begin
  inherited;
//主供应商
  if not ActSave.Enabled then Exit;
  if trim(edtVendID1.Text)='' then Exit;
  if qryOrd150.Locate('O150_002',edtVendID1.Text,[]) then
  begin
    edtVendID1.Text:=qryOrd150.FieldByName('O150_002').AsString;
    edtVendName1.Text:=qryOrd150.FieldByName('O150_003').AsString;
  end else
  begin
    ShowMsg('UMS10000477');  //无效的供应商编号,请重新输入
    edtVendID1.SetFocus;
    Abort;
  end;
end;

procedure TInv150_02Form.edtVendID2Exit(Sender: TObject);
begin
  inherited;
//次供应商
  if not ActSave.Enabled then Exit;
  if trim(edtVendID2.Text)='' then Exit;
  if qryOrd150.Locate('O150_002',edtVendID2.Text,[]) then
  begin
    edtVendID2.Text:=qryOrd150.FieldByName('O150_002').AsString;
    edtVendName2.Text:=qryOrd150.FieldByName('O150_003').AsString;
  end else
  begin
    ShowMsg('UMS10000477');  //无效的供应商编号,请重新输入
    edtVendID2.SetFocus;
    Abort;
  end;
end;

procedure TInv150_02Form.edtNameChange(Sender: TObject);
begin
  inherited;
  edtName1.Text:=edtName.Text;
  edtName2.Text:=edtName.Text;
  edtName3.Text:=edtName.Text;
end;

procedure TInv150_02Form.cbPurChange(Sender: TObject);
begin
  inherited;
{
0=非计划料品:MRP、MPS计算时略过该料品,不核算其计划数量
1=因需定量法:计划数量等于料品的需求要量
2=固定周期法:按固定周期编制计划定单,计划数量=周期内需求数量之和
3=标准批量因需增量:需求数量<=标准批量时,计划数量=标准批量;反之计划数量=实际需求数量
4=标准批量固定增量:需求数量<=标准批量时,计划数量=标准批量;反之计划数量=标准批量+定单增量
5=标准批量倍数增量:需求数量<=标准批量时,计划数量=标准批量;反之计划数量=标准批量的倍数
6=最小成本法:暂不处理
}
  cbMRP.Enabled:=cbPur.ItemIndex<>0;
  if cbPur.ItemIndex=0 then cbMRP.ItemIndex:=0;

  edtLots.Enabled:=False;
  edtAdd.Enabled:=False;
  edtCost.Enabled:=False;
  edtOrderDays.Enabled:=False;
  if cbPur.ItemIndex=2 then edtOrderDays.Enabled:=True;  //2=固定周期法
  if cbPur.ItemIndex in [3,4,5] then edtLots.Enabled:=True;  //3..5=标准批量...
  if cbPur.ItemIndex in [4] then edtAdd.Enabled:=True;  //4=标准批量固定增量
  if cbPur.ItemIndex=6 then edtCost.Enabled:=True;  //6=最小成本法

  if edtLots.Enabled then edtLots.Color:=AEnableColor else edtLots.Color:=ADisableColor;
  if edtAdd.Enabled then edtAdd.Color:=AEnableColor else edtAdd.Color:=ADisableColor;
  if edtCost.Enabled then edtCost.Color:=AEnableColor else edtCost.Color:=ADisableColor;
  if edtOrderDays.Enabled then edtOrderDays.Color:=AEnableColor else edtOrderDays.Color:=ADisableColor;
  if cbMRP.Enabled then cbMRP.Color:=AEnableColor else cbMRP.Color:=ADisableColor;
end;

procedure TInv150_02Form.edtVolumeKeyPress(Sender: TObject; var Key: Char);
begin
  inherited;
  ValidFloat(Sender,Key);
end;

procedure TInv150_02Form.cbIsSaleClick(Sender: TObject);
begin
  inherited;
  edtLowPrice.Enabled:=cbIsSale.Checked;
  edtHighPrice.Enabled:=cbIsSale.Checked;
  if edtLowPrice.Enabled then edtLowPrice.Color:=AEnableColor else edtLowPrice.Color:=ADisableColor;
  if edtHighPrice.Enabled then edtHighPrice.Color:=AEnableColor else edtHighPrice.Color:=ADisableColor;
end;

procedure TInv150_02Form.edtLeadKeyPress(Sender: TObject; var Key: Char);
begin
  inherited;
  ValidInteger(Sender,Key);
end;

procedure TInv150_02Form.adsInv151AfterScroll(DataSet: TDataSet);
var
  AItemNo,APictNo:Integer;
  APictFile,AFileExt:String;
begin
  inherited;
  Screen.Cursor:=crHourGlass;
  tbNext.Enabled:=not adsInv151.Eof;
  tbLast.Enabled:=not adsInv151.Eof;
  tbFirst.Enabled:=not adsInv151.Bof;
  tbPrior.Enabled:=not adsInv151.Bof;
  AItemNo:=adsInv151.FieldByName('FItemNo').AsInteger;
  APictNo:=adsInv151.FieldByName('FPictNo').AsInteger;
  APictFile:=adsInv151.FieldByName('FFileName').AsString;
  AFileExt:=adsInv151.FieldByName('FFileExt').AsString;
  imgPicture.Picture.Graphic:=nil;
  imgPicture.Repaint;
  if APictFile='' then
  begin
    APictFile:=ASystemPath+'tempPic'+AFileExt;
    if FileExists(APictFile) then DeleteFile(APictFile);
    qryPicture.Close;
    qryPicture.SQL.Clear;
    qryPicture.SQL.Add('select I151_003 from INV151 where I151_001='+IntToStr(AItemNo)+' and I151_002='+IntToStr(APictNo));
    qryPicture.Open;
    if not qryPicture.IsEmpty then
    begin
      TBlobField(qryPicture.FieldByName('I151_003')).SaveToFile(APictFile);
      imgPicture.Picture.LoadFromFile(APictFile);
      imgPicture.Repaint;
    end;
  end else
  begin
    imgPicture.Picture.LoadFromFile(APictFile);
    imgPicture.Repaint;
  end;
  Screen.Cursor:=crDefault;
end;

procedure TInv150_02Form.ADOQuery1I150_006GetText(Sender: TField;
  var Text: String; DisplayText: Boolean);
begin
  inherited;
//料品类型
  if ADOQuery1.IsEmpty then Exit;
  Text:=AType[Sender.AsInteger];
end;

procedure TInv150_02Form.ADOQuery1I150_007GetText(Sender: TField;
  var Text: String; DisplayText: Boolean);
begin
  inherited;
//料品状态
  if ADOQuery1.IsEmpty then Exit;
  Text:=AStatues[Sender.AsInteger];
end;

initialization
  RegisterClass(TInv150_02Form);

⌨️ 快捷键说明

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