Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
黄成意
/
yunxin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
d089553c
authored
Feb 19, 2019
by
PRY5YKGJ82EZEPX\Administrator
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
v1.0
parent
2b976bbb
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
395 deletions
app/Http/Controllers/HandleController.php
app/Http/function.php
app/Http/routes.php
app/Http/Controllers/HandleController.php
View file @
d089553c
...
...
@@ -41,394 +41,15 @@ class HandleController extends Controller
exit
();
}
private
function
CsWebApi
(){
$url
=
'http://cube.liexin.com/WebApi/ActivityInfo'
;
$data
=
[
'time'
=>
time
(),
'sign'
=>
'listty'
private
function
a
(){
//测试sku列表
$info
=
[
'goods_id'
=>
11076
,
'cost'
=>
'ADI'
];
$key
=
Config
(
'perm.MD5KEY'
);
$data
[
'AuthSign'
]
=
MD5
(
MD5
(
http_build_query
(
$data
))
.
$key
);
$result
=
curl
(
$url
,
$data
,
true
);
dump
(
json_decode
(
$result
,
true
));
dump
(
json_decode
(
$result
,
true
));
}
private
function
Excel_cn
(){
$array
=
[
'aa'
,
'bb'
,
'cc'
,
'dd'
];
$Items
=
array
(
[
'goods_name'
=>
'STM32F103CBU6'
,
'brand_name'
=>
'TI'
,
'picking_number'
=>
1000
,
'batch_number'
=>
16
,
'delivery_time'
=>
'2-5周'
,
'picking_price'
=>
5.6
],
[
'goods_name'
=>
'STM32F103CBU6'
,
'brand_name'
=>
'TI'
,
'picking_number'
=>
1000
,
'batch_number'
=>
16
,
'delivery_time'
=>
'2-5周'
,
'picking_price'
=>
5.6
],
[
'goods_name'
=>
'STM32F103CBU6'
,
'brand_name'
=>
'TI'
,
'picking_number'
=>
1000
,
'batch_number'
=>
16
,
'delivery_time'
=>
'2-5周'
,
'picking_price'
=>
5.6
],
[
'goods_name'
=>
'STM32F103CBU6'
,
'brand_name'
=>
'TI'
,
'picking_number'
=>
1000
,
'batch_number'
=>
16
,
'delivery_time'
=>
'2-5周'
,
'picking_price'
=>
5.6
],
);
}
private
function
Excel
(){
$array
=
[
'aa'
,
'bb'
,
'cc'
,
'dd'
];
$Items
=
array
(
[
'goods_name'
=>
'STM32F103CBU6'
,
'brand_name'
=>
'TI'
,
'picking_number'
=>
1000
,
'batch_number'
=>
16
,
'delivery_time'
=>
'2-5周'
,
'picking_price'
=>
5.6
],
[
'goods_name'
=>
'STM32F103CBU6'
,
'brand_name'
=>
'TI'
,
'picking_number'
=>
1000
,
'batch_number'
=>
16
,
'delivery_time'
=>
'2-5周'
,
'picking_price'
=>
5.6
],
[
'goods_name'
=>
'STM32F103CBU6'
,
'brand_name'
=>
'TI'
,
'picking_number'
=>
1000
,
'batch_number'
=>
16
,
'delivery_time'
=>
'2-5周'
,
'picking_price'
=>
5.6
],
[
'goods_name'
=>
'STM32F103CBU6'
,
'brand_name'
=>
'TI'
,
'picking_number'
=>
1000
,
'batch_number'
=>
16
,
'delivery_time'
=>
'2-5周'
,
'picking_price'
=>
5.6
],
);
Excel
::
create
(
'aa'
,
function
(
$excel
)
use
(
$array
,
$Items
)
{
$excel
->
sheet
(
'人民币合同'
,
function
(
$sheet
)
use
(
$array
,
$Items
)
{
//设置宽度
$sheet
->
setWidth
(
array
(
'A'
=>
'8.11'
,
'B'
=>
'9.56'
,
'C'
=>
'8.11'
,
'D'
=>
'8.11'
,
'E'
=>
'8.11'
,
'F'
=>
'8.11'
,
'G'
=>
'7.11'
,
'H'
=>
'9.11'
,
'I'
=>
'16'
));
$sheet
->
setPageMargin
(
array
(
0.7
,
0.7
,
0.7
,
0.7
));
$count
=
count
(
$Items
);
$Arr
=
Config
(
'fixed.ExcelSet'
);
//处理位置
$ConfArr
=
$Arr
[
'conf'
];
foreach
(
$ConfArr
as
$k
=>
$v
){
foreach
(
$v
as
$k1
=>
$v1
){
foreach
(
$v1
as
$k2
=>
$v2
){
if
(
strpos
(
$v2
,
'+'
)){
preg_match_all
(
'/\d+/'
,
$v2
,
$row
);
//截取行
$ConfArr
[
$k
][
$k1
][
$k2
]
=
(
int
)
$row
[
0
][
0
]
+
(
int
)
$count
;
//重新结算位置
}
}
}
}
foreach
(
$ConfArr
as
$k
=>
$v
)
{
foreach
(
$v
as
$k1
=>
$v1
){
$sheet
->
mergeCells
(
$k
.
$v1
[
0
]
.
':'
.
$v1
[
1
]
.
$v1
[
2
]);
}
}
//处理详细得位置
for
(
$i
=
15
;
$i
<
$count
+
16
;
$i
++
){
$sheet
->
mergeCells
(
'B'
.
$i
.
':C'
.
$i
);
}
//填充详细数据
$rownum
=
15
;
$i
=
1
;
foreach
(
$Items
as
$k
=>
$v
){
$sheet
->
setCellValue
(
'A'
.
$rownum
,
$i
);
$sheet
->
setCellValue
(
'B'
.
$rownum
,
$v
[
'goods_name'
]);
$sheet
->
setCellValue
(
'D'
.
$rownum
,
$v
[
'brand_name'
]);
$sheet
->
setCellValue
(
'E'
.
$rownum
,
$v
[
'picking_number'
]);
$sheet
->
setCellValue
(
'F'
.
$rownum
,
$v
[
'batch_number'
]);
$sheet
->
setCellValue
(
'G'
.
$rownum
,
$v
[
'delivery_time'
]);
$sheet
->
setCellValue
(
'H'
.
$rownum
,
$v
[
'picking_price'
]);
$sheet
->
setCellValue
(
'I'
.
$rownum
,
$v
[
'picking_price'
]
*
$v
[
'picking_number'
]);
$rownum
++
;
$i
++
;
}
//设置值
$ValueArr
=
$Arr
[
'value'
];
foreach
(
$ValueArr
as
$k
=>
$v
){
if
(
strpos
(
$k
,
'+'
)){
preg_match_all
(
'/\d+/'
,
$k
,
$row
);
//截取行
$column
=
substr
(
$k
,
0
,
1
);
$sheet
->
setCellValue
(
$column
.
((
int
)
$row
[
0
][
0
]
+
(
int
)
$count
),
$v
);
}
else
{
$sheet
->
setCellValue
(
$k
,
$v
);
}
}
//设置居中
$sheet
->
cells
(
'A1:I4'
,
function
(
$cells
)
{
//$f是范围。匿名函数设置左对齐
$cells
->
setAlignment
(
'center'
);
$cells
->
setValignment
(
'center'
);
});
$sheet
->
cells
(
'A1:I4'
,
function
(
$cells
)
{
//$f是范围。匿名函数设置左对齐
$cells
->
setAlignment
(
'center'
);
$cells
->
setValignment
(
'center'
);
});
$sheet
->
cells
(
'A5'
,
function
(
$cells
)
{
//$f是范围。匿名函数设置左对齐
$cells
->
setAlignment
(
'right'
);
$cells
->
setValignment
(
'center'
);
});
$sheet
->
cells
(
'A12:I'
.
(
38
+
$count
),
function
(
$cells
)
{
//$f是范围。匿名函数设置左对齐
$cells
->
setAlignment
(
'left'
);
$cells
->
setValignment
(
'center'
);
});
//写入logo
$objDrawing
=
new
\PHPExcel_Worksheet_Drawing
;
$objDrawing
->
setPath
(
public_path
(
'img/logo.png'
));
$objDrawing
->
setCoordinates
(
'A1'
);
$objDrawing
->
setHeight
(
75
);
$objDrawing
->
setWidth
(
100
);
$objDrawing
->
setOffsetX
(
10
);
$objDrawing
->
setRotation
(
10
);
$objDrawing
->
setWorksheet
(
$sheet
);
//设置边框
$sheet
->
getStyle
(
'A2:I2'
)
->
getBorders
()
->
getBottom
()
->
setBorderStyle
(
\PHPExcel_Style_Border
::
BORDER_THIN
);
$border
=
$Arr
[
'border'
];
foreach
(
$border
as
$k
=>
$v
){
for
(
$i
=
$v
[
0
];
$i
<
$v
[
2
]
+
1
;
$i
++
){
$sheet
->
getStyle
(
$k
.
$i
.
':'
.
$v
[
1
]
.
$i
)
->
getBorders
()
->
getBottom
()
->
setBorderStyle
(
\PHPExcel_Style_Border
::
BORDER_THIN
);
}
}
$sheet
->
getStyle
(
'A14:I'
.
(
18
+
(
int
)
$count
))
->
getBorders
()
->
getAllBorders
()
->
setBorderStyle
(
\PHPExcel_Style_Border
::
BORDER_THIN
);
//设置加粗
$bold
=
$Arr
[
'bold'
];
foreach
(
$bold
as
$k
=>
$v
){
if
(
strpos
(
$k
,
'+'
))
{
preg_match_all
(
'/\d+/'
,
$k
,
$row
);
//截取行
$column
=
substr
(
$k
,
0
,
1
);
$k
=
$column
.
((
int
)
$row
[
0
][
0
]
+
(
int
)
$count
);
}
$sheet
->
getStyle
(
$k
)
->
getFont
()
->
setBold
(
true
);
}
//设置字号
$size
=
$Arr
[
'size'
];
foreach
(
$size
as
$k
=>
$v
){
if
(
strpos
(
$k
,
'+'
))
{
preg_match_all
(
'/\d+/'
,
$k
,
$row
);
//截取行
$column
=
substr
(
$k
,
0
,
1
);
$k
=
$column
.
((
int
)
$row
[
0
][
0
]
+
(
int
)
$count
);
}
$sheet
->
getStyle
(
$k
)
->
getFont
()
->
setSize
(
$v
);
}
//设置宽度
$sheet
->
setHeight
(
array
(
1
=>
'33.9'
,
4
=>
'40.6'
,
21
+
(
int
)
$count
=>
'34.5'
,
23
+
(
int
)
$count
=>
'34.5'
,
28
+
(
int
)
$count
=>
'34.5'
,
29
+
(
int
)
$count
=>
'34.5'
,
30
+
(
int
)
$count
=>
'34.5'
,
));
//设置自动折行
$sheet
->
getStyle
(
'A1:I'
.
(
38
+
(
int
)
$count
))
->
getAlignment
()
->
setWrapText
(
true
);
});
})
->
download
(
'xls'
);
}
private
function
webserver
(){
webserver
(
'美元'
);
}
private
function
cgmx
(){
$info
=
'{
"instock_sn": "IN20180518",
"delivery_sn": "LL181119021",
"supplier_id": "10028",
"stockup_type": "1",
"supplier_sn": "YJL-SZ20180724Z0055",
"currency": "CNY",
"instock_time": "1533027903",
"instock_userid": "1477",
"total_rows": "45",
"warehouse_code": "01",
"detail": [
{
"instock_sn": "rk20180518",
"delivery_sn": "LL181119021",
"delivery_items_id": "384",
"goods_id": "10393",
"picking_price": "3.25",
"instock_number": "1000",
"purchase_sn": "ZC181119003"
}
]
}'
;
$data
[
'data'
]
=
json_decode
(
$info
,
true
);
$data
[
'data'
]
=
urlencode
(
json_encode
(
$data
[
'data'
]));
$data
[
'timestamp'
]
=
time
();
$token
=
WMSencryption
(
$data
);
$url
=
'http://pur.liexin.com/wmsapi/WebApiPutaway?token='
.
$token
;
$result
=
curl
(
$url
,
$data
,
true
);
print_r
(
$result
);
die
();
echo
$result
;
dump
(
json_decode
(
$result
,
true
));
}
private
function
csym
(){
$Url
=
'http://footstone.ichunt.net/AuthApi/WebApiObGoodsID'
;
$map
[
'time'
]
=
time
();
$map
[
'data'
][
'arr'
]
=
''
;
$key
=
Config
(
'website.MD5KEY'
);
$map
[
'AuthSign'
]
=
MD5
(
MD5
(
http_build_query
(
$map
))
.
$key
);
$updata
[
'data'
]
=
$map
;
$result
=
json_decode
(
curl
(
$Url
,
http_build_query
(
$updata
),
1
),
true
);
dump
(
$result
);
}
private
function
aacs
(){
$Redis
=
RedisDB
::
connection
();
$list
=
$Redis
->
hgetAll
(
'Pur_PutawayLog'
);
foreach
(
$list
as
$k
=>
$v
){
$info
=
$Redis
->
hget
(
'Pur_PutawayLog'
,
$k
);
dump
(
$info
);
dump
(
json_decode
(
urldecode
(
$info
),
true
));
die
;
}
}
private
function
skcs
(){
$PurchaseItemsModel
=
new
PurchaseDeliveryItemsModel
();
$Puc
=
new
PurchaseItemsModel
();
$list
=
$PurchaseItemsModel
->
where
(
'picking_id'
,
'='
,
31
)
->
select
(
'picking_items_id'
)
->
orderBy
(
'picking_items_id'
,
'asc'
)
->
get
()
->
toArray
();
foreach
(
$list
as
$k
=>
$v
){
dump
(
$v
[
'picking_items_id'
]);
$Find
=
$Puc
->
where
(
'picking_items_id'
,
'='
,
$v
[
'picking_items_id'
])
->
first
();
if
(
$Find
)
dump
(
$Find
->
toArray
());
}
}
private
function
wh
(){
$Model
=
new
PutawayItemsModel
();
$Auth
=
$Model
->
where
(
'putaway_id'
,
'='
,
58
)
->
select
(
'putaway_number'
,
'picking_sn'
,
'picking_price'
,
'sku_id'
)
->
get
()
->
toArray
();
foreach
(
$Auth
as
$k
=>
$v
){
$data
[
'data'
][]
=
[
'picking_sn'
=>
$v
[
'picking_sn'
],
'putaway_sn'
=>
'IN18063000001'
,
'goods_id'
=>
$v
[
'sku_id'
],
'num'
=>
$v
[
'putaway_number'
],
'cost'
=>
$v
[
'picking_price'
]];
}
// dump($data['data']);die;
$data
[
'data'
]
=
urlencode
(
json_encode
(
$data
[
'data'
]));
$data
[
'timestamp'
]
=
time
();
$data
[
'type'
]
=
'sku.instock'
;
$token
=
WMSencryption
(
$data
);
$url
=
Config
(
'website.serviceUrl'
)
.
'/wmsapi/WebApiStockAuthPush?token='
.
$token
;
$result
=
curl
(
$url
,
$data
,
true
);
$result
=
json_decode
(
$result
,
true
);
dump
(
$result
);
if
(
!
$result
||
$result
[
'errcode'
]
!=
0
)
return
[
30114
,
'基石推送入库失败'
];
}
private
function
xfsj
(){
DB
::
connection
(
'web'
)
->
beginTransaction
();
$result
=
DB
::
connection
(
'web'
)
->
update
(
'UPDATE lie_purchase SET picking_amount=picking_amount/1000 WHERE picking_id=113'
);
if
(
!
$result
){
echo
'修复采购主表失败'
;
die
;
}
$result
=
DB
::
connection
(
'web'
)
->
update
(
'UPDATE lie_purchase_items SET picking_price=picking_price/1000 WHERE picking_id=113'
);
if
(
!
$result
){
echo
'修复采购明细失败'
;
die
;
}
$result
=
DB
::
connection
(
'web'
)
->
update
(
'UPDATE lie_purchase_delivery_items SET picking_price=picking_price/1000 WHERE picking_id=113'
);
if
(
!
$result
){
echo
'修复来料明细失败'
;
die
;
}
DB
::
connection
(
'web'
)
->
commit
();
echo
'修复成功'
;
}
private
function
xfpur
(){
$PurModel
=
new
PurchaseModel
();
$PurItemsModel
=
new
PurchaseItemsModel
();
$PurList
=
$PurModel
->
select
(
'picking_id'
)
->
get
()
->
toArray
();
foreach
(
$PurList
as
$k
=>
$v
){
dump
(
$PurItemsModel
->
CountPrice
(
$v
[
'picking_id'
]));
}
}
private
function
xfab
(){
$con
=
DB
::
connection
(
'web'
);
//同步币种
$sql1
=
"update lie_abnormal b,lie_purchase p SET b.currency=p.currency,b.exchange_rate=p.exchange_rate WHERE b.picking_id=p.picking_id ;"
;
$res1
=
$con
->
update
(
$sql1
);
if
(
!
$res1
){
echo
'同步币种失败'
;
die
;
}
//查询最新币种
$abInfo
=
$con
->
select
(
"select * from lie_abnormal"
);
exchangeRateLogin
();
//登录获取汇率
foreach
(
$abInfo
as
$k
=>&
$v
)
{
if
(
$v
[
'currency'
]
!=
1
)
{
//不是人民币更新汇率
$exchangeRate
=
exchangeRatePost
(
$v
[
'currency'
]);
//获取最新汇率,hcy 2018.10.19
if
(
!
$exchangeRate
)
{
echo
"获取汇率错误"
.
$v
[
'currency'
];
die
();
}
$up2
=
$con
->
update
(
"update lie_abnormal set exchange_rate =
$exchangeRate
where abnormal_id="
.
$v
[
'abnormal_id'
]);
if
(
!
$up2
){
echo
"更新异常错误:
$exchangeRate
"
.
$v
[
'abnormal_id'
];
}
}
}
echo
"更新成功"
;
}
private
function
hcytest1
(
Request
$request
){
$arr
=
[
"outstock_sn"
=>
"LX1811010001"
,
"order_id"
=>
"128"
,
//对应采购异常单号
"shipping_id"
=>
"10"
,
"box_weight"
=>
"115.0000"
,
"express_amount"
=>
"0.0000"
,
"express_sn"
=>
"SUR400002492502"
,
"send_time"
=>
"1541041860"
,
//发货时间
"send_userid"
=>
"1460"
,
"is_print"
=>
"False"
,
"warehouse_code"
=>
"01"
,
"total_rows"
=>
"1"
,
"detail"
=>
[
[
"outstock_sn"
=>
"LX1811010001"
,
"order_id"
=>
"128"
,
"rec_id"
=>
"250194"
,
"goods_id"
=>
"10257"
,
"goods_price"
=>
"1.15560"
,
"goods_number"
=>
"50"
]
]
];
print_r
(
json_encode
(
$arr
));
die
();
$data
[
'data'
]
=
urlencode
(
json_encode
(
$arr
));
$data
[
'timestamp'
]
=
time
();
$data
[
'type'
]
=
'sku.jishou'
;
$token
=
WMSencryption
(
$data
);
$url
=
'pur.liexin.com/wmsapi/WebApiAbnormalStockReturn?token='
.
$token
;
$result
=
curl
(
$url
,
$data
,
true
);
print_r
(
$data
);
print_r
(
$result
);
die
();
}
private
function
hcytest4
(
Request
$request
){
$arr
=
[
'11050'
,
'11073'
,
'53534'
];
$data
[
'data'
]
=
urlencode
(
json_encode
(
$arr
));
$data
[
'timestamp'
]
=
time
();
$token
=
WMSencryption
(
$data
);
$url
=
'szpur.ichunt.net/wmsapi/WebApiRunningNumber?token='
.
$token
;
$result
=
curl
(
$url
,
$data
,
true
);
print_r
(
$data
);
print_r
(
$result
);
die
();
$data
=
ExcessEncryption
(
$info
,
'liexin20190128castervbht=1@k'
,
'DEvLbH82HMj$ZSjxNZW#M%5Xgn9dvsvT'
);
$url
=
'http://footstone.liexin.com/third/api/obtain/list/sku'
;
$res
=
(
curl
(
$url
,
$data
));
print_r
(
\GuzzleHttp\json_decode
(
$res
,
true
));
}
private
function
hcytest3
(){
...
...
@@ -446,10 +67,5 @@ class HandleController extends Controller
echo
"更新成功"
;
}
private
function
deletede
(
$request
){
$Model
=
new
PurchaseDeliveryModel
();
$result
=
$Model
->
ApiCloseDelivery
(
$request
->
user
->
userId
,
true
,
$request
->
input
(
'id'
));
dump
(
$result
);
}
}
app/Http/function.php
View file @
d089553c
...
...
@@ -1070,7 +1070,6 @@ function ExcessEncryption($info,$appid,$key){
$data
[
'token'
]
=
md5
(
$data
[
'data'
]
.
$data
[
'timestamp'
]
.
$key
.
$appid
);
return
$data
;
}
/**
* 解密第三方仓库加密
*/
...
...
@@ -1087,7 +1086,6 @@ function ExcessDecrypt($data,$key){
$Redis
->
expire
(
$data
[
'token'
],
10
);
return
[
0
,
'success'
,
$info
];
}
/**
* 加密明文
* $data 需要加密的明文 string
...
...
app/Http/routes.php
View file @
d089553c
...
...
@@ -5,5 +5,6 @@ Route::group(['middleware' => 'web'], function () {
Route
::
match
([
'get'
,
'post'
],
'/web/{key}'
,
'WebController@info'
);
Route
::
match
([
'get'
,
'post'
],
'/api/{key}'
,
'ApiController@Entrance'
);
Route
::
match
([
'get'
,
'post'
],
'/helper/{key}'
,
'HelperController@Entrance'
);
Route
::
match
([
'get'
,
'post'
],
'/hd/{key}'
,
'HandleController@Entrance'
);
});
Route
::
match
([
'get'
,
'post'
],
'/hd/{key}'
,
'HandleController@Entrance'
);
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment