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

📄 otherin.pas

📁 文件包含程序源原文件
💻 PAS
📖 第 1 页 / 共 5 页
字号:
    MessageDlg(ErrMsg, mtWarning, [mbOK], 0);
  end;
end;

function  TfrmOtherIn.UpdateProc(UpdateListList: TList): Boolean;
var List: TList;
    lcP:  PUPDATE_LIST;
    lcInvP: PINVENTORY;
    IX_1, IX_2, Recid, Error: LongInt;
    ReReadFlg: Boolean;
    ErrMsg: string;
begin
  Result := False;
  Screen.Cursor  := crSqlWait;
  RecIdType := 0;
  try
    for IX_1:=0 to UpdateListList.Count-1 do begin
      List  := UpdateListList[IX_1];
      lcP   := List[0];
      Recid := lcP^.REC_ID;
      ReReadFlg := (Recid < 0);
      Error := dm_Inventory.UpdateDatabase('inventory_sheet', Recid, List);
      if Error < 0 then begin
        Screen.Cursor := crDefault;
        ErrMsg := GetMultiLingalMsg(1917, 'Update Database is Error!');
        MessageDlg(ErrMsg, mtError, [mbOk], 0);
        Exit;
      end;
      lcInvP := nil;
      for IX_2:=0 to List.Count-1 do begin
        lcInvP := PUPDATE_LIST(List[IX_2])^.Parent;
        if lcInvP^.REC_ID <> Recid then lcInvP^.REC_ID := Recid;
      end;
      Inc(ReRead_Cnt);
      SetLength(ReRead_RID, ReRead_Cnt);
      ReRead_RID[ReRead_Cnt-1] := lcInvP^.REC_ID;
      if not(ReReadFlg) then begin
        Inc(Delete_Cnt);
        SetLength(Delete_RID, Delete_Cnt);
        Delete_RID[Delete_Cnt-1] := lcInvP^.REC_ID;
      end;
    end;
  finally
    RecIdType := 1;
    Screen.Cursor := crDefault;
  end;
  for IX_1:=0 to FUpdateList.Count-1 do Dispose(FUpdateList[IX_1]);
  FUpdateList.Clear;
  Result := True;
end;

procedure TfrmOtherIn.UpdateCheck;
var UpdateListList: TList;
begin
  UpdateListList := GetUpdateListList;
  if (UpdateListList.Count>0)then begin
    if ErrorCheck(Selected) <> 0 then Exit;
    UpdateProc(UpdateListList);
    //if ReRead_Cnt > 0 then frmInvHistory.ReReadProc(False);
  end;
end;

procedure TfrmOtherIn.SetCopy;
var lcP, lcNewP: PINVENTORY;
    View: TINVENTORY;
    iPaper: integer;
begin
  lcP := Selected;
  New(lcNewP);

  ZeroMemory(lcNewP, SizeOf(TINVENTORY));
  CopyMemory(lcNewP, lcP, SizeOf(TINVENTORY));
  DEC(FNewRecid);
  lcNewP^.REC_ID   := FNewRecid;
  if lcNewP^.DATE <= 2  then lcNewP^.DATE  := NOW;

  iPaper := strToIntDef(frmMain.IniData.PaperNo,20);
  StrPCopy(lcNewp^.PAPERNO, dm_Inventory.Get_PaperNO(lcp^.SUP_CD, lcp^.DATE, iPaper,0));

  lcNewP^.UNT_PRICE     := 0;
  lcNewP^.QUANTITY      := 0;
  lcNewP.MAK_PRICE      := 0;
  lcNewP^.TTL_PRICE     := 0;
  lcNewP^.USE_GUAGE     := '';
  lcNewP^.USE_QUANTITY  := 0;
  lcNewP^.USE_AMOUNT    := 0;
  lcNewP^.ODR_RID       := 0;
  lcNewP^.PAT_RID       := 0;
  lcNewP^.HAT_RID       := 0;

  SetData(lcNewP);
  AddTab(lcNewP);
  SetUpdateList(lcNewP^.REC_ID, @lcNewP^.STK_ID,
                LongInt(@View.STK_ID)-LongInt(@View),     0, lcNewP);
  SetUpdateList(lcNewP^.REC_ID, @lcNewP^.KIND,
                LongInt(@View.KIND)-LongInt(@View),       0, lcNewP);
  SetUpdateList(lcNewP^.REC_ID, @lcNewP^.DATE,
                LongInt(@View.DATE)-LongInt(@View),       0, lcNewP);
  SetUpdateList(lcNewP^.REC_ID, @lcNewP^.PAPERNO,
                LongInt(@View.PAPERNO)-LongInt(@View),    0, lcNewP);
  SetUpdateList(lcNewP^.REC_ID, @lcNewP^.MAT_RID,
                LongInt(@View.MAT_RID)-LongInt(@View),    0, lcNewP);
  SetUpdateList(lcNewP^.REC_ID, @lcNewP^.MAT_NM,
                LongInt(@View.MAT_NM)-LongInt(@View),     0, lcNewP);
  SetUpdateList(lcNewP^.REC_ID, @lcNewP^.GUAGE_ID,
                LongInt(@View.GUAGE_ID)-LongInt(@View),   0, lcNewP);
  SetUpdateList(lcNewP^.REC_ID, @lcNewP^.SUP_CD,
                LongInt(@View.SUP_CD)-LongInt(@View),     0, lcNewP);
  SetUpdateList(lcNewP^.REC_ID, @lcNewP^.MAK_CD,
                LongInt(@View.MAK_CD)-LongInt(@View),     0, lcNewP);
  SetUpdateList(lcNewP^.REC_ID, @lcNewP^.QUANTITY,
                LongInt(@View.QUANTITY)-LongInt(@View),   0, lcNewP);
  SetUpdateList(lcNewP^.REC_ID, @lcNewP^.UNT_PRICE,
                LongInt(@View.UNT_PRICE)-LongInt(@View),  0, lcNewP);
  SetUpdateList(lcNewP^.REC_ID, @lcNewP^.MAK_PRICE,
                LongInt(@View.MAK_PRICE)-LongInt(@View),  0, lcNewP);
  SetUpdateList(lcNewP^.REC_ID, @lcNewP^.TTL_PRICE,
                LongInt(@View.TTL_PRICE)-LongInt(@View),  0, lcNewP);
  SetUpdateList(lcNewP^.REC_ID, @lcNewP^.USE_GUAGE,
                LongInt(@View.USE_GUAGE)-LongInt(@View),  0, lcNewP);
  SetUpdateList(lcNewP^.REC_ID, @lcNewP^.USE_QUANTITY,
                LongInt(@View.USE_QUANTITY)-LongInt(@View),  0, lcNewP);
  SetUpdateList(lcNewP^.REC_ID, @lcNewP^.USE_AMOUNT,
                LongInt(@View.USE_AMOUNT)-LongInt(@View),  0, lcNewP);
  SetUpdateList(lcNewP^.REC_ID, @lcNewP^.INOUT_ID,
                LongInt(@View.INOUT_ID)-LongInt(@View),   0, lcNewP);
  SetUpdateList(lcNewP^.REC_ID, @lcNewP^.input_empid,
                LongInt(@View.input_empid)-LongInt(@View),       0, lcNewP);
  SetUpdateList(lcNewP^.REC_ID, @lcNewP^.invoice_no,
                LongInt(@View.invoice_no)-LongInt(@View),       0, lcNewP);
  SetUpdateList(lcNewP^.REC_ID, @lcNewP^.recieve_empid,
                LongInt(@View.recieve_empid)-LongInt(@View),       0, lcNewP);
  SetUpdateList(lcNewP^.REC_ID, @lcNewP^.ODR_RID,
                LongInt(@View.ODR_RID)-LongInt(@View),    0, lcNewP);
  SetUpdateList(lcNewP^.REC_ID, @lcNewP^.PAT_RID,
                LongInt(@View.PAT_RID)-LongInt(@View),    0, lcNewP);
  SetUpdateList(lcNewP^.REC_ID, @lcNewP^.HAT_RID,
                LongInt(@View.HAT_RID)-LongInt(@View),    0, lcNewP);
  SetUpdateList(lcNewP^.REC_ID, @lcNewP^.ISS_PAPERNO,
                LongInt(@View.ISS_PAPERNO)-LongInt(@View),    0, lcNewP);
  SetUpdateList(lcNewP^.REC_ID, @lcNewP^.SEQUAL_NO,
                LongInt(@View.SEQUAL_NO)-LongInt(@View),    0, lcNewP);
  SetUpdateList(lcNewP^.REC_ID, @lcNewP^.HAT_CODE,
                LongInt(@View.HAT_CODE)-LongInt(@View),    0, lcNewP);
  //SetUpdateList(lcNewP^.REC_ID, @lcNewP^.IS_CLOSE, LongInt(@View.IS_CLOSE)-LongInt(@View),    0, lcNewP);
  SetUpdateList(lcNewP^.REC_ID, @lcNewP^.NOTE, LongInt(@View.NOTE)-LongInt(@View),       0, lcNewP);
end;

{**********************************************************************************}
{**********************************************************************************}
procedure TfrmOtherIn.set_tmpdata(i: integer; lcp: PINVENTORY; agp: PUnDeliveryOnTime);
var iGuage_ID: Integer;
    View: TINVENTORY;
    lcpA: PINVENTORY;
begin
  //-- process guage_id use guage_name
  if agp=nil then exit;

  if not(dm_inventory.isExists_GuageInfo(agp^.shizai_rec_id, agp^.kikaku)) then begin
    dm_inventory.Insert_MatGuageInfo(agp^.shizai_rec_id, agp^.kikaku);
    dm_inventory.Read_MatGuageInfo(FGuageList);
  end;
  iGuage_ID := dm_Inventory.Get_GuageID(agp^.shizai_rec_id, agp^.kikaku);

  case i of
    1: begin
         lcp^.MAT_RID   := agp^.shizai_rec_id;
         SetUpdateList(lcP^.REC_ID, @lcP^.MAT_RID, LongInt(@View.MAT_RID)-LongInt(@View), 0, lcP);

         strPCopy(LCP^.MAT_NM, dm_inventory.GetMaterialName(lcp^.MAT_RID));
         SetUpdateList(lcP^.REC_ID, @lcP^.MAT_NM, LongInt(@View.MAT_NM)-LongInt(@View), 0, lcP);

         lcp^.GUAGE_ID  := iGuage_ID;
         SetUpdateList(lcP^.REC_ID, @lcP^.GUAGE_ID, LongInt(@View.GUAGE_ID)-LongInt(@View), 0, lcP);

         lcp^.SUP_CD          := agp^.hatchu_saki;
         SetUpdateList(lcP^.REC_ID, @lcP^.SUP_CD, LongInt(@View.SUP_CD)-LongInt(@View), 0, lcP);

         lcp^.MAK_CD    := agp^.maker;
         SetUpdateList(lcP^.REC_ID, @lcP^.MAK_CD, LongInt(@View.MAK_CD)-LongInt(@View), 0, lcP);

         lcp^.UNT_PRICE := abs(RoundTo(agp^.tanka,-2));
         SetUpdateList(lcP^.REC_ID, @lcP^.UNT_PRICE, LongInt(@View.UNT_PRICE)-LongInt(@View), 0, lcP);

         lcp^.QUANTITY  := abs(RoundTo(agp^.un_deliveried_suryo,-2));
         SetUpdateList(lcP^.REC_ID, @lcP^.QUANTITY, LongInt(@View.QUANTITY)-LongInt(@View), 0, lcP);

         lcp^.MAK_PRICE := abs(RoundTo(agp^.mak_price,-2))*abs(RoundTo(agp^.suryo,-2));
         SetUpdateList(lcP^.REC_ID, @lcP^.MAK_PRICE, LongInt(@View.MAK_PRICE)-LongInt(@View), 0, lcP);

         lcp^.TTL_PRICE := abs(RoundTo(lcp^.UNT_PRICE,-2))*abs(RoundTo(lcp^.QUANTITY,-2))+abs(RoundTo(lcp^.MAK_PRICE,-2));
         SetUpdateList(lcP^.REC_ID, @lcP^.TTL_PRICE, LongInt(@View.TTL_PRICE)-LongInt(@View), 0, lcP);

         lcp^.ODR_RID   := agp^.seihin_rec_id;
         SetUpdateList(lcP^.REC_ID, @lcP^.ODR_RID, LongInt(@View.ODR_RID)-LongInt(@View), 0, lcP);

         lcp^.PAT_RID   := agp^.buhin_rec_id;
         SetUpdateList(lcP^.REC_ID, @lcP^.PAT_RID, LongInt(@View.PAT_RID)-LongInt(@View), 0, lcP);

         lcp^.HAT_RID   := agp^.hatchu_id;
         SetUpdateList(lcP^.REC_ID, @lcP^.HAT_RID, LongInt(@View.HAT_RID)-LongInt(@View), 0, lcP);

         strPCopy(lcp^.HAT_CODE, agp^.hatchu_code);
         SetUpdateList(lcP^.REC_ID, @lcP^.HAT_CODE, LongInt(@View.HAT_CODE)-LongInt(@View), 0, lcP);

         strPCopy(lcp^.SEQUAL_NO, agp^.sequal_no);
         SetUpdateList(lcP^.REC_ID, @lcP^.SEQUAL_NO, LongInt(@View.SEQUAL_NO)-LongInt(@View), 0, lcP);
         SetData(lcP);
       end;
    2: begin
         setNew(-1);
         lcpA := Selected;

         lcpA^.MAT_RID   := agp^.shizai_rec_id;
         SetUpdateList(lcpA^.REC_ID, @lcpA^.MAT_RID, LongInt(@View.MAT_RID)-LongInt(@View), 0, lcpA);

         strPCopy(lcpA^.MAT_NM, dm_inventory.GetMaterialName(lcpA^.MAT_RID));
         SetUpdateList(lcpA^.REC_ID, @lcpA^.MAT_NM, LongInt(@View.MAT_NM)-LongInt(@View), 0, lcpA);

         lcpA^.GUAGE_ID  := iGuage_ID;
         SetUpdateList(lcpA^.REC_ID, @lcpA^.GUAGE_ID, LongInt(@View.GUAGE_ID)-LongInt(@View), 0, lcpA);

         lcpA^.SUP_CD    := agp^.hatchu_saki;
         SetUpdateList(lcpA^.REC_ID, @lcpA^.SUP_CD, LongInt(@View.SUP_CD)-LongInt(@View), 0, lcpA);
         
         lcpA^.MAK_CD    := agp^.maker;
         SetUpdateList(lcpA^.REC_ID, @lcpA^.MAK_CD, LongInt(@View.MAK_CD)-LongInt(@View), 0, lcpA);

         lcpA^.UNT_PRICE := abs(RoundTo(agp^.tanka,-2));
         SetUpdateList(lcpA^.REC_ID, @lcpA^.UNT_PRICE, LongInt(@View.UNT_PRICE)-LongInt(@View), 0, lcpA);

         lcpA^.QUANTITY  := abs(RoundTo(agp^.un_deliveried_suryo,-2));
         SetUpdateList(lcpA^.REC_ID, @lcpA^.QUANTITY, LongInt(@View.QUANTITY)-LongInt(@View), 0, lcpA);

         lcpA^.MAK_PRICE := abs(RoundTo(agp^.mak_price,-2))*abs(RoundTo(agp^.suryo,-2));
         SetUpdateList(lcpA^.REC_ID, @lcpA^.MAK_PRICE, LongInt(@View.MAK_PRICE)-LongInt(@View), 0, lcpA);

         lcpA^.TTL_PRICE := abs(RoundTo(lcpA^.UNT_PRICE,-2))*abs(RoundTo(lcpA^.QUANTITY,-2))+abs(RoundTo(lcpA^.MAK_PRICE,-2));
         SetUpdateList(lcpA^.REC_ID, @lcpA^.TTL_PRICE, LongInt(@View.TTL_PRICE)-LongInt(@View), 0, lcpA);

         lcpA^.ODR_RID   := agp^.seihin_rec_id;
         SetUpdateList(lcpA^.REC_ID, @lcpA^.ODR_RID, LongInt(@View.ODR_RID)-LongInt(@View), 0, lcpA);

         lcpA^.PAT_RID   := agp^.buhin_rec_id;
         SetUpdateList(lcpA^.REC_ID, @lcpA^.PAT_RID, LongInt(@View.PAT_RID)-LongInt(@View), 0, lcpA);

         lcpA^.HAT_RID   := agp^.hatchu_id;
         SetUpdateList(lcpA^.REC_ID, @lcpA^.HAT_RID, LongInt(@View.HAT_RID)-LongInt(@View), 0, lcpA);

         strPCopy(lcpA^.HAT_CODE, agp^.hatchu_code);
         SetUpdateList(lcpA^.REC_ID, @lcpA^.HAT_CODE, LongInt(@View.HAT_CODE)-LongInt(@View), 0, lcpA);

         strPCopy(lcpA^.SEQUAL_NO, agp^.sequal_no);
         SetUpdateList(lcpA^.REC_ID, @lcpA^.SEQUAL_NO, LongInt(@View.SEQUAL_NO)-LongInt(@View), 0, lcpA);
         SetData(lcpA);
       end;
  end;
end;

{**********************************************************************************}
procedure TfrmOtherIn.SetNew(Index: Integer);
var lcP:  PINVENTORY;
    View: TINVENTORY;
    iPaper: integer;
begin
  New(lcP);
  ZeroMemory(lcP, SizeOf(TINVENTORY));

  Dec(FNewRecid);
  lcP^.REC_ID   := FNewRecid;
  lcp^.KIND     := 0;
  if lcp^.DATE <= 2 then lcp^.DATE := NOW;
  lcp^.USE_GUAGE    := '';
  lcp^.USE_QUANTITY := 0;
  lcp^.USE_AMOUNT   := 0;

  ///////////////////////////////////////////////////
  lcp^.SUP_CD             := default_suplier;
  StrPCopy(lcp^.ISS_PAPERNO, default_issuepaper);
  strPCopy(lcp^.INOUT_ID,    default_IOID);
  strPCopy(lcp^.INPUT_EMPID, default_InManID);
  strPCopy(lcp^.STK_ID,      default_stkid);


  SetUpdateList(lcP^.REC_ID, @lcP^.SUP_CD, LongInt(@View.SUP_CD)-LongInt(@View), 0, lcP);
  SetUpdateList(lcP^.REC_ID, @lcP^.ISS_PAPERNO, LongInt(@View.ISS_PAPERNO)-LongInt(@View), 0, lcP);
  SetUpdateList(lcP^.REC_ID, @lcP^.INOUT_ID,    LongInt(@View.INOUT_ID)-LongInt(@View), 0, lcP);
  SetUpdateList(lcP^.REC_ID, @lcP^.INPUT_EMPID, LongInt(@View.INPUT_EMPID)-LongInt(@View), 0, lcP);
  SetUpdateList(lcP^.REC_ID, @lcP^.STK_ID, LongInt(@View.STK_ID)-LongInt(@View), 0, lcP);

  iPaper := strToIntDef(frmMain.IniData.PaperNo,20);
  StrPCopy(lcp^.PAPERNO, dm_Inventory.Get_PaperNO(lcp^.SUP_CD, lcp^.DATE, iPaper,0));
  SetUpdateList(lcP^.REC_ID, @lcP^.PAPERNO, LongInt(@View.PAPERNO)-LongInt(@View), 0, lcP);

  SetUpdateList(lcP^.REC_ID, @lcP^.KIND, LongInt(@View.KIND)-LongInt(@View), 0, lcP);
  SetUpdateList(lcP^.REC_ID, @lcP^.DATE, LongInt(@View.DATE)-LongInt(@View), 0, lcP);

  SetUpdateList(lcP^.REC_ID, @lcP^.USE_GUAGE, LongInt(@View.USE_GUAGE)-LongInt(@View), 0, lcP);
  SetUpdateList(lcP^.REC_ID, @lcP^.USE_QUANTITY, LongInt(@View.USE_QUANTITY)-LongInt(@View), 0, lcP);
  SetUpdateList(lcP^.REC_ID, @lcP^.USE_AMOUNT,   LongInt(@View.USE_AMOUNT)-LongInt(@View), 0, lcP);

  SetData(lcP);
  if Index < 0 then AddTab(lcP)
  else InsertTab(lcP, Index);
end;

function  TfrmOtherIn.RECExists(RecID: LongInt): Boolean;
var i: Integer;
    WObj: Pointer;
    lcP: PINVENTORY;
begin
  Result := False;
  for i:=0 to TabControl.Tabs.Count-1 do begin
    WObj := TabControl.Tabs.Objects[i];
    lcP  := WObj;
    if lcP^.REC_ID = RecID then begin
      Result := True;
      Exit;
    end;
  end;
end;

{**********************************************************************************}
{**********************************************************************************}
function  TfrmOtherIn.GetTabCaption(Item: Pointer): string;
var lcP: PINVENTORY;
begin
  lcP := Item;
  Result := dm_Inventory.GetMaterialCode(lcP^.MAT_RID);
end;

procedure TfrmOtherIn.SetKomoku(Item: Pointer);
begin
  Selected := nil;
  if Item <> nil then begin
    SetData(Item);
    Selected := Item;
  end else SetNull;
end;

{**********************************************************************************}
{**********************************************************************************}
procedure TfrmOtherIn.btnNewClick(Sender: TObject);
var
  frmInSuplier: TfrmInSuplier;
begin
  if Selected <> nil then
  begin
    if ErrorCheck(Selected) = 0 then
    begin
      UpdateCheck;

      if ckbNew.Checked then
      begin
        frmInSuplier := TfrmInSuplier.Create(self);
        frmInSuplier.ShowModal;
        if frmInSuplier.ModalResult = mrOK then
        begin

⌨️ 快捷键说明

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