|
|
@@ -60,6 +60,51 @@ class PurchaseOrderClass extends BaseClass
|
|
|
const IN_TYPE_LATER = 0;
|
|
|
const IN_TYPE_NOW = 1;
|
|
|
|
|
|
+ //取消采购入库 ssh 20231218
|
|
|
+ public static function cancel($cg)
|
|
|
+ {
|
|
|
+ $cg->status = self::PURCHASE_ORDER_STATUS_CANCEL;
|
|
|
+ $cg->save();
|
|
|
+
|
|
|
+ $orderSn = $cg->orderSn ?? '';
|
|
|
+ $mainId = $cg->mainId ?? 0;
|
|
|
+ $sjId = $cg->sjId ?? 0;
|
|
|
+ $shopId = $cg->shopId ?? 0;
|
|
|
+ $ghsName = $cg->ghsName ?? '';
|
|
|
+ $itemList = PurchaseOrderItemClass::getAllByCondition(['orderSn' => $orderSn], null, '*', null, true);
|
|
|
+ if (empty($itemList)) {
|
|
|
+ util::fail('没有找到花材');
|
|
|
+ }
|
|
|
+ foreach ($itemList as $cgKey => $cgItem) {
|
|
|
+ $productId = $cgItem['productId'] ?? 0;
|
|
|
+ $currentNum = $cgItem['itemNum'] ?? 0;
|
|
|
+ $ptItemId = $cgItem['itemId'] ?? 0;
|
|
|
+ $presell = $cgItem['presell'] ?? 0;
|
|
|
+ $product = ProductClass::getLockById($productId);
|
|
|
+ if (empty($product)) {
|
|
|
+ util::fail('没有找到花材哦');
|
|
|
+ }
|
|
|
+ if ($presell == 0) {
|
|
|
+ //减少路上库存
|
|
|
+ $onRecord = [];
|
|
|
+ $onRecord['sjId'] = $sjId;
|
|
|
+ $onRecord['shopId'] = $shopId;
|
|
|
+ $onRecord['mainId'] = $mainId;
|
|
|
+ $onRecord['orderSn'] = $orderSn;
|
|
|
+ $onRecord['productId'] = $productId;
|
|
|
+ $onRecord['itemId'] = $ptItemId;
|
|
|
+ $onRecord['relateName'] = $ghsName;
|
|
|
+ $onRecord['itemNum'] = $currentNum;
|
|
|
+ $oldOnStock = $product->onStock ?? 0;
|
|
|
+ $onRecord['oldStock'] = $oldOnStock;
|
|
|
+ $onRecord['newStock'] = bcsub($oldOnStock, $currentNum);
|
|
|
+ $onRecord['ptStyle'] = 2;
|
|
|
+ OnStockRecordClass::cancelCg($onRecord);
|
|
|
+ ProductClass::decreaseOnStockByItemNum($productId, $currentNum);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
public static function printGroup($current, $content)
|
|
|
{
|
|
|
//58mm的机器,一行打印16个汉字,32个字母
|