|
|
@@ -161,10 +161,6 @@ class BookItemClass extends BaseClass
|
|
|
$secondRemainSubNum = bcsub($firstRemainSubNum, $secondNeedSubNum);
|
|
|
}
|
|
|
|
|
|
- $bookItemCustomRes->roadNum = bcsub($bookItemCustomRes->roadNum, $secondNeedSubNum);
|
|
|
- $bookItemRes->roadNum = bcsub($bookItemRes->roadNum, $secondNeedSubNum);
|
|
|
- $bookCustomRes->roadNum = bcsub($bookCustomRes->roadNum, $secondNeedSubNum);
|
|
|
-
|
|
|
$bookItemRes = self::delRoadNum($bookItemRes, $secondNeedSubNum, $num, $order, $shop, $product, $params);
|
|
|
$bookItemCustomRes = BookItemCustomClass::delRoadNum($bookItemCustomRes, $secondNeedSubNum, $num, $order, $shop, $product, $params);
|
|
|
$bookCustomRes = BookCustomClass::delRoadNum($bookCustomRes, $secondNeedSubNum, $num, $order, $shop, $product, $params);
|
|
|
@@ -398,6 +394,57 @@ class BookItemClass extends BaseClass
|
|
|
return $bookItemRes;
|
|
|
}
|
|
|
|
|
|
+ public static function addOnNum($bookItemRes, $addOnNum, $bill, $shop, $product, $params)
|
|
|
+ {
|
|
|
+ $bookItemRes->onNum = bcadd($bookItemRes->onNum, $addOnNum);
|
|
|
+ $bookItemRes->save();
|
|
|
+ $bookItemResId = $bookItemRes->id ?? 0;
|
|
|
+
|
|
|
+ $ioRes = $params['ioRes'] ?? null;
|
|
|
+ $relatedId = $ioRes->id ?? 0;
|
|
|
+
|
|
|
+ //变动记录
|
|
|
+ $itemId = $product->id ?? 0;
|
|
|
+ $ptItemId = $product->itemId ?? 0;
|
|
|
+ $name = $product->name ?? '';
|
|
|
+ $py = $product->py ?? '';
|
|
|
+ $bigUnit = $product->bigUnit ?? '扎';
|
|
|
+ $bookSn = $shop->bookSn ?? '';
|
|
|
+ $mainId = $shop->mainId ?? 0;
|
|
|
+ $customId = $bill->customId ?? 0;
|
|
|
+ $customName = $bill->customName ?? '';
|
|
|
+ $customNamePy = $bill->customNamePy ?? '';
|
|
|
+ $currentCapitalType = dict::getDict('capitalType', 'ghsCheckIn');
|
|
|
+ $staffName = $params['staffName'] ?? '';
|
|
|
+ $staffId = $params['staffId'] ?? 0;
|
|
|
+ $orderSn = $bill->orderSn ?? '';
|
|
|
+ $event = "采购单 {$orderSn} 入库,{$name} 上架 " . $addOnNum . $bigUnit;
|
|
|
+ $changeData = [
|
|
|
+ 'mainId' => $mainId,
|
|
|
+ 'bookSn' => $bookSn,
|
|
|
+ 'name' => $name,
|
|
|
+ 'py' => $py,
|
|
|
+ 'itemId' => $itemId,
|
|
|
+ 'ptItemId' => $ptItemId,
|
|
|
+ 'customId' => $customId,
|
|
|
+ 'customName' => $customName,
|
|
|
+ 'customNamePy' => $customNamePy,
|
|
|
+ 'relateId' => $relatedId,
|
|
|
+ 'relateSecondId' => $bookItemResId,
|
|
|
+ 'ptStyle' => 2,
|
|
|
+ 'capitalType' => $currentCapitalType,
|
|
|
+ 'io' => 1,
|
|
|
+ 'changeNum' => $addOnNum,
|
|
|
+ 'num' => $bookItemRes->onNum,
|
|
|
+ 'event' => $event,
|
|
|
+ 'staffId' => $staffId,
|
|
|
+ 'staffName' => $staffName,
|
|
|
+ 'remark' => '',
|
|
|
+ ];
|
|
|
+ BookOnChangeGlobalClass::add($changeData, true);
|
|
|
+ return $bookItemRes;
|
|
|
+ }
|
|
|
+
|
|
|
public static function delOnNum($bookItemRes, $delOnNum, $num, $order, $shop, $product, $params)
|
|
|
{
|
|
|
$bookItemRes->onNum = bcsub($bookItemRes->onNum, $delOnNum);
|
|
|
@@ -448,7 +495,7 @@ class BookItemClass extends BaseClass
|
|
|
return $bookItemRes;
|
|
|
}
|
|
|
|
|
|
- public static function delRoadNum($bookItemRes, $delRoadNum, $num, $order, $shop, $product, $params)
|
|
|
+ public static function delRoadNum($bookItemRes, $delRoadNum, $num, $bill, $shop, $product, $params)
|
|
|
{
|
|
|
$bookItemRes->roadNum = bcsub($bookItemRes->roadNum, $delRoadNum);
|
|
|
$bookItemRes->save();
|
|
|
@@ -464,14 +511,36 @@ class BookItemClass extends BaseClass
|
|
|
$py = $product->py ?? '';
|
|
|
$bigUnit = $product->bigUnit ?? '扎';
|
|
|
$bookSn = $shop->bookSn ?? '';
|
|
|
- $mainId = $order->mainId ?? 0;
|
|
|
- $customId = $order->customId ?? 0;
|
|
|
- $customName = $order->customName ?? '';
|
|
|
- $customNamePy = $order->customNamePy ?? '';
|
|
|
+ $mainId = $shop->mainId ?? 0;
|
|
|
+
|
|
|
$currentCapitalType = dict::getDict('capitalType', 'delBook');
|
|
|
$staffName = $params['staffName'] ?? '';
|
|
|
$staffId = $params['staffId'] ?? 0;
|
|
|
- $event = $customName . '减少预订' . $name . $num . $bigUnit . ',其中减少路上' . $delRoadNum . $bigUnit;
|
|
|
+ $currentChangeType = $params['currentChangeType'] ?? 'delBook';
|
|
|
+
|
|
|
+ if ($currentChangeType == 'putIn') {
|
|
|
+ //入库
|
|
|
+ $currentCapitalType = dict::getDict('capitalType', 'ghsCheckIn');
|
|
|
+ $customId = 0;
|
|
|
+ $customName = '';
|
|
|
+ $customNamePy = '';
|
|
|
+ $orderSn = $bill->orderSn ?? '';
|
|
|
+ $event = "采购单 {$orderSn} 入库上架,{$name} 路上减少" . $delRoadNum . $bigUnit;
|
|
|
+ } elseif ($currentChangeType == 'delBook') {
|
|
|
+ //减少预订
|
|
|
+ $currentCapitalType = dict::getDict('capitalType', 'delBook');
|
|
|
+ $customId = $bill->customId ?? 0;
|
|
|
+ $customName = $bill->customName ?? '';
|
|
|
+ $customNamePy = $bill->customNamePy ?? '';
|
|
|
+ $event = $customName . '减少预订' . $name . $num . $bigUnit . ',其中减少路上' . $delRoadNum . $bigUnit;
|
|
|
+ } else {
|
|
|
+ $event = '';
|
|
|
+ $customId = 0;
|
|
|
+ $customName = '';
|
|
|
+ $customNamePy = '';
|
|
|
+ util::fail('此变动方式没有找到');
|
|
|
+ }
|
|
|
+
|
|
|
$changeData = [
|
|
|
'mainId' => $mainId,
|
|
|
'bookSn' => $bookSn,
|