📄 othermatout.pas
字号:
edtMakerCode.Value := lcP^.MAK_CD;
lblMakerNM.Text := dm_Inventory.GetShigenName(lcP^.MAK_CD);
edtMakerPrice.Value := RoundTo(lcp^.MAK_PRICE,-2);
edtNote.Text := lcP^.NOTE;
////////////-- get Inventory material qty
SetInventoryCnt(lcP^.REC_ID, lcp^.MAT_RID,lcp^.GUAGE_ID, lcp^.STK_ID, lcP^.DATE, InvCnt);
lblCurrQty.Caption := FormatFloat('#,##0.00',InvCnt);
end;
procedure TfrmOtherMatOut.SetNull;
begin
Selected := nil;
edtStkID.Text := IniData.otherstkid;
edtIssPaperNO.Text := '';
edtMatOutID.Text := '';
edtOutIDName.Text := '';
edtRecEmpID.Text := '';
edtRecEmpName.Text := '';
edtInputEmpID.Text := '';
edtInputEmpName.Text := '';
edtPaperNo.Text := '';
edtDate.Text := '';
edtMatCode.Text := '';
edtMatName.Text := '';
edtIssGuageID.Value := 0;
edtIssGuageName.Text := '';
edtPrice.Value := 0;
edtIssWeight.Value := 0;
lblUType.Caption := '';
lblTPrice.Caption := '0';
edtMoldID.Text := '';
edtPartID.Text := '';
edtSequalNo.Text := '';
edtOrderSerial.Text := '';
edtHatCode.Text := '';
edtSuplierCode.Value := 0;
lblSupplierNM.Text := '';
edtMakerCode.Value := 0;
lblMakerNM.Text := '';
edtMakerPrice.Value := 0;
edtNote.Text := '';
lblCurrQty.Caption := '0';
end;
function TfrmOtherMatOut.ErrorCheck(Item: PINVENTORY): Integer;
var
lcP: PINVENTORY;
ErrNo: integer;
ErrMsg: string;
begin
Result := 0;
ErrNo := 0;
lcP := Selected;
if (lcP <> nil) and (GetTabCaption(Selected)='') then ErrNo := -1;
if (lcp <> nil) and (trim(edtPaperNo.Text)='') then ErrNo := -3;
if (lcp <> nil) and (trim(edtMatOutID.Text)='') then ErrNo := -4;
if (lcp <> nil) and (trim(edtRecEmpID.Text)='') then ErrNo := -5;
if (lcp <> nil) and (trim(edtInputEmpID.Text)='') then ErrNo := -6;
if ErrNo = 0 then begin
if (lcp <> nil) and (Abs(RoundTo(lcP^.QUANTITY,-2))>(InvCnt+0.0001)) then ErrNo := -2;
if (lcp <> nil) and (Abs(RoundTo(lcP^.QUANTITY,-2)) = 0) then ErrNo := -7;
if (lcp <> nil) and (abs(RoundTo(lcp^.USE_QUANTITY,-2)) > abs(RoundTo(lcp^.QUANTITY,-2))) then ErrNo := -8;
if (lcp <> nil) and (abs(lcp^.USE_QUANTITY) = 0) then ErrNo := -9;
end;
//-- 检查日期是否有效
if ErrNo = 0 then begin
if lcP^.DATE <= 2 then ErrNo := -12;
end;
//-- 检查输入的日期是否在已月结关帐区间
if ErrNo = 0 then begin
if dm_Inventory.is_DateInAccountedMonth(trim(lcp^.STK_ID),lcp^.DATE) then ErrNo := -11;
end;
if ErrNo<>0 then begin
Result := -1;
case ErrNo of
-1: ErrMsg := GetMultiLingalMsg(90207, 'this Material Code is not Exists!');
-2: ErrMsg := GetMultiLingalMsg(90218, 'Out Quantity > Inventory Quantity!');
-3: ErrMsg := GetMultiLingalMsg(90219, 'None Input Out Paper NO!');
-4: ErrMsg := GetMultiLingalMsg(90220, 'None Input Out Type!');
-5: ErrMsg := GetMultiLingalMsg(90221, 'None Input Receive Man!');
-6: ErrMsg := GetMultiLingalMsg(90222, 'None Input Input Man!');
-7: ErrMsg := GetMultiLingalMsg(90223, 'Out Quantity is Zero!');
-8: ErrMsg := GetMultiLingalMsg(90224, 'Use Quantity > Out Quantity!');
-9: ErrMsg := GetMultiLingalMsg(90225, 'Use Quantity is Zero!');
-11: ErrMsg := '该日期已月结结帐,已结帐区间不能再输入入库数据!';
-12: ErrMsg := '该入库数据的入库日期无效!';
end;
MessageDlg(ErrMsg, mtWarning, [mbOK], 0);
end;
end;
function TfrmOtherMatOut.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 TfrmOtherMatOut.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 TfrmOtherMatOut.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,1));
lcNewP^.UNT_PRICE := 0;
lcNewP^.QUANTITY := 0;
lcNewP^.TTL_PRICE := 0;
lcNewP^.USE_QUANTITY := 0;
lcNewP^.USE_AMOUNT := 0;
lcNewP^.HAT_RID := 0;
lcNewP^.MAK_PRICE := 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^.ISS_PAPERNO, LongInt(@View.ISS_PAPERNO)-LongInt(@View), 0, lcNewP);
SetUpdateList(lcNewP^.REC_ID, @lcNewP^.inout_ID, LongInt(@View.inout_ID)-LongInt(@View), 0, lcNewP);
SetUpdateList(lcNewP^.REC_ID, @lcNewP^.recieve_empid,LongInt(@View.recieve_empid)-LongInt(@View), 0, lcNewP);
SetUpdateList(lcNewP^.REC_ID, @lcNewP^.input_empid, LongInt(@View.input_empid)-LongInt(@View), 0, lcNewP);
SetUpdateList(lcNewP^.REC_ID, @lcNewP^.Paperno, LongInt(@View.Paperno)-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^.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^.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^.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^.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^.MAK_PRICE, LongInt(@View.MAK_PRICE)-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^.SEQUAL_NO, LongInt(@View.SEQUAL_NO)-LongInt(@View), 0, lcNewP);
SetUpdateList(lcNewP^.REC_ID, @lcNewP^.HAT_RID, LongInt(@View.HAT_RID)-LongInt(@View), 0, lcNewP);
SetUpdateList(lcNewP^.REC_ID, @lcNewP^.HAT_CODE, LongInt(@View.HAT_CODE)-LongInt(@View), 0, lcNewP);
SetUpdateList(lcNewP^.REC_ID, @lcNewP^.INVOICE_NO, LongInt(@View.INVOICE_NO)-LongInt(@View), 0, lcNewP);
SetUpdateList(lcNewP^.REC_ID, @lcNewP^.NOTE, LongInt(@View.NOTE)-LongInt(@View), 0, lcNewP);
end;
{**********************************************************************************}
procedure TfrmOtherMatOut.set_tmpdata(i: integer; lcp: PINVENTORY; agp: PAllReadyInOrder);
var iGuage_ID: Integer;
View: TINVENTORY;
begin
//-- process guage_id use guage_name
if agp=nil then exit;
iGuage_ID := dm_Inventory.Get_GuageID(agp^.material_rec_id, agp^.guage_name);
//tmp_wghpcs := dm_inventory.Get_MatGuageWgtPcs(agp^.material_rec_id,agp^.guage_id);
//iGuage_ID := 0;
case i of
1: begin
lcp := selected;
lcp^.MAT_RID := agp^.material_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^.supplier_code;
SetUpdateList(lcP^.REC_ID, @lcP^.SUP_CD, LongInt(@View.SUP_CD)-LongInt(@View), 0, lcP);
lcp^.MAK_CD := agp^.maker_code;
SetUpdateList(lcP^.REC_ID, @lcP^.MAK_CD, LongInt(@View.MAK_CD)-LongInt(@View), 0, lcP);
lcp^.MAK_PRICE := RoundTo(agp^.MAK_PRICE,-2);
SetUpdateList(lcP^.REC_ID, @lcP^.MAK_PRICE, LongInt(@View.MAK_PRICE)-LongInt(@View), 0, lcP);
lcp^.UNT_PRICE := abs(RoundTo(agp^.unit_price,-2));
SetUpdateList(lcP^.REC_ID, @lcP^.UNT_PRICE, LongInt(@View.UNT_PRICE)-LongInt(@View), 0, lcP);
lcp^.QUANTITY := abs(RoundTo(agp^.quantity,-2))*-1;
SetUpdateList(lcP^.REC_ID, @lcP^.QUANTITY, LongInt(@View.QUANTITY)-LongInt(@View), 0, lcP);
lcp^.TTL_PRICE := abs(RoundTo(lcp^.UNT_PRICE,-2))*abs(RoundTo(lcp^.quantity,-2))*-1;
SetUpdateList(lcP^.REC_ID, @lcP^.TTL_PRICE, LongInt(@View.TTL_PRICE)-LongInt(@View), 0, lcP);
strPCopy(lcp^.USE_GUAGE, agp^.guage_name);
SetUpdateList(lcP^.REC_ID, @lcP^.USE_GUAGE, LongInt(@View.USE_GUAGE)-LongInt(@View), 0, lcP);
lcp^.USE_QUANTITY := abs(lcp^.quantity)*-1;
SetUpdateList(lcP^.REC_ID, @lcP^.USE_QUANTITY, LongInt(@View.USE_QUANTITY)-LongInt(@View), 0, lcP);
lcp^.USE_AMOUNT := abs(lcp^.UNT_PRICE)*abs(lcp^.quantity)*-1;
SetUpdateList(lcP^.REC_ID, @lcP^.USE_AMOUNT, LongInt(@View.USE_AMOUNT)-LongInt(@View), 0, lcP);
lcp^.ODR_RID := agp^.order_rec_id;
SetUpdateList(lcP^.REC_ID, @lcP^.ODR_RID, LongInt(@View.ODR_RID)-LongInt(@View), 0, lcP);
lcp^.PAT_RID := agp^.parts_rec_id;
SetUpdateList(lcP^.REC_ID, @lcP^.PAT_RID, LongInt(@View.PAT_RID)-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);
lcp^.HAT_RID := agp^.order_no;
SetUpdateList(lcP^.REC_ID, @lcP^.HAT_RID, LongInt(@View.HAT_RID)-LongInt(@View), 0, lcP);
strPCopy(lcp^.HAT_CODE, agp^.HAT_CODE);
SetUpdateList(lcP^.REC_ID, @lcP^.HAT_CODE, LongInt(@View.HAT_CODE)-LongInt(@View), 0, lcP);
SetData(lcP);
ControlChange(edtMatCode);
ControlChange(edtIssGuageID);
end;
2: begin
setNew(-1);
lcp := selected;
lcp^.MAT_RID := agp^.material_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^.supplier_code;
SetUpdateList(lcP^.REC_ID, @lcP^.SUP_CD, LongInt(@View.SUP_CD)-LongInt(@View), 0, lcP);
lcp^.MAK_CD := agp^.maker_code;
SetUpdateList(lcP^.REC_ID, @lcP^.MAK_CD, LongInt(@View.MAK_CD)-LongInt(@View), 0, lcP);
lcp^.MAK_PRICE := RoundTo(agp^.MAK_PRICE,-2);
SetUpdateList(lcP^.REC_ID, @lcP^.MAK_PRICE, LongInt(@View.MAK_PRICE)-LongInt(@View), 0, lcP);
lcp^.UNT_PRICE := abs(RoundTo(agp^.unit_price,-2));
SetUpdateList(lcP^.REC_ID, @lcP^.UNT_PRICE, LongInt(@View.UNT_PRICE)-LongInt(@View), 0, lcP);
lcp^.QUANTITY := abs(RoundTo(agp^.quantity,-2))*-1;
SetUpdateList(lcP^.REC_ID, @lcP^.QUANTITY, LongInt(@View.QUANTITY)-LongInt(@View), 0, lcP);
lcp^.TTL_PRICE := abs(RoundTo(lcp^.UNT_PRICE,-2))*abs(RoundTo(lcp^.quantity,-2))*-1;
SetUpdateList(lcP^.REC_ID, @lcP^.TTL_PRICE, LongInt(@View.TTL_PRICE)-LongInt(@View), 0, lcP);
strPCopy(lcp^.USE_GUAGE, agp^.guage_name);
SetUpdateList(lcP^.REC_ID, @lcP^.USE_GUAGE, LongInt(@View.USE_GUAGE)-LongInt(@View), 0, lcP);
lcp^.USE_QUANTITY := abs(RoundTo(lcp^.quantity,-2))*-1;
SetUpdateList(lcP^.REC_ID, @lcP^.USE_QUANTITY, LongInt(@View.USE_QUANTITY)-LongInt(@View), 0, lcP);
lcp^.USE_AMOUNT := abs(RoundTo(lcp^.UNT_PRICE,-2))*abs(RoundTo(lcp^.quantity,-2))*-1;
SetUpdateList(lcP^.REC_ID, @lcP^.USE_AMOUNT, LongInt(@View.USE_AMOUNT)-LongInt(@View), 0, lcP);
lcp^.ODR_RID := agp^.order_rec_id;
SetUpdateList(lcP^.REC_ID, @lcP^.ODR_RID, LongInt(@View.ODR_RID)-LongInt(@View), 0, lcP);
lcp^.PAT_RID := agp^.parts_rec_id;
SetUpdateList(lcP^.REC_ID, @lcP^.PAT_RID, LongInt(@View.PAT_RID)-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);
lcp^.HAT_RID := agp^.order_no;
SetUpdateList(lcP^.REC_ID, @lcP^.HAT_RID, LongInt(@View.HAT_RID)-LongInt(@View), 0, lcP);
strPCopy(lcp^.HAT_CODE, agp^.HAT_CODE);
SetUpdateList(lcP^.REC_ID, @lcP^.HAT_CODE, LongInt(@View.HAT_CODE)-LongInt(@View), 0, lcP);
SetData(lcP);
ControlChange(edtMatCode);
ControlChange(edtIssGuageID);
end;
end;
end;
{**********************************************************************************}
procedure TfrmOtherMatOut.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 := 1;
lcp^.DATE := Now;
strPCopy(lcp^.STK_ID, default_stkid);
strPCopy(lcp^.ISS_PAPERNO, default_isspaper);
strPCopy(lcp^.INOUT_ID, default_ioid);
strPCopy(lcp^.INPUT_EMPID, default_outmanid);
strPCopy(lcp^.RECIEVE_EMPID, default_receivemanid);
iPaper := strToIntDef(frmMain.IniData.PaperNo,20);
StrPCopy(lcp^.PAPERNO, dm_Inventory.Get_PaperNO(lcp^.SUP_CD, lcp^.DATE, iPaper,1));
SetUpdateList(lcP^.REC_ID, @lcP^.STK_ID, LongInt(@View.STK_ID)-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^.RECIEVE_EMPID, LongInt(@View.RECIEVE_EMPID)-LongInt(@View), 0, lcP);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -