|
|
@@ -96,11 +96,7 @@ class PurchaseOrderClass extends BaseClass
|
|
|
$cgItemNum = $cgItem->itemNum ?? 0;
|
|
|
$productId = $cgItem->productId ?? 0;
|
|
|
$ptItemId = $cgItem->itemId ?? 0;
|
|
|
-// $assignSeat = $cgItem->assignSeat;
|
|
|
-// if($assignSeat == 0){
|
|
|
-// //不需要分配货位
|
|
|
-// continue;
|
|
|
-// }
|
|
|
+ $assignSeat = $cgItem->assignSeat;
|
|
|
if ($cgItemNum <= 0) {
|
|
|
continue;
|
|
|
}
|
|
|
@@ -158,79 +154,84 @@ class PurchaseOrderClass extends BaseClass
|
|
|
$params['customName'] = $bookItemCustomRes->customName ?? '';
|
|
|
$params['customId'] = $bookItemCustomRes->customId ?? '';
|
|
|
$params['customNamePy'] = $bookItemCustomRes->customNamePy ?? '';
|
|
|
- $bookItemCustomRes = BookItemCustomClass::delNeedCgNum($bookItemCustomRes, $remainNeedSendNum, 0, $cg, $shop, $currentItemInfo, $params);
|
|
|
- $bookCustomRes = BookCustomClass::delNeedCgNum($bookCustomRes, $remainNeedSendNum, 0, $cg, $shop, $currentItemInfo, $params);
|
|
|
+ if ($assignSeat == 1) {
|
|
|
+ $bookItemCustomRes = BookItemCustomClass::delNeedCgNum($bookItemCustomRes, $remainNeedSendNum, 0, $cg, $shop, $currentItemInfo, $params);
|
|
|
+ $bookCustomRes = BookCustomClass::delNeedCgNum($bookCustomRes, $remainNeedSendNum, 0, $cg, $shop, $currentItemInfo, $params);
|
|
|
+ }
|
|
|
$bookItemRes = BookItemClass::delNeedCgNum($bookItemRes, $remainNeedSendNum, 0, $cg, $shop, $currentItemInfo, $params);
|
|
|
|
|
|
- //路上数量增加
|
|
|
- $bookItemCustomRes = BookItemCustomClass::addRoadNum($bookItemCustomRes, $remainNeedSendNum, $cg, $shop, $currentItemInfo, $params);
|
|
|
- $bookCustomRes = BookCustomClass::addRoadNum($bookCustomRes, $remainNeedSendNum, $cg, $shop, $currentItemInfo, $params);
|
|
|
- $bookItemRes = BookItemClass::addRoadNum($bookItemRes, $remainNeedSendNum, $cg, $shop, $currentItemInfo, $params);
|
|
|
+ if ($assignSeat == 1) {
|
|
|
+ //路上数量增加
|
|
|
+ $bookItemCustomRes = BookItemCustomClass::addRoadNum($bookItemCustomRes, $remainNeedSendNum, $cg, $shop, $currentItemInfo, $params);
|
|
|
+ $bookCustomRes = BookCustomClass::addRoadNum($bookCustomRes, $remainNeedSendNum, $cg, $shop, $currentItemInfo, $params);
|
|
|
+ $bookItemRes = BookItemClass::addRoadNum($bookItemRes, $remainNeedSendNum, $cg, $shop, $currentItemInfo, $params);
|
|
|
|
|
|
- //确认已分配数量增加
|
|
|
- $cgItem->confirmSendNum = bcadd($cgItem->confirmSendNum, $remainNeedSendNum);
|
|
|
- $cgItem->save();
|
|
|
+ //确认已分配数量增加
|
|
|
+ $cgItem->confirmSendNum = bcadd($cgItem->confirmSendNum, $remainNeedSendNum);
|
|
|
+ $cgItem->save();
|
|
|
|
|
|
- $sendInfo = CgOrderItemSendClass::getByCondition(['parentId' => $cgItemId, 'customId' => $customId, 'itemId' => $productId], true);
|
|
|
- $bookItemCustomId = $bookItemCustomRes->id ?? 0;
|
|
|
- $currentCustom = $customList[$customId] ?? null;
|
|
|
- if (empty($currentCustom)) {
|
|
|
- util::fail('客户信息缺失');
|
|
|
- }
|
|
|
- if (empty($sendInfo)) {
|
|
|
- $sendData = [
|
|
|
- 'mainId' => $mainId,
|
|
|
- 'parentOrderId' => $cgId,
|
|
|
- 'parentId' => $cgItemId,
|
|
|
- 'bookGhsGiveId' => 0,
|
|
|
- 'name' => $currentItemInfo->name ?? '',
|
|
|
- 'py' => $currentItemInfo->py ?? '',
|
|
|
- 'itemId' => $productId,
|
|
|
- 'ptItemId' => $ptItemId,
|
|
|
- 'customId' => $customId,
|
|
|
- 'customName' => $currentCustom->name ?? '',
|
|
|
- 'customPy' => $currentCustom->py ?? '',
|
|
|
- 'seatSn' => $currentCustom->seatSn ?? 0,
|
|
|
- 'num' => 0,
|
|
|
- 'bookItemCustomId' => $bookItemCustomId,
|
|
|
- 'status' => 0,
|
|
|
- 'staffId' => $currentItemInfo->cgStaffId ?? 0,
|
|
|
- 'staffName' => $currentItemInfo->cgStaffName ?? '',
|
|
|
- ];
|
|
|
- $sendInfo = CgOrderItemSendClass::add($sendData, true);
|
|
|
- }
|
|
|
- $sendInfo->num = bcadd($sendInfo->num, $remainNeedSendNum);
|
|
|
- $sendInfo->save();
|
|
|
- $sendInfoId = $sendInfo->id ?? 0;
|
|
|
|
|
|
- $giveGhs = BookItemGhsClass::getByCondition(['parentId' => $bookItemCustomId, 'ghsId' => $ghsId, 'itemId' => $productId,], true);
|
|
|
- if (empty($giveGhs)) {
|
|
|
- $giveGhsData = [
|
|
|
- 'mainId' => $mainId,
|
|
|
- 'bookSn' => $bookSn,
|
|
|
- 'parentId' => $bookItemCustomId,
|
|
|
- 'cgSendId' => $sendInfoId,
|
|
|
- 'name' => $currentItemInfo->name ?? '',
|
|
|
- 'py' => $currentItemInfo->py ?? '',
|
|
|
- 'itemId' => $productId,
|
|
|
- 'ptItemId' => $ptItemId,
|
|
|
- 'ghsId' => $ghsId,
|
|
|
- 'ghsName' => $ghsName,
|
|
|
- 'cgId' => $cgId,
|
|
|
- 'cgItemId' => $cgItemId,
|
|
|
- 'customId' => $customId,
|
|
|
- 'customName' => $currentCustom->name ?? '',
|
|
|
- 'staffId' => $currentItemInfo->cgStaffId ?? 0,
|
|
|
- 'staffName' => $currentItemInfo->cgStaffName ?? '',
|
|
|
- 'status' => 0,
|
|
|
- ];
|
|
|
- $giveGhs = BookItemGhsClass::add($giveGhsData, true);
|
|
|
+ $sendInfo = CgOrderItemSendClass::getByCondition(['parentId' => $cgItemId, 'customId' => $customId, 'itemId' => $productId], true);
|
|
|
+ $bookItemCustomId = $bookItemCustomRes->id ?? 0;
|
|
|
+ $currentCustom = $customList[$customId] ?? null;
|
|
|
+ if (empty($currentCustom)) {
|
|
|
+ util::fail('客户信息缺失');
|
|
|
+ }
|
|
|
+ if (empty($sendInfo)) {
|
|
|
+ $sendData = [
|
|
|
+ 'mainId' => $mainId,
|
|
|
+ 'parentOrderId' => $cgId,
|
|
|
+ 'parentId' => $cgItemId,
|
|
|
+ 'bookGhsGiveId' => 0,
|
|
|
+ 'name' => $currentItemInfo->name ?? '',
|
|
|
+ 'py' => $currentItemInfo->py ?? '',
|
|
|
+ 'itemId' => $productId,
|
|
|
+ 'ptItemId' => $ptItemId,
|
|
|
+ 'customId' => $customId,
|
|
|
+ 'customName' => $currentCustom->name ?? '',
|
|
|
+ 'customPy' => $currentCustom->py ?? '',
|
|
|
+ 'seatSn' => $currentCustom->seatSn ?? 0,
|
|
|
+ 'num' => 0,
|
|
|
+ 'bookItemCustomId' => $bookItemCustomId,
|
|
|
+ 'status' => 0,
|
|
|
+ 'staffId' => $currentItemInfo->cgStaffId ?? 0,
|
|
|
+ 'staffName' => $currentItemInfo->cgStaffName ?? '',
|
|
|
+ ];
|
|
|
+ $sendInfo = CgOrderItemSendClass::add($sendData, true);
|
|
|
+ }
|
|
|
+ $sendInfo->num = bcadd($sendInfo->num, $remainNeedSendNum);
|
|
|
+ $sendInfo->save();
|
|
|
+ $sendInfoId = $sendInfo->id ?? 0;
|
|
|
+
|
|
|
+ $giveGhs = BookItemGhsClass::getByCondition(['parentId' => $bookItemCustomId, 'ghsId' => $ghsId, 'itemId' => $productId,], true);
|
|
|
+ if (empty($giveGhs)) {
|
|
|
+ $giveGhsData = [
|
|
|
+ 'mainId' => $mainId,
|
|
|
+ 'bookSn' => $bookSn,
|
|
|
+ 'parentId' => $bookItemCustomId,
|
|
|
+ 'cgSendId' => $sendInfoId,
|
|
|
+ 'name' => $currentItemInfo->name ?? '',
|
|
|
+ 'py' => $currentItemInfo->py ?? '',
|
|
|
+ 'itemId' => $productId,
|
|
|
+ 'ptItemId' => $ptItemId,
|
|
|
+ 'ghsId' => $ghsId,
|
|
|
+ 'ghsName' => $ghsName,
|
|
|
+ 'cgId' => $cgId,
|
|
|
+ 'cgItemId' => $cgItemId,
|
|
|
+ 'customId' => $customId,
|
|
|
+ 'customName' => $currentCustom->name ?? '',
|
|
|
+ 'staffId' => $currentItemInfo->cgStaffId ?? 0,
|
|
|
+ 'staffName' => $currentItemInfo->cgStaffName ?? '',
|
|
|
+ 'status' => 0,
|
|
|
+ ];
|
|
|
+ $giveGhs = BookItemGhsClass::add($giveGhsData, true);
|
|
|
+ }
|
|
|
+ $giveGhs->num = bcadd($giveGhs->num, $remainNeedSendNum);
|
|
|
+ $giveGhs->save();
|
|
|
+ $giveGhsId = $giveGhs->id ?? 0;
|
|
|
+ $sendInfo->bookGhsGiveId = $giveGhsId;
|
|
|
+ $sendInfo->save();
|
|
|
}
|
|
|
- $giveGhs->num = bcadd($giveGhs->num, $remainNeedSendNum);
|
|
|
- $giveGhs->save();
|
|
|
- $giveGhsId = $giveGhs->id ?? 0;
|
|
|
- $sendInfo->bookGhsGiveId = $giveGhsId;
|
|
|
- $sendInfo->save();
|
|
|
$hasChange = 1;
|
|
|
}
|
|
|
|
|
|
@@ -1264,9 +1265,9 @@ class PurchaseOrderClass extends BaseClass
|
|
|
$id = $val['id'] ?? 0;
|
|
|
$shortCover = $val['cover'] ?? '';
|
|
|
$orderInfo[$key]['ShortCover'] = $shortCover;
|
|
|
- $orderInfo[$key]['itemNum'] = $val['itemNum']?floatval($val['itemNum']):0;
|
|
|
- $orderInfo[$key]['bigPrice'] = $val['bigPrice']?floatval($val['bigPrice']):0;
|
|
|
- $orderInfo[$key]['totalPrice'] = $val['totalPrice']?floatval($val['totalPrice']):0;
|
|
|
+ $orderInfo[$key]['itemNum'] = $val['itemNum'] ? floatval($val['itemNum']) : 0;
|
|
|
+ $orderInfo[$key]['bigPrice'] = $val['bigPrice'] ? floatval($val['bigPrice']) : 0;
|
|
|
+ $orderInfo[$key]['totalPrice'] = $val['totalPrice'] ? floatval($val['totalPrice']) : 0;
|
|
|
$orderInfo[$key]['cover'] = imgUtil::groupImg($shortCover) . "?x-oss-process=image/resize,m_fill,h_130,w_130";
|
|
|
$orderInfo[$key]['bigCover'] = imgUtil::groupImg($shortCover) . "?x-oss-process=image/resize,m_fill,h_700,w_700";
|
|
|
$sendList = CgOrderItemSendClass::getAllByCondition(['parentId' => $id], null, '*');
|
|
|
@@ -1340,7 +1341,7 @@ class PurchaseOrderClass extends BaseClass
|
|
|
$productId = $v['productId'];
|
|
|
$currentAboutPrice = $v['aboutPrice'] ?? 0;
|
|
|
$currentTotal = $v['totalPrice'] ?? 0;
|
|
|
- $assignSeat = $v['assignSeat']??1;
|
|
|
+ $assignSeat = $v['assignSeat'] ?? 1;
|
|
|
$itemId = $productData[$productId]['itemId'];
|
|
|
$tmp['orderSn'] = $orderSn;
|
|
|
$tmp['assignSeat'] = $assignSeat;
|