AX_CreateAndPostPurch

时间:2022-09-22 23:38:59
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 = ;
localPurchLine.PurchUnit = InventTableModule::find(localPurchLine.ItemId,ModuleInventPurchSales::Invent).UnitId;
localPurchLine.THK_2ndPurchQty = ;
localPurchLine.THK_2ndPurchUnit = InventTableModule::find(localPurchLine.ItemId,ModuleInventPurchSales::Invent).THK_2ndUnit;
localPurchLine.PurchPrice = ;
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;
} template 2
static void CreatePurchTemplate2(Args _args)
{
SalesTable salesTable = SalesTable::find("VS1000031");
PurchCreateFromSalesOrder purchCreate;
SalesLine getSalesLine;
QueryRun queryRun;
Query querySalesLine;
TmpPurchLinePrice tmpPurchLinePrice;
; purchCreate = PurchCreateFromSalesOrder::construct();
purchCreate.getLast();
purchCreate.resetCurrentListCS();
purchCreate.salesTable(salesTable);
purchCreate.callerRecord(salesTable); querySalesLine = new Query();
querySalesLine.addDataSource(tablenum(SalesLine));
queryRun = new QueryRun(purchCreate.querySalesLine(querySalesLine));
while (queryRun.next())
{
getSalesLine = queryRun.get(tablenum(SalesLine)); select tmpPurchLinePrice where tmpPurchLinePrice.SalesId == getSalesLine.SalesId &&
tmpPurchLinePrice.LineNum == getSalesLine.LineNum &&
tmpPurchLinePrice.SalesLineRefRecId == getSalesLine.RecId; tmpPurchLinePrice.initFromInventTable(InventTable::find(getSalesLine.ItemId));
tmpPurchLinePrice.SalesId = getSalesLine.SalesId;
tmpPurchLinePrice.LineNum = getSalesLine.LineNum;
tmpPurchLinePrice.SalesLineRefRecId = getSalesLine.RecId;
tmpPurchLinePrice.ItemId = getSalesLine.ItemId;
tmpPurchLinePrice.AccountNum = "V-10001";
tmpPurchLinePrice.PurchQty = getSalesLine.SalesQty;
tmpPurchLinePrice.PurchUnit = getSalesLine.SalesUnit;
tmpPurchLinePrice.PriceUnit = getSalesLine.PriceUnit;
tmpPurchLinePrice.CurrencyCode = "HKD";
tmpPurchLinePrice.Price = getSalesLine.SalesPrice;
tmpPurchLinePrice.Included = NoYes::Yes;
tmpPurchLinePrice.PriceSearched = NoYes::Yes;
tmpPurchLinePrice.InventDimId = getSalesLine.InventDimId;
tmpPurchLinePrice.write();
tmpPurchLinePrice.setLineAmount();
tmpPurchLinePrice.write();
} purchCreate.tmpPurchLinePrice(tmpPurchLinePrice);
purchCreate.run();
}

 

 

AX_CreateAndPostPurch的更多相关文章

    随机推荐

    1. 【golang】go语言,进行并发请求的wrap变参封装

      package main import ( "fmt" "sync" "time" ) type WaitGroupWrapper stru ...

    2. ABP入门系列(20)——使用后台作业和工作者

      ABP入门系列目录--学习Abp框架之实操演练 源码路径:Github-LearningMpaAbp 1.引言 说到后台作业,你可能条件反射的想到BackgroundWorker,但后台作业并非是后台 ...

    3. 使用sed删除拼音的音调

      */ .hljs { display: block; overflow-x: auto; padding: 0.5em; color: #333; background: #f8f8f8; } .hl ...

    4. DSP 运行时间计算函数--_itoll(TSCH,TSCL);

      DSP OMAP 程序耗时测定 CPU周期 两种方法 利用TSCL和TSCH来计算时钟周期,这两天看了一下如何他们 DSP开发,测量某个函数或某段代码的cycles消耗是经常要做的 事情,常用的pro ...

    5. 深入理解java虚拟机一之走进Java

      Java技术体系 Java程序设计语言.Java虚拟机.Java API类库统称为JDK Java API类库中Java SE API子集和Java虚拟机统称为JRE Java发展史 1991年4月 ...

    6. jQuery 选择器 筛选器 样式操作 文本操作 属性操作 文档处理 事件 动画效果 插件 each、data、Ajax

      jQuery jQuery介绍 1.jQuery是一个轻量级的.兼容多浏览器的JavaScript库. 2.jQuery使用户能够更方便地处理HTML Document.Events.实现动画效果.方 ...

    7. 动态替换iframe的src及动态改变iframe的高度

      实现效果:点击左侧右侧内容变化,但左侧保持不变(如折叠等) 动态替换iframe的src <iframe width="100%" frameBorder="0&q ...

    8. Python解码base64遇到Incorrect padding错误

      Python解码base64遇到Incorrect padding错误 base64转码过程 先说一下转换过程,详细的可以参考阮一峰.廖雪峰博客: 所谓Base64,就是说选出64个字符----小写字 ...

    9. js小功能

      1 删除左右两端的空格 //删除左右两端的空格 function trim(str) { return str.replace(/(^\s*)|(\s*$)/g, ""); } 2 ...

    10. svmtrain输入参数介绍【转】

      -s svm类型:SVM设置类型(默认0) 0 -- C-SVC 1 --v-SVC 2 – 一类SVM 3 -- e -SVR 4 -- v-SVR -t 核函数类型:核函数设置类型(默认2) 0 ...