|
@@ -65,7 +65,8 @@ public function list()
|
|
|
$list = Db::name('good_check')->alias('a')->join("warehouse_info b","a.wsm_code = b.wsm_code","left")
|
|
|
->join("depart_user c","c.uid=a.apply_id","left")
|
|
|
->join("company_item d","d.id=c.itemid","left")
|
|
|
- ->field("a.apply_id,a.apply_name,a.type,a.addtime,a.wsm_code,a.check_code,b.name,c.itemid,d.name as 'rename',a.id")->where($where)->page($page,$size)->select();
|
|
|
+ ->join("supplier v","v.code=b.supplierNo","left")
|
|
|
+ ->field("a.status,a.apply_id,a.apply_name,a.type,a.addtime,a.wsm_code,a.check_code,b.name,c.itemid,d.name as 'rename',a.id,v.name as 'caname',v.code")->where($where)->page($page,$size)->select();
|
|
|
return app_show(0,"获取成功",['count'=>$count,'list'=>$list]);
|
|
|
}
|
|
|
public function goodlist(){
|
|
@@ -101,23 +102,23 @@ public function create(){
|
|
|
$rm= isset($apply_id["data"]['id']) ? $apply_id["data"]['id'] : "";
|
|
|
$ri= isset($apply_name["data"]['nickname']) ? $apply_name["data"]['nickname'] : "";
|
|
|
$status = isset($this->post['status']) && $this->post['status'] !=="" ? intval($this->post['status']) :"0";
|
|
|
- $dain=isset($this->post['good']) && $this->post['good'] !=="" ? trim($this->post['good']):"";
|
|
|
- if($type==2){
|
|
|
- if($dain==""||empty($dain)){
|
|
|
- return error_show(1002,"商品不能为空");
|
|
|
- }
|
|
|
- }else{
|
|
|
- if($type==1) {
|
|
|
-
|
|
|
- $dain= Db::name("good_type")->alias("b")->join("good a","a.good_code = b.good_code","left")
|
|
|
- ->join("good_stock c","c.good_type_code = b.type_code","left")->where(['c.wsm_code'=>$wsm_code,'b.is_del'=>0,'a.is_del'=>0])->where("c.is_del=0 or c.is_del is null")
|
|
|
- ->field("b.type_code,a.good_name")->select();
|
|
|
- //var_dump($dain);
|
|
|
- }
|
|
|
- if($dain==""){
|
|
|
- return error_show(1003,"商品不能为空");
|
|
|
- }
|
|
|
- }
|
|
|
+// $dain=isset($this->post['good']) && $this->post['good'] !=="" ? trim($this->post['good']):"";
|
|
|
+// if($type==2){
|
|
|
+// if($dain==""||empty($dain)){
|
|
|
+// return error_show(1002,"商品不能为空");
|
|
|
+// }
|
|
|
+// }else{
|
|
|
+// if($type==1) {
|
|
|
+//
|
|
|
+// $dain= Db::name("good_type")->alias("b")->join("good a","a.good_code = b.good_code","left")
|
|
|
+// ->join("good_stock c","c.good_type_code = b.type_code","left")->where(['c.wsm_code'=>$wsm_code,'b.is_del'=>0,'a.is_del'=>0])->where("c.is_del=0 or c.is_del is null")
|
|
|
+// ->field("b.type_code,a.good_name")->select();
|
|
|
+// //var_dump($dain);
|
|
|
+// }
|
|
|
+// if($dain==""){
|
|
|
+// return error_show(1003,"商品不能为空");
|
|
|
+// }
|
|
|
+// }
|
|
|
Db::startTrans();
|
|
|
try{
|
|
|
$data=[
|
|
@@ -132,33 +133,33 @@ public function create(){
|
|
|
"updatetime"=>date("Y-m-d H:i:s")
|
|
|
];
|
|
|
$da= Db::name('good_check')->insert($data,true);
|
|
|
- $dio=[];
|
|
|
- if($da>0){
|
|
|
- foreach ($dain as $value){
|
|
|
- $st=Db::name("good_type")->alias("b")->join("good a","a.good_code = b.good_code","left")
|
|
|
- ->join("good_stock c","c.good_type_code = b.type_code","left")->where(['c.wsm_code'=>$wsm_code,'good_type_code'=>$value['type_code'],'b.is_del'=>0,'a.is_del'=>0])->where("c.is_del=0 or c.is_del is null")
|
|
|
- ->field("b.type_code,a.good_name,c.wsm_code,c.wait_in_stock,c.wait_out_stock,c.usable_stock,c.good_type_code,a.original_price")->find();
|
|
|
-
|
|
|
- $temp=[];
|
|
|
- $temp['good_name']=$st['good_name'];
|
|
|
- $temp['origin_price']=$st['original_price'];
|
|
|
- $temp['good_type_code']=$st['good_type_code'];
|
|
|
- $temp['origin_num']=$st['usable_stock'];
|
|
|
- $temp['check_num']=0;
|
|
|
- $temp['diff_num']=0;
|
|
|
- $temp['status']=0;
|
|
|
- $temp['remark']="";
|
|
|
- $temp['is_del']=0;
|
|
|
- $temp['check_time']=date('Y-m-d H:i:s');
|
|
|
- $temp['check_code']=$check_code;
|
|
|
- $temp['addtime']=date("Y-m-d H:i:s");
|
|
|
- $temp['updatetime']=date("Y-m-d H:i:s");
|
|
|
- $dio[] =$temp;
|
|
|
- }
|
|
|
- $in= Db::name('check_item')->insertAll($dio);
|
|
|
- }
|
|
|
- if($in){
|
|
|
- Db::commit();
|
|
|
+// $dio=[];
|
|
|
+// if($da>0){
|
|
|
+// foreach ($dain as $value){
|
|
|
+// $st=Db::name("good_type")->alias("b")->join("good a","a.good_code = b.good_code","left")
|
|
|
+// ->join("good_stock c","c.good_type_code = b.type_code","left")->where(['c.wsm_code'=>$wsm_code,'good_type_code'=>$value['type_code'],'b.is_del'=>0,'a.is_del'=>0])->where("c.is_del=0 or c.is_del is null")
|
|
|
+// ->field("b.type_code,a.good_name,c.wsm_code,c.wait_in_stock,c.wait_out_stock,c.usable_stock,c.good_type_code,a.original_price")->find();
|
|
|
+//
|
|
|
+// $temp=[];
|
|
|
+// $temp['good_name']=$st['good_name'];
|
|
|
+// $temp['origin_price']=$st['original_price'];
|
|
|
+// $temp['good_type_code']=$st['good_type_code'];
|
|
|
+// $temp['origin_num']=$st['usable_stock'];
|
|
|
+// $temp['check_num']=0;
|
|
|
+// $temp['diff_num']=0;
|
|
|
+// $temp['status']=0;
|
|
|
+// $temp['remark']="";
|
|
|
+// $temp['is_del']=0;
|
|
|
+// $temp['check_time']=date('Y-m-d H:i:s');
|
|
|
+// $temp['check_code']=$check_code;
|
|
|
+// $temp['addtime']=date("Y-m-d H:i:s");
|
|
|
+// $temp['updatetime']=date("Y-m-d H:i:s");
|
|
|
+// $dio[] =$temp;
|
|
|
+// }
|
|
|
+// $in= Db::name('check_item')->insertAll($dio);
|
|
|
+// }
|
|
|
+ if($da){
|
|
|
+ Db::commit();
|
|
|
return error_show(0,"盘点创建成功");
|
|
|
}else{
|
|
|
Db::rollback();
|
|
@@ -167,7 +168,7 @@ public function create(){
|
|
|
}catch (\Exception $e){
|
|
|
Db::rollback();
|
|
|
return error_show(1005,$e->getMessage());
|
|
|
- }
|
|
|
+ }
|
|
|
}
|
|
|
public function info(){
|
|
|
$id = isset($this->post['id']) && $this->post['id'] !=="" ? intval($this->post['id']) :"";
|
|
@@ -223,24 +224,24 @@ public function edit()
|
|
|
}
|
|
|
$rm= isset($apply_id["data"]['id']) ? $apply_id["data"]['id'] : "";
|
|
|
$ri= isset($apply_name["data"]['nickname']) ? $apply_name["data"]['nickname'] : "";
|
|
|
- $dain=isset($this->post['good']) && $this->post['good'] !=="" ? $this->post['good']:"";
|
|
|
- if($type==2){
|
|
|
- // var_dump($dain);
|
|
|
- if($dain==""||empty($dain)){
|
|
|
- return error_show(1002,"商品不能为空");
|
|
|
- }
|
|
|
- }else{
|
|
|
- if($type==1) {
|
|
|
-
|
|
|
- $dain= Db::name("good_type")->alias("b")->join("good a","a.good_code = b.good_code","left")
|
|
|
- ->join("good_stock c","c.good_type_code = b.type_code","left")->where(['c.wsm_code'=>$wsm_code,'b.is_del'=>0,'a.is_del'=>0])->where("c.is_del=0 or c.is_del is null")
|
|
|
- ->field("b.type_code,a.good_name")->select();
|
|
|
- //var_dump($dain);
|
|
|
- }
|
|
|
- if($dain==""){
|
|
|
- return error_show(1003,"商品不能为空");
|
|
|
- }
|
|
|
- }
|
|
|
+// $dain=isset($this->post['good']) && $this->post['good'] !=="" ? $this->post['good']:"";
|
|
|
+// if($type==2){
|
|
|
+// // var_dump($dain);
|
|
|
+// if($dain==""||empty($dain)){
|
|
|
+// return error_show(1002,"商品不能为空");
|
|
|
+// }
|
|
|
+// }else{
|
|
|
+// if($type==1) {
|
|
|
+//
|
|
|
+// $dain= Db::name("good_type")->alias("b")->join("good a","a.good_code = b.good_code","left")
|
|
|
+// ->join("good_stock c","c.good_type_code = b.type_code","left")->where(['c.wsm_code'=>$wsm_code,'b.is_del'=>0,'a.is_del'=>0])->where("c.is_del=0 or c.is_del is null")
|
|
|
+// ->field("b.type_code,a.good_name")->select();
|
|
|
+// //var_dump($dain);
|
|
|
+// }
|
|
|
+// if($dain==""){
|
|
|
+// return error_show(1003,"商品不能为空");
|
|
|
+// }
|
|
|
+// }
|
|
|
Db::startTrans();
|
|
|
try {
|
|
|
$var = [
|
|
@@ -251,36 +252,36 @@ public function edit()
|
|
|
"updatetime" => date("Y-m-d H:i:s")
|
|
|
];
|
|
|
$up = Db::name('good_check')->where(['id'=>$id,'is_del' => 0])->save($var);
|
|
|
- $dn =[];
|
|
|
- if($up>0){
|
|
|
- foreach ($dain as $value){
|
|
|
- $st=Db::name("good_type")->alias("b")->join("good a","a.good_code = b.good_code","left")
|
|
|
- ->join("good_stock c","c.good_type_code = b.type_code","left")->where(['c.wsm_code'=>$wsm_code,'good_type_code'=>$value['type_code'],'b.is_del'=>0,'a.is_del'=>0])->where("c.is_del=0 or c.is_del is null")
|
|
|
- ->field("b.type_code,a.good_name,c.wsm_code,c.wait_in_stock,c.wait_out_stock,c.usable_stock,c.good_type_code,a.original_price")->find();
|
|
|
- $temp=[];
|
|
|
- $temp['good_name']=$st['good_name'];
|
|
|
- $temp['origin_price']=$st['original_price'];
|
|
|
- $temp['good_type_code']=$st['good_type_code'];
|
|
|
- $temp['origin_num']=$st['usable_stock'];
|
|
|
- $temp['check_num']=0;
|
|
|
- $temp['diff_num']=0;
|
|
|
- $temp['status']=0;
|
|
|
- $temp['remark']="";
|
|
|
- $temp['is_del']=0;
|
|
|
- $temp['check_time']=date('Y-m-d H:i:s');
|
|
|
- $temp['check_code']=$eid['check_code'];
|
|
|
- $temp['addtime']=date("Y-m-d H:i:s");
|
|
|
- $temp['updatetime']=date("Y-m-d H:i:s");
|
|
|
- $dn[] =$temp;
|
|
|
- }
|
|
|
- $np = Db::name('check_item')->where(['check_code'=>$eid['check_code'],'is_del'=>0])->update(['is_del'=>1,'updatetime'=>date('Y-m-d H:i:s')]);
|
|
|
- $io = db::name('check_item')->insertAll($dn);
|
|
|
+// $dn =[];
|
|
|
+// if($up>0){
|
|
|
+// foreach ($dain as $value){
|
|
|
+// $st=Db::name("good_type")->alias("b")->join("good a","a.good_code = b.good_code","left")
|
|
|
+// ->join("good_stock c","c.good_type_code = b.type_code","left")->where(['c.wsm_code'=>$wsm_code,'good_type_code'=>$value['type_code'],'b.is_del'=>0,'a.is_del'=>0])->where("c.is_del=0 or c.is_del is null")
|
|
|
+// ->field("b.type_code,a.good_name,c.wsm_code,c.wait_in_stock,c.wait_out_stock,c.usable_stock,c.good_type_code,a.original_price")->find();
|
|
|
+// $temp=[];
|
|
|
+// $temp['good_name']=$st['good_name'];
|
|
|
+// $temp['origin_price']=$st['original_price'];
|
|
|
+// $temp['good_type_code']=$st['good_type_code'];
|
|
|
+// $temp['origin_num']=$st['usable_stock'];
|
|
|
+// $temp['check_num']=0;
|
|
|
+// $temp['diff_num']=0;
|
|
|
+// $temp['status']=0;
|
|
|
+// $temp['remark']="";
|
|
|
+// $temp['is_del']=0;
|
|
|
+// $temp['check_time']=date('Y-m-d H:i:s');
|
|
|
+// $temp['check_code']=$eid['check_code'];
|
|
|
+// $temp['addtime']=date("Y-m-d H:i:s");
|
|
|
+// $temp['updatetime']=date("Y-m-d H:i:s");
|
|
|
+// $dn[] =$temp;
|
|
|
+// }
|
|
|
+// $np = Db::name('check_item')->where(['check_code'=>$eid['check_code'],'is_del'=>0])->update(['is_del'=>1,'updatetime'=>date('Y-m-d H:i:s')]);
|
|
|
+// $io = db::name('check_item')->insertAll($up);
|
|
|
// var_dump(Db::name('check_item')->getLastSql());
|
|
|
- if ($io) {
|
|
|
+ if ($up) {
|
|
|
Db::commit();
|
|
|
return error_show(0, "盘点更新成功");
|
|
|
}
|
|
|
- }
|
|
|
+
|
|
|
Db::rollback();
|
|
|
return error_show(1003,"盘点更新失败");
|
|
|
} catch (\Exception $e) {
|