|
|
@@ -14,8 +14,33 @@ class LabelController extends BaseController
|
|
|
{
|
|
|
$post = Yii::$app->request->post();
|
|
|
$data = $post['data'] ?? '';
|
|
|
+ $arr = json_decode($data, true);
|
|
|
+ if (empty($arr)) {
|
|
|
+ util::fail('没有电子标');
|
|
|
+ }
|
|
|
$ptItemId = $post['ptItemId'] ?? 0;
|
|
|
- util::complete();
|
|
|
+ if (empty($ptItemId)) {
|
|
|
+ util::fail('没有花材信息');
|
|
|
+ }
|
|
|
+print_r($arr);die;
|
|
|
+ $list = LabelClass::getAllByCondition(['mainId' => $this->mainId, 'use' => 0], null, '*');
|
|
|
+ $has = [];
|
|
|
+ if (!empty($list)) {
|
|
|
+ $has = array_column($list, 'epc');
|
|
|
+ }
|
|
|
+ $connection = Yii::$app->db;//事务处理
|
|
|
+ $transaction = $connection->beginTransaction();
|
|
|
+ try {
|
|
|
+ foreach ($arr as $epc) {
|
|
|
+
|
|
|
+ }
|
|
|
+ $transaction->commit();
|
|
|
+ util::complete('操作成功');
|
|
|
+ } catch (\Exception $e) {
|
|
|
+ $transaction->rollBack();
|
|
|
+ Yii::info("保存失败原因:" . $e->getMessage());
|
|
|
+ util::fail('保存失败');
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
//获取我没有使用的电子标 ssh 20230817
|