|
@@ -169,11 +169,487 @@ class DwyController extends BaseController
|
|
|
|
|
|
}
|
|
|
|
|
|
+ public function test(){
|
|
|
+ $a = json_decode('{
|
|
|
+ "status": 200,
|
|
|
+ "data": [
|
|
|
+ {
|
|
|
+ "created_date_lt": "2024-06-08T08:30:15.000Z",
|
|
|
+ "created_date": "2024-06-08T08:30:15.086Z",
|
|
|
+ "last_modified_by_show": "余丽娴",
|
|
|
+ "device_code": "a6a672c3e458bed2",
|
|
|
+ "material_code": "40010127000001",
|
|
|
+ "last_modified_by": "553395510115962882",
|
|
|
+ "unit_code_show": "张",
|
|
|
+ "bus_type_dk": "SUPPLIER",
|
|
|
+ "created_by": "553395510115962882",
|
|
|
+ "unit_code": "ST",
|
|
|
+ "dynamic_form_value_id": "587196751249805312",
|
|
|
+ "supplier_code_show": "嘉善大王椰整体橱柜有限公司",
|
|
|
+ "device_code_show": "天凝工厂1号机",
|
|
|
+ "belong_org": "0102",
|
|
|
+ "bus_type_dk_show": "工厂",
|
|
|
+ "created_by_show": "余丽娴",
|
|
|
+ "id": "587196751312719872",
|
|
|
+ "supplier_code": "0102",
|
|
|
+ "main_table_id": null,
|
|
|
+ "last_modified_date_lt": "2024-06-08T08:30:15.000Z",
|
|
|
+ "material_code_show": "尊贵免漆板ENF小标",
|
|
|
+ "qty": 4040,
|
|
|
+ "specs": null,
|
|
|
+ "box_code": "CK00005",
|
|
|
+ "request_id": null,
|
|
|
+ "detail_table_id": null,
|
|
|
+ "last_modified_date": "2024-06-08T08:30:15.095Z",
|
|
|
+ "box_code_show": "商标二号仓",
|
|
|
+ "in_stock_qty": 5000,
|
|
|
+ "use_qty": 4040,
|
|
|
+ "product_list": [
|
|
|
+ {
|
|
|
+ "product_code": "BC450108000001",
|
|
|
+ "product_code_show": "大王椰1700尊贵型ENF机拼香杉木-智能生态免漆板W",
|
|
|
+ "order_item_id": "581029211289030656",
|
|
|
+ "order_item_id_show": "SO202405200171",
|
|
|
+ "process_title": "",
|
|
|
+ "color": "",
|
|
|
+ "process_title_two": "",
|
|
|
+ "color_two": "",
|
|
|
+ "send_qty": "120",
|
|
|
+ "fake_qty": "120",
|
|
|
+ "restock_qty": 0
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "product_code": "BC450108000001",
|
|
|
+ "product_code_show": "大王椰1700尊贵型ENF机拼香杉木-智能生态免漆板W",
|
|
|
+ "order_item_id": "581029211242893312",
|
|
|
+ "order_item_id_show": "SO202405200171",
|
|
|
+ "process_title": "",
|
|
|
+ "color": "",
|
|
|
+ "process_title_two": "",
|
|
|
+ "color_two": "",
|
|
|
+ "send_qty": "30",
|
|
|
+ "fake_qty": "30",
|
|
|
+ "restock_qty": 0
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "product_code": "BC450108000001",
|
|
|
+ "product_code_show": "大王椰1700尊贵型ENF机拼香杉木-智能生态免漆板W",
|
|
|
+ "order_item_id": "581029211221921792",
|
|
|
+ "order_item_id_show": "SO202405200171",
|
|
|
+ "process_title": "",
|
|
|
+ "color": "",
|
|
|
+ "process_title_two": "",
|
|
|
+ "color_two": "",
|
|
|
+ "send_qty": "160",
|
|
|
+ "fake_qty": "160",
|
|
|
+ "restock_qty": 0
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ "send_qty": 310,
|
|
|
+ "restore_qty": 0
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "created_date_lt": "2024-06-06T10:34:14.000Z",
|
|
|
+ "created_date": "2024-06-06T10:34:14.502Z",
|
|
|
+ "last_modified_by_show": "余丽娴",
|
|
|
+ "device_code": "a6a672c3e458bed2",
|
|
|
+ "material_code": "40010232000001",
|
|
|
+ "last_modified_by": "553395510115962882",
|
|
|
+ "unit_code_show": "张",
|
|
|
+ "bus_type_dk": "SUPPLIER",
|
|
|
+ "created_by": "553395510115962882",
|
|
|
+ "unit_code": "ST",
|
|
|
+ "dynamic_form_value_id": "586503178690891776",
|
|
|
+ "supplier_code_show": "嘉善大王椰整体橱柜有限公司",
|
|
|
+ "device_code_show": "天凝工厂1号机",
|
|
|
+ "belong_org": "0102",
|
|
|
+ "bus_type_dk_show": "工厂",
|
|
|
+ "created_by_show": "余丽娴",
|
|
|
+ "id": "586503178758000640",
|
|
|
+ "supplier_code": "0102",
|
|
|
+ "main_table_id": null,
|
|
|
+ "last_modified_date_lt": "2024-06-06T10:34:14.000Z",
|
|
|
+ "material_code_show": "优选A6森芯板E0小标",
|
|
|
+ "qty": 4519,
|
|
|
+ "specs": null,
|
|
|
+ "box_code": "CK00007",
|
|
|
+ "request_id": null,
|
|
|
+ "detail_table_id": null,
|
|
|
+ "last_modified_date": "2024-06-06T10:34:14.512Z",
|
|
|
+ "box_code_show": "商标四号仓",
|
|
|
+ "in_stock_qty": 4652,
|
|
|
+ "use_qty": 4519,
|
|
|
+ "product_list": [],
|
|
|
+ "send_qty": 0
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "created_date_lt": "2024-06-08T05:59:10.000Z",
|
|
|
+ "created_date": "2024-06-08T05:59:10.127Z",
|
|
|
+ "last_modified_by_show": "余丽娴",
|
|
|
+ "device_code": "a6a672c3e458bed2",
|
|
|
+ "material_code": "40010504000001",
|
|
|
+ "last_modified_by": "553395510115962882",
|
|
|
+ "unit_code_show": "张",
|
|
|
+ "bus_type_dk": "SUPPLIER",
|
|
|
+ "created_by": "553395510115962882",
|
|
|
+ "unit_code": "ST",
|
|
|
+ "dynamic_form_value_id": "587158730056011776",
|
|
|
+ "supplier_code_show": "嘉善大王椰整体橱柜有限公司",
|
|
|
+ "device_code_show": "天凝工厂1号机",
|
|
|
+ "belong_org": "0102",
|
|
|
+ "bus_type_dk_show": "工厂",
|
|
|
+ "created_by_show": "余丽娴",
|
|
|
+ "id": "587158730123120640",
|
|
|
+ "supplier_code": "0102",
|
|
|
+ "main_table_id": null,
|
|
|
+ "last_modified_date_lt": "2024-06-08T05:59:10.000Z",
|
|
|
+ "material_code_show": "ENF圆标",
|
|
|
+ "qty": 2909,
|
|
|
+ "specs": null,
|
|
|
+ "box_code": "CK00010",
|
|
|
+ "request_id": null,
|
|
|
+ "detail_table_id": null,
|
|
|
+ "last_modified_date": "2024-06-08T05:59:10.136Z",
|
|
|
+ "box_code_show": "商标七号仓",
|
|
|
+ "in_stock_qty": 5000,
|
|
|
+ "use_qty": 2909,
|
|
|
+ "safe_stock_qty": 400,
|
|
|
+ "min_stock_qty": 100,
|
|
|
+ "product_list": [
|
|
|
+ {
|
|
|
+ "product_code": "BC450108000001",
|
|
|
+ "product_code_show": "大王椰1700尊贵型ENF机拼香杉木-智能生态免漆板W",
|
|
|
+ "order_item_id": "581029211289030656",
|
|
|
+ "order_item_id_show": "SO202405200171",
|
|
|
+ "process_title": "",
|
|
|
+ "color": "",
|
|
|
+ "process_title_two": "",
|
|
|
+ "color_two": "",
|
|
|
+ "send_qty": "120",
|
|
|
+ "fake_qty": "120",
|
|
|
+ "restock_qty": 0
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "product_code": "BC450108000001",
|
|
|
+ "product_code_show": "大王椰1700尊贵型ENF机拼香杉木-智能生态免漆板W",
|
|
|
+ "order_item_id": "581029211242893312",
|
|
|
+ "order_item_id_show": "SO202405200171",
|
|
|
+ "process_title": "",
|
|
|
+ "color": "",
|
|
|
+ "process_title_two": "",
|
|
|
+ "color_two": "",
|
|
|
+ "send_qty": "30",
|
|
|
+ "fake_qty": "30",
|
|
|
+ "restock_qty": 0
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "product_code": "BC450108000001",
|
|
|
+ "product_code_show": "大王椰1700尊贵型ENF机拼香杉木-智能生态免漆板W",
|
|
|
+ "order_item_id": "581029211221921792",
|
|
|
+ "order_item_id_show": "SO202405200171",
|
|
|
+ "process_title": "",
|
|
|
+ "color": "",
|
|
|
+ "process_title_two": "",
|
|
|
+ "color_two": "",
|
|
|
+ "send_qty": "160",
|
|
|
+ "fake_qty": "160",
|
|
|
+ "restock_qty": 0
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ "send_qty": 310,
|
|
|
+ "restore_qty": 0
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "created_date_lt": "2024-06-06T07:05:12.000Z",
|
|
|
+ "created_date": "2024-06-06T07:05:12.783Z",
|
|
|
+ "last_modified_by_show": "余丽娴",
|
|
|
+ "device_code": "a6a672c3e458bed2",
|
|
|
+ "material_code": "40010102000001",
|
|
|
+ "last_modified_by": "553395510115962882",
|
|
|
+ "unit_code_show": "张",
|
|
|
+ "bus_type_dk": "SUPPLIER",
|
|
|
+ "created_by": "553395510115962882",
|
|
|
+ "unit_code": "ST",
|
|
|
+ "dynamic_form_value_id": "586450574908723200",
|
|
|
+ "supplier_code_show": "嘉善大王椰整体橱柜有限公司",
|
|
|
+ "device_code_show": "天凝工厂1号机",
|
|
|
+ "belong_org": "0102",
|
|
|
+ "bus_type_dk_show": "工厂",
|
|
|
+ "created_by_show": "余丽娴",
|
|
|
+ "id": "586450574980026368",
|
|
|
+ "supplier_code": "0102",
|
|
|
+ "main_table_id": null,
|
|
|
+ "last_modified_date_lt": "2024-06-06T07:05:12.000Z",
|
|
|
+ "material_code_show": "尊贵免漆背板E0小标",
|
|
|
+ "qty": 5001,
|
|
|
+ "specs": null,
|
|
|
+ "box_code": "CK00011",
|
|
|
+ "request_id": null,
|
|
|
+ "detail_table_id": null,
|
|
|
+ "last_modified_date": "2024-06-06T07:05:12.793Z",
|
|
|
+ "box_code_show": "商标八号仓",
|
|
|
+ "in_stock_qty": 5001,
|
|
|
+ "use_qty": 5001,
|
|
|
+ "product_list": [],
|
|
|
+ "send_qty": 0
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "created_date_lt": "2024-06-06T07:37:23.000Z",
|
|
|
+ "created_date": "2024-06-06T07:37:23.194Z",
|
|
|
+ "last_modified_by_show": "余丽娴",
|
|
|
+ "device_code": "a6a672c3e458bed2",
|
|
|
+ "material_code": "40010134000001",
|
|
|
+ "last_modified_by": "553395510115962882",
|
|
|
+ "unit_code_show": "张",
|
|
|
+ "bus_type_dk": "SUPPLIER",
|
|
|
+ "created_by": "553395510115962882",
|
|
|
+ "unit_code": "ST",
|
|
|
+ "dynamic_form_value_id": "586458671639302144",
|
|
|
+ "supplier_code_show": "嘉善大王椰整体橱柜有限公司",
|
|
|
+ "device_code_show": "天凝工厂1号机",
|
|
|
+ "belong_org": "0102",
|
|
|
+ "bus_type_dk_show": "工厂",
|
|
|
+ "created_by_show": "余丽娴",
|
|
|
+ "id": "586458671702216704",
|
|
|
+ "supplier_code": "0102",
|
|
|
+ "main_table_id": null,
|
|
|
+ "last_modified_date_lt": "2024-06-06T07:37:23.000Z",
|
|
|
+ "material_code_show": "优选免漆板ENF小标",
|
|
|
+ "qty": 3345,
|
|
|
+ "specs": null,
|
|
|
+ "box_code": "CK00014",
|
|
|
+ "request_id": null,
|
|
|
+ "detail_table_id": null,
|
|
|
+ "last_modified_date": "2024-06-06T07:37:23.203Z",
|
|
|
+ "box_code_show": "商标十一号仓",
|
|
|
+ "in_stock_qty": 3345,
|
|
|
+ "use_qty": 3345,
|
|
|
+ "safe_stock_qty": 400,
|
|
|
+ "min_stock_qty": 300,
|
|
|
+ "product_list": [],
|
|
|
+ "send_qty": 0
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "created_date_lt": "2024-06-07T08:37:02.000Z",
|
|
|
+ "created_date": "2024-06-07T08:37:02.353Z",
|
|
|
+ "last_modified_by_show": "余丽娴",
|
|
|
+ "device_code": "a6a672c3e458bed2",
|
|
|
+ "material_code": "40010101000999",
|
|
|
+ "last_modified_by": "553395510115962882",
|
|
|
+ "unit_code_show": "张",
|
|
|
+ "bus_type_dk": "SUPPLIER",
|
|
|
+ "created_by": "553395510115962882",
|
|
|
+ "unit_code": "ST",
|
|
|
+ "dynamic_form_value_id": "586836071590006784",
|
|
|
+ "supplier_code_show": "嘉善大王椰整体橱柜有限公司",
|
|
|
+ "device_code_show": "天凝工厂1号机",
|
|
|
+ "belong_org": "0102",
|
|
|
+ "bus_type_dk_show": "工厂",
|
|
|
+ "created_by_show": "余丽娴",
|
|
|
+ "id": "586836071657115648",
|
|
|
+ "supplier_code": "0102",
|
|
|
+ "main_table_id": null,
|
|
|
+ "last_modified_date_lt": "2024-06-07T08:37:02.000Z",
|
|
|
+ "material_code_show": "E0批零免漆(测试白标)",
|
|
|
+ "qty": 1234,
|
|
|
+ "specs": null,
|
|
|
+ "box_code": "CK00015",
|
|
|
+ "request_id": null,
|
|
|
+ "detail_table_id": null,
|
|
|
+ "last_modified_date": "2024-06-07T08:37:02.364Z",
|
|
|
+ "box_code_show": "商标十二号仓",
|
|
|
+ "in_stock_qty": 1518,
|
|
|
+ "use_qty": 1234,
|
|
|
+ "product_list": [],
|
|
|
+ "send_qty": 0
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "created_date_lt": "2024-06-08T02:08:40.000Z",
|
|
|
+ "created_date": "2024-06-08T02:08:40.233Z",
|
|
|
+ "last_modified_by_show": "余丽娴",
|
|
|
+ "device_code": "a6a672c3e458bed2",
|
|
|
+ "material_code": "40010504000001",
|
|
|
+ "last_modified_by": "553395510115962882",
|
|
|
+ "unit_code_show": "张",
|
|
|
+ "bus_type_dk": "SUPPLIER",
|
|
|
+ "created_by": "553395510115962882",
|
|
|
+ "unit_code": "ST",
|
|
|
+ "dynamic_form_value_id": "587100723276288000",
|
|
|
+ "supplier_code_show": "嘉善大王椰整体橱柜有限公司",
|
|
|
+ "device_code_show": "天凝工厂1号机",
|
|
|
+ "belong_org": "0102",
|
|
|
+ "bus_type_dk_show": "工厂",
|
|
|
+ "created_by_show": "余丽娴",
|
|
|
+ "id": "587100723347591168",
|
|
|
+ "supplier_code": "0102",
|
|
|
+ "main_table_id": null,
|
|
|
+ "last_modified_date_lt": "2024-06-08T02:08:40.000Z",
|
|
|
+ "material_code_show": "ENF圆标",
|
|
|
+ "qty": 4467,
|
|
|
+ "specs": null,
|
|
|
+ "box_code": "CK00016",
|
|
|
+ "request_id": null,
|
|
|
+ "detail_table_id": null,
|
|
|
+ "last_modified_date": "2024-06-08T02:08:40.243Z",
|
|
|
+ "box_code_show": "商标十三号仓",
|
|
|
+ "in_stock_qty": 5000,
|
|
|
+ "use_qty": 4467,
|
|
|
+ "safe_stock_qty": 400,
|
|
|
+ "min_stock_qty": 100,
|
|
|
+ "product_list": [],
|
|
|
+ "send_qty": 0
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "created_date_lt": "2024-06-07T08:12:36.000Z",
|
|
|
+ "created_date": "2024-06-07T08:12:36.275Z",
|
|
|
+ "last_modified_by_show": "余丽娴",
|
|
|
+ "device_code": "a6a672c3e458bed2",
|
|
|
+ "material_code": "40010501000999",
|
|
|
+ "last_modified_by": "553395510115962882",
|
|
|
+ "unit_code_show": "张",
|
|
|
+ "bus_type_dk": "SUPPLIER",
|
|
|
+ "created_by": "553395510115962882",
|
|
|
+ "unit_code": "ST",
|
|
|
+ "dynamic_form_value_id": "586829922408992768",
|
|
|
+ "supplier_code_show": "嘉善大王椰整体橱柜有限公司",
|
|
|
+ "device_code_show": "天凝工厂1号机",
|
|
|
+ "belong_org": "0102",
|
|
|
+ "bus_type_dk_show": "工厂",
|
|
|
+ "created_by_show": "余丽娴",
|
|
|
+ "id": "586829922471907328",
|
|
|
+ "supplier_code": "0102",
|
|
|
+ "main_table_id": null,
|
|
|
+ "last_modified_date_lt": "2024-06-07T08:12:36.000Z",
|
|
|
+ "material_code_show": "银盾抗菌圆标(测试白标)",
|
|
|
+ "qty": 1236,
|
|
|
+ "specs": null,
|
|
|
+ "box_code": "CK00017",
|
|
|
+ "request_id": null,
|
|
|
+ "detail_table_id": null,
|
|
|
+ "last_modified_date": "2024-06-07T08:12:36.284Z",
|
|
|
+ "box_code_show": "商标十四号仓",
|
|
|
+ "in_stock_qty": 1510,
|
|
|
+ "use_qty": 1236,
|
|
|
+ "product_list": [],
|
|
|
+ "send_qty": 0
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "created_date_lt": "2024-06-06T07:35:54.000Z",
|
|
|
+ "created_date": "2024-06-06T07:35:54.496Z",
|
|
|
+ "last_modified_by_show": "余丽娴",
|
|
|
+ "device_code": "a6a672c3e458bed2",
|
|
|
+ "material_code": "40010504000001",
|
|
|
+ "last_modified_by": "553395510115962882",
|
|
|
+ "unit_code_show": "张",
|
|
|
+ "bus_type_dk": "SUPPLIER",
|
|
|
+ "created_by": "553395510115962882",
|
|
|
+ "unit_code": "ST",
|
|
|
+ "dynamic_form_value_id": "586458299612925952",
|
|
|
+ "supplier_code_show": "嘉善大王椰整体橱柜有限公司",
|
|
|
+ "device_code_show": "天凝工厂1号机",
|
|
|
+ "belong_org": "0102",
|
|
|
+ "bus_type_dk_show": "工厂",
|
|
|
+ "created_by_show": "余丽娴",
|
|
|
+ "id": "586458299675840512",
|
|
|
+ "supplier_code": "0102",
|
|
|
+ "main_table_id": null,
|
|
|
+ "last_modified_date_lt": "2024-06-06T07:35:54.000Z",
|
|
|
+ "material_code_show": "ENF圆标",
|
|
|
+ "qty": 32,
|
|
|
+ "specs": null,
|
|
|
+ "box_code": "CK00018",
|
|
|
+ "request_id": null,
|
|
|
+ "detail_table_id": null,
|
|
|
+ "last_modified_date": "2024-06-06T07:35:54.505Z",
|
|
|
+ "box_code_show": "商标十五号仓",
|
|
|
+ "in_stock_qty": 1540,
|
|
|
+ "use_qty": 32,
|
|
|
+ "safe_stock_qty": 400,
|
|
|
+ "min_stock_qty": 100,
|
|
|
+ "product_list": [],
|
|
|
+ "send_qty": 0
|
|
|
+ }
|
|
|
+ ]
|
|
|
+}',true);
|
|
|
+
|
|
|
+ foreach ($a['data'] as $k=>$v){
|
|
|
+ if($v['box_code'] == 'CK00005') {
|
|
|
+
|
|
|
+ foreach ($v['product_list'] as $kk=>$vv){
|
|
|
+ if($kk > 0 ){
|
|
|
+ unset($v['product_list'][$kk]);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ $v['product_list'][$kk]['send_qty'] = 300;
|
|
|
+ $v['product_list'][$kk]['fake_qty'] = 300;
|
|
|
+
|
|
|
+ }
|
|
|
+// $a['data'][$k]['box_code'] = 'CK00006';
|
|
|
+// $a['data'][$k]['box_code_show'] = '商标三号仓';
|
|
|
+
|
|
|
+ $aa = $v;
|
|
|
+// $aa['box_code'] = 'CK00019';
|
|
|
+// $aa['box_code_show'] = '商标十六号';
|
|
|
+ $aa['send_qty'] = 300;
|
|
|
+//
|
|
|
+// $bb = $v;
|
|
|
+// $bb['box_code'] = 'CK00013';
|
|
|
+// $bb['box_code_show'] = '商标十号';
|
|
|
+// $bb['send_qty'] = '15';
|
|
|
+//
|
|
|
+// $cc = $v;
|
|
|
+// $cc['box_code'] = 'CK00014';
|
|
|
+// $cc['box_code_show'] = '商标十一号';
|
|
|
+// $cc['send_qty'] = '15';
|
|
|
+//
|
|
|
+// $dd = $v;
|
|
|
+// $dd['box_code'] = 'CK00015';
|
|
|
+// $dd['box_code_show'] = '商标十二号';
|
|
|
+// $dd['send_qty'] = '15';
|
|
|
+//
|
|
|
+// $gg = $v;
|
|
|
+// $gg['box_code'] = 'CK00018';
|
|
|
+// $gg['box_code_show'] = '商标十五号';
|
|
|
+// $gg['send_qty'] = '15';
|
|
|
+ }
|
|
|
+ if($v['box_code'] == 'CK00004'||$v['box_code'] == 'CK00005'||$v['box_code'] == 'CK00006'||$v['box_code'] == 'CK00007'||$v['box_code'] == 'CK00008'||$v['box_code'] == 'CK00009'||$v['box_code'] == 'CK00010'||$v['box_code'] == 'CK00011'||$v['box_code'] == 'CK00012'||$v['box_code'] == 'CK00013'||$v['box_code'] == 'CK00014'||$v['box_code'] == 'CK00015'||$v['box_code'] == 'CK00016'||$v['box_code'] == 'CK00017'||$v['box_code'] == 'CK00018'||$v['box_code'] == 'CK00019') {
|
|
|
+ unset($a['data'][$k]);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ $box_list = [
|
|
|
+ 14,15,2,3,9,12
|
|
|
+ ];
|
|
|
+ foreach ($box_list as $v){
|
|
|
+ $v = $v+3;
|
|
|
+ if($v<10) $n = '0'.$v;
|
|
|
+ else $n = $v;
|
|
|
+ $aa['box_code'] = 'CK000'.$n;
|
|
|
+ $aa['box_code_show'] = '商标'.($n-3).'号';
|
|
|
+ $a['data'][] = $aa;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+// $a['data'][] = $bb;
|
|
|
+// $a['data'][] = $cc;
|
|
|
+// $a['data'][] = $dd;
|
|
|
+// $a['data'][] = $gg;
|
|
|
+ usort( $a['data'], function ($jj,$kk){
|
|
|
+ return str_replace('CK','',$jj['box_code']) - str_replace('CK','',$kk['box_code']);
|
|
|
+ });
|
|
|
+ return $a;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
public function setLb(Request $request)
|
|
|
{
|
|
|
|
|
|
+
|
|
|
+
|
|
|
$param = $request->all();
|
|
|
+
|
|
|
file_put_contents('dwy.txt', json_encode($param) . PHP_EOL, 8);
|
|
|
// $param = [
|
|
|
// 'token'=>'Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiIyNzM2OTUyNTA3NTI5NTQzNzMiLCJhdXRoIjoiUk9MRV9JTk5FUl9VU0VSLFJPTEVfQlJBTkRfQVJSRVNULFJPTEVfQURNSU4iLCJ0b2tlbklkIjoiOTUwIiwiZXhwIjoxNzA3OTcxMTcxfQ.2VQ9Wqmk4rvKAcTsQPw59llBbeXjalKDGIZA4kesnuOJ0POmPVOVlRLbTtUDxl0XiFdPDUrKzuEFl2DXSgQdJg',
|
|
@@ -190,6 +666,12 @@ class DwyController extends BaseController
|
|
|
$token = $param['token'];
|
|
|
$list = $param['list'];
|
|
|
$mac = $param['mac'];
|
|
|
+// if($mac === 'cff4dc68c73115b'){
|
|
|
+//
|
|
|
+// return $this->test();
|
|
|
+// }
|
|
|
+
|
|
|
+
|
|
|
$url = 'https://tm.dwycloud.com/jbl/api/module-data/brand_in_stock/brand_in_stock/diy/box_inventory';
|
|
|
$header = [
|
|
|
'Content-Type:application/json',
|
|
@@ -201,6 +683,32 @@ class DwyController extends BaseController
|
|
|
usort($data, function ($a,$b){
|
|
|
return str_replace('CK','',$a['box_code']) - str_replace('CK','',$b['box_code']);
|
|
|
});
|
|
|
+
|
|
|
+ //做一个单独的校验,如果数量不够则返回失败
|
|
|
+ $out_key_list = [];
|
|
|
+ foreach ($list as $l){
|
|
|
+ if(!isset($out_key_list[$l['title']])) $out_key_list[$l['title']] = 0;
|
|
|
+ $out_key_list[$l['title']] += $l['num'];
|
|
|
+ }
|
|
|
+
|
|
|
+ $box_key_list = [];
|
|
|
+ foreach ($data as $d){
|
|
|
+ if (!isset($d['box_code_show']) || $d['box_code_show'] == '设备仓') {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if(!isset($box_key_list[$d['material_code_show']])) $box_key_list[$d['material_code_show']] = 0;
|
|
|
+ $box_key_list[$d['material_code_show']] += $d['qty'];
|
|
|
+ }
|
|
|
+ foreach ($out_key_list as $k=>$v){
|
|
|
+ if(!isset($box_key_list[$k])){
|
|
|
+ return ['status' => '201', 'data' => [],'msg'=>$k.'没有库存信息!'];
|
|
|
+ }
|
|
|
+ if($box_key_list[$k] < $v) {
|
|
|
+ return ['status' => '201','data'=>[], 'msg' => $k.'库存数量不足信息!'];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //end
|
|
|
+
|
|
|
foreach ($data as $k => &$v) {
|
|
|
|
|
|
if (!isset($v['product_list'])) $v['product_list'] = [];
|
|
@@ -208,14 +716,6 @@ class DwyController extends BaseController
|
|
|
unset($data[$k]);
|
|
|
continue;
|
|
|
}
|
|
|
-// $v['use_qty'] = $v['qty'];
|
|
|
-// if($v['box_code'] === 'CK00008'){
|
|
|
-// $v['use_qty'] = 150;
|
|
|
-// $v['qty'] = 150;
|
|
|
-//// $v['qty'] = 200;
|
|
|
-// $v['in_stock_qty'] = 0;
|
|
|
-// }
|
|
|
-
|
|
|
if ($v['qty'] <= 0) {
|
|
|
unset($data[$k]);
|
|
|
continue;
|
|
@@ -224,7 +724,6 @@ class DwyController extends BaseController
|
|
|
if (!isset($v['send_qty'])) $v['send_qty'] = 0;
|
|
|
foreach ($list as $kk => $vv) {
|
|
|
|
|
|
-
|
|
|
if ($vv['num'] == 0) continue;
|
|
|
if ($v['material_code_show'] === $vv['title']) {
|
|
|
$v['restore_qty'] = isset($vv['restock_qty']) && $vv['restock_qty'] > 0 ? $vv['restock_qty'] : 0;
|
|
@@ -234,11 +733,13 @@ class DwyController extends BaseController
|
|
|
$p_total = $vv['num'];
|
|
|
} else {
|
|
|
$list[$kk]['num'] -= ($v['qty'] - $v['send_qty']);
|
|
|
- $p_total = $vv['num'] - ($v['qty'] - $v['send_qty']);
|
|
|
+ $p_total = ($v['qty'] - $v['send_qty']);
|
|
|
$v['send_qty'] += ($v['qty'] - $v['send_qty']);
|
|
|
}
|
|
|
|
|
|
|
|
|
+
|
|
|
+
|
|
|
//把产品相关参数进行封装
|
|
|
////产品编号
|
|
|
//"product_code": "",
|
|
@@ -252,23 +753,28 @@ class DwyController extends BaseController
|
|
|
//"process_title_two": "",
|
|
|
////花色2
|
|
|
//"color_two": "",
|
|
|
+ if($p_total == 0) continue;
|
|
|
$key_arr = [
|
|
|
'product_code' => $vv['product_code'] ?? '',
|
|
|
'product_code_show' => $vv['product_code_show'] ?? '',
|
|
|
'order_item_id' => $vv['order_item_id'] ?? '',
|
|
|
'order_item_id_show' => $vv['order_item_id_show'] ?? '',
|
|
|
- 'process_title' => $vv['process_title'] ?? '',
|
|
|
- 'color' => $vv['color'] ?? '',
|
|
|
- 'process_title_two' => $vv['process_title_two'] ?? '',
|
|
|
- 'color_two' => $vv['color_two'] ?? '',
|
|
|
+ 'process_title' => $vv['craft_type_code_show'] ?? '',
|
|
|
+ 'color' => $vv['decor_code_show'] ?? '',
|
|
|
+ 'process_title_two' => $vv['craft_type_two_code_show'] ?? '',
|
|
|
+ 'color_two' => $vv['decor_two_code_show'] ?? '',
|
|
|
'send_qty' => $p_total,
|
|
|
'fake_qty' => $p_total,
|
|
|
// 'send_qty' => 0,
|
|
|
'restock_qty' => $vv['restock_qty'] ?? 0,
|
|
|
];
|
|
|
+ if($vv['restock_qty'] > 0) $list[$kk]['restock_qty'] = 0;
|
|
|
$v['product_list'][] = $key_arr;
|
|
|
}
|
|
|
|
|
|
+// var_dump($key_arr);
|
|
|
+// var_dump($key_arr);
|
|
|
+
|
|
|
|
|
|
|
|
|
}
|
|
@@ -277,7 +783,7 @@ class DwyController extends BaseController
|
|
|
usort($data, function ($a,$b){
|
|
|
return str_replace('CK','',$a['box_code']) - str_replace('CK','',$b['box_code']);
|
|
|
});
|
|
|
- return ['status' => 200, 'data' => $data];
|
|
|
+ return ['status' => '200', 'data' => $data];
|
|
|
}
|
|
|
|
|
|
public function zjlb(Request $request)
|