|
|
@@ -13,6 +13,7 @@ use bizGhs\shop\classes\ShopClass;
|
|
|
use bizHd\purchase\classes\PurchaseClass;
|
|
|
use common\components\dateUtil;
|
|
|
use common\components\dict;
|
|
|
+use common\components\dirUtil;
|
|
|
use common\components\noticeUtil;
|
|
|
use common\components\printUtil;
|
|
|
use common\components\stringUtil;
|
|
|
@@ -405,7 +406,7 @@ class PurchaseOrderController extends BaseController
|
|
|
if (getenv('YII_ENV') == 'production') {
|
|
|
//小向花卉采购控制
|
|
|
if ($this->mainId == 23390) {
|
|
|
- if (!in_array($this->adminId, [24586, 24115, 24759, 26390, 23960, 25011, 25004, 24655, 28521,4])) {
|
|
|
+ if (!in_array($this->adminId, [24586, 24115, 24759, 26390, 23960, 25011, 25004, 24655, 28521, 4])) {
|
|
|
util::fail('你不能采购哦');
|
|
|
}
|
|
|
}
|
|
|
@@ -764,27 +765,27 @@ class PurchaseOrderController extends BaseController
|
|
|
|
|
|
$mainId = $this->mainId;
|
|
|
$staff = $this->shopAdmin;
|
|
|
- $addTime = $orderData['addTime']??'';
|
|
|
+ $addTime = $orderData['addTime'] ?? '';
|
|
|
$currentTime = time();
|
|
|
$hasOver = false;
|
|
|
$overTime = $currentTime - strtotime($addTime);
|
|
|
$overDay = ceil($overTime / 86400);
|
|
|
- if($overDay>3){
|
|
|
+ if ($overDay > 3) {
|
|
|
$hasOver = true;
|
|
|
}
|
|
|
if (getenv('YII_ENV') == 'production') {
|
|
|
//花大苪没有财务权限的人,采购单只能看最近3天
|
|
|
- if($mainId == 8164){
|
|
|
+ if ($mainId == 8164) {
|
|
|
if (!isset($staff->finance) || $staff->finance == 0) {
|
|
|
- if($hasOver){
|
|
|
+ if ($hasOver) {
|
|
|
util::fail('超过3天,无法查看');
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- }else{
|
|
|
- if($mainId == 644){
|
|
|
+ } else {
|
|
|
+ if ($mainId == 644) {
|
|
|
if (!isset($staff->finance) || $staff->finance == 0) {
|
|
|
- if($hasOver){
|
|
|
+ if ($hasOver) {
|
|
|
util::fail('超过3天,无法查看');
|
|
|
}
|
|
|
}
|
|
|
@@ -957,4 +958,32 @@ class PurchaseOrderController extends BaseController
|
|
|
util::complete('修改成功');
|
|
|
}
|
|
|
|
|
|
+ //导入采购 ssh 20241126
|
|
|
+ public function actionImportCreate()
|
|
|
+ {
|
|
|
+ $get = Yii::$app->request->get();
|
|
|
+ $id = $get['id'] ?? '';
|
|
|
+ $file = $_FILES['file'];
|
|
|
+ if (!is_uploaded_file($file['tmp_name'])) {
|
|
|
+ util::fail('please upload img');
|
|
|
+ }
|
|
|
+ $mainId = $this->sjId;
|
|
|
+ $shopId = $this->shopId;
|
|
|
+ $month = date("Ym");
|
|
|
+ $date = date("d");
|
|
|
+ $path = dirUtil::getImgUploadDir() . "/{$mainId}/cg/{$shopId}/{$month}/{$date}/";
|
|
|
+ if (!file_exists($path)) {
|
|
|
+ //检查是否有该文件夹,如果没有就创建,并给予最高权限
|
|
|
+ mkdir($path, 0700, true);
|
|
|
+ }
|
|
|
+ $preFileName = stringUtil::uniqueFileName();
|
|
|
+ $newFile = $preFileName . ".xls";
|
|
|
+ $fullPathFile = $path . $newFile;
|
|
|
+ if (move_uploaded_file($file['tmp_name'], $fullPathFile)) {
|
|
|
+ util::complete($fullPathFile . ' id:' . $id);
|
|
|
+ } else {
|
|
|
+ util::fail('fail');
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|