|
|
@@ -106,4 +106,99 @@ class BookCustomClass extends BaseClass
|
|
|
return $bookCustomRes;
|
|
|
}
|
|
|
|
|
|
+ public static function addBookNum($bookCustomRes, $num, $order, $shop, $product, $params)
|
|
|
+ {
|
|
|
+ $currentNum = bcadd($bookCustomRes->bookNum, $num);
|
|
|
+ $bookCustomRes->bookNum = $currentNum;
|
|
|
+ $bookCustomRes->save();
|
|
|
+ $bookItemCustomResId = $bookCustomRes->id ?? 0;
|
|
|
+
|
|
|
+ //预订增加变动记录
|
|
|
+ $itemId = $product->id ?? 0;
|
|
|
+ $ptItemId = $product->itemId ?? 0;
|
|
|
+ $name = $product->name ?? '';
|
|
|
+ $py = $product->py ?? '';
|
|
|
+ $bigUnit = $product->bigUnit ?? '扎';
|
|
|
+ $bookSn = $shop->bookSn ?? '';
|
|
|
+ $mainId = $order->mainId ?? 0;
|
|
|
+ $customId = $order->customId ?? 0;
|
|
|
+ $customName = $order->customName ?? '';
|
|
|
+ $customNamePy = $order->customNamePy ?? '';
|
|
|
+ $currentCapitalType = dict::getDict('capitalType', 'addBook');
|
|
|
+ $staffName = $params['staffName'] ?? '';
|
|
|
+ $staffId = $params['staffId'] ?? 0;
|
|
|
+ $event = $customName . '预订' . $name . $num . $bigUnit;
|
|
|
+ $changeData = [
|
|
|
+ 'mainId' => $mainId,
|
|
|
+ 'bookSn' => $bookSn,
|
|
|
+ 'name' => $name,
|
|
|
+ 'py' => $py,
|
|
|
+ 'itemId' => $itemId,
|
|
|
+ 'ptItemId' => $ptItemId,
|
|
|
+ 'customId' => $customId,
|
|
|
+ 'customName' => $customName,
|
|
|
+ 'customNamePy' => $customNamePy,
|
|
|
+ 'relateId' => $bookItemCustomResId,
|
|
|
+ 'relateSecondId' => 0,
|
|
|
+ 'ptStyle' => 2,
|
|
|
+ 'capitalType' => $currentCapitalType,
|
|
|
+ 'io' => 1,
|
|
|
+ 'changeNum' => $num,
|
|
|
+ 'num' => $bookCustomRes->bookNum,
|
|
|
+ 'event' => $event,
|
|
|
+ 'staffId' => $staffId,
|
|
|
+ 'staffName' => $staffName,
|
|
|
+ 'remark' => '',
|
|
|
+ ];
|
|
|
+ BookCustomChangeClass::add($changeData, true);
|
|
|
+ return $bookCustomRes;
|
|
|
+ }
|
|
|
+
|
|
|
+ public static function addNeedCgNum($bookCustomRes, $addNeedCgNum, $num, $order, $shop, $product, $params)
|
|
|
+ {
|
|
|
+ $bookCustomRes->needCgNum = bcadd($bookCustomRes->needCgNum, $addNeedCgNum);
|
|
|
+ $bookCustomRes->save();
|
|
|
+ $bookCustomResId = $bookCustomRes->id ?? 0;
|
|
|
+
|
|
|
+ //待采增加变动记录
|
|
|
+ $itemId = $product->id ?? 0;
|
|
|
+ $ptItemId = $product->itemId ?? 0;
|
|
|
+ $name = $product->name ?? '';
|
|
|
+ $py = $product->py ?? '';
|
|
|
+ $bigUnit = $product->bigUnit ?? '扎';
|
|
|
+ $bookSn = $shop->bookSn ?? '';
|
|
|
+ $mainId = $order->mainId ?? 0;
|
|
|
+ $customId = $order->customId ?? 0;
|
|
|
+ $customName = $order->customName ?? '';
|
|
|
+ $customNamePy = $order->customNamePy ?? '';
|
|
|
+ $currentCapitalType = dict::getDict('capitalType', 'addBook');
|
|
|
+ $staffName = $params['staffName'] ?? '';
|
|
|
+ $staffId = $params['staffId'] ?? 0;
|
|
|
+ $event = $customName . '预订' . $name . $num . $bigUnit . ',增加待采' . $addNeedCgNum . $bigUnit;
|
|
|
+ $changeData = [
|
|
|
+ 'mainId' => $mainId,
|
|
|
+ 'bookSn' => $bookSn,
|
|
|
+ 'name' => $name,
|
|
|
+ 'py' => $py,
|
|
|
+ 'itemId' => $itemId,
|
|
|
+ 'ptItemId' => $ptItemId,
|
|
|
+ 'customId' => $customId,
|
|
|
+ 'customName' => $customName,
|
|
|
+ 'customNamePy' => $customNamePy,
|
|
|
+ 'relateId' => $bookCustomResId,
|
|
|
+ 'relateSecondId' => 0,
|
|
|
+ 'ptStyle' => 2,
|
|
|
+ 'capitalType' => $currentCapitalType,
|
|
|
+ 'io' => 1,
|
|
|
+ 'changeNum' => $addNeedCgNum,
|
|
|
+ 'num' => $bookCustomRes->needCgNum,
|
|
|
+ 'event' => $event,
|
|
|
+ 'staffId' => $staffId,
|
|
|
+ 'staffName' => $staffName,
|
|
|
+ 'remark' => '',
|
|
|
+ ];
|
|
|
+ BookCustomCgClass::add($changeData, true);
|
|
|
+ return $bookCustomRes;
|
|
|
+ }
|
|
|
+
|
|
|
}
|