|
@@ -100,11 +100,12 @@ class OrderImport extends Base
|
|
|
$id = $this->request->post('id/d', 0, 'trim');
|
|
|
|
|
|
$info = OIFCModel::alias('c')
|
|
|
- ->field('c.*,ce.*,b.company,ci.companyName CustomerCompanyName,s.name supplierName')
|
|
|
+ ->field('c.*,ce.*,b.company,ci.companyName CustomerCompanyName,s.name supplierName,a.activity_code')
|
|
|
->leftJoin('order_import_from_c_extend ce', 'ce.order_import_from_c_id=c.id')
|
|
|
->leftJoin('business b', 'b.companyNo=ce.companyNo AND b.is_del=0')
|
|
|
->leftJoin('customer_info ci', 'ci.companyNo=ce.customer_code AND ci.is_del=0')
|
|
|
->leftJoin('supplier s', 's.code=ce.supplierNo AND s.is_del=0')
|
|
|
+ ->leftJoin('activity_info a', 'a.id=ce.activity_id AND a.is_del=0')
|
|
|
->where('c.id', $id)
|
|
|
->find();
|
|
|
|
|
@@ -145,10 +146,11 @@ class OrderImport extends Base
|
|
|
//用户编辑字段
|
|
|
$user_update = Db::name('order_import_from_c_extend')
|
|
|
->alias('ce')
|
|
|
- ->field('ce.*,b.company,ci.companyName CustomerCompanyName,s.name supplierName')
|
|
|
+ ->field('ce.*,b.company,ci.companyName CustomerCompanyName,s.name supplierName,a.activity_code')
|
|
|
->leftJoin('business b', 'b.companyNo=ce.companyNo AND b.is_del=0')
|
|
|
->leftJoin('customer_info ci', 'ci.companyNo=ce.customer_code AND ci.is_del=0')
|
|
|
->leftJoin('supplier s', 's.code=ce.supplierNo AND s.is_del=0')
|
|
|
+ ->leftJoin('activity_info a', 'a.id=ce.activity_id AND a.is_del=0')
|
|
|
->where(['ce.order_import_from_c_id' => $id, 'ce.is_del' => 1])
|
|
|
->order('ce.addtime', 'desc')
|
|
|
->find();
|
|
@@ -267,14 +269,14 @@ class OrderImport extends Base
|
|
|
public function relationStockBatch()
|
|
|
{
|
|
|
|
|
|
- $param = $this->request->only(['ids','plat_code'], 'post', 'trim');
|
|
|
+ $param = $this->request->only(['ids', 'plat_code'], 'post', 'trim');
|
|
|
|
|
|
$val = Validate::rule([
|
|
|
- 'ids'=>'require',
|
|
|
- 'plat_code|平台商品编号'=>'require',
|
|
|
+ 'ids' => 'require',
|
|
|
+ 'plat_code|平台商品编号' => 'require',
|
|
|
]);
|
|
|
|
|
|
- if(!$val->check($param)) return error_show(1004, $val->getError());
|
|
|
+ if (!$val->check($param)) return error_show(1004, $val->getError());
|
|
|
|
|
|
$info = Db::name('order_import_from_c_extend')
|
|
|
->field('id,spuCode,companyNo')
|
|
@@ -287,13 +289,13 @@ class OrderImport extends Base
|
|
|
->where(['is_del' => OIFCModel::$is_del_normal, 'status' => OIFCModel::$status_stock_not_enough])
|
|
|
->sum('num');
|
|
|
$wsm_code = Db::name('warehouse_info')
|
|
|
- ->where(['companyNo'=>$info['companyNo'],'is_del'=>0])
|
|
|
+ ->where(['companyNo' => $info['companyNo'], 'is_del' => 0])
|
|
|
->value('wsm_code');
|
|
|
$usable_stock = Db::name('good_stock')
|
|
|
- ->where(['spuCode'=> $info['spuCode'],'wsm_code'=>$wsm_code,'is_del'=>0])
|
|
|
- ->value('usable_stock',0);
|
|
|
+ ->where(['spuCode' => $info['spuCode'], 'wsm_code' => $wsm_code, 'is_del' => 0])
|
|
|
+ ->value('usable_stock', 0);
|
|
|
|
|
|
- if($usable_stock<$num) return error_show(1005,'可用库存只有'.$usable_stock.',库存不足,关联失败');
|
|
|
+ if ($usable_stock < $num) return error_show(1005, '可用库存只有' . $usable_stock . ',库存不足,关联失败');
|
|
|
else {
|
|
|
|
|
|
$userinfo = GetUserInfo($this->post['token']);
|