|
|
@@ -315,10 +315,10 @@ class PurchaseOrderController extends BaseController
|
|
|
try {
|
|
|
$shop = $this->shop;
|
|
|
$staff = $this->shopAdmin;
|
|
|
- $staffId = $staff->id??0;
|
|
|
- $staffName = $staff->name??'';
|
|
|
- $params = ['staffId'=>$staffId,'staffName'=>$staffName,'staff'=>$staff];
|
|
|
- PurchaseOrderClass::cancel($cg,$shop,$params);
|
|
|
+ $staffId = $staff->id ?? 0;
|
|
|
+ $staffName = $staff->name ?? '';
|
|
|
+ $params = ['staffId' => $staffId, 'staffName' => $staffName, 'staff' => $staff];
|
|
|
+ PurchaseOrderClass::cancel($cg, $shop, $params);
|
|
|
$transaction->commit();
|
|
|
util::complete();
|
|
|
} catch (\Exception $e) {
|
|
|
@@ -464,17 +464,17 @@ class PurchaseOrderController extends BaseController
|
|
|
$bookSn = $shop->bookSn ?? 0;
|
|
|
|
|
|
//只查我负责的花材
|
|
|
- $globalCgMyCharge = $post['globalCgMyCharge']??0;
|
|
|
+ $globalCgMyCharge = $post['globalCgMyCharge'] ?? 0;
|
|
|
$needCgList = [];
|
|
|
- if($globalCgMyCharge == 1){
|
|
|
- $staffId = $staff->id??0;
|
|
|
- if(!empty($bookSn)){
|
|
|
- $bList = BookItemClass::getAllByCondition(['bookSn'=>$bookSn,'cgStaffId'=>$staffId],null,'*',null,true);
|
|
|
- if(!empty($bList)){
|
|
|
+ if ($globalCgMyCharge == 1) {
|
|
|
+ $staffId = $staff->id ?? 0;
|
|
|
+ if (!empty($bookSn)) {
|
|
|
+ $bList = BookItemClass::getAllByCondition(['bookSn' => $bookSn, 'cgStaffId' => $staffId], null, '*', null, true);
|
|
|
+ if (!empty($bList)) {
|
|
|
$myIds = [];
|
|
|
- foreach($bList as $bInfo){
|
|
|
- $biProductId = $bInfo->itemId??0;
|
|
|
- if($bInfo->needCgNum > 0){
|
|
|
+ foreach ($bList as $bInfo) {
|
|
|
+ $biProductId = $bInfo->itemId ?? 0;
|
|
|
+ if ($bInfo->needCgNum > 0) {
|
|
|
$myIds[] = $biProductId;
|
|
|
$needCgList[$biProductId] = $bInfo->needCgNum;
|
|
|
}
|
|
|
@@ -488,7 +488,7 @@ class PurchaseOrderController extends BaseController
|
|
|
$bigNum = $v['bigNum'] ?? 0;
|
|
|
$productId = $v['productId'] ?? 0;
|
|
|
$smallNum = $v['smallNum'] ?? 0;
|
|
|
- $name = $v['name']??'';
|
|
|
+ $name = $v['name'] ?? '';
|
|
|
if (!isset($v['itemPrice'])) {
|
|
|
util::fail('采购价格不能为空');
|
|
|
}
|
|
|
@@ -499,13 +499,13 @@ class PurchaseOrderController extends BaseController
|
|
|
util::fail('花材数量不能为0');
|
|
|
}
|
|
|
|
|
|
- if($globalCgMyCharge == 1){
|
|
|
- if(isset($needCgList[$productId]) == false){
|
|
|
- util::fail($name.' 不需要采购');
|
|
|
+ if ($globalCgMyCharge == 1) {
|
|
|
+ if (isset($needCgList[$productId]) == false) {
|
|
|
+ util::fail($name . ' 不需要采购');
|
|
|
}
|
|
|
$needNum = $needCgList[$productId];
|
|
|
- if($bigNum>$needNum){
|
|
|
- util::fail($name.' 只要采'.$needNum.'份');
|
|
|
+ if ($bigNum > $needNum) {
|
|
|
+ util::fail($name . ' 只要采' . $needNum . '份');
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -533,15 +533,14 @@ class PurchaseOrderController extends BaseController
|
|
|
if (isset($order->needPrint) && $order->needPrint == 1) {
|
|
|
PurchaseOrderClass::printTicket($order);
|
|
|
}
|
|
|
- $pfLevel = $shop->pfLevel ?? 0;
|
|
|
- if ($pfLevel == 1 && !empty($bookSn) && $inType == 0) {
|
|
|
+ if (!empty($bookSn) && $inType == 0) {
|
|
|
//如果是昆明批发,有开启预订则直接分配货位
|
|
|
$key = 'ghs_cg_order_scan_seat_' . $order->id;
|
|
|
$noLock = util::lock($key);
|
|
|
if ($noLock) {
|
|
|
//没有锁定,即没有在分配货位,可以进行货位分配
|
|
|
- $params = ['staffId'=>$shopAdmin->id,'staffName'=>$shopAdmin->name];
|
|
|
- PurchaseOrderClass::assign($order,$shop,$params);
|
|
|
+ $params = ['staffId' => $shopAdmin->id, 'staffName' => $shopAdmin->name];
|
|
|
+ PurchaseOrderClass::assign($order, $shop, $params);
|
|
|
util::unlock($key);
|
|
|
}
|
|
|
}
|
|
|
@@ -583,9 +582,9 @@ class PurchaseOrderController extends BaseController
|
|
|
util::success(['assign' => 0, 'hint' => 'shop bookSn != cg bookSn']);
|
|
|
}
|
|
|
$staff = $this->shopAdmin;
|
|
|
- $staffId = $staff->id??0;
|
|
|
- $staffName = $staff->name??'';
|
|
|
- $params = ['staffId'=>$staffId,'staffName'=>$staffName];
|
|
|
+ $staffId = $staff->id ?? 0;
|
|
|
+ $staffName = $staff->name ?? '';
|
|
|
+ $params = ['staffId' => $staffId, 'staffName' => $staffName];
|
|
|
} else {
|
|
|
if ($cg->salt != $salt) {
|
|
|
util::success(['assign' => 0, 'hint' => 'cg salt != post salt']);
|
|
|
@@ -598,14 +597,14 @@ class PurchaseOrderController extends BaseController
|
|
|
if ($shop->bookSn != $cgBookSn) {
|
|
|
util::success(['assign' => 0, 'hint' => 'shop bookSn != cg bookSn o']);
|
|
|
}
|
|
|
- $staffId = $cg->shopAdminId??0;
|
|
|
- $staffName = $cg->shopAdminName??'';
|
|
|
- $params = ['staffId'=>$staffId,'staffName'=>$staffName];
|
|
|
+ $staffId = $cg->shopAdminId ?? 0;
|
|
|
+ $staffName = $cg->shopAdminName ?? '';
|
|
|
+ $params = ['staffId' => $staffId, 'staffName' => $staffName];
|
|
|
}
|
|
|
$connection = Yii::$app->db;
|
|
|
$transaction = $connection->beginTransaction();
|
|
|
try {
|
|
|
- PurchaseOrderClass::assign($cg,$shop,$params);
|
|
|
+ PurchaseOrderClass::assign($cg, $shop, $params);
|
|
|
$transaction->commit();
|
|
|
util::success(['assign' => 1]);
|
|
|
} catch (\Exception $e) {
|