|
@@ -312,12 +312,12 @@ class Purch extends Base
|
|
$im = Db::name('purchease_back')->where(['cgdNo' => $data['cgdNo'], 'is_del' => 0])->select();
|
|
$im = Db::name('purchease_back')->where(['cgdNo' => $data['cgdNo'], 'is_del' => 0])->select();
|
|
$var = [];
|
|
$var = [];
|
|
foreach ($im as $value) {
|
|
foreach ($im as $value) {
|
|
- if ($data['order_type'] == 3) {
|
|
|
|
- $goo = Db::name("good_zixun")->where(["spuCode" => $value['spuCode'], "is_del" => 0])->find();
|
|
|
|
|
|
+ if (in_array($data['order_type'], [3, 4])) {
|
|
|
|
+ $goo = Db::name("good_zixun")->field('cat_id')->where(["spuCode" => $value['spuCode'], "is_del" => 0])->findOrEmpty();
|
|
} else {
|
|
} else {
|
|
- $goo = Db::name('good_basic')->where(['spuCode' => $value['spuCode']])->find();
|
|
|
|
|
|
+ $goo = Db::name('good_basic')->field('cat_id')->where(['spuCode' => $value['spuCode']])->findOrEmpty();
|
|
}
|
|
}
|
|
- if ($goo == false) {
|
|
|
|
|
|
+ if (empty($goo)) {
|
|
return error_show(1002, "未找到商品数据");
|
|
return error_show(1002, "未找到商品数据");
|
|
}
|
|
}
|
|
$cat = isset($goo['cat_id']) && $goo['cat_id'] != 0 ? made($goo['cat_id']) : [];
|
|
$cat = isset($goo['cat_id']) && $goo['cat_id'] != 0 ? made($goo['cat_id']) : [];
|
|
@@ -326,7 +326,7 @@ class Purch extends Base
|
|
}
|
|
}
|
|
//采购工差单
|
|
//采购工差单
|
|
$dom = Db::name("purchease_diff")->where(['cgdNo' => $data['cgdNo'], 'is_del' => 0])->find();
|
|
$dom = Db::name("purchease_diff")->where(['cgdNo' => $data['cgdNo'], 'is_del' => 0])->find();
|
|
- if ($data['order_type'] == 3) {
|
|
|
|
|
|
+ if (in_array($data['order_type'], [3, 4])) {
|
|
$goon = Db::name("good_zixun")->where(["spuCode" => $data['spuCode'], "is_del" => 0])->find();
|
|
$goon = Db::name("good_zixun")->where(["spuCode" => $data['spuCode'], "is_del" => 0])->find();
|
|
} else {
|
|
} else {
|
|
$goon = Db::name('good_basic')->where(['spuCode' => $data['spuCode']])->find();
|
|
$goon = Db::name('good_basic')->where(['spuCode' => $data['spuCode']])->find();
|