Commit 5e8e8eee by 朱继来

审单添加校验

parent 2ffe417c
...@@ -902,7 +902,7 @@ Class OrderController extends Controller ...@@ -902,7 +902,7 @@ Class OrderController extends Controller
// $resData['is_manager'] = $auditor_role == 3 ? 0 : 1; // 角色为‘查看自己’时,is_manager = 0 // $resData['is_manager'] = $auditor_role == 3 ? 0 : 1; // 角色为‘查看自己’时,is_manager = 0
// } // }
// 若采购员选择‘平台’,校验自营库存 // 若采购员选择‘平台’,校验自营库存、倍数
$order_goods_type = $request->input('order_goods_type', 1); $order_goods_type = $request->input('order_goods_type', 1);
if ($order_goods_type == 1) { if ($order_goods_type == 1) {
...@@ -910,7 +910,31 @@ Class OrderController extends Controller ...@@ -910,7 +910,31 @@ Class OrderController extends Controller
foreach ($resData['change_info'] as $v) { foreach ($resData['change_info'] as $v) {
if ($v['buyer_id'] == $pingtai_id) { if ($v['buyer_id'] == $pingtai_id) {
$client = new \Hprose\Http\Client(Config('website.footstone_url').'/service', false);
$data = array(
'goods_name' => $v['goods_name'],
'num' => $v['goods_number'],
'brand_name' => $v['brand_name'],
);
$res = $client->SelfGoodsInfo(json_encode($data));
if (!$res) return ['errcode'=>-1, 'errmsg'=>'请求基石库存接口失败'];
$res = json_decode($res, true);
if ($res['errcode'] != 0) return ['errcode'=>-1, 'errmsg'=>'请求基石库存接口,'.$v['goods_name'].'型号'.$res['errmsg']];
$goods_info = $res['data']['goods_info'];
// 判断库存
if (!$goods_info['stock'] || $goods_info['stock'] < $v['goods_number']) {
return ['errcode'=>-1, 'errmsg'=>'请求基石库存接口,'.$v['goods_name'].'型号库存不足,当前库存为'.$goods_info['stock']];
}
// 判断倍数
if ($v['goods_number'] % $goods_info['mpl'] != 0) {
return ['errcode'=>-1, 'errmsg'=>'请求基石库存接口,'.$v['goods_name'].'型号倍数不满足下单条件,当前倍数为'.$goods_info['mpl']];
}
} }
} }
} }
......
...@@ -102,4 +102,6 @@ return [ ...@@ -102,4 +102,6 @@ return [
'pur_url' => 'http://pur.ichunt.net', 'pur_url' => 'http://pur.ichunt.net',
'footstone_url' => 'http://footstone.liexin.net',
]; ];
...@@ -602,7 +602,7 @@ ...@@ -602,7 +602,7 @@
} }
}) })
layer.msg('审核提交中...', {icon: 16, time: 0, shade: 0.3}); // 阻止重复提交 // layer.msg('审核提交中...', {icon: 16, time: 0, shade: 0.3}); // 阻止重复提交
}, },
btn2: function(index, layero){ btn2: function(index, layero){
layer.close(index); layer.close(index);
......
...@@ -212,7 +212,7 @@ ...@@ -212,7 +212,7 @@
@if ($order_info['order_goods_type'] == 1) @if ($order_info['order_goods_type'] == 1)
<td> <td>
<select class="form-control change_buyer_id selectpicker" name="change_info[{{ $v['rec_id'] }}][buyer_id]" data-live-search="true" data-size="5" title="请选择采购员"> <select id="buyer_id_{{$v['rec_id']}}" class="form-control change_buyer_id selectpicker" name="change_info[{{ $v['rec_id'] }}][buyer_id]" data-live-search="true" data-size="5" title="请选择采购员">
<option value="">请选择采购员</option> <option value="">请选择采购员</option>
@if (!empty($buyers)) @if (!empty($buyers))
@foreach ($buyers as $val) @foreach ($buyers as $val)
...@@ -221,8 +221,13 @@ ...@@ -221,8 +221,13 @@
@endif @endif
</select> </select>
</td> </td>
<script>
var rec_id = "{{ $v['rec_id'] }}";
var buyer_id = "{{ $v['buyer_id'] }}";
$('#buyer_id_'+rec_id).selectpicker('val', buyer_id);
</script>
<td> <td>
<input type="text" class="form-control change_batch" name="change_info[{{ $v['rec_id'] }}][batch]" value=""> <input type="text" class="form-control change_batch" name="change_info[{{ $v['rec_id'] }}][batch]" value="{{ $v['batch'] }}">
</td> </td>
@endif @endif
......
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 sign in to comment