|
|
@@ -44,9 +44,9 @@ class ItemController extends BaseController
|
|
|
$item->save();
|
|
|
|
|
|
$shop = $this->shop;
|
|
|
- $bookSn = $shop->bookSn??0;
|
|
|
- if(!empty($bookSn)){
|
|
|
- BookItemClass::updateByCondition(['bookSn'=>$bookSn,'itemId'=>$id],['cgStaffId'=>$staffId,'cgStaffName'=>$staffName]);
|
|
|
+ $bookSn = $shop->bookSn ?? 0;
|
|
|
+ if (!empty($bookSn)) {
|
|
|
+ BookItemClass::updateByCondition(['bookSn' => $bookSn, 'itemId' => $id], ['cgStaffId' => $staffId, 'cgStaffName' => $staffName]);
|
|
|
}
|
|
|
|
|
|
util::complete('修改成功');
|
|
|
@@ -161,25 +161,25 @@ class ItemController extends BaseController
|
|
|
$field = '*';
|
|
|
|
|
|
//只查我负责的花材
|
|
|
- $globalCgMyCharge = $get['globalCgMyCharge']??0;
|
|
|
+ $globalCgMyCharge = $get['globalCgMyCharge'] ?? 0;
|
|
|
$needCgList = [];
|
|
|
$shop = $this->shop;
|
|
|
- $bookSn = $shop->bookSn??0;
|
|
|
+ $bookSn = $shop->bookSn ?? 0;
|
|
|
$staff = $this->shopAdmin;
|
|
|
- $staffId = $staff->id??0;
|
|
|
- if(!empty($bookSn)){
|
|
|
- $biList = BookItemClass::getAllByCondition(['bookSn'=>$bookSn,'cgStaffId'=>$staffId],null,'*',null,true);
|
|
|
- if(!empty($biList)){
|
|
|
+ $staffId = $staff->id ?? 0;
|
|
|
+ if (!empty($bookSn)) {
|
|
|
+ $biList = BookItemClass::getAllByCondition(['bookSn' => $bookSn, 'cgStaffId' => $staffId], null, '*', null, true);
|
|
|
+ if (!empty($biList)) {
|
|
|
$myIds = [];
|
|
|
- foreach($biList as $biInfo){
|
|
|
- $biProductId = $biInfo->itemId??0;
|
|
|
- if($biInfo->needCgNum > 0){
|
|
|
+ foreach ($biList as $biInfo) {
|
|
|
+ $biProductId = $biInfo->itemId ?? 0;
|
|
|
+ if ($biInfo->needCgNum > 0) {
|
|
|
$myIds[] = $biProductId;
|
|
|
$needCgList[$biProductId] = $biInfo->needCgNum;
|
|
|
}
|
|
|
}
|
|
|
- if(!empty($myIds)){
|
|
|
- $where['id']=['in',$myIds];
|
|
|
+ if (!empty($myIds)) {
|
|
|
+ $where['id'] = ['in', $myIds];
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -226,12 +226,12 @@ class ItemController extends BaseController
|
|
|
util::fail('没有数据');
|
|
|
}
|
|
|
|
|
|
- if(!empty($needCgList)) {
|
|
|
+ if (!empty($needCgList)) {
|
|
|
//采购人采自己花材需要知道要采多少
|
|
|
- if(!empty($list)){
|
|
|
- foreach($list as $key => $val){
|
|
|
- $productId = $val['id']??0;
|
|
|
- if(isset($needCgList[$productId])){
|
|
|
+ if (!empty($list)) {
|
|
|
+ foreach ($list as $key => $val) {
|
|
|
+ $productId = $val['id'] ?? 0;
|
|
|
+ if (isset($needCgList[$productId])) {
|
|
|
$needCgNum = $needCgList[$productId];
|
|
|
$list[$key]['needCgNum'] = $needCgNum;
|
|
|
}
|
|
|
@@ -287,6 +287,24 @@ class ItemController extends BaseController
|
|
|
util::success($respond);
|
|
|
}
|
|
|
|
|
|
+ //借库存的花材列表 ssh 20240720
|
|
|
+ public function actionGetLoanList()
|
|
|
+ {
|
|
|
+ $get = Yii::$app->request->get();
|
|
|
+ $name = $get['name'] ?? '';
|
|
|
+ $num = $get['num'] ?? 0;
|
|
|
+ $where = ['mainId' => $this->mainId, 'delStatus' => 0];
|
|
|
+ if (!empty($name)) {
|
|
|
+ if (stringUtil::isLetter($name)) {
|
|
|
+ $where['py'] = ['like', $name];
|
|
|
+ } else {
|
|
|
+ $where['name'] = ['like', $name];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $respond = ItemClass::getLoanList($where, $num);
|
|
|
+ util::success($respond);
|
|
|
+ }
|
|
|
+
|
|
|
public function actionChangeFrontHide()
|
|
|
{
|
|
|
$get = Yii::$app->request->get();
|