|
@@ -261,7 +261,6 @@ class Allot extends BaseController
|
|
|
if(empty($etid)){
|
|
|
return error_show(1002,"未找到数据");
|
|
|
}
|
|
|
- $allot_code = isset($this->post['allot_code']) && $this->post['allot_code'] !=="" ? trim($this->post['allot_code']) :"";
|
|
|
$post_name = isset($this->post['post_name']) && $this->post['post_name'] !=="" ? trim($this->post['post_name']) :"";
|
|
|
$post_code = isset($this->post['post_code']) && $this->post['post_code'] !=="" ? trim($this->post['post_code']) :"";
|
|
|
$apply_id =GetUserInfo($token);
|
|
@@ -269,7 +268,7 @@ class Allot extends BaseController
|
|
|
return error_show(1002,"申请人数据不存在");
|
|
|
}
|
|
|
$rm= isset($apply_id["data"]['id']) ? $apply_id["data"]['id'] : "";
|
|
|
- $ri= isset($apply_name["data"]['nickname']) ? $apply_name["data"]['nickname'] : "";
|
|
|
+ $ri= isset($apply_id["data"]['nickname']) ? $apply_id["data"]['nickname'] : "";
|
|
|
$wsm_out = isset($this->post['wsm_out']) && $this->post['wsm_out'] !=="" ? trim($this->post['wsm_out']) :"" ;
|
|
|
if($wsm_out==""){
|
|
|
return error_show(1002,"出库仓库不能为空");
|
|
@@ -290,7 +289,6 @@ class Allot extends BaseController
|
|
|
Db::startTrans();
|
|
|
try{
|
|
|
$data=[
|
|
|
- "allot_code"=>$allot_code,
|
|
|
"apply_id"=>$rm,
|
|
|
"apply_name"=>$ri,
|
|
|
"wsm_out"=>$wsm_out,
|
|
@@ -298,7 +296,6 @@ class Allot extends BaseController
|
|
|
"post_fee"=>$post_fee,
|
|
|
"post_name"=>$post_name,
|
|
|
"post_code"=>$post_code,
|
|
|
-// "status"=>$status,
|
|
|
"updatetime"=>date('Y-m-d H:i:s'),
|
|
|
];
|
|
|
$da = Db::name('allot_stock')->where(["id"=>$id,"is_del"=>0])->save($data);
|
|
@@ -312,7 +309,16 @@ class Allot extends BaseController
|
|
|
Db::rollback();
|
|
|
return error_show(1003, "商品不能为空");
|
|
|
}
|
|
|
+ if(isset($value['id'])&&$value['id']!==""){
|
|
|
+ $good = Db::name('allot_info')->where(["id"=>$value['id'],"is_del"=>0])->find();
|
|
|
+ if(empty($good)||$good['allot_code']!=$etid['allot_code']){
|
|
|
+ Db::rollback();
|
|
|
+ return error_show(2000,"商品不属于此次调拨");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
if($value['allot_num']>$st['usable_stock']){
|
|
|
+ Db::rollback();
|
|
|
return error_show(2000,"库存数量不足");
|
|
|
}
|
|
|
$temp = [];
|