|
@@ -31,7 +31,7 @@ class AfterChild extends Base
|
|
|
|
|
|
$list = Db::name('order_return_child')
|
|
|
->alias('a')
|
|
|
- ->field('a.id,a.returnCode,a.orderCode,a.outCode,a.order_out_status,a.outChildCode,b.supplierName send_supplierName,b.supplierNo send_supplierNo,b.name send_wsm_name,a.send_wsm_code,b.contactor_name send_contactor_name,a.send_num,a.return_num,c.supplierName return_supplierName,c.supplierNo return_supplierNo,c.name return_wsm_name,a.return_wsm_code,c.contactor_name return_contactor_name,a.status')
|
|
|
+ ->field('a.id,a.returnCode,a.orderCode,a.outCode,a.order_out_child_status,a.outChildCode,b.supplierName send_supplierName,b.supplierNo send_supplierNo,b.name send_wsm_name,a.send_wsm_code,b.contactor_name send_contactor_name,a.send_num,a.return_num,c.supplierName return_supplierName,c.supplierNo return_supplierNo,c.name return_wsm_name,a.return_wsm_code,c.contactor_name return_contactor_name,a.status')
|
|
|
->leftJoin('warehouse_info b', 'b.wsm_code=a.send_wsm_code')
|
|
|
->leftJoin('warehouse_info c', 'c.wsm_code=a.return_wsm_code')
|
|
|
->where($where)
|
|
@@ -78,7 +78,7 @@ class AfterChild extends Base
|
|
|
//发货工单详情
|
|
|
$order_out_child = Db::name('order_out_child')
|
|
|
->where(['is_del' => 0, 'outCode' => $info['outCode'], 'outChildCode' => array_column($param['list'], 'outChildCode')])
|
|
|
- ->column('num,wsm_code', 'outChildCode');
|
|
|
+ ->column('num,wsm_code,status', 'outChildCode');
|
|
|
|
|
|
//所有仓库详情
|
|
|
$wsm_info = Db::name('warehouse_info')
|
|
@@ -100,7 +100,7 @@ class AfterChild extends Base
|
|
|
'returnCode' => $param['returnCode'],
|
|
|
'orderCode' => $order_out['orderCode'],
|
|
|
'outCode' => $info['outCode'],
|
|
|
- 'order_out_status' => $order_out['order_out_status'],
|
|
|
+ 'order_out_child_status' => $order_out_child[$value['outChildCode']]['status'],
|
|
|
'outChildCode' => $value['outChildCode'],
|
|
|
'send_wsm_code' => $order_out_child[$value['outChildCode']]['wsm_code'],
|
|
|
'send_num' => $order_out_child[$value['outChildCode']]['num'],
|
|
@@ -146,16 +146,17 @@ class AfterChild extends Base
|
|
|
'list|退货工单集合' => 'require|array|max:100',
|
|
|
]);
|
|
|
|
|
|
- if ($val->check($param)) return json_show(1004, $val->getError());
|
|
|
+ if ($val->check($param) == false) return json_show(1004, $val->getError());
|
|
|
|
|
|
$order_return = Db::name('order_return')
|
|
|
->alias('a')
|
|
|
- ->field('a.id,a.good_code,a.outCode,b.orderCode,c.is_stock,c.order_type')
|
|
|
+ ->field('a.id,a.good_code,a.outCode,b.orderCode,c.is_stock,c.order_type,a.status')
|
|
|
->leftJoin('order_out b', 'b.outCode=a.outCode AND b.is_del=0')
|
|
|
->leftJoin('sale c', 'c.orderCode=b.orderCode AND c.is_del=0')
|
|
|
->where(['a.is_del' => 0, 'a.returnCode' => $param['returnCode']])
|
|
|
->findOrEmpty();
|
|
|
if (empty($order_return)) return json_show(1004, '售后申请单不存在');
|
|
|
+ if ($order_return['status'] != 12) return json_show(1004, '售后申请单状态有误');
|
|
|
|
|
|
$info = Db::name('order_return_child')
|
|
|
->alias('a')
|
|
@@ -188,7 +189,7 @@ class AfterChild extends Base
|
|
|
'can_sell_num' => $value['can_sell_num'],
|
|
|
'defective_num' => $value['defective_num'],
|
|
|
'loss_num' => $value['loss_num'],
|
|
|
- 'remark' => $value['remark'],
|
|
|
+ 'remark' => $value['remark'] ?? '',
|
|
|
'updatetime' => $date,
|
|
|
'status' => 2
|
|
|
]);
|
|
@@ -306,8 +307,7 @@ class AfterChild extends Base
|
|
|
'updatetime' => $date,
|
|
|
]);
|
|
|
|
|
|
- }
|
|
|
- throw new Exception('未找到对应的商品数据');
|
|
|
+ } else throw new Exception('未找到对应的商品数据');
|
|
|
|
|
|
}
|
|
|
|
|
@@ -335,7 +335,7 @@ class AfterChild extends Base
|
|
|
->insertGetId([
|
|
|
'project_code' => '',
|
|
|
'spuCode' => $spuCode,
|
|
|
- 'wsm_code' => $value['return_wsm_code'],
|
|
|
+ 'wsm_code' => $info[$value['id']]['return_wsm_code'],
|
|
|
'wait_in_stock' => 0,
|
|
|
'wait_out_stock' => 0,
|
|
|
'usable_stock' => $value['can_sell_num'],
|
|
@@ -468,6 +468,11 @@ class AfterChild extends Base
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ //售后申请单状态维护
|
|
|
+ Db::name('order_return')
|
|
|
+ ->where(['is_del' => 0, 'returnCode' => $param['returnCode'], 'status' => 12])
|
|
|
+ ->update(['status' => 5, 'updatetime' => $date]);
|
|
|
+
|
|
|
Db::commit();
|
|
|
return json_show(0, '库管收货成功');
|
|
|
} catch (Exception $exception) {
|