|
@@ -102,7 +102,7 @@ class FyyOrderService extends Service
|
|
|
|
|
|
public function orderList($data){
|
|
|
$model = SaleOrdersProduct::where('del_time',0)
|
|
|
- ->select('id','order_no','out_order_no','out_order_no_time','customer_no','customer_name','table_header_mark','product_no','product_title','product_size','product_unit','order_quantity','technology_material','technology_name','wood_name','process_mark','table_body_mark','out_crt_man','out_checker_man','out_checker_time','production_quantity','box_num','finished_num')
|
|
|
+ ->select('id','order_no','out_order_no','out_order_no_time','customer_no','customer_name','table_header_mark','product_no','product_title','product_size','product_unit','order_quantity','technology_material','technology_name','wood_name','process_mark','table_body_mark','out_crt_man','out_checker_man','out_checker_time','production_quantity','box_num','finished_num','shipment_num')
|
|
|
->orderBy('id','desc');
|
|
|
|
|
|
if(! empty($data['order_no'])) $model->where('order_no', 'LIKE', '%'.$data['order_no'].'%');
|
|
@@ -249,14 +249,25 @@ class FyyOrderService extends Service
|
|
|
return [true,''];
|
|
|
}
|
|
|
|
|
|
- public function orderOutRule($data){
|
|
|
+ public function orderOutRule($data){//todo
|
|
|
if(empty($data['order_no'])) return [false,'包装单号不能为空!'];
|
|
|
|
|
|
- $box = Box::where('order_no',$data['order_no'])->where('del_time',0)->first();
|
|
|
- if(! $box) return [false,'包装单不存在或已经被删除!'];
|
|
|
- $box = $box->toArray();
|
|
|
- if($box['state'] == 1) return [false,'包装单正在出库队列中!'];
|
|
|
- if($box['state'] > 1) return [false, '包装单已出库!'];
|
|
|
+ $boxList = Box::whereIn('order_no',$data['order_no'])->get()->toArray();
|
|
|
+ if(empty($boxList)) return [false,'包装单不存在!'];
|
|
|
+
|
|
|
+ $box_detail_list = [];
|
|
|
+ foreach ($boxList as $value){
|
|
|
+ if($value['del_time'] > 0) return [false,'包装单:' . $value['order_no'] . '已删除'];
|
|
|
+ if($value['state'] == 1) return [false,'包装单:' . $value['order_no'] . '已操作出库!'];
|
|
|
+ if($value['state'] > 1) return [false,'包装单:' . $value['order_no'] . '已出库!'];
|
|
|
+
|
|
|
+ $box_detail = new BoxDetail(['channel' => $value['order_no']]);
|
|
|
+ $box_detail_list = $box_detail->where('del_time',0)
|
|
|
+ ->where('order_no',$data['order_no'])
|
|
|
+ ->select('order_no','out_order_no','top_id as sale_orders_product_id','ext_1 as customer_no','ext_2 as customer_name','ext_3 as product_no','num')
|
|
|
+ ->get()->toArray();
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
$box_detail = new BoxDetail(['channel'=>$box['order_no']]);
|
|
|
$box_detail_list = $box_detail->where('order_no',$data['order_no'])
|
|
@@ -276,4 +287,48 @@ class FyyOrderService extends Service
|
|
|
|
|
|
return [true, $box_detail_list];
|
|
|
}
|
|
|
+
|
|
|
+ public function orderMobileList($data){
|
|
|
+ $list = SaleOrdersProduct::where('del_time',0)
|
|
|
+ ->select('out_order_no')
|
|
|
+ ->where('box_num', '>', 0)
|
|
|
+ ->whereColumn('order_quantity', '>', 'shipment_num')
|
|
|
+ ->groupBy('order_no')
|
|
|
+ ->orderBy('id','desc')
|
|
|
+ ->get()->toArray();
|
|
|
+ $order = array_column($list,'out_order_no');
|
|
|
+
|
|
|
+ return [true, $order];
|
|
|
+ }
|
|
|
+
|
|
|
+ public function getShipmentOrder($data){
|
|
|
+ if(empty($data['order_no'])) return ['false', '销售订单号不能为空!'];
|
|
|
+
|
|
|
+ $sqlServerModel = new FyySqlServerService();
|
|
|
+ if($sqlServerModel->error) return [false,$sqlServerModel->error];
|
|
|
+
|
|
|
+ $result = $sqlServerModel->getDataFromDispatchList($data['order_no']);
|
|
|
+ $return = [];
|
|
|
+ if(! empty($result)){
|
|
|
+ foreach ($result as $value){
|
|
|
+ $cfree1 = $value['cfree1'] ?? '';
|
|
|
+ $cfree2 = $value['cfree2'] ?? '';
|
|
|
+ $tmp_key = $value['cinvcode'] . $cfree1 . $cfree2;
|
|
|
+ $n = $value['iquantity'] - ($value['out_quantity'] ?? 0);
|
|
|
+ if(isset($return[$tmp_key])){
|
|
|
+ $return[$tmp_key]['num'] += $n;
|
|
|
+ }else{
|
|
|
+ $return[$tmp_key] = [
|
|
|
+ 'product_no' => $value['cinvcode'],
|
|
|
+ 'product_title' => $value['product_title'],
|
|
|
+ 'technology_name' => $cfree1,
|
|
|
+ 'wood_name' => $cfree2,
|
|
|
+ 'num' => $n,
|
|
|
+ ];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return [true,['show'=>array_values($return),'post'=>$result]];
|
|
|
+ }
|
|
|
}
|