static void CreateAndPostPurch(Args _args) { List il = new List(Types::Record); DocumentNum DocumentNum; TmpFrmVirtual TmpFrmVirtual; PurchLine localPurchLine; PurchTable localPurchTable; VendPackingSlipJour ventPackingSlipJour; PurchFormLetter_PackingSlip purchFormLetter_PackintSlip = PurchFormLetter::construct(DocumentStatus::PackingSlip); PurchFormLetter_PackingSlip purchFormLetter_Invoice = PurchFormLetter::construct(DocumentStatus::Invoice); ; ttsbegin; localPurchTable.clear(); localPurchTable.initValue(); localPurchTable.PurchId = NumberSeq::newGetNumFromCode("PONUM").num(); localPurchTable.initFromVendTable(VendTable::find("V-00001")); localPurchTable.PurchaseType = PurchaseType::Purch; localPurchTable.CurrencyCode = "RMB"; localPurchTable.PurchPoolId = "NOR"; localPurchTable.DeliveryDate = systemdateget(); localPurchTable.insert(); localPurchLine.clear(); localPurchLine.initValue(); localPurchLine.initFromPurchTable(localPurchTable); localPurchLine.ItemId = "100XA00125"; localPurchLine.initFromInventTable(InventTable::find(localPurchLine.ItemId)); localPurchLine.PurchQty = 1; localPurchLine.PurchUnit = InventTableModule::find(localPurchLine.ItemId,ModuleInventPurchSales::Invent).UnitId; localPurchLine.THK_2ndPurchQty = 0; localPurchLine.THK_2ndPurchUnit = InventTableModule::find(localPurchLine.ItemId,ModuleInventPurchSales::Invent).THK_2ndUnit; localPurchLine.PurchPrice = 1; localPurchLine.LineAmount = localPurchLine.calcLineAmount(); localPurchLine.THK_2ndQtyOrdered = localPurchLine.THK_2ndcalcQtyOrdered(); localPurchLine.QtyOrdered = localPurchLine.calcQtyOrdered(); localPurchLine.DeliveryDate = systemdateget(); localPurchLine.InventDimId = "T00309533"; localPurchLine.createLine(); info(strfmt("@SYS82024", localPurchTable.PurchId),‘‘, SysInfoAction_TableField::newBuffer(localPurchTable)); if(localPurchTable) { DocumentNum = NumberSeq::newGetNumFromCode("POPS").num(); purchFormLetter_PackintSlip.update(localPurchTable, DocumentNum, systemDateGet(), PurchUpdate::All, AccountOrder::Account, NoYes::No, NoYes::No, false, noYes::Yes); } while select ventPackingSlipJour where ventPackingSlipJour.PurchId == localPurchTable.PurchId { tmpFrmVirtual.clear(); tmpFrmVirtual.TableNum = tableNum(VendPackingSlipJour); tmpFrmVirtual.RecordNo = ventPackingSlipJour.recid; tmpFrmVirtual.insert(); il.addEnd(tmpFrmVirtual); } purchFormLetter_Invoice.update(localPurchTable, NumberSeq::newGetNumFromCode("POINV").num(), systemDateGet(), PurchUpdate::All, AccountOrder::Account, NoYes::No, NoYes::No, false, noYes::Yes, il.pack()); ttscommit; }
时间: 2024-11-09 08:08:40