|
|
@@ -2,8 +2,8 @@
|
|
|
|
|
|
namespace ghs\controllers;
|
|
|
|
|
|
-use biz\admin\classes\AdminRoleClass;
|
|
|
use bizGhs\order\classes\StockInOrderClass;
|
|
|
+use bizGhs\stock\classes\StockInDayClass;
|
|
|
use common\components\util;
|
|
|
use Yii;
|
|
|
|
|
|
@@ -11,6 +11,55 @@ use Yii;
|
|
|
class StockInController extends BaseController
|
|
|
{
|
|
|
|
|
|
+ //入库单盘点,生成需要盘点的花材 ssh 20221208
|
|
|
+ public function actionCreatePdItem()
|
|
|
+ {
|
|
|
+ $post = Yii::$app->request->post();
|
|
|
+ $ids = $post['ids'] ?? '';
|
|
|
+ $arr = json_decode($ids, true);
|
|
|
+ if (is_array($arr) == false) {
|
|
|
+ util::fail('没有盘点单');
|
|
|
+ }
|
|
|
+ $idData = array_column($arr, 'id');
|
|
|
+ if (empty($idData) || is_array($idData) == false) {
|
|
|
+ util::fail('没有盘点单哦');
|
|
|
+ }
|
|
|
+ $idData = array_filter(array_unique($idData));
|
|
|
+ $list = StockInOrderClass::getByIds($idData);
|
|
|
+ if (empty($list)) {
|
|
|
+ util::fail('没有找到盘点单');
|
|
|
+ }
|
|
|
+ $use = [];
|
|
|
+ $inMainId = 0;
|
|
|
+ foreach ($list as $item) {
|
|
|
+ $inMainId = $item['inMainId'] ?? 0;
|
|
|
+ if ($inMainId != $this->mainId) {
|
|
|
+ util::fail('入库单有问题');
|
|
|
+ }
|
|
|
+ $orderSn = $item['orderSn'] ?? '';
|
|
|
+ $itemList = StockInOrderItemClass::getAllByCondition(['orderSn' => $orderSn], null, '*');
|
|
|
+ if (!empty($itemList)) {
|
|
|
+ foreach ($itemList as $it) {
|
|
|
+ $itemId = $it['productId'] ?? 0;
|
|
|
+ $ptItemId = $it['itemId'] ?? 0;
|
|
|
+ $use[$itemId] = [
|
|
|
+ 'mainId' => $inMainId,
|
|
|
+ 'itemId' => $itemId,
|
|
|
+ 'ptItemId' => $ptItemId,
|
|
|
+ ];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (empty($use)) {
|
|
|
+ util::fail('没有找到需要盘点的花材');
|
|
|
+ }
|
|
|
+ StockInDayClass::deleteByCondition(['mainId' => $inMainId]);
|
|
|
+ foreach ($use as $info) {
|
|
|
+ StockInDayClass::add($info);
|
|
|
+ }
|
|
|
+ util::complete();
|
|
|
+ }
|
|
|
+
|
|
|
//入库列表 lqh 2021.1.25
|
|
|
public function actionList()
|
|
|
{
|