|
@@ -117,16 +117,22 @@ class Good extends \app\BaseController
|
|
|
}
|
|
|
|
|
|
public function GetStock(){
|
|
|
+ $condition=["a.is_del"=>0];
|
|
|
$type_code = isset($this->post['type_code']) &&$this->post['type_code'] !=="" ? trim($this->post['type_code']):"";
|
|
|
- if($type_code===""){
|
|
|
- return error_show(1005,"参数type_code 不能为空");
|
|
|
+ if($type_code!==""){
|
|
|
+ $good= Db::name("good_type")->where(["type_code"=>$type_code,"is_del"=>0])->find();
|
|
|
+ if(empty($good)){
|
|
|
+ return error_show(1005,"未找到数据");
|
|
|
+ }
|
|
|
+ $condition["a.good_type_code"]=$type_code;
|
|
|
}
|
|
|
- $good= Db::name("good_type")->where(["type_code"=>$type_code,"is_del"=>0])->find();
|
|
|
- if(empty($good)){
|
|
|
- return error_show(1005,"未找到数据");
|
|
|
+ $wsm_code = isset($this->post['wsm_code']) &&$this->post['wsm_code'] !=="" ? trim($this->post['wsm_code'])
|
|
|
+ :"";
|
|
|
+ if($wsm_code!==""){
|
|
|
+ $condition["a.wsm_code"]=$wsm_code;
|
|
|
}
|
|
|
$list = Db::name("good_stock")->alias("a")->join("warehouse_info b","a.wsm_code=b.wsm_code","left")->join("supplier c","b.supplierNo=c.code","left")
|
|
|
- ->where(["a.is_del"=>0,"good_type_code"=>$type_code])->field("a.id,b.name,c.code,c.name,a.wait_in_stock,a.wait_out_stock,a.usable_stock,a.intra_stock,a.total_stock,a.status,a.warn_stock")->select();
|
|
|
+ ->where($condition)->field("a.id,b.name,c.code,c.name,a.wait_in_stock,a.wait_out_stock,a.usable_stock,a.intra_stock,a.total_stock,a.status,a.warn_stock")->select();
|
|
|
return app_show(0,"获取成功",$list);
|
|
|
}
|
|
|
|