|
@@ -4,6 +4,7 @@ namespace app\admin\controller\pig;
|
|
|
|
|
|
use app\common\controller\Backend;
|
|
|
use think\Db;
|
|
|
+use app\admin\model\pig\Company;
|
|
|
|
|
|
/**
|
|
|
* 订单
|
|
@@ -83,6 +84,16 @@ class Order extends Backend
|
|
|
$this->error('生成码数量需要大于0!');
|
|
|
}
|
|
|
|
|
|
+ if (!$params['customer_id'] || !$params['supplier_id']) {
|
|
|
+ $this->error('请选择供应商和者客户!');
|
|
|
+ }
|
|
|
+
|
|
|
+ $company = new Company();
|
|
|
+ $customer = $company->where('id', $params['customer_id'])->find();
|
|
|
+ if (!$customer) {
|
|
|
+ $this->error('请选择客户!');
|
|
|
+ }
|
|
|
+
|
|
|
if ($this->dataLimit && $this->dataLimitFieldAutoFill) {
|
|
|
$params[$this->dataLimitField] = $this->auth->id;
|
|
|
}
|
|
@@ -137,7 +148,12 @@ class Order extends Backend
|
|
|
} else {
|
|
|
$params['code'] = $str.$list[count($list)-1]['id'];
|
|
|
}
|
|
|
+
|
|
|
|
|
|
+ $params['company_id'] = $this->auth->company_id;
|
|
|
+ $params['source_id'] = $this->auth->province_id;
|
|
|
+ $params['province_id'] = $customer['province_id'];
|
|
|
+
|
|
|
$params['num'] = $num;
|
|
|
$result = $this->model->allowField(true)->save($params);
|
|
|
Db::commit();
|