Commit 4b59539f by 蒋勇

d

parent 9cf7636e
...@@ -10,16 +10,20 @@ class DeliverybillService extends ServiceBase { ...@@ -10,16 +10,20 @@ class DeliverybillService extends ServiceBase {
var self=this var self=this
return this.db.transaction(async function (t){ return this.db.transaction(async function (t){
//先按照ids查询出交付单的合计服务成本 //先按照ids查询出交付单的合计服务成本
let settleAmount=await self.dao.model.findSum("cost_price",{where:{[self.db.Op.In]:ids},transaction:t}) let settleAmount=await self.dao.model.findSum("cost_price",{where:{id:{[self.db.Op.In]:ids}},transaction:t})
let settlecode=await self. getBusUid("JSD") let settlecode=await self. getBusUid("JSD")
let settleObj={ let settleObj={
code:settlecode, code:settlecode,
settle_amount:settleAmount, settle_amount:settleAmount,
} }
//生成结算单,结算单状态为待审核 //生成结算单,结算单状态为待审核
await self.db.models.settlebill.create(settleObj,{transaction:t}) let newentity=await self.db.models.settlebill.create(settleObj,{transaction:t})
//然后按照ids更新交付单的状态为结算中,更新结算单的id到交付单表 //然后按照ids更新交付单的状态为结算中,更新结算单的id到交付单表
await self.updateByWhere({
'settle_status':'settling',
'settlebill_id':newentity.id
},{id:{[self.db.Op.In]:ids}},t)
return newentity
}); });
} }
async findAndCountAll(obj) { async findAndCountAll(obj) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment