|
@@ -125,16 +125,17 @@ class Resign extends Base
|
|
$data=[];
|
|
$data=[];
|
|
$all_createrid = array_column($list,'apply_id');
|
|
$all_createrid = array_column($list,'apply_id');
|
|
$item = get_company_name_by_uid($all_createrid);
|
|
$item = get_company_name_by_uid($all_createrid);
|
|
|
|
+ $userCommon = new \app\admin\common\User();
|
|
foreach ($list as $value){
|
|
foreach ($list as $value){
|
|
$value['wsm_name']="";
|
|
$value['wsm_name']="";
|
|
$value['wsm_supplier']="";
|
|
$value['wsm_supplier']="";
|
|
$value['wsm_supplierNo']="";
|
|
$value['wsm_supplierNo']="";
|
|
if($value['wsm_code']!=""){
|
|
if($value['wsm_code']!=""){
|
|
- $wsmcode = Db::name("warehouse_info")->alias("a")->leftJoin("supplier b","a.supplierNo=b.code")
|
|
|
|
- ->where(["a.wsm_code"=>$value['wsm_code']])->field("a.name as wsm_name,b.name,b.code")->find();
|
|
|
|
- $value['wsm_name'] =isset($wsmcode['wsm_name']) ? $wsmcode['wsm_name']:"";
|
|
|
|
- $value['wsm_supplier'] =isset($wsmcode['name']) ? $wsmcode['name']:"";
|
|
|
|
- $value['wsm_supplierNo'] =isset($wsmcode['code']) ? $wsmcode['code']:"";
|
|
|
|
|
|
+ $wsmcode = Db::name("warehouse_info")->where(["wsm_code"=>$value['wsm_code']])->field("name as wsm_name,supplierNo")->find();
|
|
|
|
+ $tmpd = $userCommon->handle('getCodeAndName', ['code' =>$wsmcode['supplierNo']]);
|
|
|
|
+ $value['wsm_name'] =isset($wsmcode['wsm_name']) ? $wsmcode['wsm_name']:"";
|
|
|
|
+ $value['wsm_supplier'] =$tmpd['data'][$wsmcode['supplierNo']]??"";
|
|
|
|
+ $value['wsm_supplierNo'] =$wsmcode['supplierNo']??"";
|
|
}
|
|
}
|
|
$value['file_name'] ='';
|
|
$value['file_name'] ='';
|
|
if($value['file_url']){
|
|
if($value['file_url']){
|
|
@@ -142,11 +143,6 @@ class Resign extends Base
|
|
$value['file_name'] =substr($file,0,strripos($file,"_"));
|
|
$value['file_name'] =substr($file,0,strripos($file,"_"));
|
|
}
|
|
}
|
|
$value['company_name'] = $item[$value['apply_id']]??'';
|
|
$value['company_name'] = $item[$value['apply_id']]??'';
|
|
-
|
|
|
|
- //是否具有编辑权限
|
|
|
|
-// $value['is_allow_update'] = 0;
|
|
|
|
-// if (in_array($this->roleid, $super_roleid) || in_array($value['apply_id'], $role[DataGroupModel::$type_可编辑])) $value['is_allow_update'] = 1;
|
|
|
|
-
|
|
|
|
$data[]=$value;
|
|
$data[]=$value;
|
|
}
|
|
}
|
|
return app_show(0,"获取成功",["count"=>$count,"list"=>$data]);
|
|
return app_show(0,"获取成功",["count"=>$count,"list"=>$data]);
|
|
@@ -178,8 +174,11 @@ class Resign extends Base
|
|
if($good==false){
|
|
if($good==false){
|
|
return error_show(1004,"未找到商品数据");
|
|
return error_show(1004,"未找到商品数据");
|
|
}
|
|
}
|
|
- $supplier=Db::name("supplier")->where("code","=",$good['supplierNo'])->find();
|
|
|
|
- if($supplier==false) return error_show(1004,"未找到供应商数据");
|
|
|
|
|
|
+ $userCommon= new \app\admin\common\User();
|
|
|
|
+ $supplier_temp =$userCommon->handle("sInfo",["code"=>$good['supplierNo']]);
|
|
|
|
+ if($supplier_temp['code']!=0 || empty($supplier_temp['data']) ) return error_show(1002,"商品供应商不存在");
|
|
|
|
+ $holder_id=$supplier_temp['data']['personid']??0;
|
|
|
|
+ $holder_name=$supplier_temp['data']['person']??0;
|
|
// $bk= Db::name("purchease")->where([["spuCode","=",$good_code],["status","<>",2],["is_del","=",0]])->find();
|
|
// $bk= Db::name("purchease")->where([["spuCode","=",$good_code],["status","<>",2],["is_del","=",0]])->find();
|
|
// if($bk!=false) return error_show(1004,"存在未完成备库单数据");
|
|
// if($bk!=false) return error_show(1004,"存在未完成备库单数据");
|
|
// $cgd =Db::name("purchease_order")->where([["spuCode","=",$good_code],["status","in",[0,1]],["is_del","=",0]])->find();
|
|
// $cgd =Db::name("purchease_order")->where([["spuCode","=",$good_code],["status","in",[0,1]],["is_del","=",0]])->find();
|
|
@@ -237,7 +236,7 @@ class Resign extends Base
|
|
$in = Db::name("purchease")->insert($info,true);
|
|
$in = Db::name("purchease")->insert($info,true);
|
|
if($in>0){
|
|
if($in>0){
|
|
//备库单,推给供应商负责人
|
|
//备库单,推给供应商负责人
|
|
- $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']];
|
|
|
|
|
|
+ $order = ["order_type" => 'BHD', "order_code" => $bk_code, "order_id" => $in, "order_status" => 1, "before_status" => 1, 'wait_id' => $holder_id, 'wait_name' => $holder_name];
|
|
ProcessOrder::AddProcess(['id' => $this->uid, 'nickname' => $this->uname], $order);
|
|
ProcessOrder::AddProcess(['id' => $this->uid, 'nickname' => $this->uname], $order);
|
|
$ste = ["order_code" => $bk_code, "status" => 0, "action_remark" => '', "action_type" => "create"];
|
|
$ste = ["order_code" => $bk_code, "status" => 0, "action_remark" => '', "action_type" => "create"];
|
|
ActionLog::logAdd(['id' => $this->uid, 'nickname' => $this->uname], $ste, "BHD", 1, $info);
|
|
ActionLog::logAdd(['id' => $this->uid, 'nickname' => $this->uname], $ste, "BHD", 1, $info);
|
|
@@ -272,6 +271,11 @@ class Resign extends Base
|
|
if(empty($info)){
|
|
if(empty($info)){
|
|
return error_show(1002,'未找到数据');
|
|
return error_show(1002,'未找到数据');
|
|
}
|
|
}
|
|
|
|
+ $userCommon= new \app\admin\common\User();
|
|
|
|
+ $supplier_temp =$userCommon->handle("sInfo",["code"=>$info['supplierNo']]);
|
|
|
|
+ if($supplier_temp['code']!=0 || empty($supplier_temp['data']) ) return error_show(1002,"供应商不存在");
|
|
|
|
+ $holder_id=$supplier_temp['data']['personid']??0;
|
|
|
|
+ $holder_name=$supplier_temp['data']['person']??0;
|
|
// $data = GetUserInfo($this->post['token']);
|
|
// $data = GetUserInfo($this->post['token']);
|
|
// if((!empty($data) && $data['code']!=0) ||empty($data) ){
|
|
// if((!empty($data) && $data['code']!=0) ||empty($data) ){
|
|
// return error_show($data['code'],$data['message']);
|
|
// return error_show($data['code'],$data['message']);
|
|
@@ -293,11 +297,11 @@ class Resign extends Base
|
|
unset($info['id']);
|
|
unset($info['id']);
|
|
$in = Db::name("purchease")->insert($info,true);
|
|
$in = Db::name("purchease")->insert($info,true);
|
|
if($in>0){
|
|
if($in>0){
|
|
- $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']];
|
|
|
|
|
|
+// $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' =>$holder_id, 'wait_name' =>$holder_name];
|
|
ProcessOrder::AddProcess(['id' => $this->uid, 'nickname' => $this->uname], $order);
|
|
ProcessOrder::AddProcess(['id' => $this->uid, 'nickname' => $this->uname], $order);
|
|
$ste = ["order_code"=>$bk_code,"status"=>0,"action_remark"=>'',"action_type"=>"create"];
|
|
$ste = ["order_code"=>$bk_code,"status"=>0,"action_remark"=>'',"action_type"=>"create"];
|
|
ActionLog::logAdd(['id' => $this->uid, 'nickname' => $this->uname],$ste,"BHD",1,$info);
|
|
ActionLog::logAdd(['id' => $this->uid, 'nickname' => $this->uname],$ste,"BHD",1,$info);
|
|
@@ -335,23 +339,22 @@ class Resign extends Base
|
|
$file= basename($info['file_url']);
|
|
$file= basename($info['file_url']);
|
|
$info['file_name'] =substr($file,0,strripos($file,"_"));
|
|
$info['file_name'] =substr($file,0,strripos($file,"_"));
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+ $userCommon = new \app\admin\common\User();
|
|
if($info['wsm_code']!=""){
|
|
if($info['wsm_code']!=""){
|
|
- $wsmcode = Db::name("warehouse_info")->alias("a")->leftJoin("supplier b","a.supplierNo=b.code")
|
|
|
|
- ->where(["a.wsm_code"=>$info['wsm_code']])->field("a.name as wsm_name,b.name,b.code")->find();
|
|
|
|
|
|
+ $wsmcode = Db::name("warehouse_info")->where(["wsm_code"=>$info['wsm_code']])->field("name as wsm_name,supplierNo")->find();
|
|
|
|
+ $tmpd = $userCommon->handle('getCodeAndName', ['code' =>$wsmcode['supplierNo']]);
|
|
$info['wsm_name'] =isset($wsmcode['wsm_name']) ? $wsmcode['wsm_name']:"";
|
|
$info['wsm_name'] =isset($wsmcode['wsm_name']) ? $wsmcode['wsm_name']:"";
|
|
- $info['wsm_supplier'] =isset($wsmcode['name']) ? $wsmcode['name']:"";
|
|
|
|
- $info['wsm_supplierNo'] =isset($wsmcode['code']) ? $wsmcode['code']:"";
|
|
|
|
|
|
+ $info['wsm_supplier'] =$tmpd['data'][$wsmcode['supplierNo']]??"";
|
|
|
|
+ $info['wsm_supplierNo'] =$wsmcode['supplierNo']??"";
|
|
}
|
|
}
|
|
- $supplier =Db::name("supplier")->where(["code"=>$info['supplierNo']])->find();
|
|
|
|
- $info['supplier_name'] = isset($supplier['name'])?$supplier['name']:"";
|
|
|
|
|
|
+// $supplier =Db::name("supplier")->where(["code"=>$info['supplierNo']])->find();
|
|
|
|
|
|
- $userCommon = new \app\admin\common\User();
|
|
|
|
- $tmp = $userCommon->handle('getCodeAndName', ['code' => $info['companyNo']]);
|
|
|
|
|
|
+ $tmp = $userCommon->handle('getCodeAndName', ['code' =>[$info['companyNo'],$info['supplierNo']]]);
|
|
if (!isset($tmp['code']) || $tmp['code'] != 0) return json_show($tmp['code'], $tmp['message'], $tmp['data']);
|
|
if (!isset($tmp['code']) || $tmp['code'] != 0) return json_show($tmp['code'], $tmp['message'], $tmp['data']);
|
|
|
|
|
|
// $company =Db::name("business")->where(["companyNo"=>$info['companyNo']])->find();
|
|
// $company =Db::name("business")->where(["companyNo"=>$info['companyNo']])->find();
|
|
$info['company_name'] = $tmp['data'][$info['companyNo']] ?? '';
|
|
$info['company_name'] = $tmp['data'][$info['companyNo']] ?? '';
|
|
|
|
+ $info['supplier_name'] = $tmp['data'][$info['supplierNo']] ?? '';
|
|
$info['can']=$int;
|
|
$info['can']=$int;
|
|
return app_show(0,"获取成功",$info);
|
|
return app_show(0,"获取成功",$info);
|
|
}
|
|
}
|
|
@@ -454,6 +457,11 @@ class Resign extends Base
|
|
if(empty($info)){
|
|
if(empty($info)){
|
|
return error_show(1002,'未找到数据');
|
|
return error_show(1002,'未找到数据');
|
|
}
|
|
}
|
|
|
|
+ $userCommon= new \app\admin\common\User();
|
|
|
|
+ $supplier_temp =$userCommon->handle("sInfo",["code"=>$info['supplierNo']]);
|
|
|
|
+ if($supplier_temp['code']!=0 || empty($supplier_temp['data']) ) return error_show(1002,"采购单供应商不存在");
|
|
|
|
+ $holder_id=$supplier_temp['data']['personid']??0;
|
|
|
|
+ $holder_name=$supplier_temp['data']['person']??0;
|
|
$status = isset($this->post['status'])&&$this->post['status']!=='' ? intval($this->post['status']) : "";
|
|
$status = isset($this->post['status'])&&$this->post['status']!=='' ? intval($this->post['status']) : "";
|
|
if($status===""){
|
|
if($status===""){
|
|
return error_show(1001,'status不能为空');
|
|
return error_show(1001,'status不能为空');
|
|
@@ -465,11 +473,7 @@ class Resign extends Base
|
|
if($up){
|
|
if($up){
|
|
|
|
|
|
if($status==1){
|
|
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']];
|
|
|
|
|
|
+ $order = ["order_type" => 'BHD', "order_code" => $info['bk_code'], "order_id" => $info['id'], "order_status" => $status, "before_status" => $temp,'wait_id' => $holder_id, 'wait_name' => $holder_name];
|
|
}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']];
|
|
}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']];
|
|
$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);
|
|
ProcessOrder::AddProcess($this->post['token'],$order);
|
|
@@ -482,7 +486,7 @@ class Resign extends Base
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
|
|
+ //废弃
|
|
public function addFeed(){
|
|
public function addFeed(){
|
|
$token = isset($this->post['token']) ? trim($this->post['token']) : "";
|
|
$token = isset($this->post['token']) ? trim($this->post['token']) : "";
|
|
if($token==""){
|
|
if($token==""){
|
|
@@ -523,7 +527,7 @@ class Resign extends Base
|
|
if($supplierNo==""){
|
|
if($supplierNo==""){
|
|
return error_show(1002,'参数supplierNo 不能为空');
|
|
return error_show(1002,'参数supplierNo 不能为空');
|
|
}
|
|
}
|
|
- $supplie = Db::name("supplier")->where(['code'=>$supplierNo,"is_del"=>0])->find();
|
|
|
|
|
|
+ $supplie = Db::name("supplier")->where(['code'=>$supplierNo,"is_del"=>0])->find();//废弃
|
|
if(empty($supplie)){
|
|
if(empty($supplie)){
|
|
return error_show(1002,'未找到供应商');
|
|
return error_show(1002,'未找到供应商');
|
|
}
|
|
}
|
|
@@ -651,7 +655,7 @@ class Resign extends Base
|
|
$feed['wsm_supplierNo'] =isset($wsmcode['code']) ? $wsmcode['code']:"";
|
|
$feed['wsm_supplierNo'] =isset($wsmcode['code']) ? $wsmcode['code']:"";
|
|
}
|
|
}
|
|
if($feed['supplier']!=""){
|
|
if($feed['supplier']!=""){
|
|
- $supplie = Db::name("supplier")->where(['code'=>$feed['supplier'],"is_del"=>0])->find();
|
|
|
|
|
|
+ $supplie = Db::name("supplier")->where(['code'=>$feed['supplier'],"is_del"=>0])->find();//废弃
|
|
$feed['supplier_name'] =isset($supplie['name']) ? $supplie['name']:"";
|
|
$feed['supplier_name'] =isset($supplie['name']) ? $supplie['name']:"";
|
|
}
|
|
}
|
|
return app_show(0,"获取成功",$feed);
|
|
return app_show(0,"获取成功",$feed);
|
|
@@ -671,6 +675,11 @@ class Resign extends Base
|
|
return error_show(1001,'参数status 不能为空');
|
|
return error_show(1001,'参数status 不能为空');
|
|
}
|
|
}
|
|
$remark = isset($this->post['remark'])&& $this->post['remark']!=='' ? trim($this->post['remark']) : "";
|
|
$remark = isset($this->post['remark'])&& $this->post['remark']!=='' ? trim($this->post['remark']) : "";
|
|
|
|
+ $userCommon= new \app\admin\common\User();
|
|
|
|
+ $supplier_temp =$userCommon->handle("sInfo",["code"=>$feed['supplierNo']]);
|
|
|
|
+ if($supplier_temp['code']!=0 || empty($supplier_temp['data']) ) return error_show(1002,"供应商不存在");
|
|
|
|
+ $holder_id=$supplier_temp['data']['personid']??0;
|
|
|
|
+ $holder_name=$supplier_temp['data']['person']??0;
|
|
Db::startTrans();
|
|
Db::startTrans();
|
|
try{
|
|
try{
|
|
$tem =$feed['status'];
|
|
$tem =$feed['status'];
|
|
@@ -680,11 +689,11 @@ class Resign extends Base
|
|
$up = Db::name("purchease")->update($feed);
|
|
$up = Db::name("purchease")->update($feed);
|
|
if($up){
|
|
if($up){
|
|
if ($feed['status'] == 1) {
|
|
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']];
|
|
|
|
|
|
+// $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' => $holder_id, 'wait_name' => $holder_name];
|
|
} 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']];
|
|
} 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);
|
|
ProcessOrder::AddProcess($this->post['token'], $order);
|
|
$ste = ["order_code"=>$feed['bk_code'],"status"=>$tem,"action_remark"=>'',"action_type"=>"edit"];
|
|
$ste = ["order_code"=>$feed['bk_code'],"status"=>$tem,"action_remark"=>'',"action_type"=>"edit"];
|
|
@@ -708,7 +717,7 @@ class Resign extends Base
|
|
ProcessOrder::AddProcess($this->post['token'],$order);
|
|
ProcessOrder::AddProcess($this->post['token'],$order);
|
|
$ste = ["order_code"=>$feed['bk_code'],"status"=>$pe,"action_remark"=>'',"action_type"=>"status"];
|
|
$ste = ["order_code"=>$feed['bk_code'],"status"=>$pe,"action_remark"=>'',"action_type"=>"status"];
|
|
ActionLog::logAdd($this->post['token'],$ste,"FKD",$feed['status'],$purse);
|
|
ActionLog::logAdd($this->post['token'],$ste,"FKD",$feed['status'],$purse);
|
|
- $supplier = Db::name("supplier")->where(["code"=>$purse['supplier']])->find();
|
|
|
|
|
|
+ $supplier = Db::name("supplier")->where(["code"=>$purse['supplier']])->find(); //废弃
|
|
$inw = makeNo("CG");
|
|
$inw = makeNo("CG");
|
|
$goodinfo=Db::name('good_basic')
|
|
$goodinfo=Db::name('good_basic')
|
|
->field('id,createrid,creater')
|
|
->field('id,createrid,creater')
|
|
@@ -752,7 +761,8 @@ class Resign extends Base
|
|
$in= Db::name("purchease_order")->insert($data,true);
|
|
$in= Db::name("purchease_order")->insert($data,true);
|
|
if($in>0){
|
|
if($in>0){
|
|
//当采购单是节点0待与供应商确认,推给供应商负责人
|
|
//当采购单是节点0待与供应商确认,推给供应商负责人
|
|
- if(!isset($supplier)) $supplier = Db::name("supplier")->where(["code"=>$purse['supplier']])->find();
|
|
|
|
|
|
+ if(!isset($supplier)) $supplier = Db::name("supplier")->where(["code"=>$purse['supplier']]) //废弃
|
|
|
|
+ ->find(); //废弃
|
|
$order=["order_type"=>'CGD',"order_code"=>$data['cgdNo'],"order_id"=>$in, "order_status"=>$data['status'],"before_status"=>0,'wait_id'=>$supplier['personid'],'wait_name'=>$supplier['person']];
|
|
$order=["order_type"=>'CGD',"order_code"=>$data['cgdNo'],"order_id"=>$in, "order_status"=>$data['status'],"before_status"=>0,'wait_id'=>$supplier['personid'],'wait_name'=>$supplier['person']];
|
|
ProcessOrder::AddProcess($this->post['token'],$order);
|
|
ProcessOrder::AddProcess($this->post['token'],$order);
|
|
$ste = ["order_code"=>$inw,"status"=>$data['status'],"action_remark"=>'',"action_type"=>"create"];
|
|
$ste = ["order_code"=>$inw,"status"=>$data['status'],"action_remark"=>'',"action_type"=>"create"];
|
|
@@ -829,13 +839,17 @@ class Resign extends Base
|
|
if($wsminfo==false){
|
|
if($wsminfo==false){
|
|
return error_show(1004,"未找到仓库数据");
|
|
return error_show(1004,"未找到仓库数据");
|
|
}
|
|
}
|
|
|
|
+ $userCommon= new \app\admin\common\User();
|
|
|
|
+ $supplier_temp =$userCommon->handle("sInfo",["code"=>$info['supplierNo']]);
|
|
|
|
+ if($supplier_temp['code']!=0 || empty($supplier_temp['data']) ) return error_show(1002,"供应商不存在");
|
|
|
|
+ $holder_id=$supplier_temp['data']['personid']??0;
|
|
|
|
+ $holder_name=$supplier_temp['data']['person']??0;
|
|
$info['wsm_code']=$wsm;
|
|
$info['wsm_code']=$wsm;
|
|
$old_info_status = $info['status'];
|
|
$old_info_status = $info['status'];
|
|
$info['status']=1;
|
|
$info['status']=1;
|
|
$info['updatetime']=date("y-m-d H;i:s");
|
|
$info['updatetime']=date("y-m-d H;i:s");
|
|
$up =Db::name("purchease")->save($info);
|
|
$up =Db::name("purchease")->save($info);
|
|
if($up){
|
|
if($up){
|
|
-
|
|
|
|
//修改状态,添加待办
|
|
//修改状态,添加待办
|
|
ActionLog::logAdd($this->post['token'], [
|
|
ActionLog::logAdd($this->post['token'], [
|
|
"order_code" => $info['bk_code'],//销售单code
|
|
"order_code" => $info['bk_code'],//销售单code
|
|
@@ -844,19 +858,18 @@ class Resign extends Base
|
|
"action_type" => "edit"//新建create,编辑edit,更改状态status
|
|
"action_type" => "edit"//新建create,编辑edit,更改状态status
|
|
], "BHD", $info['status'], $info);
|
|
], "BHD", $info['status'], $info);
|
|
|
|
|
|
- $supplier = Db::name('supplier')
|
|
|
|
- ->field('id,person,personid')
|
|
|
|
- ->where('code', $info['supplierNo'])
|
|
|
|
- ->findOrEmpty();
|
|
|
|
|
|
+// $supplier = Db::name('supplier')
|
|
|
|
+// ->field('id,person,personid')
|
|
|
|
+// ->where('code', $info['supplierNo'])
|
|
|
|
+// ->findOrEmpty();
|
|
ProcessOrder::AddProcess($this->post['token'], [
|
|
ProcessOrder::AddProcess($this->post['token'], [
|
|
"order_type" => 'BHD',
|
|
"order_type" => 'BHD',
|
|
"order_code" => $info['bk_code'],//销售单code
|
|
"order_code" => $info['bk_code'],//销售单code
|
|
"order_id" => $info['id'],
|
|
"order_id" => $info['id'],
|
|
"order_status" => $info['status'],
|
|
"order_status" => $info['status'],
|
|
"before_status"=>$old_info_status,
|
|
"before_status"=>$old_info_status,
|
|
- //'holder_id' => $info['apply_id'],
|
|
|
|
- 'wait_id' => $supplier['personid'],
|
|
|
|
- 'wait_name' => $supplier['person'],
|
|
|
|
|
|
+ 'wait_id' => $holder_id,
|
|
|
|
+ 'wait_name' => $holder_name,
|
|
]);
|
|
]);
|
|
|
|
|
|
return app_show(0,"备库单仓库选择成功");
|
|
return app_show(0,"备库单仓库选择成功");
|
|
@@ -887,10 +900,16 @@ class Resign extends Base
|
|
if($good==false){
|
|
if($good==false){
|
|
return error_show(1004,"未找到商品数据");
|
|
return error_show(1004,"未找到商品数据");
|
|
}
|
|
}
|
|
- $supplier=Db::name("supplier")->where(["code"=>$info['supplierNo'],"is_del"=>0])->find();
|
|
|
|
- if($supplier==false){
|
|
|
|
- return error_show(1004,"未找到供应商数据");
|
|
|
|
- }
|
|
|
|
|
|
+// $supplier=Db::name("supplier")->where(["code"=>$info['supplierNo'],"is_del"=>0])->find();
|
|
|
|
+// if($supplier==false){
|
|
|
|
+// return error_show(1004,"未找到供应商数据");
|
|
|
|
+// }
|
|
|
|
+ $userCommon= new \app\admin\common\User();
|
|
|
|
+ $supplier_temp =$userCommon->handle("sInfo",["code"=>$info['supplierNo']]);
|
|
|
|
+ if($supplier_temp['code']!=0 || empty($supplier_temp['data']) ) return error_show(1002,"未找到供应商数据");
|
|
|
|
+ $supplierName=$supplier_temp['data']['name']??'';
|
|
|
|
+ $personid=$supplier_temp['data']['personid']??'';
|
|
|
|
+ $person=$supplier_temp['data']['person']??'';
|
|
$goodnake =Db::name("good_nake")->where([["spuCode","=",$info['spuCode']],["is_del","=",0],["min_num","<=",
|
|
$goodnake =Db::name("good_nake")->where([["spuCode","=",$info['spuCode']],["is_del","=",0],["min_num","<=",
|
|
$info['good_num']]])->order("min_num desc")->find();
|
|
$info['good_num']]])->order("min_num desc")->find();
|
|
if($goodnake==false){
|
|
if($goodnake==false){
|
|
@@ -901,7 +920,6 @@ class Resign extends Base
|
|
if($good['is_gold_price']==1 && $top_cat_id==6){
|
|
if($good['is_gold_price']==1 && $top_cat_id==6){
|
|
$gold = Db::name("gold_price1")->where(["type"=>$good['noble_metal'],"is_del"=>0,"status"=>1])->order("addtime desc")
|
|
$gold = Db::name("gold_price1")->where(["type"=>$good['noble_metal'],"is_del"=>0,"status"=>1])->order("addtime desc")
|
|
->find();
|
|
->find();
|
|
- // $weight = $good['noble_weight']*$info['good_num'];
|
|
|
|
$sale_price = round($good['demo_fee'] / $info['good_num'] + $good['open_fee'] / $info['good_num'] + $good['noble_weight'] * $gold["price"] + $goodnake['cost_fee'] * $good['noble_weight'] + $goodnake['package_fee'] + $goodnake['mark_fee'] + $goodnake['cert_fee'] +$goodnake['nake_fee'] + $goodnake['delivery_fee'],2);
|
|
$sale_price = round($good['demo_fee'] / $info['good_num'] + $good['open_fee'] / $info['good_num'] + $good['noble_weight'] * $gold["price"] + $goodnake['cost_fee'] * $good['noble_weight'] + $goodnake['package_fee'] + $goodnake['mark_fee'] + $goodnake['cert_fee'] +$goodnake['nake_fee'] + $goodnake['delivery_fee'],2);
|
|
$total_price = round($info['good_num']*$sale_price,2);
|
|
$total_price = round($info['good_num']*$sale_price,2);
|
|
}else{
|
|
}else{
|
|
@@ -933,7 +951,7 @@ class Resign extends Base
|
|
"diff_fee"=>"0",
|
|
"diff_fee"=>"0",
|
|
"gold_price"=>"0",
|
|
"gold_price"=>"0",
|
|
"supplierNo"=>$info['supplierNo'],
|
|
"supplierNo"=>$info['supplierNo'],
|
|
- "supplier_name"=>$supplier['name'],
|
|
|
|
|
|
+ "supplier_name"=>$supplierName,
|
|
"companyNo"=>$info['companyNo'],
|
|
"companyNo"=>$info['companyNo'],
|
|
"send_status"=>1,
|
|
"send_status"=>1,
|
|
"send_num"=>"0",
|
|
"send_num"=>"0",
|
|
@@ -981,7 +999,7 @@ class Resign extends Base
|
|
$order = ["order_code" => $cgdCode, "status" => 0, "action_remark" => '', "action_type" => "create"];
|
|
$order = ["order_code" => $cgdCode, "status" => 0, "action_remark" => '', "action_type" => "create"];
|
|
GoodLog::LogAdd($this->post['token'], $good_data, 'CGD');
|
|
GoodLog::LogAdd($this->post['token'], $good_data, 'CGD');
|
|
ActionLog::logAdd($this->post['token'], $order, "CGD", 0, $good);
|
|
ActionLog::logAdd($this->post['token'], $order, "CGD", 0, $good);
|
|
- $process = ["order_code" => $cgdCode, "order_id" => $up, "order_status" => $cg['status'], "order_type" => 'CGD',"before_status"=>0,'holder_id'=>$supplier['personid'],'wait_id'=>$supplier['personid'],'wait_name'=>$supplier['person']];
|
|
|
|
|
|
+ $process = ["order_code" => $cgdCode, "order_id" => $up, "order_status" => $cg['status'], "order_type" => 'CGD',"before_status"=>0,'holder_id'=>$personid,'wait_id'=>$personid,'wait_name'=>$person];
|
|
ProcessOrder::AddProcess($this->post['token'], $process);
|
|
ProcessOrder::AddProcess($this->post['token'], $process);
|
|
$info['wsm_code'] = $wsm_code;
|
|
$info['wsm_code'] = $wsm_code;
|
|
$old_info_status = $info['status'];
|
|
$old_info_status = $info['status'];
|