|
@@ -448,7 +448,11 @@ class Purch extends Base
|
|
|
if($cg==""){
|
|
|
return error_show(1002,"未找到采购单数据");
|
|
|
}
|
|
|
- $gd= Db::name('good')->where(['spuCode'=>$cg['spuCode']])->find();
|
|
|
+ if($cg['order_type']==3|| $cg['order_type']==4){
|
|
|
+ $gd = Db::name("good_zixun")->where(["spuCode"=>$cg['spuCode']])->find();
|
|
|
+ }else {
|
|
|
+ $gd =Db::name('good_basic')->where(['spuCode'=>$cg['spuCode']])->find();
|
|
|
+ }
|
|
|
if($gd==""){
|
|
|
return error_show(1002,"未找到商品数据");
|
|
|
}
|
|
@@ -488,23 +492,23 @@ class Purch extends Base
|
|
|
// ActionLog::logAdd($this->post['token'],$stm,"CGGCD",1,$stm);
|
|
|
// $process=["order_code"=>$cgdNo,"order_id"=>$item,"order_status"=>1,"order_type"=>'CGGCD'];
|
|
|
// ProcessOrder::AddProcess($this->post['token'],$process);
|
|
|
- $orderCode = Db::name("order_num")->where([["cgdNo","=",$cg['cgdNo']],["status","=",1]])->column("orderCode");
|
|
|
+ $orderCode = Db::name("order_num")->where([["cgdNo","=",$cg['cgdNo']],["status","=",1]])->find();
|
|
|
|
|
|
- if(!empty($orderCode)){
|
|
|
- $order = Db::name("sale")->where("orderCode", 'in', $orderCode)->select()->toArray();
|
|
|
- if(empty($order)){
|
|
|
+ if($orderCode!=false){
|
|
|
+ $order = Db::name("sale")->where("orderCode", '=', $orderCode['orderCode'])->find();
|
|
|
+ if($order==false){
|
|
|
Db::rollback();
|
|
|
return error_show(1002,"未找到确认单信息");
|
|
|
}
|
|
|
- foreach ($orderCode as $value){
|
|
|
+
|
|
|
$data=[
|
|
|
"cgd_diffid"=>$item,
|
|
|
- "orderCode"=>$value,
|
|
|
+ "orderCode"=>$orderCode['orderCode'],
|
|
|
"good_code"=>$cg['spuCode'],
|
|
|
"good_name"=>$cg['good_name'],
|
|
|
"diff_weight"=>$diff_weight,
|
|
|
- "diff_price"=>$diff_weight*$cg['good_price'],
|
|
|
- "gold_price"=>$cg['good_price'],
|
|
|
+ "diff_price"=>$diff_weight*$order['sale_price'],
|
|
|
+ "gold_price"=>$order['sale_price'],
|
|
|
"status"=>1,
|
|
|
"addtime"=>date("Y-m-d H:i:s"),
|
|
|
"updatetime"=>date("Y-m-d H:i:s")
|
|
@@ -520,7 +524,7 @@ class Purch extends Base
|
|
|
// }else{
|
|
|
Db::rollback();
|
|
|
return error_show(1002,"新建失败");
|
|
|
- }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -634,7 +638,7 @@ class Purch extends Base
|
|
|
}
|
|
|
$dio = Db::name('purchease_diff')->where(['id'=>$id,'is_del'=>0])->find();
|
|
|
if(empty($dio)){
|
|
|
- return error_show(1002,"退货订单未找到");
|
|
|
+ return error_show(1002,"工差订单未找到");
|
|
|
}
|
|
|
$cgd = Db::name("purchease_order")->where(['cgdNo'=>$dio['cgdNo']])->find();
|
|
|
if(empty($cgd)){
|