|
@@ -177,11 +177,11 @@ class Resign extends Base
|
|
|
if($lastime===""){
|
|
|
return error_show(1004,"参数lastime不能为空");
|
|
|
}
|
|
|
- $data = GetUserInfo($token);
|
|
|
- if((!empty($data) && $data['code']!=0) ||empty($data) ){
|
|
|
- return error_show($data['code'],$data['message']);
|
|
|
- }
|
|
|
- $userinfo = $data['data'];
|
|
|
+// $data = GetUserInfo($token);
|
|
|
+// if((!empty($data) && $data['code']!=0) ||empty($data) ){
|
|
|
+// return error_show($data['code'],$data['message']);
|
|
|
+// }
|
|
|
+// $userinfo = $data['data'];
|
|
|
$bk_code=makeNo("BK");
|
|
|
$info = [
|
|
|
"spuCode"=>$good['spuCode'],
|
|
@@ -198,16 +198,16 @@ class Resign extends Base
|
|
|
"cgderid"=>$good['createrid'],
|
|
|
"addtime"=>date("Y-m-d H:i:s"),
|
|
|
"updatetime"=>date("Y-m-d H:i:s"),
|
|
|
- "apply_id"=>$userinfo['id'],
|
|
|
- "apply_name"=>$userinfo['nickname'],
|
|
|
+ "apply_id"=>$this->uid,
|
|
|
+ "apply_name"=>$this->uname,
|
|
|
"bk_code"=>$bk_code
|
|
|
];
|
|
|
$in = Db::name("purchease")->insert($info,true);
|
|
|
if($in>0){
|
|
|
- $order=["order_type"=>'BHD',"order_code"=>$bk_code,"order_id"=>$in,"order_status"=>1,"before_status"=>1, 'holder_id' => $info['apply_id']];
|
|
|
- ProcessOrder::AddProcess($token,$order);
|
|
|
- $ste = ["order_code"=>$bk_code,"status"=>0,"action_remark"=>'',"action_type"=>"create"];
|
|
|
- ActionLog::logAdd($token,$ste,"BHD",1,$info);
|
|
|
+ $order = ["order_type" => 'BHD', "order_code" => $bk_code, "order_id" => $in, "order_status" => 1, "before_status" => 1, 'wait_id' => $supplier['personid'], 'wait_name' => $supplier['person']];
|
|
|
+ ProcessOrder::AddProcess(['id' => $this->uid, 'nickname' => $this->uname], $order);
|
|
|
+ $ste = ["order_code" => $bk_code, "status" => 0, "action_remark" => '', "action_type" => "create"];
|
|
|
+ ActionLog::logAdd(['id' => $this->uid, 'nickname' => $this->uname], $ste, "BHD", 1, $info);
|
|
|
|
|
|
//台账记录
|
|
|
Db::name('standing_book')
|
|
@@ -239,31 +239,35 @@ class Resign extends Base
|
|
|
if(empty($info)){
|
|
|
return error_show(1002,'未找到数据');
|
|
|
}
|
|
|
- $data = GetUserInfo($this->post['token']);
|
|
|
- if((!empty($data) && $data['code']!=0) ||empty($data) ){
|
|
|
- return error_show($data['code'],$data['message']);
|
|
|
- }
|
|
|
+// $data = GetUserInfo($this->post['token']);
|
|
|
+// if((!empty($data) && $data['code']!=0) ||empty($data) ){
|
|
|
+// return error_show($data['code'],$data['message']);
|
|
|
+// }
|
|
|
//查验仓库库存数量
|
|
|
// $stock =Db::name("good_stock")->alias("a")->leftJoin("warehouse_info b","a.wsm_code=b.wsm_code")->where
|
|
|
// (["spuCode"=>$info['spuCode'], "a.is_del"=>0,"a.status"=>1,"b.companyNo"=>$info['companyNo']])->field("a.id,a.usable_stock,a.wait_out_stock")->find();
|
|
|
// if(isset($stock['usable_stock'])&& $stock['usable_stock']!=0){
|
|
|
// return error_show(1003,"库存数量为 {$stock['usable_stock']} 无法备库");
|
|
|
// }
|
|
|
- $userinfo = $data['data'];
|
|
|
+// $userinfo = $data['data'];
|
|
|
$bk_code=makeNo("BK");
|
|
|
$info['bk_code']=$bk_code;
|
|
|
$info['status']=1;
|
|
|
$info['addtime']=date("Y-m-d H:i:s");
|
|
|
$info['updatetime']=date("Y-m-d H:i:s");
|
|
|
- $info['apply_id']=$userinfo['id'];
|
|
|
- $info['apply_name']=$userinfo['nickname'];
|
|
|
+ $info['apply_id']=$this->uid;
|
|
|
+ $info['apply_name']=$this->uname;
|
|
|
unset($info['id']);
|
|
|
$in = Db::name("purchease")->insert($info,true);
|
|
|
if($in>0){
|
|
|
- $order=["order_type"=>'BHD',"order_code"=>$bk_code,"order_id"=>$in,"order_status"=>1,"before_status"=>1, 'holder_id' => $info['apply_id']];
|
|
|
- ProcessOrder::AddProcess($this->post['token'],$order);
|
|
|
+ $supplier = Db::name('supplier')
|
|
|
+ ->field('id,person,personid')
|
|
|
+ ->where('code', $info['supplierNo'])
|
|
|
+ ->findOrEmpty();
|
|
|
+ $order = ["order_type" => 'BHD', "order_code" => $bk_code, "order_id" => $in, "order_status" => 1, "before_status" => 1, 'wait_id' => $supplier['personid'], 'wait_name' => $supplier['person']];
|
|
|
+ ProcessOrder::AddProcess(['id' => $this->uid, 'nickname' => $this->uname], $order);
|
|
|
$ste = ["order_code"=>$bk_code,"status"=>0,"action_remark"=>'',"action_type"=>"create"];
|
|
|
- ActionLog::logAdd($this->post['token'],$ste,"BHD",1,$info);
|
|
|
+ ActionLog::logAdd(['id' => $this->uid, 'nickname' => $this->uname],$ste,"BHD",1,$info);
|
|
|
return app_show(0,"新建成功",['bk_code'=>$bk_code]);
|
|
|
}else{
|
|
|
return error_show(1005,"新建失败");
|
|
@@ -354,11 +358,11 @@ class Resign extends Base
|
|
|
if($good==false){
|
|
|
return error_show(1004,"未找到商品数据");
|
|
|
}
|
|
|
- $data = GetUserInfo($token);
|
|
|
- if((!empty($data) && $data['code']!=0) ||empty($data) ){
|
|
|
- return error_show($data['code'],$data['message']);
|
|
|
- }
|
|
|
- $userinfo = $data['data'];
|
|
|
+// $data = GetUserInfo($token);
|
|
|
+// if((!empty($data) && $data['code']!=0) ||empty($data) ){
|
|
|
+// return error_show($data['code'],$data['message']);
|
|
|
+// }
|
|
|
+// $userinfo = $data['data'];
|
|
|
$up = [
|
|
|
"spuCode"=>$good_code,
|
|
|
"good_name"=>$good['good_name'],
|
|
@@ -421,8 +425,17 @@ class Resign extends Base
|
|
|
$info['updatetime']=date("Y-m-d H:i:s");
|
|
|
$up = Db::name("purchease")->update($info);
|
|
|
if($up){
|
|
|
+
|
|
|
+ if($status==1){
|
|
|
+ $supplier = Db::name('supplier')
|
|
|
+ ->field('id,person,personid')
|
|
|
+ ->where('code', $info['supplierNo'])
|
|
|
+ ->findOrEmpty();
|
|
|
+ $order = ["order_type" => 'BHD', "order_code" => $info['bk_code'], "order_id" => $info['id'], "order_status" => $status, "before_status" => $temp,'wait_id' => $supplier['personid'], 'wait_name' => $supplier['person']];
|
|
|
+ }else $order = ["order_type" => 'BHD', "order_code" => $info['bk_code'], "order_id" => $info['id'], "order_status" => $status, "before_status" => $temp, 'holder_id' => $info['apply_id']];
|
|
|
$order = ["order_type" => 'BHD', "order_code" => $info['bk_code'], "order_id" => $info['id'], "order_status" => $status, "before_status" => $temp, 'holder_id' => $info['apply_id']];
|
|
|
ProcessOrder::AddProcess($this->post['token'],$order);
|
|
|
+
|
|
|
$ste = ["order_code"=>$info['bk_code'],"status"=> $temp,"action_remark"=>'',"action_type"=>"status"];
|
|
|
ActionLog::logAdd($this->post['token'],$ste,"BHD",$status,$info);
|
|
|
return app_show(0,"更新成功",['bk_code'=>$info['bk_code']]);
|
|
@@ -628,8 +641,14 @@ class Resign extends Base
|
|
|
$feed['updatetime']=date("Y-m-d H:i:s");
|
|
|
$up = Db::name("purchease")->update($feed);
|
|
|
if($up){
|
|
|
- $order=["order_type"=>'BHD',"order_code"=>$feed['bk_code'],"order_id"=>$feed['id'], "order_status"=>$feed['status'],"before_status"=>$tem, 'holder_id' => $feed['apply_id']];
|
|
|
- ProcessOrder::AddProcess($this->post['token'],$order);
|
|
|
+ if ($feed['status'] == 1) {
|
|
|
+ $supplier = Db::name('supplier')
|
|
|
+ ->field('id,person,personid')
|
|
|
+ ->where('code', $feed['supplierNo'])
|
|
|
+ ->findOrEmpty();
|
|
|
+ $order = ["order_type" => 'BHD', "order_code" => $feed['bk_code'], "order_id" => $feed['id'], "order_status" => $feed['status'], "before_status" => $tem, 'holder_id' => $feed['apply_id'], 'wait_id' => $supplier['personid'], 'wait_name' => $supplier['person']];
|
|
|
+ } else $order = ["order_type" => 'BHD', "order_code" => $feed['bk_code'], "order_id" => $feed['id'], "order_status" => $feed['status'], "before_status" => $tem, 'holder_id' => $feed['apply_id']];
|
|
|
+ ProcessOrder::AddProcess($this->post['token'], $order);
|
|
|
$ste = ["order_code"=>$feed['bk_code'],"status"=>$tem,"action_remark"=>'',"action_type"=>"edit"];
|
|
|
ActionLog::logAdd($this->post['token'],$ste,"BHD",$feed['status'],$feed);
|
|
|
if($status==3){
|
|
@@ -785,13 +804,19 @@ class Resign extends Base
|
|
|
"action_type" => "edit"//新建create,编辑edit,更改状态status
|
|
|
], "BHD", $info['status'], $info);
|
|
|
|
|
|
+ $supplier = Db::name('supplier')
|
|
|
+ ->field('id,person,personid')
|
|
|
+ ->where('code', $info['supplierNo'])
|
|
|
+ ->findOrEmpty();
|
|
|
ProcessOrder::AddProcess($this->post['token'], [
|
|
|
"order_type" => 'BHD',
|
|
|
"order_code" => $info['bk_code'],//销售单code
|
|
|
"order_id" => $info['id'],
|
|
|
"order_status" => $info['status'],
|
|
|
"before_status"=>$old_info_status,
|
|
|
- 'holder_id' => $info['apply_id']
|
|
|
+ //'holder_id' => $info['apply_id'],
|
|
|
+ 'wait_id' => $supplier['personid'],
|
|
|
+ 'wait_name' => $supplier['person'],
|
|
|
]);
|
|
|
|
|
|
return app_show(0,"备库单仓库选择成功");
|