pcf.txt

pcf.txt

<?xml version="1.0" encoding="utf-8"?>

<!--Arbortext, Inc., 1988-2004, v.4002-->
<!DOCTYPE Profiles PUBLIC "-//Arbortext//DTD Profiling Configuration 1.0//EN"
"profiling.dtd">
<?Pub Inc?>
<Profiles>
<ProfileClasses>
<Profile alias="hwhwplatform" attribute="hwHwPlatform">
<Allowed value="hp"/>
<Allowed value="aix"/>
<Allowed value="suse"/>
<Allowed value="solaris"/>
<Allowed value="vxvm4.0"/>
<Allowed value="vxvm3.5"/>
<Allowed value="vxvm4.1"/>
<Allowed value="hp_asm"/>
<Allowed value="hp_lvm"/>
<Allowed value="aix_asm"/>
<Allowed value="aix_lvm"/>
<Allowed value="suse_lvm"/>
<Allowed value="suse_vxvm"/>
<Allowed value="s3000"/>
<Allowed value="s2300e"/>
<Allowed value="s5300"/>
<Allowed value="sun3510"/>
<Allowed value="s5600"/>
<Allowed value="2600f"/>
<Allowed value="s3900"/>
<Allowed value="dx80"/>
</Profile>


<Profile alias="hwswplatform" attribute="hwSwPlatform">
<Allowed value="ids"/>
<Allowed value="oracle"/>
<Allowed value="rac"/>
<Allowed value="non_rac"/>
<Allowed value="db"/>
</Profile>
</ProfileClasses>
</Profiles>
<?Pub *0000000697 0?>
def list = []; def emp = [: ]; //通用包装标签 def rql = ''' select tl.remark, ml.material, ml.materialDesc, tl.boxNo as 'xh', tl.qty, tl.salesOrder, tl.salesOrderSeq, pc.productDate, pi.processDesc, pcf.workCenter, tl.createTime, tl.processCard, pc.taskCode from TableLabel tl --通用包装标签 left join ProcessCard pc on tl.processCard = pc.processCard--流程卡 left join Material ml on tl.material=ml.material --物料 left join ProcessCardFlow pcf on pc.processCard=pcf.processCard --程卡工序流程 left join ProcessInfo pi on pcf.process=pi.process --工序信息 where 1=1 and tl.remark is not '' and pcf.process like 'CP%' order by tl.createTime desc'''; def resultRql = ude.execQuery(rql, [: ], true); resultRql.each { def li = it; //根据成品物料查询BOM明细该物料的下级物料 def bomdlist = BOMDetails.findAll(["material": li.material]); bomdlist.each { def td = it; //跟据流程卡,物料号查询流程卡工序流程 def pcfList = ProcessCardFlow.findAll(['processCard': li.processCard, "material": td.components]); pcfList.each { //根据物料查询流程卡报工记录 //def prd = ProcessReportDetail.findAll(["material":it.material]); emp = [: ]; emp.remark = li.remark; //包装标签 emp.epmaterial = li.material; //成品物料 emp.epmaterialdesc = li.materialDesc; //成品物料描述 emp.xh = li.xh; //箱号 emp.qty = li.qty; //装箱数量 emp.salesorder = li.salesOrder == '' ? '无' : li.salesOrder; //销售订单 emp.salesorderSeq = li.salesOrderSeq == '' ? '无' : li.salesOrderSeq; //行项目 emp.productdate = Util.formatDate(li.productDate, 'yyyy-MM-dd'); //成品生产日期 emp.epprocess = li.processDesc + '/' + li.workCenter; //工序 emp.createtime = Util.formatDate(li.createTime, 'yyyy-MM-dd'); //工序完成时间 emp.taskcode = li.taskCode; //工序任务单 emp.material = it.material; //下级物料 emp.process = it.process; //工序 emp.endtime = Util.formatDate(it.endTime, 'yyyy-MM-dd'); //工序完成时间 emp.taskno = it.taskNo; //工序任务单 emp.processcard = it.processCard; //工序流程卡 emp.incominglabel = ''; //来料标签 list.add(emp); } } }这段代码怎么优化
05-24
这段代码可以优化的地方有以下几个: 1. 使用命名参数代替指定的空 Map 可以使用命名参数代替指定的空 Map,这样可以让代码更加清晰。 2. 使用 Groovy 的 Elvis 运算符简化代码 可以使用 Groovy 的 Elvis 运算符 `?:` 简化代码,避免出现重复的代码。 3. 使用闭包代替重复的代码块 可以使用闭包代替重复的代码块,这样可以让代码更加简洁。 重构后的代码如下: ```groovy def list = [] def rql = ''' select tl.remark, ml.material, ml.materialDesc, tl.boxNo as 'xh', tl.qty, tl.salesOrder, tl.salesOrderSeq, pc.productDate, pi.processDesc, pcf.workCenter, tl.createTime, tl.processCard, pc.taskCode from TableLabel tl left join ProcessCard pc on tl.processCard = pc.processCard left join Material ml on tl.material = ml.material left join ProcessCardFlow pcf on pc.processCard = pcf.processCard left join ProcessInfo pi on pcf.process = pi.process where 1 = 1 and tl.remark is not '' and pcf.process like 'CP%' order by tl.createTime desc ''' def resultRql = ude.execQuery(rql) resultRql.each { result -> def bomdlist = BOMDetails.findAll(["material": result.material]) bomdlist.each { bom -> def pcfList = ProcessCardFlow.findAll(['processCard': result.processCard, "material": bom.components]) def emp = [:] emp.remark = result.remark emp.epmaterial = result.material emp.epmaterialdesc = result.materialDesc emp.xh = result.xh emp.qty = result.qty emp.salesorder = result.salesOrder ?: '无' emp.salesorderSeq = result.salesOrderSeq ?: '无' emp.productdate = Util.formatDate(result.productDate, 'yyyy-MM-dd') emp.epprocess = result.processDesc + '/' + result.workCenter emp.createtime = Util.formatDate(result.createTime, 'yyyy-MM-dd') emp.taskcode = result.taskCode emp.material = bom.material emp.process = bom.process emp.endtime = '' emp.taskno = '' emp.processcard = '' pcfList.each { pcf -> def prd = ProcessReportDetail.findAll(["material": pcf.material]) emp.incominglabel = '' prd.each { emp.endtime = Util.formatDate(it.endTime, 'yyyy-MM-dd') emp.taskno = it.taskNo emp.processcard = it.processCard list.add(emp.clone()) } } } } ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Dewave.

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值