load->library('session'); $this->load->_model('Model_fullordersmt','fullordersmt'); $this->load->_model('Model_fullorderexcel','fullorderexcel'); $this->load->_model('Model_shop','shop'); $this->load->_model('Model_typeclass','typeclass'); $this->load->_model('Model_express','express'); $this->load->_model('Model_country','country'); $this->load->_model('Model_productdescribe','productdescribe'); $this->load->_model('Model_customs','customs'); $this->load->_model('Model_detailed','detailed'); $this->load->_model('Model_productdescription','productdescription'); $this->load->_model('Model_logistics','logistics'); $this->load->_model('Model_hl','hl'); $this->load->_model('Model_excel','excel'); $this->load->_model('Model_warehouse','warehouse'); $this->load->_model('Model_customersmt','customersmt'); $this->load->_model('Model_user','user'); $this->load->_model('Model_dhl','dhl'); $this->load->_model('Model_ali','ali'); $this->load->_model('Model_notice','notice'); $this->load->_model('Model_api','api'); $this->load->_model('Model_apismt','apismt'); $this->load->_model('Model_usps','usps'); $this->load->_model('Model_fullorder_smt','fullorder_smt'); $this->load->_model('Model_fullordersmthb','fullordersmthb'); $this->load->_model('Model_whlabel','whlabel'); $this->load->_model('Model_specialstock','specialstock'); $this->load->_model('Model_reset','fullreset'); $this->load->_model('Model_systemwigsout','systemwigsout'); $this->load->_model('Model_ck','ck'); $this->load->_model('Model_weight','weight'); $this->load->_model('Model_pay','pay'); $this->load->_model('Model_whlabel_fc','whlabel_fc'); $this->load->_model('Model_transfer','transfer'); $this->load->_model('Model_systemtransfer','systemtransfer'); $this->load->_model('Model_power','power'); $this->load->_model('Model_setting','setting'); $this->load->_model('Model_returngoods','returngoods'); } //定义方法的调用规则 获取URI第二段值 public function _remap($arg,$arg_array) { if($arg == 'add')//添加 { $this->_add(); } else if($arg == 'edit')//修改 { $this->_edit($arg_array); } else if($arg == 'readonly')//修改 { $this->_readonly($arg_array); } else if($arg == 'readlist') { $this->_readlist(); } else if($arg == 'del')//修改 { $this->_del(); } else if($arg == 'price')//价格明细 { $this->_price(); } else if($arg == 'customs') { $this->_customs(); } else if($arg == 'express') { $this->_express(); } else if($arg == 'hl') { $this->_hl(); } else if($arg == 'repeat') { $this->_repeat(); } else if($arg == 'operation') { $this->_operation(); } else if($arg == 'merge') { $this->_merge(); } else if($arg == 'split') { $this->_split(); } else if($arg == 'fmexcel') { $this->_fmexcel(); } else if($arg == 'fdexcel') { $this->_fdexcel(); } else if($arg == 'fdfexcel') { $this->_fdfexcel(); } else if($arg == 'evaluate') { $this->_evaluate(); } else if($arg == 'state') { $this->_state(); } else if($arg == 'review') { $this->_review(); } else if($arg == 'black') { $this->_black(); } else if($arg == 'ryf') { $this->_ryf(); } else if($arg == 'expresstype') { $this->_expresstype(); } else if($arg == 'fsstate') { $this->_fsstate(); } else if($arg == 'power') { $this->_power(); } else if($arg == 'error') { $this->_error(); } else if($arg == 'yzaddress') { $this->_yzaddress(); } else if($arg == 'return') { $this->_return(); } else if($arg == 'bcbz') { $this->_bcbz(); } else if($arg == 'abc') { $this->_aaa(); } else if($arg == 'b') { $this->_bbb($arg_array); } else if($arg == 'plcx') { $this->_plcx($arg_array); } else if($arg == 'cf') { $this->_cf(); } else if($arg == 'epod') { $this->_epod(); } else if($arg == 'ddcf') { $this->_ddcf(); } else { $this->_index(); } } //管理 public function _index() { $dt = 0; if(isset($_SESSION['api'])) { $user = $this->user->get_api($_SESSION['api']); $usp = $user; $fgshop = "";$sid = ""; $user = explode('|',trim($user['shop'],'|')); foreach ($user as $value) { $fgshop .= " shop = ".$value." or"; $sid .= " id = ".$value." or"; } } $post = $this->input->post(NULL, TRUE); if(isset($post['page'])) { $page = $this->input->post('page',true); $perpage = $this->input->post('perpage',true); $warehouse = $this->input->post('warehouse',true); $timetk = $this->input->post('timetkk',true); $timetj = $this->input->post('timetjj',true); $shop = $this->input->post('shop',true); $source = $this->input->post('source',true); $state = $this->input->post('state',true); $review = $this->input->post('review',true); $type = $this->input->post('type',true); $express = $this->input->post('express',true); $orderinfo = $this->input->post('orderinfo',true); $user = $this->input->post('user',true); $client = $this->input->post('name',true); $fullname = $this->input->post('fullname',true); $waybill = $this->input->post('waybill',true); $number = $this->input->post('number',true); $email = $this->input->post('email',true); $dlz = $this->input->post('dlz',true); $print = $this->input->post('print',true); $library = $this->input->post('library',true); $country = $this->input->post('country',true); $paypal = $this->input->post('paypal',true); $sku = $this->input->post('sku',true); $xztime = $this->input->post('xztime',true); $timetk = strtotime($timetk)-1; $timetj = strtotime($timetj); $px = $this->input->post('px',true); $plorder = $this->input->post('pl',true); $where = "1=1 and (".rtrim($fgshop,'or').")"; if($warehouse) { $where .= " and type = '$warehouse'"; } if($timetk && $timetj) { $where .= " and ".$xztime." > '$timetk' and ".$xztime." < '$timetj'"; } if($shop) { $where .= " and shop = '$shop'"; } if($source) { $where .= " and source = '$source'"; } if($state) { $where .= " and state = '$state'"; } if($review) { $where .= " and review = '$review'"; } if($type) { $where .= " and type = '$type'"; } if($express) { $where .= " and express = '$express'"; } if($orderinfo) { $where .= " and orderinfo = '$orderinfo'"; } if($user) { $where .= " and user = '$user'"; } if($client) { $where .= " and client like '%$client%'"; } if($waybill) { $where .= " and waybill = '$waybill'"; } if($number) { $where .= " and number like '$number%'"; } if($email) { $where .= " and email = '$email'"; } if($library) { $where .= " and library = '$library'"; } if($country) { $where .= " and country = '$country'"; } if($print) { $where .= " and print = '$print'"; } if($paypal) { $where .= " and paypal = '$paypal'"; } if($dlz != '') { $where .= " and dlz = '$dlz'"; } if($sku) { $where .= " and sku like '%$sku%'"; } if($fullname) { $where .= " and fullname = '$fullname'"; } //数据排序 if($px) { $order_str = $px." desc"; } else { $order_str = "numberpx desc"; } if($plorder) { $plorderinfo = '';$plnumber = '';$pln = 0; $plorder = explode(',',trim($plorder,',')); foreach ($plorder as $value) { if(is_numeric($value)) { $plorderinfo .= " orderinfo = ".$value." or"; } else if($value != '') { $plorderinfo .= " number = '".$value."' or"; } } if($pln > 0) { $where .= " and (".rtrim($plorderinfo,'or').") and (".rtrim($plnumber,'or').")"; } else { $where .= " and (".rtrim($plorderinfo,'or').")"; } } if(empty($page)) { $start = 0; $perpage = 1; } else { $start = ($page - 1)*$perpage; } //取得信息列表id,shop,type,source,user,orderinfo,number,name,state,buytime,clientremarks,review,print,library,libraryconfirm,express,waybill,orderremarks,black $info_list = $this->fullordersmt->find_all($where,'id,shop,type,orderinfo,number,fullname,state,buytime,review,libraryconfirm,express,waybill,orderremarks,library,black,clientremarks',$order_str,$start,$perpage); //格式化数据 foreach ($info_list as $key=>$value) { $ud = $this->fullordersmt->read($value['id']); $ud['address'] = str_replace("'","’",$ud['address']); $ud['name'] = str_replace("'","’",$ud['name']); //$customer = $ud['source'] != 1?$this->customersmt->get_fullname($ud['fullname']):$this->customersmt->get_shopdata($value['shop'],$ud['name'],$ud['address']);//目前只用地址和收货人判断是否老客户 $customer = $this->customersmt->get_shopdata($value['shop'],$ud['name'],$ud['address']); //$a = array_column($customer, 'email'); //三维找其中健的数组 //$a = array_flip($a); //键和值调换 $currency = $this->country->read($ud['country']); $name = ($ud['source'] == 1)?$ud['name']:$value['fullname']; $lkh = "
".$name."
".$currency['ename']."
"; if($customer) { if($customer['type'] == 1 && $customer['num'] > 1) { $lkh .= "老客户(".$customer['num'].")
"; } else if($customer['type'] == 2) { $hmsp = $this->shop->read($customer['shop']); $lkh .= "黑名单
来自".$hmsp['shopname']."
"; } } $info_list[$key]['fullname'] = $lkh; $shop = $this->shop->read($value['shop']); $info_list[$key]['shop'] = $shop['shopname']; //$info_list[$key]['user'] = $shop['shopuser']; $warehouse = $this->warehouse->read($value['type']); $warehousetitle = $warehouse['title']; if($value['type'] != 13){$warehousetitle = "".$warehouse['title']."";} $info_list[$key]['type'] = $warehousetitle; $typeclass = $this->typeclass->read($value['state']); if($ud['source'] != 1) { $info_list[$key]['state'] = "".$typeclass['title'].""; if($ud['overtime'] > 0 && $ud['state'] == 207) { //date_default_timezone_set("US/Pacific-New"); $second = $ud['overtime']-time()+15*3600; $day = floor($second/(3600*24)); $second = $second%(3600*24);//除去整天之后剩余的时间 $hour = floor($second/3600); $second = $second%3600;//除去整小时之后剩余的时间 $minute = floor($second/60); $second = $second%60;//除去整分钟之后剩余的时间 //返回字符串 $info_list[$key]['state'] .= "".$day." 天 ".$hour." 时 ".$minute." 分
"; } } else { $info_list[$key]['state'] = $typeclass['title']; } if(!$value['buytime']) { $info_list[$key]['buytime'] = '无
'; } else { $info_list[$key]['buytime'] = ''.date('Y-m-d',$value['buytime']-$dt).'
'.date('H:i:s',$value['buytime']-$dt).'
'; } if($value['review'] == 1) { $info_list[$key]['review'] = "未送审"; } else if($value['review'] == 2) { $info_list[$key]['review'] = "待审核"; } else if($value['review'] == 3) { $info_list[$key]['review'] = "不通过"; } else if($value['review'] == 4) { $info_list[$key]['review'] = "取消重审"; } else if($value['review'] == 5) { $info_list[$key]['review'] = "审核通过"; } else if($value['review'] == 6) { $info_list[$key]['review'] = "自动通过"; } if($ud['dlz'] == 1) { $dlz = "发货声明成功
"; } else if($ud['dlz'] == 3) { $dlz = "不需要发货声明
"; } else if($ud['dlz'] == 2) { $dlz = "发货声明失败
"; } else { $dlz = ""; } if($value['waybill'] != "") { $info_list[$key]['waybill'] = "".$value['waybill']."
".$dlz; } if($value['express'] != 0) { $express = $this->express->read($value['express']); $expressservicename = $express['servicename']; if($value['express'] != 1 && $value['express'] != 63) { $expressservicename = "".$express['servicename'].""; } else if($value['express'] == 63) { $expressservicename = "".$express['servicename'].""; } $info_list[$key]['express'] = $expressservicename; } else { $info_list[$key]['express'] = "无"; } $x = ""; if($value['libraryconfirm'] == 2 && $value['review'] > 4 && $ud['library'] == 1) { $x = "禁止发货
"; } else if(($value['review'] > 4) && $ud['print'] != 1 && $value['libraryconfirm'] == 1) { $x = "允许发货
"; } if(($value['review'] > 4) && $ud['print'] == 2 && ($ud['merge'] == 0 || $ud['merge'] == $ud['id'])) { $x = "禁止打印
"; } else if($value['review'] >4 && $ud['print'] == 1 && ($ud['merge'] == 0 || $ud['merge'] == $ud['id'])) { $x = "允许打印
"; } else if($value['review'] > 4 && $ud['print'] == 2 && $ud['merge'] != $ud['id']) { $x = "禁止打印
"; } else if($value['review'] > 4 && $ud['print'] == 1 && $ud['merge'] != $ud['id']) { $x = "允许打印
"; } if($value['waybill'] == "" && $value['review'] > 4) { $x .= "填写运单号
"; } else if($value['waybill'] != "" && $value['review'] > 4 && $usp['vip'] == 1) { $x .= "修改运单号
"; } else if($value['waybill'] != "" && $value['review'] > 4 && $value['library'] == 1 && $usp['vip'] != 1) { $x .= "修改运单号
"; } if(($value['review'] == 1 || $value['review'] == 3) && $ud['express'] > 0 && $ud['dtsbjz'] != 0 && $ud['ts'] != 0 && $ud['zsbjz'] != 0 && $ud['zjs'] != 0 && $ud['ts'] != 0 && ($ud['merge'] == 0 || $ud['merge'] != 0 && $ud['merge'] == $ud['id'])) { $x .= "提交审核
"; } $x .= "客户信息
"; $info_list[$key]['black'] = $x; $tly = ""; if($value['clientremarks'] != "") { $tly = "有客户留言
"; } if($value['review'] > 4 && $usp['vip'] != 1 && ($ud['merge'] == 0 || $ud['merge'] == $ud['id'])) { $info_list[$key]['orderinfo'] = "".$value['orderinfo']."
".$tly."".$value['orderinfo']."
".$tly."".$value['orderinfo']."
".$tly."合并订单
"; } if($value['library'] == 1 && $ud['printtype'] == 3) { $info_list[$key]['library'] = "不需要"; } else if($value['library'] == 1 && $ud['printtype'] != 3) { $info_list[$key]['library'] = "未出库"; } else if($value['library'] == 2) { $info_list[$key]['library'] = ''.date('Y-m-d',$ud['librarytime']).'
'.date('H:i:s',$ud['librarytime']).'出库
'; } else if($value['library'] == 3) { $info_list[$key]['library'] = ''.date('Y-m-d',$ud['retreattime']).'
'.date('H:i:s',$ud['retreattime']).'退库
'; } } $total = $this->fullordersmt->find_count($where); $pagenum = ceil($total/$perpage); $over = $total-($start+$perpage); $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($info_list)); echo json_encode($rows);exit; } $wlshop = $this->shop->find_all('1=1 and '.rtrim($sid,'or')); $this->data['wlshop'] = $wlshop; $this->data['express'] = $this->express->find_all(); $user = $this->user->get_api($_SESSION['api']); $powerid = $this->power->read($user['power']); $powertext = explode('|',trim($powerid['excelid'],'|')); $pid = ''; foreach ($powertext as $v) { $pid .= " id = ".$v." or"; } $fullorderexcel = $this->fullorderexcel->find_all("type = '100004' and (".rtrim($pid,'or').")",'*','idorder desc');//导出模板 $this->data['fullorderexcel'] = $fullorderexcel; $error = $this->fullordersmt->find_count("failed !='' and mergeid = 0 and (".rtrim($fgshop,'or').") and dtime > '".(time()-90*24*3600)."'"); $this->data['error'] = $error; if(isset($_SESSION['api'])) { $user = $this->user->get_api($_SESSION['api']); if($user['vip'] == 1) { $vip = 1; } else { $vip = 0; } } else { $vip = 0; } $this->data['power'] = $vip; $country = $this->country->find_all('1=1','id,name','name asc');//所有国家信息 $this->data['country'] = $country; $this->data['user'] = $user; $this->_Template('fullordersmt',$this->data); } //筛选重复订单 public function _repeat() { $user = $this->user->get_api($_SESSION['api']); if($user) { $fgshop = "";$sid = ""; $user = explode('|',trim($user['shop'],'|')); foreach ($user as $value) { $fgshop .= " shop = ".$value." or"; $sid .= " id = ".$value." or"; } } $post = $this->input->post(NULL, TRUE); if(isset($post['page'])) { $page = $this->input->post('page',true); $perpage = $this->input->post('perpage',true); $shop = $this->input->post('shop',true); $timetk = $this->input->post('timetk',true); $timetj = $this->input->post('timetj',true); $timetk = strtotime($timetk); $timetj = strtotime($timetj); $where = "print != 3 and review = 1 and state = 207 and (".rtrim($fgshop,'or').")"; if($shop) { $where .= " and shop = '$shop'"; } if($timetk && $timetj) { $where .= " and buytime > '$timetk' and buytime < '$timetj'"; } //数据排序 $order_str = "numberpx desc"; if(empty($page)) { $start = 0; $perpage = 1; } else { $start = ($page - 1)*$perpage; } //取得信息列表 $info_list = $this->fullordersmt->find_all($where,'id,shop,type,orderinfo,number,state,buytime,name,userid,address,merge'); $info = array(); $len = count($info_list); //格式化数据 foreach ($info_list as $key=>$value) { $ud = $this->fullordersmt->read($value['id']); $shop = $this->shop->read($value['shop']); $info_list[$key]['shop'] = $shop['shopname']; $warehouse = $this->warehouse->read($value['type']); $info_list[$key]['type'] = $warehouse['title']; $typeclass = $this->typeclass->read($value['state']); if($ud['source'] != 1) { $info_list[$key]['state'] = "".$typeclass['title'].""; } else { $info_list[$key]['state'] = $typeclass['title']; } $info_list[$key]['buytime'] = ''.date('Y-m-d',$value['buytime']).'
'.date('H:i:s',$value['buytime']).'
'; $info_list[$key]['userid'] = $value['userid']; if($value['merge'] == 0) { $info_list[$key]['merge'] = "合并订单
"; } else { if($value['merge'] == $value['id']) { if($ud['print'] < '3' && $ud['library'] == '1') { $info_list[$key]['merge'] = "拆分订单
"; } else { $info_list[$key]['merge'] = "已合并"; } } else { $info_list[$key]['merge'] = "被合并"; } } } for($i=0;$i<$len;$i++) { for($j=$i+1;$j<$len;$j++) { if ($info_list[$i]['name'] == $info_list[$j]['name'] || $info_list[$i]['address'] == $info_list[$j]['address'] || $info_list[$i]['userid'] == $info_list[$j]['userid'] && ($info_list[$i]['state'] == $info_list[$j]['state'] && $info_list[$i]['type'] == $info_list[$j]['type'])) { if(!array_key_exists($j,$info)) { $info[$j] = $info_list[$j]; } if(!array_key_exists($i,$info)) { $info[$i] = $info_list[$i]; } } } } rsort($info); $total = count($info); $pagenum = ceil($total/$perpage); $over = $total-($start+$perpage); $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>(array_slice($info,$start,$perpage))); echo json_encode($rows);exit; } $wlshop = $this->shop->find_all('1=1 and '.rtrim($sid,'or')); $this->data['wlshop'] = $wlshop; $this->_Template('fullordersmt_repeat',$this->data); } //修改 public function _edit($arg_array) { if(isset($_SESSION['api'])) { $user = $this->user->get_api($_SESSION['api']); if($user['vip'] == 1) { $vip = 1; } else { $vip = 0; } $xwtype = ''; $userwh = explode('|',trim($user['warehouse'],'|')); foreach ($userwh as $v) { $xwtype .= " id = ".$v." or"; } } else { $vip = 0; } $post = $this->input->post(NULL, TRUE); if(isset($post['id'])) { $id = $this->input->post('id',true); $data = $this->fullordersmt->read($id); $post['type'] = $this->input->post('warehouse',true); $post['country'] = $this->input->post('country',true); $currency = $this->country->read($post['country']); $post['al'] = $currency['lb']; $post['freight'] = $this->input->post('freight',true); $post['expressmoney'] = $this->input->post('expressmoney',true); $post['shouldmoney'] = $this->input->post('shouldmoney',true); $orderremarks = $this->input->post('orderremarks'); $orderremarks = str_replace(array('%26','%2B'),array('&','+'),$orderremarks); $post['orderremarks'] = $orderremarks; $post['shipremarks'] = $this->input->post('shipremarks'); $post['email'] = $this->input->post('email',true); $name = $this->input->post('name',true); $post['name'] = str_replace("'","’",$name); $post['phone'] = $this->input->post('phone',true); $post['country'] = $this->input->post('country',true); $post['province'] = $this->input->post('province',true); $post['city'] = $this->input->post('city',true); $post['zipcode'] = $this->input->post('zipcode',true); $post['street'] = $this->input->post('street',true); $address = $this->input->post('address',true); $post['address'] = str_replace("'","’",$address); $post['express'] = $this->input->post('express',true); $post['printtype'] = $this->input->post('printtype',true); $fpdata = $this->input->post('fpdata'); $fpdata = str_replace(array('%26','%2B'),array('&','+'),$fpdata); $post['fpdata'] = $fpdata; $post['waybill'] = $this->input->post('waybill',true); $post['msg'] = $this->input->post('msg',true); $post['zsbjz'] = $this->input->post('zsbjz',true); $post['refundy'] = $this->input->post('refundy',true); $post['refundj'] = $this->input->post('refundj',true); $rtime = $this->input->post('rtime',true); $post['rtime'] = strtotime($rtime); $post['rpaypal'] = $this->input->post('rpaypal',true); $post['rtext'] = $this->input->post('rtext',true); $post['ioss'] = $this->input->post('ioss',true); $post['sbpm'] = $this->input->post('sbpm',true); $post['edittime'] = time(); $post['waybill'] = preg_replace('/( | | | |\s)/','',$post['waybill']); $pay = $this->pay->get_typeclass($data['pay']); $yga = $post['shouldmoney']; $ygc = $data['estimaterate']; $post['budget'] = 0; $ifbudget = eval("return $yga*1.$ygc;"); if($ifbudget > 0) { $post['budget'] = eval("return $yga*1.$ygc;"); } $editstate = $this->input->post('state',true); $whlabel = $this->input->post('whlabel',true); $fpcount = $this->input->post('fpcount',true); $whlabeldata = explode('|',trim($whlabel,'|'));$way = 0; foreach ($whlabeldata as $va) { if(stripos($va,'z') !== false) { $way += 1; } } if((($post['express'] == 2 || $post['express'] == 63 || $post['express'] == 64) && $post['type'] != 5) || ($post['express'] != 2 && $post['express'] != 63 && $post['express'] != 64 && $post['type'] == 5)) { echo json_encode(array('msg'=>'此快递方式必须选择美国仓!','success'=>false));exit; } if($way == count($whlabeldata) && $post['type'] != 12) { echo json_encode(array('msg'=>'必须选择特殊仓!','success'=>false));exit; } if($post['express'] == 42 && $post['sbpm'] != 'Human Hair Wigs' && $post['sbpm'] != 'Human Hair Goods')//$post['express'] == 3 || { echo json_encode(array('msg'=>'此快递方式必须选择Human Hair Wigs/Human Hair Goods!','success'=>false));exit; } if($post['express'] == 24 && $post['sbpm'] != 'Hair Sample' && $post['sbpm'] != 'Human Hair Wigs' && $post['sbpm'] != 'Human Hair Goods')//$post['express'] == 3 || { echo json_encode(array('msg'=>'此快递方式必须选择Hair Sample/Human Hair Wigs/Human Hair Goods!','success'=>false));exit; } if($post['country'] != 192 && $post['express'] == 1 && $post['sbpm'] != 'Synthetic Hair Wigs' && $post['sbpm'] != 'Synthetic Hair Goods')//$post['express'] == 3 || { echo json_encode(array('msg'=>'非美国选择官方DHL必须选择Synthetic Hair Wigs/Synthetic Hair Goods','success'=>false));exit; } $post['review'] = 1; if($post['zsbjz'] < '0.01') { echo json_encode(array('msg'=>'总申报价错误!','success'=>false));exit; } if($data['shop'] == '9' && $post['type'] != '7' && $post['type'] != '8' && $post['type'] != '9') { echo json_encode(array('msg'=>'仓库选择错误!','success'=>false));exit; } if($data['library'] == 1) { if($data['print'] != 3 && $data['review'] < 5) { $post['libraryconfirm'] = 1; $post['librarynot'] = "订单未打印"; } else if($data['print'] != 3 && $data['review'] > 4) { $post['print'] = 1; $post['libraryconfirm'] = 1; $post['librarynot'] = "订单未打印,订单审核后修改"; } else { $post['libraryconfirm'] = 1; $post['librarynot'] = "订单打印后修改"; } } if($data['yhs'] == 1) { echo json_encode(array('msg'=>'仓库货物验证中,请稍后再试!','success'=>false));exit; } if(($post['express'] == '5' || $post['express'] == '24' || $post['express'] == '31') && $post['country'] != 192) { echo json_encode(array('msg'=>'非美国无法选择Fedex!','success'=>false));exit; } if(($post['express'] == '28' || $post['express'] == '7') && $post['country'] != 191) { echo json_encode(array('msg'=>'非英国无法选择CNE和GES!','success'=>false));exit; } if($data['type'] != '5' && $post['type'] == '5' && $editstate != '207') { echo json_encode(array('msg'=>'等待发货状态才可选择美仓!','success'=>false));exit; } if($post['express'] == '2' && $post['bx'] > 0) { echo json_encode(array('msg'=>'此物流不允许购买保险','success'=>false));exit; } if($post['printtype'] == 1)//如果是运单 { $post['productdescription'] = $this->input->post('productdescription',true); $post['customs'] = $this->input->post('customs',true); } $express = $this->express->read($post['express']); if($express['ioss'] == 1 && $post['ioss'] == '') { echo json_encode(array('msg'=>'此快递方式必须选择IOSS!','success'=>false));exit; } if(strlen($post['address']) > $express['addresssize'] || strlen($post['address2']) > $express['addresssize']) { echo json_encode(array('msg'=>'此快递方地址不可超出'.$express['addresssize'].'个字符','success'=>false));exit; } if($post['zsbjz'] > $express['sbjz']) { echo json_encode(array('msg'=>'总申报价值不可超出'.$express['sbjz'],'success'=>false));exit; } if($post['shouldmoney'] > $express['shouldmoney'] && $express['shouldmoney'] != 0) { echo json_encode(array('msg'=>'订单金额不可超出'.$express['shouldmoney'],'success'=>false));exit; } if($post['express'] == '2' && $post['zzl'] > '16' && $post['js'] == '0') { echo json_encode(array('msg'=>'重量大于16不可按Ground Advantage提交!','success'=>false));exit; } if($post['express'] == '2' && isset($post['js']) && $post['js'] == '0'&& $post['qm'] == '1') { echo json_encode(array('msg'=>'Ground Advantage不可使用签名服务!','success'=>false));exit; } if(($post['express'] == '3' || $post['express'] == '42' || $post['express'] == '24' || $post['express'] == '31') && $post['shouldmoney'] < 1) { echo json_encode(array('msg'=>'零金额订单不可发 UPS/DHL官方-美国/Fedex(杭州)','success'=>false));exit; } if($post['express'] == '6' && $post['province'] == '') { echo json_encode(array('msg'=>'选择DPEX必须填写州信息','success'=>false));exit; } if(($post['express'] == '24' || $post['express'] == '3') && $post['shouldmoney'] == 0) { echo json_encode(array('msg'=>'0金额订单不可发UPS/Fedex(杭州)!!!','success'=>false));exit; } if($post['express'] == '42' && $post['zsbjz'] < 1) { echo json_encode(array('msg'=>'零申报金额不可发 DHL官方-美国','success'=>false));exit; } if($post['country'] == '35' && $post['zsbjz'] > 20) { echo json_encode(array('msg'=>'加拿大不可申报超过20美金!!!','success'=>false));exit; } if($post['express'] == 2 && strlen($post['zipcode']) != 5)//如果usps 邮编不是5位 { echo json_encode(array('msg'=>'USPS-USA的邮编需按5位数格式提交!','success'=>false));exit; } /** if($editstate == 216 && $data['state'] != 216) { echo json_encode(array('msg'=>'不可修改为完成状态','success'=>false));exit; } **/ if($editstate == 216 && preg_match('/\d/is',$post['waybill']) != true) { echo json_encode(array('msg'=>'当前信息不可修改订单状态','success'=>false));exit; } else { if($data['review'] == 1 && $data['source'] != 1) { $review = 6; if($data['merge'] != '0') { $hdata = $this->fullordersmt->find_all("merge = '".$data['merge']."' and id != '".$data['id']."'"); foreach ($hdata as $v) { $this->fullordersmt->save(array('review'=>6),$v['id']); } } } else if($data['review'] == 3 || ($data['review'] == 1 && $data['source'] == 1)) { $review = 2; } else { $review = $data['review']; } $post['review'] = $review; $post['state'] = $editstate; $post['reviewtime'] = time(); } $thisdata = $this->fullordersmt->read($id); $warehouse = $this->warehouse->read($thisdata['type']); $warehousenew = $this->warehouse->read($post['type']); if($warehousenew['bdcountry'] != 0 && $post['country'] != $warehousenew['bdcountry']) { echo json_encode(array('msg'=>'当前国家无法选择'.$warehousenew['title'].'!','success'=>false));exit; } if(($warehouse['zd'] == '1' || stripos($thisdata['whlabel'],'z|') !== false) && $thisdata['library'] == '2' && $post['type'] != $thisdata['type'])//如果已出库并且开启库存模式仓库或者有特殊库存,禁止调整仓库 { echo json_encode(array('msg'=>'此单已占用库存并出库,无法更改仓库!','success'=>false));exit; } $expt = $this->express->read($post['express']); if($expt['pt'] != '' && stripos($post['fpdata'],$expt['pt']) !== false) { echo json_encode(array('msg'=>$expt['ptts'],'success'=>false));exit; } if($expt['province'] != '' && stripos($expt['province'],$post['province'].'、') !== false) { echo json_encode(array('msg'=>'此省/州不可使用 '.$expt['servicename'],'success'=>false));exit; } /** if($warehouse['zd'] == '1' && $warehouse['ys'] != '1' && $thisdata['library'] == '2' && $post['fpdata'] != $thisdata['fpdata']) { echo json_encode(array('msg'=>'已扣减库存,无法更改产品!','success'=>false));exit; } **/ //开始注释 xyxg /** $ft = array(); $ftdata = explode('|',rtrim($fpcount,'|')); foreach ($ftdata as $va) { $ftitle = ''; $va = explode('-',trim($va,'-')); foreach ($va as $v) { $v = $this->typeclass->read($v); $ftitle .= $v['title'].' '; } $ft[] = rtrim($ftitle,' '); } if(stripos($whlabel,'z|') !== false || stripos($thisdata['whlabel'],'z|') !== false) { $tskcyz = $this->specialstock->get_kc($thisdata['state'],$post['state'],$whlabel,$thisdata['whlabel'],$thisdata['number']); if($tskcyz['t'] > '0') { echo $tskcyz['m'];exit; } } $kcyz = $this->whlabel->get_kc($data['state'],$post['state'],$warehousenew['zd'],$warehousenew['ys'],$post['type'],$whlabel,$fpcount,$ft,$thisdata['number'],$thisdata['shop'],$thisdata['type'],$thisdata['whlabel']); if($kcyz['t'] > '0') { echo $kcyz['m'];exit; } else { if($this->fullordersmt->save($post,$id)) { echo json_encode(array('msg'=>'修改成功','id'=>$id,'success'=>true));exit; } else { echo json_encode(array('msg'=>'修改失败,请重试','success'=>false));exit; } } //结束注释 **/ $warehouse = $this->warehouse->read($post['type']); if($data['library'] == 1 || ($data['library'] != 2 && ($post['state'] != '207' || $post['state'] == '209'))) { $kcyz = $this->ck->get_kc($post['state'],$warehouse,$thisdata['shop'],$thisdata['number'],$whlabel,$fpdata); if($kcyz['t'] > '0') { echo $kcyz['m'];exit; } else if($kcyz['fpdata'] != '') { $post['whlabel'] = $kcyz['whlabel']; $post['fpdata'] = $kcyz['fpdata']; } } $fl = $this->ck->get_fl($warehouse['hz'],$whlabel,$fpdata); $post['sfxh'] = $fl['sfxh']; $post['ckfl'] = $fl['ckfl']; //查询净重开始 $post['jweight'] = $this->weight->get_weightcx($post['fpdata']); //查询净重结束 if($this->fullordersmt->save($post,$id)) { if($data['printtime'] == '0') { $xghz = ',该单将自动禁止打印'; } else if($data['printtime'] > '0' && $data['librarytime'] == '0') { $xghz = ',该单将自动禁止发货'; } else { $xghz = ''; } echo json_encode(array('msg'=>'修改成功'.$xghz,'id'=>$id,'success'=>true));exit; } else { echo json_encode(array('msg'=>'修改失败,请重试','success'=>false));exit; } } $arg_array = $arg_array[0];$fpdata = array(); $fullordersmt = $this->fullordersmt->read($arg_array); $returngoods = $this->returngoods->get_orderinfo($fullordersmt['orderinfo']); $this->data['returngoods'] = $returngoods?1:0; $fullordersmt['parameter'] = str_replace(",","---",$fullordersmt['parameter']); $country = $this->country->find_all('1=1','id,name','name asc');//所有国家信息 $express = $this->express->find_all('1=1');//所有快递配置信息 $this->data['fullordersmt'] = $fullordersmt; if($fullordersmt['express'] == 2) { $zzhl = 'oz'; } else { $zzhl = 'kg'; } $this->data['zzhl'] = $zzhl; $this->data['country'] = $country; $this->data['express'] = $express; $this->data['dtime'] = date('Y-m-d H:i:s',$fullordersmt['dtime']); $warehouse = $this->warehouse->read($fullordersmt['type']); if(stripos($fullordersmt['fpdata'],';') !== false) { $fpdata = explode(';',rtrim($fullordersmt['fpdata'],';')); foreach ($fpdata as $k=>$v) { $xxv = explode('|',$v); if(isset($xxv[9]) && stripos($xxv[9],$warehouse['hz']) !== false && $warehouse['hz'] != '' && $warehouse['zd'] == 1) { $xxv['zd'] = "已占单
"; $bdck = $warehouse['bdck']; if(stripos($xxv[9],'~') !== false) { $dxxv = explode('~',trim($xxv[9],'~')); foreach ($dxxv as $val) { $wzid = $this->$bdck->read(trim($val,$warehouse['hz'])); if($wzid['details'] != '') { $xxv['zd'] .= '位置:'.$wzid['details'].' - '.$wzid['cpid'].'
'; } } } else { $wzid = $this->$bdck->read(trim($xxv[9],$warehouse['hz'])); if($wzid['details'] != '') { $xxv['zd'] .= '位置:'.$wzid['details'].' - '.$wzid['cpid'].'
'; } } } $fpdata[$k] = $xxv; } } $this->data['fpdata'] = $fpdata; $thfpdataxs = array(); if($fullordersmt['thfpdata'] != '') { $thfpdata = explode(';',trim($fullordersmt['thfpdata'],';')); foreach ($thfpdata as $k=>$v) { $thxs = explode('~',trim($v,'~')); $thxs[0] = explode('|',trim($thxs[0],'|')); $thxs[1] = explode('|',trim($thxs[1],'|')); $thfpdataxs[] = array("".$thxs[0][1]."
".$thxs[1][1]."
","".$thxs[0][2]."
".$thxs[1][2]."
","旧
新
",$thxs[1][0]); } } $this->data['thfpdata'] = $thfpdataxs; $shop = $this->shop->read($fullordersmt['shop']); $this->data['et'] = $shop['estimaterate'];//此店铺配置预计到帐金额比例 $is = 0; if($shop['type'] == 269)//判断是否独立站,269是独立站 { $is = 1; } $this->data['is'] = $is; $this->data['power'] = $vip; /** 历史运单号展示并下载PDF 打印时间需要2019-3-21 0点之后有记录 **/ $downwaybill = '';$dwls = array(); $oldwaybill = explode('-',ltrim($fullordersmt['oldwaybill'],'-')); if(isset($oldwaybill[0][1])) { $oldwaybill = array_reverse($oldwaybill); //调整顺序 foreach ($oldwaybill as $v) { $dw = explode('/',$v); if(isset($dw[1])) { if(stripos($downwaybill,$dw[1]) === false) { $dwls[$dw[1]] = 1; $downwaybill .= ''.$dw[1].'、'; } } } } if($fullordersmt['printtype'] == 1) { if($fullordersmt['waybill'] != '' && !isset($dwls[$fullordersmt['waybill']])) { $downwaybill = ''.$fullordersmt['waybill'].'、'.$downwaybill; } } $this->data['downwaybill'] = rtrim($downwaybill,'、'); $product = ''; if($fullordersmt['link'] != '' && $fullordersmt['source'] != '1') { $pt = explode(';',rtrim($fullordersmt['product'],';')); $lk = explode(',',$fullordersmt['link']); for($i=0;$i已占单
"; $bdck = $warehouse['bdck']; if(stripos($xxv[9],'~') !== false) { $dxxv = explode('~',trim($xxv[9],'~')); foreach ($dxxv as $val) { $wzid = $this->$bdck->read(trim($val,$warehouse['hz'])); if($wzid['details'] != '') { $xxv['zd'] .= '位置:'.$wzid['details'].' - '.$wzid['cpid'].'
'; } } } else { $wzid = $this->$bdck->read(trim($xxv[9],$warehouse['hz'])); if($wzid['details'] != '') { $xxv['zd'] .= '位置:'.$wzid['details'].' - '.$wzid['cpid'].'
'; } } } $fpdata[$k] = $xxv; } } $this->data['fpdata'] = $fpdata; $thfpdataxs = array(); if($fullordersmt['thfpdata'] != '') { $thfpdata = explode(';',trim($fullordersmt['thfpdata'],';')); foreach ($thfpdata as $k=>$v) { $thxs = explode('~',trim($v,'~')); $thxs[0] = explode('|',trim($thxs[0],'|')); $thxs[1] = explode('|',trim($thxs[1],'|')); $thfpdataxs[] = array("".$thxs[0][1]."
".$thxs[1][1]."
","".$thxs[0][2]."
".$thxs[1][2]."
","旧
新
",$thxs[1][0]); } } $this->data['thfpdata'] = $thfpdataxs; $shop = $this->shop->read($fullordersmt['shop']); $this->data['et'] = $shop['estimaterate'];//此店铺配置预计到帐金额比例 $is = 0; if($shop['type'] == 269)//判断是否独立站,269是独立站 { $is = 1; } $this->data['is'] = $is; //单项开始 $warehouse = $this->warehouse->read($fullordersmt['warehouse']);//发货仓库 $state = $this->typeclass->read($fullordersmt['state']);//订单状态 $country = $this->country->read($fullordersmt['country']);//国家 if($fullordersmt['capital'] == 1) { $capital = '暂未支付'; } else if($fullordersmt['capital'] == 2) { $capital = '部分支付'; } else if($fullordersmt['capital'] == 3) { $capital = '全部支付'; } if($fullordersmt['printtype'] == 1) { $printtype = '运单'; } else if($fullordersmt['printtype'] == 2) { $printtype = '发货单'; } else if($fullordersmt['printtype'] == 3) { $printtype = '不打印单据'; } else { $printtype = '未选择'; } $this->data['warehouse'] = $warehouse['title']; $this->data['state'] = $state['title']; $this->data['capital'] = $capital; $this->data['country'] = $country['ename']; $this->data['printtype'] = $printtype; //单项结束 /** 历史运单号展示并下载PDF 打印时间需要2019-3-21 0点之后有记录 **/ $downwaybill = '';$dwls = array(); $oldwaybill = explode('-',ltrim($fullordersmt['oldwaybill'],'-')); if(isset($oldwaybill[0][1])) { $oldwaybill = array_reverse($oldwaybill); //调整顺序 foreach ($oldwaybill as $v) { $dw = explode('/',$v); if(isset($dw[1])) { $dwls[$dw[1]] = 1; $downwaybill .= ''.$dw[1].'、'; } } } if($fullordersmt['printtype'] == 1) { if($fullordersmt['waybill'] != '' && !isset($dwls[$fullordersmt['waybill']])) { $downwaybill = ''.$fullordersmt['waybill'].'、'.$downwaybill; } } $this->data['downwaybill'] = rtrim($downwaybill,'、'); /** 历史打印时间 **/ $printtime = ''; if($fullordersmt['oldprinttime']) { $pte = explode('-',rtrim($fullordersmt['oldprinttime'],'-')); foreach ($pte as $v) { $printtime .= date('Y-m-d H:i:s',$v).'、'; } } $this->data['printtime'] = rtrim($printtime,'、'); $product = ''; if($fullordersmt['link'] != '' && $fullordersmt['source'] != '1') { $pt = explode(';',rtrim($fullordersmt['product'],';')); $lk = explode(',',$fullordersmt['link']); for($i=0;$i'.date('Y-m-d',$ud['dtime']).'
'.date('H:i:s',$ud['dtime']).'
'; } else { $info_list[$key]['buytime'] = ''.date('Y-m-d',$value['buytime']).'
'.date('H:i:s',$value['buytime']).'
'; } $express = $this->express->read($value['express']); $info_list[$key]['express'] = $express['servicename']; if($value['print'] == 1) { $info_list[$key]['print'] = "不可打印"; } else if($value['print'] == 2) { $info_list[$key]['print'] = "未打印"; } else if($value['print'] == 3) { $info_list[$key]['print'] = ''.date('Y-m-d',$ud['printtime']).'
'.date('H:i:s',$ud['printtime']).'
'; } if($value['library'] == 1) { $info_list[$key]['library'] = "未出库"; } else if($value['library'] == 2) { $info_list[$key]['library'] = ''.date('Y-m-d',$ud['librarytime']).'
'.date('H:i:s',$ud['librarytime']).'
'; } else if($value['library'] == 3) { $info_list[$key]['library'] = "已退库"; } } $total = $this->fullordersmt->find_count($where); $pagenum = ceil($total/$perpage); $over = $total-($start+$perpage); $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($info_list)); echo json_encode($rows);exit; } $this->_Template('fullordersmt_readlist',$this->data); } //删除 public function _del() { $post = $this->input->post(NULL, TRUE); if(isset($post['s'])) { $id_arr = $this->input->post('s'); $id_arr = explode(',',$id_arr); if(!$id_arr) { echo json_encode(array('msg'=>'参数错误!','success'=>false));exit; } //循环删除记录 foreach ($id_arr as $v) { $this->fullordersmt->remove($v); } echo json_encode(array('del'=>$id_arr,'msg'=>'删除记录成功!','success'=>true)); } } //查找商品价格 public function _price() { $post = $this->input->post(NULL, TRUE); if(isset($post['data'])) { $data = $this->input->post('data'); $data = explode('-',$data); $number = '';$num = count($data); //循环删除记录 for($i=0;$i<$num-1;$i++) { if($data[$i] != 0) { $number=$number.$data[$i]; if($i == 2) { $number=$number.$data[$num-1]; } } } $list = $this->productdescribe->get_number($number); if($list) { echo json_encode(array('msg'=>($list),'n'=>$data[$num-1],'number'=>$number,'success'=>true)); } else { $list = array('purchase'=>0,'cost'=>0,'salesprice'=>0); //echo json_encode(array('msg'=>'此信息没有配置价格!','n'=>$data[$num-1],'success'=>false));exit; echo json_encode(array('msg'=>($list),'n'=>$data[$num-1],'number'=>$number,'success'=>true));exit; } } } public function _customs() { $post = $this->input->post(NULL, TRUE); if(isset($post['e'])) { $e = $this->input->post('e');//快递信息 $c = $this->input->post('c');//国家信息 $data = $this->customs->find_all('express = "'.$e.'" and country = "'.$c.'"'); $list = $this->productdescription->find_all('express = "'.$e.'" and country = "'.$c.'"'); $rows = array(); foreach ($data as $key=>$value) { $detailed = explode('|',trim($value['detailed'],'|')); //此处未对比重量选择价值,暂直接选择第一条海关价值 $detailed = $this->detailed->read($detailed[0]); $money = $detailed['customsval'];//找到海关价值 } foreach ($list as $key=>$value) { $description = $this->typeclass->read($value['description']); $list[$key]['title'] = $description['title'];//产品描述名称 } if(!$data && !$list) { echo json_encode(array('msg'=>'无此快递配置信息!','success'=>false));exit; } else { //$list-title -description 取值 echo json_encode(array('money'=>sprintf("%.2f",$money),'msg'=>$list,'success'=>true)); } } } public function _express() { $post = $this->input->post(NULL, TRUE); if(isset($post['e'])) { $e = $this->input->post('e');//快递信息 $c = $this->input->post('c');//国家信息 $data = $this->logistics->find_all('express = "'.$e.'" and country = "'.$c.'"'); if(!$data) { echo json_encode(array('success'=>false));exit; } else { echo json_encode(array('money'=>sprintf("%.2f",$data[0]['firstmoney']),'success'=>true)); } } } public function _hl() { $post = $this->input->post(NULL, TRUE); if(isset($post['cy'])) { $hl = 0; $cy = $this->input->post('cy');//币种ID $cy = $this->typeclass->read($cy); $gethl = $this->hl->get_hl(); foreach ($gethl as $v) { $code = str_replace(" ","",$v['code']); if($code == $cy['title']) { $hl = $v['refePrice']/100; } } echo json_encode(array('msg'=>$hl,'success'=>true)); } } public function _operation() { $post = $this->input->post(NULL, TRUE); if(isset($post['type'])) { $type = $this->input->post('type'); $id = $this->input->post('id'); $msg = $this->input->post('msg'); if($type == 1)//禁止发货 { $d = $this->fullordersmt->read($id); if($d['library'] != 1) { echo json_encode(array('msg'=>'操作失败,订单非未出库状态!','success'=>false));exit; } if($msg == "") { echo json_encode(array('msg'=>'必须填写禁止原因!','success'=>false));exit; } if($d['print'] < 3) { $a = "订单未打印,"; } else { $a = ""; } if($this->fullordersmt->save(array('libraryconfirm'=>1,'librarynot'=>$a.$msg),$id)) { echo json_encode(array('msg'=>'操作成功','l'=>1,'d'=>$id,'success'=>true));exit; } else { echo json_encode(array('msg'=>'操作失败,请重试','success'=>false));exit; } } if($type == 6)//允许发货 { $d = $this->fullordersmt->read($id); if($d['library'] > 1) { echo json_encode(array('msg'=>'订单已出库,操作失败','success'=>false));exit; } if($d['print'] < 3) { $a = "订单未打印,"; } else { $a = ""; } if($this->fullordersmt->save(array('libraryconfirm'=>2,'librarynot'=>$a.$msg),$id)) { echo json_encode(array('msg'=>'操作成功','l'=>1,'d'=>$id,'success'=>true));exit; } else { echo json_encode(array('msg'=>'操作失败,请重试','success'=>false));exit; } } if($type == 7)//禁止打印 { $d = $this->fullordersmt->read($id); if($d['printtime'] != 0) { echo json_encode(array('msg'=>'订单已打印,操作失败','success'=>false));exit; } if($d['library'] > 1) { echo json_encode(array('msg'=>'订单已出库,操作失败','success'=>false));exit; } if($d['print'] == 3) { echo json_encode(array('msg'=>'操作失败,订单已打印!','success'=>false));exit; } if($d['print'] < 3) { $a = "订单未打印,"; } else { $a = ""; } if($this->fullordersmt->save(array('print'=>1),$id)) { echo json_encode(array('msg'=>'操作成功','l'=>2,'d'=>$id,'success'=>true));exit; } else { echo json_encode(array('msg'=>'操作失败,请重试','success'=>false));exit; } } if($type == 8)//允许打印 { $d = $this->fullordersmt->read($id); /** if($d['printtime'] != 0) { echo json_encode(array('msg'=>'订单已打印,操作失败','success'=>false));exit; } **/ if($d['library'] > 1) { echo json_encode(array('msg'=>'订单已出库,操作失败','success'=>false));exit; } if($d['print'] < 3) { $a = "订单未打印,"; } else { $a = ""; } if($d['printtime'] == '0') { $bcprint = 2; } else { $bcprint = 3; } if($this->fullordersmt->save(array('print'=>$bcprint,'failed'=>'','librarynot'=>$a.$d['librarynot']),$id)) { echo json_encode(array('msg'=>'操作成功','l'=>2,'d'=>$id,'success'=>true));exit; } else { echo json_encode(array('msg'=>'操作失败,请重试','success'=>false));exit; } } if($type == 9)//关闭 { if($this->fullordersmt->save(array('failed'=>''),$id)) { echo json_encode(array('msg'=>'操作成功','l'=>2,'d'=>$id,'success'=>true));exit; } else { echo json_encode(array('msg'=>'操作失败,请重试','success'=>false));exit; } } if($type == 10)//允许出库 { if($this->fullordersmt->save(array('failed'=>'','libraryconfirm'=>2),$id)) { echo json_encode(array('msg'=>'操作成功','l'=>2,'d'=>$id,'success'=>true));exit; } else { echo json_encode(array('msg'=>'操作失败,请重试','success'=>false));exit; } } if($type == 2)//填写运单、修改运单 { $d = $this->fullordersmt->read($id); if($d['source'] == 1) { $this->fullordersmt->save(array('waybill'=>$msg,'state'=>216,'dlz'=>3),$id); echo json_encode(array('msg'=>'操作成功','success'=>true));exit; } $ex = $this->express->read($d['express']); $shop = $this->shop->read($d['shop']); if($d['express'] == 0) { echo json_encode(array('msg'=>'操作失败,未选择物流方式!','success'=>false));exit; } if($d['library'] == 3 || ($d['print'] == 3 && $d['libraryconfirm'] == 1)) { echo json_encode(array('msg'=>'操作失败,不允许填写运单号!','success'=>false));exit; } if($d['dlz'] == 1 || $d['dlz'] == 2)//如果已经声明过需要操作修改声明 { $obtain = $this->apismt->get_obtain($d['orderinfo'],$shop['code']);//修改声明先查询之前物流信息 if(isset($obtain['logistics_no'])) { $result = $this->apismt->get_editout($obtain['logistics_no'],$msg,'all',$d['orderinfo'],$obtain['service_name'],$ex['aecode'],$shop['code']); } if(isset($result['result_success']) && $result['result_success'] == 1) { $this->fullordersmt->save(array('waybill'=>$msg),$id); /** 合并信息处理开始-修改声明 **/ if($d['merge'] != '0') { $hdata = $this->fullordersmt->find_all("merge = '".$d['merge']."' and id != '".$d['id']."' and dlz = '0' and source != 1");$i=0; foreach ($hdata as $v) { $obtain = $this->apismt->get_obtain($v['orderinfo'],$shop['code']);//修改声明先查询之前物流信息 if(isset($obtain['logistics_no'])) { $result = $this->apismt->get_editout($obtain['logistics_no'],$msg,'all',$v['orderinfo'],$obtain['service_name'],$ex['aecode'],$shop['code']); } if(isset($result['result_success']) && $result['result_success'] == 1) { $this->fullordersmt->save(array('waybill'=>$msg),$v['id']); } else { $this->fullordersmt->save(array('waybill'=>$msg,'dlz'=>4),$v['id']); } $i++; if($i > 10) { break; } } } /** 合并信息处理结束开始 **/ echo json_encode(array('msg'=>'操作成功','success'=>true));exit; } else { echo json_encode(array('msg'=>'修改声明失败,请重试','xq'=>$obtain,'success'=>false));exit; } } else if($d['dlz'] == '0')//未发货声明状态 { $result = $this->apismt->get_out($msg,'all',$d['orderinfo'],$ex['aecode'],$shop['code']); if(isset($result['result_success']) && $result['result_success'] == "true") { $this->fullordersmt->save(array('waybill'=>$msg,'state'=>209,'dlz'=>1),$id); /** 合并信息处理开始-发货声明 **/ if($d['merge'] != '0') { $hdata = $this->fullordersmt->find_all("merge = '".$d['merge']."' and id != '".$d['id']."' and dlz = '0' and source != 1");$i=0; foreach ($hdata as $v) { $result = $this->apismt->get_out($msg,'all',$v['orderinfo'],$ex['aecode'],$shop['code']); if(isset($result['result_success']) && $result['result_success'] == "true") { $this->fullordersmt->save(array('waybill'=>$msg,'state'=>209,'dlz'=>1),$v['id']); } else { $this->fullordersmt->save(array('waybill'=>$msg,'state'=>209,'dlz'=>2),$v['id']); } $i++; if($i > 10) { break; } } } /** 合并信息处理结束开始 **/ echo json_encode(array('msg'=>'操作成功','success'=>true));exit; } else { echo json_encode(array('msg'=>'声明失败:'.$result['result_error_desc'],'success'=>false));exit; } } else { if($this->fullordersmt->save(array('waybill'=>$msg),$id)) { echo json_encode(array('msg'=>'操作成功','success'=>true));exit; } else { echo json_encode(array('msg'=>'操作失败,请重试','success'=>false)); } } } } } public function _merge() { $user = $this->user->get_api($_SESSION['api']); if($user) { $fgshop = "";$sid = ""; $user = explode('|',trim($user['shop'],'|')); foreach ($user as $value) { $fgshop .= " shop = ".$value." or"; $sid .= " id = ".$value." or"; } } $post = $this->input->post(NULL, TRUE); if(isset($post['type'])) { $post = array(); $type = $this->input->post('type'); $id = $this->input->post('id'); $u = $this->fullordersmt->read($id); $rows = $this->fullordersmt->find_all('name = "'.$u['name'].'" and userid = "'.$u['userid'].'" and address = "'.$u['address'].'" and state = "207" and print != "3" and review = "1" and type = "'.$u['type'].'" and merge = "0" and ('.rtrim($fgshop,"or").')','*','id desc'); if(count($rows)>1) { $this->db->trans_begin(); $hd = $this->fullordersmthb->get_orderinfo($u['orderinfo']); if(!$hd) { $this->fullordersmthb->insert($u); } //相加 $post['shouldmoney'] = $u['shouldmoney'];//购买应收金额 $post['budget'] = $u['budget'];//预估到帐金额 $post['expressmoney']= $u['expressmoney'];//物流金额 //$post['refundy'] = $u['refundy'];//补/退原额 //$post['refundj'] = $u['refundj'];//补/退净额 $post['cost'] = $u['cost'];//成本金额 //$post['zzl'] = $u['zzl'];//总重量 //$post['zsbjz'] = $u['zsbjz'];//总申报价值 $post['ts'] = $u['ts'];//条数 $post['cost'] = $u['cost'];//成本金额 //追加 $post['rpaypal'] = $u['rpaypal'];//补/退交易号 $post['rtext'] = $u['rtext'];//补/退原因 $post['pay'] = $u['pay'];//付款方式 $post['paypal'] = $u['paypal'];//交易号 $post['clientremarks'] = $u['clientremarks'];//客户留言 $post['product'] = $u['product'];//商品名称 //$post['issku'] = $u['issku'];//sku //$post['orderremarks'] = $u['orderremarks'];//订单备注 $post['shipremarks'] = $u['shipremarks'];//仓库品名 //产品追加 $post['fpdata'] = $u['fpdata'];//产品内容 $post['whlabel'] = $u['whlabel'];//产品对应库存码 $merge = $u['id']; $d = array($id);$order = ''; $zsl = 0;$zccsl = 0; foreach ($rows as $v) { if($v['id'] != $id && $v['shop'] = $u['shop']) { $hd = $this->fullordersmthb->get_orderinfo($v['orderinfo']); if(!$hd) { $this->fullordersmthb->insert($v); } $post['shouldmoney'] += $v['shouldmoney'];//购买应收金额 $post['budget'] += $v['budget'];//预估到帐金额 $post['expressmoney'] += $v['expressmoney'];//物流金额 //$post['refundy'] += $v['refundy'];//补/退原额 //$post['refundj'] += $v['refundj'];//补/退净额 $post['cost'] += $v['cost'];//成本金额 //$post['zzl'] += $v['zzl'];//总重量 //$post['zsbjz'] += $v['zsbjz'];//总申报价值 $post['ts'] += $v['ts'];//条数 //$post['rpaypal'] .= $v['rpaypal'];//补/退交易号 //$post['rtext'] .= $v['rtext'];//补/退原因 //$post['pay'] .= (stripos($post['pay'],$v['pay']) !== false)?'':';'.$v['pay'];//付款方式 //$post['paypal'] .= $v['paypal'];//交易号 $post['clientremarks'] .= $v['clientremarks'];//客户留言 $post['product'] .= $v['product'];//商品名称 //$post['issku'] .= $v['issku'];//sku //$post['orderremarks'] .= $v['orderremarks'];//订单备注 $post['shipremarks'] .= $v['shipremarks'];//仓库品名 $post['fpdata'] .= $v['fpdata'];//产品内容 $post['whlabel'] .= $v['whlabel'];//产品对应库存码 $d[] = $v['id']; $order .= $v['orderinfo'].'('.$v['number'].')、'; $wl = $this->whlabel->find_all("zd = '".$v['number']."'");//查找是否有占用库存情况 $i = 0; if($wl)//如果有那么清除所有占用 { foreach ($wl as $v) { if($v['sku'] == 'Preset' && $v['state'] == '9') { $this->whlabel->remove($v['id']);//删除预设 $i++; } else { $this->whlabel->save(array('zd'=>''),$v['id']);//专属 $i++; } } } $zsl += count($wl); $zccsl += $i; $this->fullordersmt->save(array('merge'=>$id,'mergeid'=>1,'orderremarks'=>' 《合并信息》:'.'已合并到'.$u['orderinfo'].'('.$u['number'].')中; '.$v['orderremarks'],'shouldmoney'=>0,'print'=>1,'libraryconfirm'=>1,'shouldmoney'=>0,'budget'=>0,'whlabel'=>'','fpdata'=>'','shipremarks'=>''),$v['id']); } } //计算出单条价值 /** if($post['zsbjz'] < 1 || $post['ts'] < 1) { $post['dtsbjz'] = 0; } else { $post['dtsbjz'] = $post['zsbjz']/$post['ts'];//单条申报价 } **/ $post['orderremarks'] = ' 《合并信息》:由'.rtrim($order,'、').'合并而来; '.$u['orderremarks'];; $post['merge'] = $id; //$post['mergeid'] = 1; $this->fullordersmt->save($post,$id); if ($this->db->trans_status() === FALSE || $zsl != $zccsl) { $this->db->trans_commit(); echo json_encode(array('msg'=>'操作失败,请重试','success'=>false));exit; } else { $this->db->trans_commit(); echo json_encode(array('msg'=>'操作成功','d'=>($d),'b'=>$id,'success'=>true)); } } else { echo json_encode(array('msg'=>'缺少可合并单','success'=>false));exit; } } } public function _split() { $user = $this->user->get_api($_SESSION['api']); if($user) { $fgshop = "";$sid = ""; $user = explode('|',trim($user['shop'],'|')); foreach ($user as $value) { $fgshop .= " shop = ".$value." or"; $sid .= " id = ".$value." or"; } } $post = $this->input->post(NULL, TRUE); if(isset($post['id'])) { $id = $this->input->post('id'); $data = $this->fullordersmt->find_all("merge = '$id' and print !=3 and library =1 and (".rtrim($fgshop,'or').")"); $datanum = $this->fullordersmt->find_count("merge = '$id' and (".rtrim($fgshop,'or').")"); if($data && count($data) == $datanum) { foreach ($data as $k=>$v) { unset($data[$k]['id']); unset($data[$k]['express']); unset($data[$k]['printtype']); unset($data[$k]['review']); unset($data[$k]['reviewtime']); $t = $this->fullordersmt->get_orderinfo($v['orderinfo']); $this->fullordersmt->save($v,$t['id']); } echo json_encode(array('msg'=>'拆分成功!','success'=>true)); } else { echo json_encode(array('msg'=>'有订单不符合条件,请重试','success'=>false));exit; } } } //评价管理 public function _evaluate() { $user = $this->user->get_api($_SESSION['api']); if($user) { $fgshop = "";$sid = ""; $user = explode('|',trim($user['shop'],'|')); foreach ($user as $value) { $fgshop .= " shop = ".$value." or"; $sid .= " id = ".$value." or"; } } $post = $this->input->post(NULL, TRUE); if(isset($post['page'])) { $page = $this->input->post('page',true); $perpage = $this->input->post('perpage',true); $shop = $this->input->post('shop',true); $where = "1=1 and evaluate = 0 and (".rtrim($fgshop,'or').")"; if($shop) { $where .= " and shop = '$shop'"; } //数据排序 $order_str = "id desc"; if(empty($page)) { $start = 0; $perpage = 1; } else { $start = ($page - 1)*$perpage; } //取得信息列表 $info_list = $this->fullordersmt->find_all($where,'id,shop,orderinfo,number,operation',$order_str,$start,$perpage); //格式化数据 foreach ($info_list as $key=>$value) { $shop = $this->shop->read($value['shop']); $info_list[$key]['shop'] = $shop['shopname']; $info_list[$key]['operation'] = "评价"; } $total = $this->fullordersmt->find_count($where); $pagenum = ceil($total/$perpage); $over = $total-($start+$perpage); $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($info_list)); echo json_encode($rows);exit; } $this->_Template('fullordersmt_evaluate',$this->data); } //订单消息 public function _state() { $user = $this->user->get_api($_SESSION['api']); if($user) { $fgshop = "";$sid = ""; $user = explode('|',trim($user['shop'],'|')); foreach ($user as $value) { $fgshop .= " shop = ".$value." or"; $sid .= " id = ".$value." or"; } } $post = $this->input->post(NULL, TRUE); if(isset($post['page'])) { $page = $this->input->post('page',true); $perpage = $this->input->post('perpage',true); $timetk = $this->input->post('timetk',true); $timetj = $this->input->post('timetj',true); $shop = $this->input->post('shop',true); $source = $this->input->post('source',true); $state = $this->input->post('state',true); $review = $this->input->post('review',true); $expressstate = $this->input->post('expressstate',true); $express = $this->input->post('express',true); $orderinfo = $this->input->post('orderinfo',true); $user = $this->input->post('user',true); $name = $this->input->post('name',true); $waybill = $this->input->post('waybill',true); $timetk = strtotime($timetk); $timetj = strtotime($timetj); $where = "1=1 and mergeid = 0 and (".rtrim($fgshop,'or').")"; if($timetk && $timetj) { $where .= " and dtime > '$timetk' and dtime < '$timetj'"; } if($shop) { $where .= " and shop = '$shop'"; } if($source) { $where .= " and source = '$source'"; } if($state) { $where .= " and state = '$state'"; } if($review) { $where .= " and review = '$review'"; } if($expressstate != "") { $where .= " and expressstate = '$expressstate'"; } if($express) { $where .= " and express = '$express'"; } if($orderinfo) { $where .= " and orderinfo = '$orderinfo'"; } if($user) { $where .= " and user = '$user'"; } if($name) { $where .= " and name = '$name'"; } if($waybill) { $where .= " and waybill = '$waybill'"; } //数据排序 $order_str = "id desc"; if(empty($page)) { $start = 0; $perpage = 1; } else { $start = ($page - 1)*$perpage; } //取得信息列表 $info_list = $this->fullordersmt->find_all($where,'id,shop,user,orderinfo,number,country,state,library,librarytime,exstate,express,waybill,content,exstateerror',$order_str,$start,$perpage); //格式化数据 foreach ($info_list as $key=>$value) { $ud = $this->fullordersmt->read($value['id']); $shop = $this->shop->read($value['shop']); $info_list[$key]['shop'] = $shop['shopname']; $info_list[$key]['user'] = $shop['shopuser']; $country = $this->country->read($value['country']); $info_list[$key]['country'] = $country['name']; $state = $this->typeclass->read($value['state']); if($ud['source'] != '1') { $info_list[$key]['state'] = "".$state['title'].""; } else { $info_list[$key]['state'] = $state['title']; } if($value['library'] == 1) { $info_list[$key]['library'] = "未出库"; } else if($value['library'] == 2) { $info_list[$key]['library'] = "已出库"; } else if($value['library'] == 3) { $info_list[$key]['library'] = "已退库"; } if($value['librarytime'] == '0') { $info_list[$key]['librarytime'] = '无'; } else { $info_list[$key]['librarytime'] = date('Y-m-d H:i:s',$value['librarytime']); } if($value['exstate'] == 0) { $info_list[$key]['exstate'] = "未取件"; } else if($value['exstate'] == 1) { $info_list[$key]['exstate'] = "已揽收"; } else if($value['exstate'] == 2) { $info_list[$key]['exstate'] = "在途中"; } else if($value['exstate'] == 3) { $info_list[$key]['exstate'] = "派送中"; } else if($value['exstate'] == 4) { $info_list[$key]['exstate'] = "签收"; } if($value['express']) { $express = $this->express->read($value['express']); $info_list[$key]['express'] = $express['servicename']; } else { $info_list[$key]['express'] = ''; } } $total = $this->fullordersmt->find_count($where); $pagenum = ceil($total/$perpage); $over = $total-($start+$perpage); $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($info_list)); echo json_encode($rows);exit; } $wlshop = $this->shop->find_all('1=1 and '.rtrim($sid,'or')); $this->data['wlshop'] = $wlshop; $this->data['express'] = $this->express->find_all(); $this->_Template('fullordersmt_state',$this->data); } //审核订单 public function _review() { $user = $this->user->get_api($_SESSION['api']); $fgshop = ""; if($user) { $fgshop = "";$sid = ""; $user = explode('|',trim($user['shop'],'|')); foreach ($user as $value) { $fgshop .= " shop = ".$value." or"; } $fgshop = " and (".rtrim($fgshop,'or').")"; } $post = $this->input->post(NULL, TRUE); if(isset($post['page'])) { $page = $this->input->post('page',true); $perpage = $this->input->post('perpage',true); $source = $this->input->post('source',true); $warehouse = $this->input->post('warehouse',true); $express = $this->input->post('express',true); $user = $this->input->post('user',true); $shop = $this->input->post('shop',true); $review = $this->input->post('review',true); $orderinfo = $this->input->post('orderinfo',true); $number = $this->input->post('number',true); $timetk = $this->input->post('timetk',true); $timetj = $this->input->post('timetj',true); $timetk = strtotime($timetk); $timetj = strtotime($timetj); $where = "mergeid = 0".$fgshop; if($timetk && $timetj) { $where .= " and dtime > '$timetk' and dtime < '$timetj'"; } if($source) { $where .= " and source = '$source'"; } if($shop) { $where .= " and shop = '$shop'"; } if($warehouse) { $where .= " and type = '$warehouse'"; } if($express) { $where .= " and express = '$express'"; } if($user) { $where .= " and user = '$user'"; } if($review) { $where .= " and review = '$review'"; } if($orderinfo) { $where .= " and orderinfo = '$orderinfo'"; } if($number) { $where .= " and number = '$number'"; } //数据排序 $order_str = "id desc"; if(empty($page)) { $start = 0; $perpage = 1; } else { $start = ($page - 1)*$perpage; } //取得信息列表 $info_list = $this->fullordersmt->find_all($where,'id,shop,user,type,orderinfo,number,client,express,buytime,shouldmoney,review,currencytitle,library'); //格式化数据 foreach ($info_list as $key=>$value) { $lr = $this->fullordersmt->read($value['id']); $shop = $this->shop->read($value['shop']); $info_list[$key]['shop'] = $shop['shopname']; $info_list[$key]['user'] = $shop['shopuser']; $warehouse = $this->warehouse->read($value['type']); $info_list[$key]['type'] = $warehouse['title']; $express = $this->express->read($value['express']); $info_list[$key]['express'] = $express['servicename']; $info_list[$key]['buytime'] = ''.date('Y-m-d',$value['buytime']).'
'.date('H:i:s',$value['buytime']).'
'; if($value['review'] == 1) { $info_list[$key]['review'] = "未送审"; } else if($value['review'] == 2) { $info_list[$key]['review'] = "待审核"; } else if($value['review'] == 3) { $info_list[$key]['review'] = "不通过"; } else if($value['review'] == 4) { $info_list[$key]['review'] = "取消重审"; } else if($value['review'] == 5) { $info_list[$key]['review'] = "审核通过"; } else if($value['review'] == 6) { $info_list[$key]['review'] = "自动通过"; } if($value['review'] == 2) { $info_list[$key]['library'] = "审核通过
不通过
"; } else if($value['review'] == 3) { $info_list[$key]['library'] = "审核通过
"; } else if($value['review'] == 5) { $info_list[$key]['library'] = "不通过
"; } else { $info_list[$key]['library'] = ""; } $info_list[$key]['shouldmoney'] = $value['shouldmoney'].' '.$lr['currencytitle']; $lr['hl'] = $lr['hl']==0?6.71:$lr['hl']; $cost = $lr['cost']/$lr['hl']; $currencytitle = $lr['budget']-$lr['refundj']-$cost-$lr['expressmoney']; $info_list[$key]['currencytitle'] = sprintf("%.2f",$currencytitle).' '.$lr['currencytitle']; } $total = $this->fullordersmt->find_count($where); $pagenum = ceil($total/$perpage); $over = $total-($start+$perpage); $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($info_list)); echo json_encode($rows);exit; } $this->_Template('fullordersmt_review',$this->data); } //导出资金统计excel public function _fmexcel() { $user = $this->user->get_api($_SESSION['api']); if($user) { $fgshop = "";$sid = ""; $user = explode('|',trim($user['shop'],'|')); foreach ($user as $value) { $fgshop .= " shop = ".$value." or"; $sid .= " id = ".$value." or"; } } if(isset($_GET['excel'])) { $timetk = $this->input->get('timetk',true); $timetj = $this->input->get('timetj',true); $shop = $this->input->get('shop',true); $source = $this->input->get('source',true); $state = $this->input->get('state',true); $type = $this->input->get('type',true); $orderinfo = $this->input->get('orderinfo',true); $user = $this->input->get('user',true); $name = $this->input->get('name',true); $timetk = strtotime($timetk); $timetj = strtotime($timetj); $where = "1=1 and mergeid = 0 and (".rtrim($fgshop,'or').")"; if($timetk && $timetj) { $where .= " and buytime > '$timetk' and buytime < '$timetj'"; } if($shop) { $where .= " and shop = '$shop'"; } if($source) { $where .= " and source = '$source'"; } if($state) { if($state == 1) { $where .= " and state = '$state'"; } } if($type) { $where .= " and type = '$type'"; } if($orderinfo) { $where .= " and orderinfo = '$orderinfo'"; } if($user) { $where .= " and user = '$user'"; } if($name) { $where .= " and name = '$name'"; } //取得信息列表 $info_list = $this->fullordersmt->find_all($where,'id,shop,user,number,orderinfo,client,country,dtime,ftime,express,waybill,shouldmoney,refund,currency,budget,fpdata,hl,currencytitle'); //格式化数据 $i = 1;$shouldmoney = 0;$refund = 0;$budget = 0;$currency = 0;$hl=1; foreach ($info_list as $key=>$value) { $info_list[$key]['id'] = $i; if($value['currencytitle'] != "CNY") { $hl=$value['hl']; } $shouldmoney=$shouldmoney+($value['shouldmoney']*$hl); $budget=$budget+($value['budget']*$hl); $currency=$currency+(($value['shouldmoney']-$value['budget'])*$hl); $refund=$refund+($value['refund']*$hl); $shop = $this->shop->read($value['shop']); $info_list[$key]['shop'] = $shop['shopname']; $info_list[$key]['user'] = $shop['shopuser']; $info_list[$key]['dtime'] = date('Y-m-d H:i:s',$value['dtime']); $info_list[$key]['ftime'] = date('Y-m-d H:i:s',$value['ftime']); $country = $this->country->read($value['country']); $info_list[$key]['country'] = $country['name']; $express = $this->express->read($value['express']); $info_list[$key]['express'] = $express['servicename']; $info_list[$key]['shouldmoney'] = $value['shouldmoney'].' '.$value['currencytitle']; $info_list[$key]['refund'] = $value['refund'].' '.$value['currencytitle']; $info_list[$key]['budget'] = $value['budget'].' '.$value['currencytitle']; $info_list[$key]['currency'] = sprintf("%.2f",$value['shouldmoney']-$value['budget']).' '.$value['currencytitle']; $fpdata = array(); if(stripos($value['fpdata'],';') !== false) { $fpdata = explode(';',rtrim($value['fpdata'],';')); foreach ($fpdata as $ke=>$va) { $v = explode('|',rtrim($va,'|')); $fpdata[$ke] = array($v[4],$v[5],$v[6],$v[5]*$v[6]);//内容,条数,数量,总条数 } } $info_list[$key]['fpdata'] = $fpdata; $i++; } $data = array($shouldmoney.' CNY',$refund.' CNY',$currency.' CNY',$budget.' CNY'); $title = "订单资金信息"; $titlename = "".$title." | ||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
NO. | 店铺 | 负责人 | 编号 | 订单号 | 客户姓名 | 国家 | 订单日期 | 发货日期 | 快递公司 | 运单号 | 订单金额 | 退款金额 | 手续费 | 预估金额 |
|
总条数 |
".$title." | ||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
NO. | 店铺 | 编号 | 订单号 | 订单类型 | 客户姓名 | 收件人名称 | 收货人地址 | 城市 | 邮编 | 州 | 国家 | 收件电话 | 订单日期 | 发货日期 | 订单状态 | 订单金额 | 快递公司 | 运单号 | 订单备注 | 客户备注 |
|
总条数 |
"; $warehouse = $this->warehouse->read($value['type']); $warehousetitle = $warehouse['title']; if($value['type'] != 1){$warehousetitle = "".$warehouse['title']."";} $info_list[$key]['type'] = $warehousetitle; if($value['express'] != 0) { $express = $this->express->read($value['express']); $expressservicename = $express['servicename']; if($value['express'] != 1){$expressservicename = "".$express['servicename']."";} $info_list[$key]['express'] = $expressservicename; } else { $info_list[$key]['express'] = "无"; } $x = ""; if($ud['review'] >4 && $ud['print'] == 1) { $x = "
允许打印
"; } else if($ud['review'] >4 && $ud['print'] == 3 && $ud['libraryconfirm'] == 1) { $x = "清除错误
"; } else { $x = "关闭
"; } $info_list[$key]['operation'] = $x; } $total = $this->fullordersmt->find_count($where); $pagenum = ceil($total/$perpage); $over = $total-($start+$perpage); $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($info_list)); echo json_encode($rows);exit; } $wlshop = $this->shop->find_all('1=1 and '.rtrim($sid,'or')); $this->data['wlshop'] = $wlshop; $this->data['express'] = $this->express->find_all(); $user = $this->user->get_api($_SESSION['api']); $powerid = $this->power->read($user['power']); $powertext = explode('|',trim($powerid['excelid'],'|')); $pid = ''; foreach ($powertext as $v) { $pid .= " id = ".$v." or"; } $fullorderexcel = $this->fullorderexcel->find_all("type = '100004' and (".rtrim($pid,'or').")",'*','idorder desc');//导出模板 $this->data['fullorderexcel'] = $fullorderexcel; $this->_Template('fullordersmt_error',$this->data); } //关闭订单详情时保存备注 public function _bcbz() { $post = $this->input->post(NULL, TRUE); if(isset($post['id'])) { $fpcount = $this->input->post('fpcount',true); if(!$fpcount) { echo json_encode(array('msg'=>'未设置商品信息!','success'=>false));exit; } $post['edittime'] = time(); $fpdata = $this->input->post('fpdata'); $fpdata = str_replace(array('%26','%2B'),array('&','+'),$fpdata); $post['fpdata'] = $fpdata; $post['state'] = $this->input->post('state'); $post['type'] = $this->input->post('warehouse'); $post['ioss'] = $this->input->post('ioss'); $rtime = $this->input->post('rtime',true); if($rtime) { $post['rtime'] = strtotime($rtime); } $id = $this->input->post('id',TRUE); $whlabel = $this->input->post('whlabel',true); $data = $this->fullordersmt->read($id); $editstate = $post['state']; if($data['library'] == 1) { if($data['print'] != 3 && $data['review'] < 5) { $post['libraryconfirm'] = 1; $post['librarynot'] = "订单未打印"; } else if($data['print'] != 3 && $data['review'] > 4) { $post['print'] = 1; $post['libraryconfirm'] = 1; $post['librarynot'] = "订单未打印,订单审核后修改"; } else { $post['libraryconfirm'] = 1; $post['librarynot'] = "订单打印后修改"; } } if($data['yhs'] == 1) { echo json_encode(array('msg'=>'仓库货物验证中,请稍后再试!','success'=>false));exit; } if((($post['express'] == 2 || $post['express'] == 63 || $post['express'] == 64) && $post['type'] != 5) || ($post['express'] != 2 && $post['express'] != 63 && $post['express'] != 64 && $post['type'] == 5)) { echo json_encode(array('msg'=>'此快递方式必须选择美国仓!','success'=>false));exit; } if(($post['express'] == '5' || $post['express'] == '24' || $post['express'] == '31') && $data['country'] != 192) { echo json_encode(array('msg'=>'非美国无法选择Fedex!','success'=>false));exit; } if(($post['express'] == '28' || $post['express'] == '7') && $data['country'] != 191) { echo json_encode(array('msg'=>'非英国无法选择CNE和GES!','success'=>false));exit; } $express = $this->express->read($post['express']); if($express['ioss'] == 1 && $post['ioss'] == '') { echo json_encode(array('msg'=>'此快递方式必须选择IOSS!','success'=>false));exit; } if(isset($post['address']) && (strlen($post['address']) > $express['addresssize'] || strlen($post['address2']) > $express['addresssize'])) { echo json_encode(array('msg'=>'此快递方地址不可超出'.$express['addresssize'].'个字符','success'=>false));exit; } if($data['type'] != '5' && $post['type'] == '5' && $editstate != '207') { echo json_encode(array('msg'=>'等待发货状态才可选择美仓!','success'=>false));exit; } if($data['library'] == 2 && $data['print'] == 3 && $data['waybill'] != $post['waybill']) { echo json_encode(array('msg'=>'不允许修改运单号','success'=>true));exit; } $thisdata = $data; $warehouse = $this->warehouse->read($thisdata['type']); $warehousenew = $this->warehouse->read($post['type']); if(($warehouse['zd'] == '1' || stripos($thisdata['whlabel'],'z|') !== false) && $thisdata['library'] == '2' && $post['type'] != $thisdata['type'])//如果已出库并且开启库存模式仓库或者有特殊库存,禁止调整仓库 { echo json_encode(array('msg'=>'此单已占用库存并出库,无法更改仓库!','success'=>false));exit; } /** if($warehouse['zd'] == '1' && $warehouse['ys'] != '1' && $thisdata['library'] == '2' && $post['fpdata'] != $thisdata['fpdata']) { echo json_encode(array('msg'=>'已扣减库存,无法更改产品!','success'=>false));exit; } **/ if($data['shop'] == '9' && $post['type'] != '7' && $post['type'] != '8' && $post['type'] != '9') { echo json_encode(array('msg'=>'仓库选择错误!','success'=>false));exit; } /** if($warehousenew['zd'] == '1' && $editstate != $thisdata['state'] && $thisdata['library'] == '1')//如果提交的仓库开启库存模式并且更改订单状态并且未出库,那么拒绝 { echo json_encode(array('msg'=>'如需更改订单状态,请先把仓库选择为非开启库存模式仓库或等待订单出库!','success'=>false));exit; } if($warehousenew['zd'] == '1' && $editstate != '207' && $thisdata['library'] == '1')//如果提交的仓库开启库存模式并且更改订单状态并且未出库,那么拒绝 { echo json_encode(array('msg'=>'非待发货状态,不允许修改为开启库存模式仓库','success'=>false));exit; } **/ //开始注释 xyxg /** $ft = array(); $ftdata = explode('|',rtrim($fpcount,'|')); foreach ($ftdata as $va) { $ftitle = ''; $va = explode('-',trim($va,'-')); foreach ($va as $v) { $v = $this->typeclass->read($v); $ftitle .= $v['title'].' '; } $ft[] = rtrim($ftitle,' '); } if(stripos($whlabel,'z|') !== false || stripos($thisdata['whlabel'],'z|') !== false) { $tskcyz = $this->specialstock->get_kc($thisdata['state'],$post['state'],$whlabel,$thisdata['whlabel'],$thisdata['number']); if($tskcyz['t'] > '0') { echo $tskcyz['m'];exit; } } $kcyz = $this->whlabel->get_kc($thisdata['state'],$post['state'],$warehousenew['zd'],$warehousenew['ys'],$post['type'],$whlabel,$fpcount,$ft,$thisdata['number'],$thisdata['shop'],$thisdata['type'],$thisdata['whlabel']);//旧状态、新状态、仓库占单设置、仓库预设设置、新仓库、新产品简化数字、旧产品数字、旧产品名称、订单号、订单店铺、旧订单仓库、旧产品简化数字 if($kcyz['t'] > '0') { echo $kcyz['m'];exit; } else { if($this->fullordersmt->save($post,$id)) { echo json_encode(array('msg'=>'保存成功','id'=>$id,'a'=>$kcyz,'success'=>true));exit; } else { echo json_encode(array('msg'=>'保存失败,请重试','success'=>false));exit; } } //结束注释 **/ $warehouse = $this->warehouse->read($post['type']); if($data['library'] == 1 || ($data['library'] != 2 && ($post['state'] != '207' || $post['state'] == '209'))) { $kcyz = $this->ck->get_kc($post['state'],$warehouse,$thisdata['shop'],$thisdata['number'],$whlabel,$fpdata); if($kcyz['t'] > '0') { echo $kcyz['m'];exit; } else if($kcyz['fpdata'] != '') { $post['whlabel'] = $kcyz['whlabel']; $post['fpdata'] = $kcyz['fpdata']; } } $fl = $this->ck->get_fl($warehouse['hz'],$whlabel,$fpdata); $post['sfxh'] = $fl['sfxh']; $post['ckfl'] = $fl['ckfl']; $post['jweight'] = $this->weight->get_weightcx($post['fpdata']); if($this->fullordersmt->save($post,$id)) { echo json_encode(array('msg'=>'保存成功','id'=>$id,'success'=>true));exit; } else { echo json_encode(array('msg'=>'保存失败,请重试','success'=>false));exit; } } } //验证地址 public function _yzaddress() { $post = $this->input->post(NULL, TRUE); if(isset($post['address'])) { $address = $this->input->post('address',true); $address2 = $this->input->post('address2',true); $city = $this->input->post('city',true); $province = $this->input->post('province',true); $zipcode = $this->input->post('zipcode',true); $barcode = $this->usps->get_address(array('address'=>$address,'address2'=>$address2,'city'=>$city,'province'=>$province,'zipcode'=>$zipcode)); echo $barcode; } } //订单退货 public function _return() { $post = $this->input->post(NULL, TRUE); if(isset($post['orderinfo'])) { $orderinfo = $this->input->post('orderinfo',true); $data = $this->fullordersmt->get_orderinfo($orderinfo); $fu = 'fullordersmt'; $bctime = date('Ymd',time()); if($data['returndata'] != "") { echo json_encode(array('msg'=>'请求失败,已有退货信息!','success'=>false));exit; } $barcode = $this->usps->get_return($data); if(isset($barcode['errors']['ExternalReturnLabelError']['InternalErrorDescription'])) { echo json_encode(array('msg'=>$barcode['errors']['ExternalReturnLabelError']['InternalErrorDescription'],'success'=>false));exit; } else { $pdf = $this->_pdf($barcode['ReturnLabel'],'t-'.$barcode['TrackingNumber'],$bctime); $read = 'PostalRouting:'.$barcode['PostalRouting'].' - TrackingNumber:'.$barcode['TrackingNumber'].''; $this->$fu->save(array('returndata'=>$read),$data['id']); echo json_encode(array('msg'=>'退货成功!','data'=>$read,'success'=>true));exit; } } } public function _pdf($pdf,$title,$bctime) { $pdf_path = './data/pdf/'.$bctime.'/'; $file_base64 = $pdf; $file_base64 = preg_replace('/data:.*;base64,/i', '', $file_base64); $file_base64 = base64_decode($file_base64); if(!is_dir($pdf_path))mkdir($pdf_path,0777); //上传目录不存在则创建 file_put_contents($pdf_path.$title.'.pdf',$file_base64); return $bctime; } //管理 public function _aaa() { $dt = 0; if(isset($_SESSION['api'])) { $user = $this->user->get_api($_SESSION['api']); $usp = $user; $fgshop = "";$sid = ""; $user = explode('|',trim($user['shop'],'|')); foreach ($user as $value) { $fgshop .= " shop = ".$value." or"; $sid .= " id = ".$value." or"; } } $post = $this->input->post(NULL, TRUE); if(isset($post['page'])) { $page = $this->input->post('page',true); $perpage = $this->input->post('perpage',true); $warehouse = $this->input->post('warehouse',true); $timetk = $this->input->post('timetkk',true); $timetj = $this->input->post('timetjj',true); $shop = $this->input->post('shop',true); $source = $this->input->post('source',true); $state = $this->input->post('state',true); $review = $this->input->post('review',true); $type = $this->input->post('type',true); $express = $this->input->post('express',true); $orderinfo = $this->input->post('orderinfo',true); $user = $this->input->post('user',true); $client = $this->input->post('name',true); $fullname = $this->input->post('fullname',true); $waybill = $this->input->post('waybill',true); $number = $this->input->post('number',true); $email = $this->input->post('email',true); $dlz = $this->input->post('dlz',true); $print = $this->input->post('print',true); $library = $this->input->post('library',true); $xztime = $this->input->post('xztime',true); $timetk = strtotime($timetk)-1; $timetj = strtotime($timetj); $px = $this->input->post('px',true); $where = "1=1 and mergeid = 0 and (".rtrim($fgshop,'or').")"; if($warehouse) { $where .= " and type = '$warehouse'"; } if($timetk && $timetj) { $where .= " and ".$xztime." > '$timetk' and ".$xztime." < '$timetj'"; } if($shop) { $where .= " and shop = '$shop'"; } if($source) { $where .= " and source = '$source'"; } if($state) { $where .= " and state = '$state'"; } if($review) { $where .= " and review = '$review'"; } if($type) { $where .= " and type = '$type'"; } if($express) { $where .= " and express = '$express'"; } if($orderinfo) { $where .= " and orderinfo = '$orderinfo'"; } if($user) { $where .= " and user = '$user'"; } if($client) { $where .= " and client like '%$client%'"; } if($waybill) { $where .= " and waybill = '$waybill'"; } if($number) { $where .= " and number = '$number'"; } if($email) { $where .= " and email = '$email'"; } if($library) { $where .= " and library = '$library'"; } if($print) { $where .= " and print = '$print'"; } if($dlz != '') { $where .= " and dlz = '$dlz'"; } if($fullname) { $where .= " and fullname = '$fullname'"; } //数据排序 if($px) { $order_str = $px." desc"; } else { $order_str = "numberpx desc"; } if(empty($page)) { $start = 0; $perpage = 1; } else { $start = ($page - 1)*$perpage; } //取得信息列表id,shop,type,source,user,orderinfo,number,name,state,buytime,clientremarks,review,print,library,libraryconfirm,express,waybill,orderremarks,black $info_list = $this->fullordersmt1->find_all($where,'id,shop,type,orderinfo,number,fullname,state,buytime,review,libraryconfirm,express,waybill,orderremarks,library,black,clientremarks',$order_str,$start,$perpage); //格式化数据 foreach ($info_list as $key=>$value) { $ud = $this->fullordersmt1->read($value['id']); $ud['address'] = str_replace("'","’",$ud['address']); $ud['name'] = str_replace("'","’",$ud['name']); $customer = $ud['source'] != 1?$this->customersmt1->get_fullname($ud['fullname']):$this->customersmt1->get_shopdata($value['shop'],$ud['name'],$ud['address']); //$a = array_column($customer, 'email'); //三维找其中健的数组 //$a = array_flip($a); //键和值调换 $currency = $this->country->read($ud['country']); $name = ($ud['source'] == 1)?$ud['name']:$value['fullname']; $lkh = "".$name."
".$currency['ename']."
"; if($customer) { if($customer['type'] == 1 && $customer['num'] > 1) { $lkh .= "老客户
"; } else if($customer['type'] == 2) { $hmsp = $this->shop->read($customer[0]['shop']); $lkh .= "黑名单
来自".$hmsp['shopname']."
"; } } $info_list[$key]['fullname'] = $lkh; $shop = $this->shop->read($value['shop']); $info_list[$key]['shop'] = $shop['shopname']; //$info_list[$key]['user'] = $shop['shopuser']; $warehouse = $this->warehouse->read($value['type']); $warehousetitle = $warehouse['title']; if($value['type'] != 1){$warehousetitle = "".$warehouse['title']."";} $info_list[$key]['type'] = $warehousetitle; $typeclass = $this->typeclass->read($value['state']); if($ud['source'] != 1) { $info_list[$key]['state'] = "".$typeclass['title'].""; } else { $info_list[$key]['state'] = $typeclass['title']; } if(!$value['buytime']) { $info_list[$key]['buytime'] = '无
'; } else { $info_list[$key]['buytime'] = ''.date('Y-m-d',$value['buytime']-$dt).'
'.date('H:i:s',$value['buytime']-$dt).'
'; } if($value['review'] == 1) { $info_list[$key]['review'] = "未送审"; } else if($value['review'] == 2) { $info_list[$key]['review'] = "待审核"; } else if($value['review'] == 3) { $info_list[$key]['review'] = "不通过"; } else if($value['review'] == 4) { $info_list[$key]['review'] = "取消重审"; } else if($value['review'] == 5) { $info_list[$key]['review'] = "审核通过"; } else if($value['review'] == 6) { $info_list[$key]['review'] = "自动通过"; } if($ud['dlz'] == 1) { $dlz = "发货声明成功
"; } else if($ud['dlz'] == 3) { $dlz = "不需要发货声明
"; } else if($ud['dlz'] == 2) { $dlz = "发货声明失败
"; } else { $dlz = ""; } if($value['waybill'] != "") { $info_list[$key]['waybill'] = "".$value['waybill']."
".$dlz; } if($value['express'] != 0) { $express = $this->express->read($value['express']); $expressservicename = $express['servicename']; if($value['express'] != 1){$expressservicename = "".$express['servicename']."";} $info_list[$key]['express'] = $expressservicename; } else { $info_list[$key]['express'] = "无"; } $x = ""; if($value['libraryconfirm'] == 2 && $value['review'] > 4 && $ud['library'] == 1) { $x = "禁止发货
"; } else if(($value['review'] > 4) && $ud['print'] != 1 && $value['libraryconfirm'] == 1) { $x = "允许发货
"; } if(($value['review'] > 4) && $ud['print'] == 2) { $x = "禁止打印
"; } else if($value['review'] >4 && $ud['print'] == 1) { $x = "允许打印
"; } if($value['waybill'] == "" && $value['review'] > 4) { $x .= "填写运单号
"; } else if($value['waybill'] != "" && $value['review'] > 4) { $x .= "修改运单
"; } if(($value['review'] == 1 || $value['review'] == 3) && $ud['express'] > 0 && $ud['dtsbjz'] != 0 && $ud['ts'] != 0 && $ud['zsbjz'] != 0 && $ud['zjs'] != 0 && $ud['ts'] != 0) { $x .= "提交审核
"; } $x .= "客户信息
"; $info_list[$key]['black'] = $x; $tly = ""; if($value['clientremarks'] != "") { $tly = "有客户留言
"; } if($value['review'] > 4 && $usp['vip'] != 1) { $info_list[$key]['orderinfo'] = "".$value['orderinfo']."
".$tly."".$value['orderinfo']."
".$tly."'.date('Y-m-d',$ud['librarytime']).'
'.date('H:i:s',$ud['librarytime']).'出库
'; } else if($value['library'] == 3) { $info_list[$key]['library'] = ''.date('Y-m-d',$ud['retreattime']).'
'.date('H:i:s',$ud['retreattime']).'退库
'; } } $total = $this->fullordersmt1->find_count($where); $pagenum = ceil($total/$perpage); $over = $total-($start+$perpage); $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($info_list)); echo json_encode($rows);exit; } $wlshop = $this->shop->find_all('1=1 and '.rtrim($sid,'or')); $this->data['wlshop'] = $wlshop; $this->data['express'] = $this->express->find_all(); $user = $this->user->get_api($_SESSION['api']); $powerid = $this->power->read($user['power']); $powertext = explode('|',trim($powerid['excelid'],'|')); $pid = ''; foreach ($powertext as $v) { $pid .= " id = ".$v." or"; } $fullorderexcel = $this->fullorderexcel->find_all("type = '100004' and (".rtrim($pid,'or').")",'*','idorder desc');//导出模板 $this->data['fullorderexcel'] = $fullorderexcel; $error = $this->fullordersmt1->find_count("print = 1 and failed !='' and mergeid = 0 and waybill = '' and (".rtrim($fgshop,'or').")"); $this->data['error'] = $error; $this->_Template('fullordersmt_a',$this->data); } public function _bbb($arg_array) { $post = $this->input->post(NULL, TRUE); if(isset($post['id'])) { $id = $this->input->post('id',true); $data = $this->fullordersmt1->read($id); $post['type'] = $this->input->post('warehouse',true); $post['country'] = $this->input->post('country',true); $currency = $this->country->read($post['country']); $post['al'] = $currency['lb']; $post['freight'] = $this->input->post('freight',true); $post['expressmoney'] = $this->input->post('expressmoney',true); $post['shouldmoney'] = $this->input->post('shouldmoney',true); $post['orderremarks'] = $this->input->post('orderremarks',true); $shipremarks = $this->input->post('shipremarks'); $shipremarks = str_replace(array('%26','%2B'),array('&','+'),$shipremarks); $post['shipremarks'] = preg_replace('/( | | |\s)/',' ',$shipremarks); $post['email'] = $this->input->post('email',true); $name = $this->input->post('name',true); $post['name'] = str_replace("'","’",$name); $post['phone'] = $this->input->post('phone',true); $post['country'] = $this->input->post('country',true); $post['province'] = $this->input->post('province',true); $post['city'] = $this->input->post('city',true); $post['zipcode'] = $this->input->post('zipcode',true); $post['street'] = $this->input->post('street',true); $address = $this->input->post('address',true); $post['address'] = str_replace("'","’",$address); $post['express'] = $this->input->post('express',true); $post['printtype'] = $this->input->post('printtype',true); $post['fpdata'] = $this->input->post('fpdata'); $post['waybill'] = $this->input->post('waybill',true); $post['msg'] = $this->input->post('msg',true); $post['zsbjz'] = $this->input->post('zsbjz',true); $post['refundy'] = $this->input->post('refundy',true); $post['refundj'] = $this->input->post('refundj',true); $rtime = $this->input->post('rtime',true); $post['rtime'] = strtotime($rtime); $post['rpaypal'] = $this->input->post('rpaypal',true); $post['rtext'] = $this->input->post('rtext',true); $editstate = $this->input->post('state',true); $post['review'] = 1; if($post['zsbjz'] < '0.01') { echo json_encode(array('msg'=>'总申报价错误!','success'=>false));exit; } if($data['library'] == 1) { if($data['print'] != 3 && $data['review'] < 5) { $post['libraryconfirm'] = 1; $post['librarynot'] = "订单未打印"; } else if($data['print'] != 3 && $data['review'] > 4) { $post['print'] = 1; $post['libraryconfirm'] = 1; $post['librarynot'] = "订单未打印,订单审核后修改"; } else { $post['libraryconfirm'] = 1; $post['librarynot'] = "订单打印后修改"; } } if($post['printtype'] == 1)//如果是运单 { $post['productdescription'] = $this->input->post('productdescription',true); $post['customs'] = $this->input->post('customs',true); } /** if($editstate == 216 && $data['state'] != 216) { echo json_encode(array('msg'=>'不可修改为完成状态','success'=>false));exit; } **/ if($editstate == 216 && preg_match('/\d/is',$post['waybill']) != true) { echo json_encode(array('msg'=>'当前信息不可修改订单状态','success'=>false));exit; } else { if($data['review'] == 1 && $data['source'] != 1) { $review = 6; } else if($data['review'] == 3 || ($data['review'] == 1 && $data['source'] == 1)) { $review = 2; } else { $review = $data['review']; } $post['review'] = $review; $post['state'] = $editstate; $post['reviewtime'] = time(); } if($this->fullordersmt1->save($post,$id)) { echo json_encode(array('msg'=>'修改成功','success'=>true));exit; } else { echo json_encode(array('msg'=>'修改失败,请重试','success'=>false));exit; } } $arg_array = $arg_array[0];$fpdata = array(); $fullordersmt = $this->fullordersmt1->read($arg_array); $fullordersmt['parameter'] = str_replace(",","---",$fullordersmt['parameter']); $country = $this->country->find_all('1=1','id,name','name asc');//所有国家信息 $express = $this->express->find_all('1=1');//所有快递配置信息 $this->data['fullordersmt'] = $fullordersmt; $this->data['country'] = $country; $this->data['express'] = $express; $this->data['dtime'] = date('Y-m-d H:i:s',$fullordersmt['dtime']); if(stripos($fullordersmt['fpdata'],';') !== false) { $fpdata = explode(';',rtrim($fullordersmt['fpdata'],';')); foreach ($fpdata as $k=>$v) { $fpdata[$k] = explode('|',$v); } } $this->data['fpdata'] = $fpdata; $shop = $this->shop->read($fullordersmt['shop']); $this->data['et'] = $shop['estimaterate'];//此店铺配置预计到帐金额比例 $is = 0; if($shop['type'] == 269)//判断是否独立站,269是独立站 { $is = 1; } $this->data['is'] = $is; if(isset($_SESSION['api'])) { $user = $this->user->get_api($_SESSION['api']); if($user['vip'] == 1) { $vip = 1; } else { $vip = 0; } } else { $vip = 0; } $this->data['power'] = $vip; /** 历史运单号展示并下载PDF 打印时间需要2019-3-21 0点之后有记录 **/ $downwaybill = ''; if($fullordersmt['printtype'] == 1) { if($fullordersmt['waybill'] != '') { $downwaybill .= ''.$fullordersmt['waybill'].'、'; } } $oldwaybill = explode('-',ltrim($fullordersmt['oldwaybill'],'-')); if(isset($oldwaybill[0][1])) { $oldwaybill = array_reverse($oldwaybill); //调整顺序 foreach ($oldwaybill as $v) { $dw = explode('/',$v); if(isset($dw[1])) { $downwaybill .= ''.$dw[1].'、'; } } } $this->data['downwaybill'] = rtrim($downwaybill,'、'); /** 历史打印时间 **/ $printtime = ''; if($fullordersmt['oldprinttime']) { $pte = explode('-',rtrim($fullordersmt['oldprinttime'],'-')); foreach ($pte as $v) { $printtime .= date('Y-m-d H:i:s',$v).'、'; } } $this->data['printtime'] = rtrim($printtime,'、'); $this->_Template('fullordersmt_b',$this->data); } public function _cf() //速卖通订单拆分 { $post = $this->input->post(NULL, TRUE); if(isset($post['id'])) { $id = $this->input->post('id',true); $b = $this->fullordersmt->read($id); $order = array(); if($b['merge'] == $b['id']) { $data = $this->fullordersmt->find_all("merge = '".$b['merge']."'"); foreach ($data as $v) { $a = $this->fullordersmthb->get_orderinfo($v['orderinfo']); if($a) { $this->fullordersmt->save($a,$v['id']); } $order[] = $v['id']; } echo json_encode(array('msg'=>'拆分成功!','d'=>$order,'success'=>true));exit; } else { echo json_encode(array('msg'=>'拆分条件错误!','success'=>false));exit; } } } public function _epod() { $post = $this->input->post(NULL, TRUE); if(isset($post['number'])) { $number = $this->input->post('number',true); $data = $this->fullordersmt->get_number($number); if(is_file('./data/epod/'.date('Y',time()).'/epod-'.$data['waybill'].'.pdf')) { echo json_encode(array('msg'=>'http://'.$_SERVER['HTTP_HOST'].'/data/epod/'.date('Y',time()).'/epod-'.$data['waybill'].'.pdf','success'=>true));exit; } else { $epod = $this->dhl->get_epod($data); if($epod['c'] == 1) { echo json_encode(array('msg'=>'http://'.$_SERVER['HTTP_HOST'].$epod['d'],'success'=>true));exit; } else { echo json_encode(array('msg'=>$epod['d'],'success'=>false));exit; } } } } public function _ddcf() { $post = $this->input->post(NULL, TRUE); if(isset($post['number'])) { $number = $this->input->post('number',true); $data = $this->fullordersmt->get_number($number); if(!$data) { echo json_encode(array('msg'=>'没有找到此订单','success'=>false));exit; } if($data['review'] != 1 && $data['review'] != 2) { echo json_encode(array('msg'=>'必须是 待审核 状态才能拆分','success'=>false));exit; } $cfnum = explode('-',trim($number,'-')); if((count($cfnum)> 3 && stripos($pd[$x],'-PF-') !== false) || (count($cfnum)> 4 && stripos($pd[$x],'-PF-') === false)) { echo json_encode(array('msg'=>'只能在原单操作拆分','success'=>false));exit; } $num = $this->fullordersmt->find_count("number like '".$number."%'"); $data['number'] = $data['number'].'-'.$num; $data['orderinfo'] = $data['shop'].date('ymdHis',time()).rand(0,1); $data['shouldmoney'] = 0; $data['budget'] = 0; $data['shipremarks'] = ''; $data['source'] = 1; unset($data['id']); unset($data['jweight']); unset($data['fpcount']); unset($data['returndata']); unset($data['waybill']); unset($data['oldwaybill']); unset($data['printtime']); if($this->fullordersmt->insert($data)) { echo json_encode(array('msg'=>'拆分成功!新订单编号:'.$data['number'],'success'=>true));exit; } else { echo json_encode(array('msg'=>'拆分失败,请重试','success'=>false));exit; } } } }