|
@@ -11,7 +11,7 @@ use Illuminate\Http\Request;
|
|
|
use Illuminate\Support\Facades\Redis;
|
|
|
use Illuminate\Support\Str;
|
|
|
use Obs\ObsClient;
|
|
|
-
|
|
|
+use Carbon\Carbon;
|
|
|
class DwyController extends BaseController
|
|
|
{
|
|
|
|
|
@@ -921,10 +921,75 @@ class DwyController extends BaseController
|
|
|
});
|
|
|
// list($status,$msg) = DwyService::getInstance()->setLimitForBoxOut($param);
|
|
|
// if(! $status) return ['status' => '201', 'data' => [],'msg'=> $msg];
|
|
|
+ $this->unusualRestock($data,$mac,$token);
|
|
|
if(empty($data)) return ['status' => '201', 'data' => $data,'msg'=>'无商标需要申领'];
|
|
|
return ['status' => '200', 'data' => $data];
|
|
|
}
|
|
|
|
|
|
+ //单独的没有出标数据但是需要保存补领
|
|
|
+ public function unusualRestock($data,$mac,$token){
|
|
|
+ $send_status = true;
|
|
|
+ $send_data = [];
|
|
|
+ //2024-06-19T21:01:51.948Z,赖的写,直接拼
|
|
|
+ $iso8601Time = date('Y-m-d').'T'.date('H:i:s').'.'.rand(100,999).'Z';
|
|
|
+ foreach ($data as $v){
|
|
|
+ if($v['send_qty'] > 0) $send_status = false;
|
|
|
+ $send_product = [];
|
|
|
+ //创建异常数据
|
|
|
+ $box_data = [
|
|
|
+ 'in_out_type_code' => 'CK00004',
|
|
|
+ 'in_out_type_code_show' => '商标仓正常领标出库',
|
|
|
+ 'send_box_code' => $v['box_code'],
|
|
|
+ 'send_box_code_show' => $v['box_code_show'],
|
|
|
+ 'device_code' => $mac,
|
|
|
+ 'get_brand_source_dk' => 'SALE_ORDER',
|
|
|
+ 'abnormal_flag' => false,
|
|
|
+ 'abnormal_date' => $iso8601Time,
|
|
|
+ ];
|
|
|
+ foreach ($v['product_list'] as $kk=>$vv){
|
|
|
+ $send_product[] = [
|
|
|
+ 'item_no' => 10+$kk*10,
|
|
|
+ 'brand_qr_code_list' => '',
|
|
|
+ 'material_code' => $v['material_code'],
|
|
|
+ 'material_code_show' => $v['material_code_show'],
|
|
|
+ 'unit_code' => $v['unit_code'],
|
|
|
+ 'unit_code_show' => $v['unit_code_show'],
|
|
|
+ 'restock_qty' => $vv['restock_qty'],
|
|
|
+ 'qty' => 0,
|
|
|
+ 'fake_qty' => 0,
|
|
|
+ 'bus_type_dk' => 'SALE_ORDER',
|
|
|
+ 'bus_type_dk_show' => '销售订单',
|
|
|
+ 'bus_no' => $vv['order_item_id'],
|
|
|
+ 'bus_no_show' => $vv['order_item_id_show'],
|
|
|
+ 'product_code' => $vv['product_code'],
|
|
|
+ 'product_code_show' => $vv['product_code_show'],
|
|
|
+ 'process_title' => $vv['process_title'],
|
|
|
+ 'color' => $vv['color'],
|
|
|
+ 'process_title_two' => $vv['process_title_two'],
|
|
|
+ 'color_two' => $vv['color_two'],
|
|
|
+ ];
|
|
|
+ }
|
|
|
+ $box_data['brand_out_stock_dtl'] =$send_product;
|
|
|
+
|
|
|
+ $send_data[] = $box_data;
|
|
|
+ }
|
|
|
+ $param = [
|
|
|
+ 'brand_out_stock_list' => $send_data
|
|
|
+ ];
|
|
|
+ if($send_status){
|
|
|
+ $url = 'https://tm.dwycloud.com/jbl/api/module-data/brand_in_stock/brand_in_stock/diy/lead_bind_out_stock';
|
|
|
+ $header = [
|
|
|
+ 'Content-Type:application/json',
|
|
|
+ 'Authorization: ' . $token,
|
|
|
+ ];
|
|
|
+ $res = $this->post_helper($url, json_encode($param), $header);
|
|
|
+
|
|
|
+ file_put_contents('dwy1.txt', date('Y-m-d H:i:s').json_encode($header) . PHP_EOL, 8);
|
|
|
+ file_put_contents('dwy1.txt', date('Y-m-d H:i:s').json_encode($param) . PHP_EOL, 8);
|
|
|
+ file_put_contents('dwy1.txt', date('Y-m-d H:i:s').$res . PHP_EOL, 8);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
public function zjlb(Request $request)
|
|
|
{
|
|
|
|