|
@@ -461,6 +461,7 @@ class Sale extends BaseController
|
|
}
|
|
}
|
|
}
|
|
}
|
|
public function status(){
|
|
public function status(){
|
|
|
|
+ $token= isset($this->post['token']) && $this->post['token'] !=="" ? trim($this->post['token']) :"";
|
|
$id = isset($this->post['id']) && $this->post['id'] !=="" ? intval($this->post['id']) :"";
|
|
$id = isset($this->post['id']) && $this->post['id'] !=="" ? intval($this->post['id']) :"";
|
|
if($id==""){
|
|
if($id==""){
|
|
return error_show(1002,"参数id不能为空");
|
|
return error_show(1002,"参数id不能为空");
|
|
@@ -478,6 +479,7 @@ class Sale extends BaseController
|
|
if ($zxinfo == false) {
|
|
if ($zxinfo == false) {
|
|
return error_show(1004, "未找到咨询单数据");
|
|
return error_show(1004, "未找到咨询单数据");
|
|
}
|
|
}
|
|
|
|
+ $gold['price']=0;
|
|
if ($zxinfo['zx_type'] == 2) {
|
|
if ($zxinfo['zx_type'] == 2) {
|
|
if ($zxinfo['metals'] == "") {
|
|
if ($zxinfo['metals'] == "") {
|
|
return error_show(1004, "未找到咨询单贵金属类型数据");
|
|
return error_show(1004, "未找到咨询单贵金属类型数据");
|
|
@@ -487,14 +489,22 @@ class Sale extends BaseController
|
|
if (empty($gold)) {
|
|
if (empty($gold)) {
|
|
return error_show(1004, "未找到咨询单贵金属类型数据");
|
|
return error_show(1004, "未找到咨询单贵金属类型数据");
|
|
}
|
|
}
|
|
|
|
+ $dio['gold_price']=$gold['price'];
|
|
}
|
|
}
|
|
$wsm = Db::name("warehouse_info")->where(["supplierNo" => $zxinfo['gysNo'], "wsm_type" => 2])->find();
|
|
$wsm = Db::name("warehouse_info")->where(["supplierNo" => $zxinfo['gysNo'], "wsm_type" => 2])->find();
|
|
if (empty($wsm)) {
|
|
if (empty($wsm)) {
|
|
return error_show(1002, "供应商仓库未找到");
|
|
return error_show(1002, "供应商仓库未找到");
|
|
}
|
|
}
|
|
- $dio['gold_price']=$gold['price'];
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
- Db::startTrans();
|
|
|
|
|
|
+ $apply_id =GetUserInfo($token);
|
|
|
|
+ if(empty($apply_id)||$apply_id['code']!=0){
|
|
|
|
+ return error_show(1002,"申请人数据不存在");
|
|
|
|
+ }
|
|
|
|
+ $rm= isset($apply_id["data"]['id']) ? $apply_id["data"]['id'] : "";
|
|
|
|
+ $ri= isset($apply_id["data"]['nickname']) ? $apply_id["data"]['nickname'] : "";
|
|
|
|
+
|
|
|
|
+ Db::startTrans();
|
|
try {
|
|
try {
|
|
$dio['status']=$status;
|
|
$dio['status']=$status;
|
|
$dio['updatetime']=date("Y-m-d H:i:s");
|
|
$dio['updatetime']=date("Y-m-d H:i:s");
|
|
@@ -567,6 +577,36 @@ class Sale extends BaseController
|
|
Db::rollback();
|
|
Db::rollback();
|
|
return error_show(1002,"咨询采购单创建商品失败");
|
|
return error_show(1002,"咨询采购单创建商品失败");
|
|
}
|
|
}
|
|
|
|
+ if($dio['send_type']==1){
|
|
|
|
+ $addr = Db::name('order_addr')->where(["orderCode"=>$dio['orderCode'],'is_del'=>0])->select();
|
|
|
|
+ foreach ($addr as $value){
|
|
|
|
+ $outCode=makeNo("CK");
|
|
|
|
+ $data=[
|
|
|
|
+ "wsm_code"=>$wsm['wsm_code'],
|
|
|
|
+ "orderCode"=>$dio['orderCode'],
|
|
|
|
+ "outCode"=>$outCode,
|
|
|
|
+ "order_type"=>$dio['order_type'],
|
|
|
|
+ "apply_id"=>$rm,
|
|
|
|
+ "apply_name"=>$ri,
|
|
|
|
+ "addrid"=>$value['id'],
|
|
|
|
+ "post_name"=>'',
|
|
|
|
+ "post_code"=>'',
|
|
|
|
+ "post_fee"=>'',
|
|
|
|
+ "sendtime"=>date("Y-m-d H:i:s"),
|
|
|
|
+ "send_num"=>$value['receipt_quantity'],
|
|
|
|
+ "check_num"=>0,
|
|
|
|
+ "error_num"=>0,
|
|
|
|
+ "status"=>0,
|
|
|
|
+ "addtime"=>date("Y-m-d H:i:s"),
|
|
|
|
+ "updatetime"=>date("Y-m-d H:i:s")
|
|
|
|
+ ];
|
|
|
|
+ $datainfo = Db::name('order_out')->insert($data);
|
|
|
|
+ if(!$datainfo){
|
|
|
|
+ Db::rollback();
|
|
|
|
+ return error_show(1003,"创建失败");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
Db::commit();
|
|
Db::commit();
|