|
|
@@ -3,6 +3,7 @@
|
|
|
namespace bizHd\work\classes;
|
|
|
|
|
|
use bizGhs\product\classes\ProductClass;
|
|
|
+use common\components\arrayUtil;
|
|
|
use common\components\dict;
|
|
|
use common\components\imgUtil;
|
|
|
use common\components\util;
|
|
|
@@ -14,6 +15,33 @@ class WorkItemClass extends BaseClass
|
|
|
|
|
|
public static $baseFile = '\bizHd\work\models\WorkItem';
|
|
|
|
|
|
+ public static function waste($work, $wastage)
|
|
|
+ {
|
|
|
+ //[{"productId":"12253","num":1,"unitType":0}]
|
|
|
+ $wast = arrayUtil::arraySort($wastage, 'productId');
|
|
|
+
|
|
|
+ $workSn = $work->workSn ?? '';
|
|
|
+ $itemList = self::getAllByCondition(['workSn' => $workSn], null, '*', null, true);
|
|
|
+ if (!empty($itemList)) {
|
|
|
+ foreach ($itemList as $key => $item) {
|
|
|
+ $itemId = $item->itemId ?? 0;
|
|
|
+ $wastNum = $wast[$itemId]['num'];
|
|
|
+ $wastUnitType = $wast[$itemId]['unitType'];
|
|
|
+ $bigName = $item->bigName ?? '';
|
|
|
+ $smallName = $item->smallName ?? '';
|
|
|
+ $wastUnitName = $wastUnitType == dict::getDict('unitType', 'big') ? $bigName : $smallName;
|
|
|
+
|
|
|
+ $item->wastNum = $wastNum;
|
|
|
+ $item->wastUnitType = $wastUnitType;
|
|
|
+ $item->wastUnitName = $wastUnitName;
|
|
|
+ $item->save();
|
|
|
+
|
|
|
+ //todo 相应库存扣除
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
//取消锁定,释放库存 ssh 20220320
|
|
|
public static function cancelLock($work)
|
|
|
{
|
|
|
@@ -93,10 +121,13 @@ class WorkItemClass extends BaseClass
|
|
|
//锁定用材 ssh 20220320
|
|
|
public static function lock($work)
|
|
|
{
|
|
|
- if ($work->hasLock == 1) {
|
|
|
- return false;
|
|
|
+ $workSn = $work->workSn ?? '';
|
|
|
+ $list = self::getAllByCondition(['workSn' => $workSn], null, '*', null, true);
|
|
|
+ if (!empty($list)) {
|
|
|
+ foreach ($list as $key => $item) {
|
|
|
+ //todo 库存处理
|
|
|
+ }
|
|
|
}
|
|
|
- //todo 库存需要扣除
|
|
|
}
|
|
|
|
|
|
//获取工单的所有花材信息 ssh 20220320
|