|
|
@@ -8,6 +8,7 @@ namespace bizGhs\item\classes;
|
|
|
|
|
|
|
|
|
use bizGhs\base\classes\BaseClass;
|
|
|
+use common\components\util;
|
|
|
|
|
|
class ItemClass extends BaseClass
|
|
|
{
|
|
|
@@ -15,4 +16,60 @@ class ItemClass extends BaseClass
|
|
|
public static $baseFile = '\bizGhs\item\models\Item';
|
|
|
|
|
|
|
|
|
+ //新增花材
|
|
|
+ public static function addGhsItem($data)
|
|
|
+ {
|
|
|
+ $ghsId = $data['ghsId']??0;
|
|
|
+ $classId = $data['classId']??0;
|
|
|
+ $itemId = $data['itemId']??0;
|
|
|
+
|
|
|
+ if(!$ghsId){
|
|
|
+ util::fail("请选择供应商");
|
|
|
+ }
|
|
|
+ if(!$classId){
|
|
|
+ util::fail("请选择分类");
|
|
|
+ }
|
|
|
+ if(!$itemId){
|
|
|
+ util::fail("请选择花材");
|
|
|
+ }
|
|
|
+ //判断花材是否存在 调用平台花材的方法
|
|
|
+ //todo
|
|
|
+ $res = ItemClass::add($data);
|
|
|
+ return $res;
|
|
|
+ }
|
|
|
+
|
|
|
+ //批量新增花材(初始化使用)
|
|
|
+ public static function batchAddGhsItem($data)
|
|
|
+ {
|
|
|
+ ItemClass::batchAdd($data);
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ //修改花材的信息(库存预警、每扎加价、每扎重量)
|
|
|
+ public static function updateGshItem($id,$stockWarning,$unitAddPrice,$unitWeight)
|
|
|
+ {
|
|
|
+ $model = ItemClass::getById($id);
|
|
|
+ if(!$model){
|
|
|
+ util::fail("该花材不存在");
|
|
|
+ }
|
|
|
+ $data['stockWarning'] = $stockWarning;
|
|
|
+ $data['unitAddPrice'] = $unitAddPrice;
|
|
|
+ $data['unitWeight'] = $unitWeight;
|
|
|
+ ItemClass::updateById($id,$data);
|
|
|
+ return true;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ //删除花材
|
|
|
+ public static function deleteGhsItem($id)
|
|
|
+ {
|
|
|
+ $model = ItemClass::getById($id);
|
|
|
+ if(!$model){
|
|
|
+ util::fail("该花材不存在");
|
|
|
+ }
|
|
|
+ //todo 要修改相应得花材详情表
|
|
|
+
|
|
|
+ ItemClass::deleteById($id);
|
|
|
+ return true;
|
|
|
+ }
|
|
|
}
|