123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506 |
- <?php
- namespace app\admin\controller;
- use app\admin\model\CgdInfo;use app\admin\model\GoodCombind;use app\admin\model\InvoiceOrder;use app\admin\model\InvoicePool;use app\admin\model\OrderCategory;use app\admin\model\Pay;use app\admin\model\PayInvoice;use app\admin\model\QrdInfo;use app\admin\model\TradePool;use think\App;use think\facade\Db;use think\facade\Validate;
- class Sale extends Base{
- public function __construct(App $app) {
- parent::__construct($app);
- }
- /** 获取列表
- * @return \think\response\Json|void
- * @throws \think\db\exception\DataNotFoundException
- * @throws \think\db\exception\DbException
- * @throws \think\db\exception\ModelNotFoundException
- */
- public function list(){
- $post =$this->request->param();
- $condition = [['a.is_del',"=",0]];
- $roleid = $this->roleid;
- $check = checkRole($roleid,'86');
- if($check){
- $condition[]=["a.ownerid","=",$this->uid];
- }
- $page = isset($post['page'])&&$post['page']!==''?intval($post['page']):1;
- $size = isset($post['size'])&&$post['size']!==''?intval($post['size']):15;
- $start =isset($post['start'])&&$post['start']!==''?trim($post['start']):'';
- if($start!=''){
- $condition[]=["a.createdTime",">=",$start." 00:00:00"];
- }
- $end =isset($post['end'])&&$post['end']!==''?trim($post['end']):'';
- if($end!=''){
- $condition[]=["a.createdTime","<=",$end." 23:59:59"];
- }
- $total_min = isset($post['total_min'])&&$post['total_min']!==''?floatval($post['total_min']):'';
- if($total_min!==''){
- $condition[]=["a.totalPrice",">=",$total_min];
- }
- $total_max = isset($post['total_max'])&&$post['total_max']!==''?floatval($post['total_max']):'';
- if($total_max!==''){
- $condition[]=["a.totalPrice","<=",$total_max];
- }
- if(isset($post['is_comon'])&&$post['is_comon']!=='') $condition []=['is_comon','=',$post['is_comon']];
- $cxCode =$post['cxCode']??[];
- if(!empty($cxCode)){
- $condition[]=["a.cxCode","in",$cxCode];
- }
- $inv_status = isset($post['inv_status'])&&$post['inv_status']!==''?intval($post['inv_status']):'';
- if($inv_status!==''){
- if($inv_status==0){
- $condition[]=["a.inv_status","<>",3];
- }else{
- $condition[]=["a.inv_status","=",$inv_status];
- }
- }
- $invIs = isset($post['inv_is'])&&$post['inv_is']!==''?intval($post['inv_is']):'';
- if($invIs!==''){
- if($invIs==1){
- $condition[]=["a.winv_fee","<>",0];
- }else{
- $condition[]=["a.winv_fee","=",0];
- }
- }
- $payIs = isset($post['pay_is'])&&$post['pay_is']!==''?intval($post['pay_is']):'';
- if($payIs!==''){
- if($payIs==1){
- $condition[]=["a.wpay_fee","<>",0];
- }else{
- $condition[]=["a.wpay_fee","=",0];
- }
- }
- $pay_status = isset($post['pay_status'])&&$post['pay_status']!==''?intval($post['pay_status']):'';
- if($pay_status!==''){
- if($pay_status==0){
- $condition[]=["a.pay_status","<>",3];
- }else{
- $condition[]=["a.pay_status","=",$pay_status];
- }
- }
- $status = isset($post['status'])&&$post['status']!==''?intval($post['status']):'';
- if($status!==''){
- if($status==3){
- $condition[]=["a.status","<>",2];
- }else{
- $condition[]=["a.status","=",$status];
- }
- }
- $poCode = isset($post['poCode']) && $post['poCode'] !== '' ? trim($post['poCode']) : '';
- if ($poCode !== '') {
- $condition[] = ['a.poCode', 'like', "%$poCode%"];
- }
- $qrdNo = isset($post['sequenceNo'])&&$post['sequenceNo']!=''?trim($post['sequenceNo']):'';
- if($qrdNo!==''){
- $condition[]=["a.sequenceNo","like","%$qrdNo%"];
- }
- $department = isset($post['department'])&&$post['department']!=''?trim($post['department']):'';
- if($department!==''){
- $condition[]=["a.department","like","%$department%"];
- }
- $customerNo = isset($post['customerNo'])&&$post['customerNo']!=''?trim($post['customerNo']):'';
- if($customerNo!==''){
- $condition[]=["a.customerNo","like","%$customerNo%"];
- }
- $customer = isset($post['customer'])&&$post['customer']!=''?trim($post['customer']):'';
- if($customer!=''){
- $condition[]=["a.customerName","like","%$customer%"];
- }
- $companyNo = isset($post['companyNo'])&&$post['companyNo']!=''?trim($post['companyNo']):'';
- if($companyNo!==''){
- $condition[]=["a.companyNo","=",$companyNo];
- }
- $companyName = isset($post['companyName'])&&$post['companyName']!=''?trim($post['companyName']):'';
- if($companyName !=''){
- $condition[]=["a.companyName","like","%$companyName%"];
- }
- $platName = isset($post['platName'])&&$post['platName']!=''?trim($post['platName']):'';
- if($platName!=''){
- $condition[]=["a.platName","like","%$platName%"];
- }
- $platform_type = isset($post['platform_type'])&&$post['platform_type']!==''?intval($post['platform_type']):'';
- if($platform_type!==''){
- $condition[]=["a.platform_type","=",$platform_type];
- }
- $saler= isset($post['saler']) && $post['saler']!='' ? trim($post['saler']) :"";
- if($saler!='') $condition []=["a.ownerName","like","%$saler%"];
- $salerid= isset($post['salerid']) && $post['salerid']!='' ? intval($post['salerid']) :"";
- if($salerid!='') $condition []=["a.ownerid","=",$salerid];
- $qrdtype= isset($post['qrdtype']) && $post['qrdtype']!='' ? intval($post['qrdtype']) :"";
- if($qrdtype!='') $condition []=["a.qrdType","=",$qrdtype];
- $qrdsource= isset($post['qrdsource']) && $post['qrdsource']!='' ? intval($post['qrdsource']) :"";
- if($qrdsource!='') $condition []=["a.qrdSource","=",$qrdsource];
- $sendstatus= isset($post['sendstatus']) && $post['sendstatus']!='' ? intval($post['sendstatus']) :"";
- if($sendstatus!='') $condition []=["a.sendStatus","=",$sendstatus];
- $tag_id= isset($post['tag_id'])&&$post['tag_id']!=="" ? intval($post['tag_id']) :"";
- if($tag_id!==''){
- if($tag_id==1) $condition[]=["a.inv_tag","=",1];
- if($tag_id==2) $condition[]=["a.pay_tag","=",1];
- if($tag_id==3) $condition[]=["a.pay_tag|inv_tag","=",1];
- if($tag_id==4) $condition[]=["a.pay_tag&inv_tag","=",1];
- }
- $cat_status= isset($post['cat_status'])&&$post['cat_status']!=="" ? intval($post['cat_status']) :"";
- if($cat_status!=='') $condition[]=["b.status","=",$cat_status];
- $count =Db::name("qrd_info")
- ->alias("a")
- ->leftJoin("good b","a.goodNo=b.spuCode")->where($condition)->count();
- $total = ceil($count/$size);
- $page = $page>$total ? intval($total) : $page;
- $list =Db::name("qrd_info")->alias("a")
- ->leftJoin("good b","a.goodNo=b.spuCode")
- ->field("a.*,b.status as cat_status,b.inv_cat_name,b.inv_cat_code,b.inv_tax,b.inv_good_name,b.isZx")
- ->order("a.createdTime desc")
- ->where($condition)->page($page,$size)->select();
- $data=[];
- foreach ( $list as $ky=>$value){
- $value['orderTax'] = OrderCategory::where(['code' => $value['sequenceNo'], 'spuCode' => $value['goodNo']])
- ->field(['cat_code', 'cat_name', 'merge_code', 'short_name', 'tax', 'inv_good_name'])->findOrEmpty();
- $value['catInfo'] = json_decode($value['catInfo'],true);
- $value['inv_tag_name']='';
- $value['pay_tag_name']='';
- $value['pay_tag_img']='';
- $value['inv_tag_id']='0';
- $value['pay_tag_id']='0';
- $value['pay_tag_remark']='';
- $value['inv_tag_img']='';
- $value['inv_tag_remark']='';
- if($value['pay_tag']==1 || $value['inv_tag']==1){
- $tag =Db::name("tag_log")->alias("a")->leftJoin("order_tag b","a.tag_id=b.id")->where
- (["code"=>$value['sequenceNo'],"a.status"=>[1,2]])->order("a.id desc")->column("a.id,b.tag_name,a.tag_img,a.tag_remark","b.type");
- if($value['inv_tag']==1){
- $value['inv_tag_name']=$tag[4]['tag_name']??'';
- $value['inv_tag_id']=$tag[4]['id']??'0';
- $value['inv_tag_img']=$tag[4]['tag_img']??'';
- $value['inv_tag_remark']=$tag[4]['tag_remark']??'';
- }
-
- if($value['pay_tag']==1){
- $value['pay_tag_id']=$tag[3]['id']??'0';
- $value['pay_tag_name']=$tag[3]['tag_name']??'';
- $value['pay_tag_img']=$tag[3]['tag_img']??'';
- $value['pay_tag_remark']=$tag[3]['tag_remark']??'';
- }
- }
- $value['plat_pay_fee']=0;
- if($value['is_comon']==1){
- $tax = QrdInfo::where(['cxCode'=>$value['cxCode'],'is_comon'=>0])->findOrEmpty();
- if($tax->isEmpty()==false){
- $rate =$tax->totalPrice==0?0: ($tax->apay_fee/$tax->totalPrice);
- $value['plat_pay_fee']= round($value['totalPrice']* $rate,2);
- }
- }
- $value['goodNum'] = $value['goodNum'] -$value['thNum'];
- $value['sendNum'] = $value['sendNum'] -$value['thNum'];
- $invArr = Db::name("assoc")
- ->alias("a")
- ->leftJoin("invoice_good b", "a.viceCode=b.invNo AND b.orderCode =a.orderCode")
- ->where(["a.status" => [1, 2], "a.is_del" => 0, "a.type" => 1, "a.orderCode" => $value['sequenceNo']])->group("a.status")
- ->column("sum(b.goodNum) as goodNum", "a.status");
- $value['inv_num'] = $invArr[1]??0;
- $value['ainv_num'] = $invArr[2]??0;
- $value['winv_num'] =$value['goodNum']- $value['inv_num']-$value['ainv_num'];
- $data[]=$value;
- }
- return app_show(0,"获取成功",["list"=>$data,"count"=>$count]);
- }
- public function query(){
- $post =$this->request->param();
- $condition = [['a.is_del',"=",0]];
- $start =isset($post['start'])&&$post['start']!==''?trim($post['start']):'';
- if($start!=''){
- $condition[]=["a.createdTime",">=",$start." 00:00:00"];
- }
- $end =isset($post['end'])&&$post['end']!==''?trim($post['end']):'';
- if($end!=''){
- $condition[]=["a.createdTime","<=",$end." 23:59:59"];
- }
- $total_min = isset($post['total_min'])&&$post['total_min']!==''?floatval($post['total_min']):'';
- if($total_min!==''){
- $condition[]=["a.totalPrice",">=",$total_min];
- }
- if(isset($post['is_comon'])&&$post['is_comon']!=='') $condition []=['is_comon','=',$post['is_comon']];
- $total_max = isset($post['total_max'])&&$post['total_max']!==''?floatval($post['total_max']):'';
- if($total_max!==''){
- $condition[]=["a.totalPrice","<=",$total_max];
- }
- $cxCode =$post['cxCode']??[];
- if(!empty($cxCode)){
- $condition[]=['a.cxCode','in',$cxCode];
- }
- $inv_status = isset($post['inv_status'])&&$post['inv_status']!==''?intval($post['inv_status']):'';
- if($inv_status!==''){
- if($inv_status==0){
- $condition[]=["a.inv_status","<>",3];
- }else{
- $condition[]=["a.inv_status","=",$inv_status];
- }
- }
- $invIs = isset($post['inv_is'])&&$post['inv_is']!==''?intval($post['inv_is']):'';
- if($invIs!==''){
- if($invIs==1){
- $condition[]=["a.winv_fee","<>",0];
- }else{
- $condition[]=["a.winv_fee","=",0];
- }
- }
- $payIs = isset($post['pay_is'])&&$post['pay_is']!==''?intval($post['pay_is']):'';
- if($payIs!==''){
- if($payIs==1){
- $condition[]=["a.wpay_fee","<>",0];
- }else{
- $condition[]=["a.wpay_fee","=",0];
- }
- }
- $pay_status = isset($post['pay_status'])&&$post['pay_status']!==''?intval($post['pay_status']):'';
- if($pay_status!==''){
- if($pay_status==0){
- $condition[]=["a.pay_status","<>",3];
- }else{
- $condition[]=["a.pay_status","=",$pay_status];
- }
- }
- $status = isset($post['status'])&&$post['status']!==''?intval($post['status']):'';
- if($status!==''){
- if($status==3){
- $condition[]=["a.status","<>",2];
- }else{
- $condition[]=["a.status","=",$status];
- }
- }
- $qrdNo = isset($post['sequenceNo'])&&$post['sequenceNo']!=''?trim($post['sequenceNo']):'';
- if($qrdNo!==''){
- $condition[]=["a.sequenceNo","in",explode(",",$qrdNo)];
- }
- $department = isset($post['department'])&&$post['department']!=''?trim($post['department']):'';
- if($department!==''){
- $condition[]=["a.department","like","%$department%"];
- }
- $customerNo = isset($post['customerNo'])&&$post['customerNo']!=''?trim($post['customerNo']):'';
- if($customerNo!==''){
- $condition[]=["a.customerNo","like","%$customerNo%"];
- }
- $customer = isset($post['customer'])&&$post['customer']!=''?trim($post['customer']):'';
- if($customer!=''){
- $condition[]=["a.customerName","like","%$customer%"];
- }
- $companyNo = isset($post['companyNo'])&&$post['companyNo']!=''?trim($post['companyNo']):'';
- if($companyNo!==''){
- $condition[]=["a.companyNo","=",$companyNo];
- }
- $companyName = isset($post['companyName'])&&$post['companyName']!=''?trim($post['companyName']):'';
- if($companyName !=''){
- $condition[]=["a.companyName","like","%$companyName%"];
- }
- $platName = isset($post['platName'])&&$post['platName']!=''?trim($post['platName']):'';
- if($platName!=''){
- $condition[]=["a.platName","like","%$platName%"];
- }
- $platform_type = isset($post['platform_type'])&&$post['platform_type']!==''?intval($post['platform_type']):'';
- if($platform_type!==''){
- $condition[]=["a.platform_type","=",$platform_type];
- }
- $saler= isset($post['saler']) && $post['saler']!='' ? trim($post['saler']) :"";
- if($saler!='') $condition []=["a.ownerName","like","%$saler%"];
- $salerid= isset($post['salerid']) && $post['salerid']!='' ? intval($post['salerid']) :"";
- if($salerid!='') $condition []=["a.ownerid","=",$salerid];
- $qrdtype= isset($post['qrdtype']) && $post['qrdtype']!='' ? intval($post['qrdtype']) :"";
- if($qrdtype!='') $condition []=["a.qrdType","=",$qrdtype];
- $qrdsource= isset($post['qrdsource']) && $post['qrdsource']!='' ? intval($post['qrdsource']) :"";
- if($qrdsource!='') $condition []=["a.qrdSource","=",$qrdsource];
- $sendstatus= isset($post['sendstatus']) && $post['sendstatus']!='' ? intval($post['sendstatus']) :"";
- if($sendstatus!='') $condition []=["a.sendStatus","=",$sendstatus];
- $tag_id= isset($post['tag_id'])&&$post['tag_id']!=="" ? intval($post['tag_id']) :"";
- if($tag_id!==''){
- if($tag_id==1) $condition[]=["a.inv_tag","=",1];
- if($tag_id==2) $condition[]=["a.pay_tag","=",1];
- if($tag_id==3) $condition[]=["a.pay_tag|inv_tag","=",1];
- if($tag_id==4) $condition[]=["a.pay_tag&inv_tag","=",1];
- }
- $poCode = isset($post['poCode']) && $post['poCode'] !== '' ? trim($post['poCode']) : '';
- if ($poCode !== '') {
- $condition[] = ['a.poCode', 'like', "%$poCode%"];
- }
- $cat_status= isset($post['cat_status'])&&$post['cat_status']!=="" ? intval($post['cat_status']) :"";
- if($cat_status!=='') $condition[]=["b.status","=",$cat_status];
- $list =Db::name("qrd_info")->alias("a")
- ->leftJoin("good b","a.goodNo=b.spuCode")
- ->field("a.*,b.status as cat_status,b.inv_cat_name,b.inv_cat_code,b.inv_tax,b.inv_good_name,b.isZx")
- ->order("a.createdTime desc")
- ->where($condition)->select();
- $data=[];
- foreach ( $list as $ky=>$value){
- $value['catInfo'] = json_decode($value['catInfo'],true);
- $value['inv_tag_name']='';
- $value['pay_tag_name']='';
- $value['pay_tag_img']='';
- $value['inv_tag_id']='0';
- $value['pay_tag_id']='0';
- $value['pay_tag_remark']='';
- $value['inv_tag_img']='';
- $value['inv_tag_remark']='';
- if($value['pay_tag']==1 || $value['inv_tag']==1){
- $tag =Db::name('tag_log')->alias('a')->leftJoin('order_tag b','a.tag_id=b.id')->where
- (['code'=>$value['sequenceNo'],'a.status'=>[1,2]])->order('id desc')->column('a.id,b.tag_name,a.tag_img,a.tag_remark','b.type');
- if($value['inv_tag']==1){
- $value['inv_tag_name']=$tag[4]['tag_name']??'';
- $value['inv_tag_id']=$tag[4]['id']??'0';
- $value['inv_tag_img']=$tag[4]['tag_img']??'';
- $value['inv_tag_remark']=$tag[4]['tag_remark']??'';
- }
-
- if($value['pay_tag']==1){
- $value['pay_tag_id']=$tag[3]['id']??'0';
- $value['pay_tag_name']=$tag[3]['tag_name']??'';
- $value['pay_tag_img']=$tag[3]['tag_img']??'';
- $value['pay_tag_remark']=$tag[3]['tag_remark']??'';
- }
- }
- $value['goodNum'] = $value['goodNum'] -$value['thNum'];
- $value['sendNum'] = $value['sendNum'] -$value['thNum'];
- $value['plat_pay_fee']=0;
- if($value['is_comon']==1){
- $tax = QrdInfo::where(["cxCode"=>$value['cxCode'],"is_comon"=>0])->findOrEmpty();
- if($tax->isEmpty()==false){
- $rate = $tax->totalPrice==0?0: ($tax->apay_fee/$tax->totalPrice);
- $value['plat_pay_fee']= round($value['totalPrice']* $rate,2);
- }
- }
- $invArr = Db::name("assoc")
- ->alias("a")
- ->leftJoin("invoice_good b", "a.viceCode=b.invNo AND b.orderCode =a.orderCode")
- ->where(["a.status" => [1, 2], "a.is_del" => 0, "a.type" => 1, "a.orderCode" => $value['sequenceNo']])->group("a.status")
- ->column("sum(b.goodNum) as goodNum", "a.status");
- $value['inv_num'] = $invArr[1]??0;
- $value['ainv_num'] = $invArr[2]??0;
- $value['winv_num'] =$value['goodNum']- $value['inv_num']-$value['ainv_num'];
- $data[]=$value;
- }
- return app_show(0,"获取成功",$data);
- }
- /**
- * 更改销售单状态 是否需要回款 0 未回款对账 1 回款对账 2 无需汇款操作
- */
- public function status(){
- $post =$this->request->only(["sequenceNo"=>'',"status"=>0],"post","trim");
- if($post['sequenceNo']==''){
- return error_show(1004,"参数 sequenceNo 不能为空");
- }
- if($post['status']===''){
- return error_show(1004,"参数 status 不能为空");
- }
- $qrdinfo =Db::name("qrd_info")->where("sequenceNo","=",$post['sequenceNo'])->findOrEmpty();
- if(empty($qrdinfo)){
- return error_show(1004,"未找到确认单信息");
- }
- if ($qrdinfo['status']==1){
- return error_show(1004,"确认单已参与对账");
- }
- $update=[
- "status"=>$post['status'],
- "updatetime"=>date("Y-m-d H:i:s")
- ];
- $up =Db::name("qrd_info")->where($qrdinfo)->update($update);
- if($up){
- return app_show(0,"更新成功");
- }else{
- return error_show(1003,"更新失败");
- }
- }
- //确认单信息详情
- public function saleinfo(){
- $post=$this->post;
- $sequenceNo =isset($post['sequenceNo'])&&$post['sequenceNo']?trim($post['sequenceNo']):"";
- if($sequenceNo==''){
- return error_show(1003,"参数 sequenceNo 不能为空");
- }
- $qrdinfo =Db::name("qrd_info")->where("sequenceNo","=",$post['sequenceNo'])->findOrEmpty();
- if(empty($qrdinfo)){
- return error_show(1004,"未找到确认单信息");
- }
- $goodinfo = Db::name("good")->where(["spuCode"=>$qrdinfo["goodNo"]])->findOrEmpty();
- $qrdinfo['goodinfo'] =$goodinfo;
- $qrdinfo['catInfo'] = json_decode($qrdinfo['catInfo'],true);
- $qrdinfo['inv_tag_name']='';
- $qrdinfo['pay_tag_name']='';
- $qrdinfo['pay_tag_img']='';
- $qrdinfo['inv_tag_id']='0';
- $qrdinfo['pay_tag_id']='0';
- $qrdinfo['pay_tag_remark']='';
- $qrdinfo['inv_tag_img']='';
- $qrdinfo['inv_tag_remark']='';
- $qrdinfo['orderTax']=OrderCategory::where(['code' => $qrdinfo['sequenceNo'], 'spuCode' => $qrdinfo['goodNo']])
- ->field(['cat_code', 'cat_name', 'merge_code', 'short_name', 'tax', 'inv_good_name'])->findOrEmpty();
- $qrdinfo['child']=[];
- if(isset($goodinfo['isCombind'])&&$goodinfo['isCombind']==1){
- $list=(new GoodCombind())->where('spuCode',$qrdinfo['goodNo'])->visible(['child'])->with(['child'])
- ->select();
- if(!$list->isEmpty()){
- $qrdinfo['child']=array_column($list->toArray(),'child');
- foreach ($qrdinfo['child'] as &$value){
- $value['orderTax'] = OrderCategory::where(['code' => $qrdinfo['sequenceNo'], 'spuCode' => $value['spuCode']])
- ->field(['cat_code', 'cat_name', 'merge_code', 'short_name', 'tax', 'inv_good_name'])->findOrEmpty();;
- }
- }
- } ;
- if($qrdinfo['pay_tag']==1 || $qrdinfo['inv_tag']==1){
- $tag =Db::name('tag_log')->alias('a')->leftJoin('order_tag b','a.tag_id=b.id')
- ->where(['code'=>$qrdinfo['sequenceNo'],'a.status'=>[1,2]])->order('id desc')->column('a.id,b.tag_name,a.tag_img,a.tag_remark','b.type');
- if($qrdinfo['inv_tag']==1){
- $qrdinfo['inv_tag_name']=$tag[4]['tag_name']??'';
- $qrdinfo['inv_tag_id']=$tag[4]['id']??'0';
- $qrdinfo['inv_tag_img']=$tag[4]['tag_img']??'';
- $qrdinfo['inv_tag_remark']=$tag[4]['tag_remark']??'';
- }
-
- if($qrdinfo['pay_tag']==1){
- $qrdinfo['pay_tag_id']=$tag[3]['id']??'0';
- $qrdinfo['pay_tag_name']=$tag[3]['tag_name']??'';
- $qrdinfo['pay_tag_img']=$tag[3]['tag_img']??'';
- $qrdinfo['pay_tag_remark']=$tag[3]['tag_remark']??'';
- }
- }
-
- $qrdinfo['goodNum'] = $qrdinfo['goodNum'] -$qrdinfo['thNum'];
- $qrdinfo['sendNum'] = $qrdinfo['sendNum'] -$qrdinfo['thNum'];
- $qrdinfo['customerAttr'] = Db::name("customer_info")->where(["companyNo"=>$qrdinfo['customerNo']])->value("parent",'');
- return app_show(0,"获取成功",$qrdinfo);
- }
- /**验证采销订单管联数据是否对账
- * @return \think\response\Json|void
- */
- public function OrderIsCheck(){
- $post =$this->request->only(["orderCode"=>'',"isCgd"=>0,"is_cgd_check"=>0],"post","trim");
- $vali=Validate::rule([
- "orderCode|销售单单号"=>"require|max:255",
- "isCgd|是否退采购单"=>"require|in:0,1",
- "is_cgd_check|只退采购单"=>"in:0,1"
- ]);
- if($vali->check($post)==false) return error_show(1004,$vali->getError());
- $data=[];
- if($post['is_cgd_check']==0){
- QrdInfo::CheckQrd($post['orderCode'],$data);
- CgdInfo::CheckCgd(['cxCode'=>$post['orderCode']],$data);
- if($post['isCgd']==1)CgdInfo::CheckCgd(['qrdCode'=>$post['orderCode']],$data);
- }else{
- CgdInfo::CheckCgd(['sequenceNo'=>$post['orderCode']],$data);
- CgdInfo::CheckCgd(['is_comon'=>2,'mainCode'=>$post['orderCode']],$data);
- }
-
-
- empty($data)?$this->success("不存在对账订单"):$this->error("存在对账业务数据",1005,$data);
- }
- }
|