|
本帖最后由 BIP422709 于 2023-11-21 16:54 编辑
BIP422709 · 2023-11-21 16:09只能想到这个方法,不知道各位大佬还有更换的方法不
let sql = "select mainid from pu.purchaseorder.PurchaseOrders where product = "+ source1.value; //查询得到符合条件的所有子表的mainid数组
好像也不用新建数组遍历,因为最开始得到的数组res里最后一项就是所需要的主表id,直接这样写一下就行
- let sql = "select mainid from pu.purchaseorder.PurchaseOrders where product = " + source1.value;
- var res = ObjectStore.queryByYonQL(sql, 'upu');
- let arr_vouchdate = [];
- if (res.length != 0) {
- // res.map(function(item,index){
- // let sql1 = "select vouchdate from pu.purchaseorder.PurchaseOrder where id =" + item.mainid;
- // var res1 = ObjectStore.queryByYonQL(sql1,'upu');
- // arr_vouchdate.push({data:res1[0],id:item.mainid})
- // })
- let sql2 = "select oriUnitPrice from pu.purchaseorder.PurchaseOrders where mainid in(select id from pu.purchaseorder.PurchaseOrder where id =" + res[res.length - 1].mainid + ") and product = " + source1.value
- var res2 = ObjectStore.queryByYonQL(sql2, 'upu');
- let price = res2[0].oriUnitPrice
- if (price != undefined) {
- assign = price
- }
- }
- }
复制代码
|
|