|
@@ -88,7 +88,7 @@ class ReorderChild extends Base
|
|
|
'returnCode' => $param['returnCode'],
|
|
|
'outCode' => $param['outCode'],
|
|
|
'outChildCode' => $value['outChildCode'] ?? '',
|
|
|
- 'order_out_child_status' =>isset($value['outChildCode'])?($orderOutChild[$value['outChildCode']]['status'] ?? 0) :0,
|
|
|
+ 'order_out_child_status' => isset($value['outChildCode']) ? ($orderOutChild[$value['outChildCode']]['status'] ?? 0) : 0,
|
|
|
'saleReturnChildCode' => substr(makeNo('KCC'), 0, -2) . str_pad($i++, 2, '0', STR_PAD_LEFT),
|
|
|
// 'type' => $param['type'],
|
|
|
'companyNo' => $saleReturn['companyNo'],
|
|
@@ -101,8 +101,8 @@ class ReorderChild extends Base
|
|
|
'addtime' => $date,
|
|
|
'updatetime' => $date,
|
|
|
'record' => '',
|
|
|
- 'send_wsm_code' => isset($value['outChildCode'])?($orderOutChild[$value['outChildCode']]['wsm_code'] ?? ''):"",
|
|
|
- 'send_num' => isset($value['outChildCode'])?($orderOutChild[$value['outChildCode']]['num'] ?? 0):"",
|
|
|
+ 'send_wsm_code' => isset($value['outChildCode']) ? ($orderOutChild[$value['outChildCode']]['wsm_code'] ?? '') : "",
|
|
|
+ 'send_num' => isset($value['outChildCode']) ? ($orderOutChild[$value['outChildCode']]['num'] ?? 0) : "",
|
|
|
'return_num' => $value['return_num'],
|
|
|
'return_wsm_code' => $value['return_wsm_code'],
|
|
|
'good_receive_type' => 0,
|
|
@@ -207,7 +207,7 @@ class ReorderChild extends Base
|
|
|
'remark|备注' => 'max:255'
|
|
|
]);
|
|
|
|
|
|
- if ($val->check($param)==false) return json_show(1004, $val->getError());
|
|
|
+ if ($val->check($param) == false) return json_show(1004, $val->getError());
|
|
|
|
|
|
$info = Db::name('sale_return_child')
|
|
|
->alias('a')
|
|
@@ -344,10 +344,31 @@ class ReorderChild extends Base
|
|
|
}
|
|
|
|
|
|
//发货工单数量减少
|
|
|
- Db::name('order_out_child')
|
|
|
+ $tmp = Db::name('order_out_child')
|
|
|
->where(['is_del' => 0, 'outChildCode' => $info['outChildCode']])
|
|
|
- ->dec('num', $info['return_num'])
|
|
|
- ->update(['updatetime' => $date]);
|
|
|
+ ->field('id,num')
|
|
|
+ ->findOrEmpty();
|
|
|
+ $tmp['num'] -= $info['return_num'];
|
|
|
+ $tmp['updatetime'] = $date;
|
|
|
+ if ($tmp['num'] <= 0) $tmp['is_del'] = 1;
|
|
|
+
|
|
|
+ Db::name('order_out_child')
|
|
|
+ ->where(['is_del' => 0, 'id' => $tmp['id']])
|
|
|
+ ->update($tmp);
|
|
|
+
|
|
|
+ //维护发货单
|
|
|
+ $temp = Db::name('order_out')
|
|
|
+ ->field('id,send_num')
|
|
|
+ ->where(['is_del' => 0, 'outCode' => $info['outCode']])
|
|
|
+ ->findOrEmpty();
|
|
|
+
|
|
|
+ $temp['send_num'] -= $info['return_num'];
|
|
|
+ $temp['updatetime'] = $date;
|
|
|
+ if ($temp['send_num'] <= 0) $temp['is_del'] = 1;
|
|
|
+
|
|
|
+ Db::name('order_out')
|
|
|
+ ->where('id', $temp['id'])
|
|
|
+ ->update($temp);
|
|
|
|
|
|
//维护bn
|
|
|
if ($info['order_out_status'] == 1) {
|