Пример #1
0
 function act_getPrintListBySku()
 {
     $sku = $_POST['sku'];
     $list = printLabelModel::getPrintListBysku($sku);
     var_dump($list);
     if ($list) {
         self::$errMsg = "打印成功!";
         return true;
     } else {
         self::$errCode = "003";
         self::$errMsg = "打印失败(请先打标),请重试!";
         return false;
     }
 }
Пример #2
0
 public function act_orderWeighingCheck()
 {
     $orderid = isset($_POST['orderid']) ? $_POST['orderid'] : "";
     $where = "where id={$orderid}";
     $orderinfo = orderWeighingModel::selectRecord($where);
     if (!orderinfo) {
         self::$errCode = 502;
         self::$errMsg = "此发货单号不存在!";
         return false;
     }
     if ($orderinfo[0]['orderStatus'] != PKS_WWEIGHING) {
         if ($orderinfo[0]['orderStatus'] == PKS_WDISTRICT) {
             self::$errCode = 514;
             self::$errMsg = "此发货单已在待分区,不用再扫描!";
             return false;
         } else {
             if ($orderinfo[0]['orderStatus'] == PKS_WAITING_SORTING) {
                 self::$errCode = 514;
                 self::$errMsg = "此发货单还在待分拣中!";
                 return false;
             } else {
                 self::$errCode = 514;
                 self::$errMsg = "此发货单在" . LibraryStatusModel::getStatusNameByStatusCode($orderinfo[0]['orderStatus']) . "状态,请确认!";
                 return false;
             }
         }
     }
     $flat_transport = C('flat_transport');
     $carrier = CommonModel::getShipingNameById($orderinfo[0]['transportId']);
     if (in_array($carrier, $flat_transport)) {
         $arr['type'] = "flat";
     } else {
         self::$errCode = 503;
         self::$errMsg = "此发货单运输方式不属于小包,请确认!";
         return false;
     }
     $partionId = CommonModel::getChannelIdByIds($orderinfo[0]['transportId'], $orderinfo[0]['countryName']);
     $account = CommonModel::getAccountNameById($orderinfo[0]['accountId']);
     //运输公司
     $channelId = printLabelModel::getMcFromCarrier($orderinfo[0]['id'], $carrier, $orderinfo[0]['countryName'], $account);
     $arr['channelId'] = $channelId;
     $arr['transportId'] = $orderinfo[0]['transportId'];
     $arr['partionId'] = $partionId;
     $arr['countryName'] = $orderinfo[0]['countryName'];
     $arr['orderid'] = $orderid;
     return $arr;
 }
Пример #3
0
 public function act_isOrderValide()
 {
     $orderid = isset($_GET['orderid']) ? intval($_GET['orderid']) : 0;
     if (empty($orderid)) {
         self::$errCode = 0;
         self::$errMsg = '请填写单号!';
         return;
     }
     $po_obj = new PackingOrderModel();
     $orderinfo = $po_obj->getOrderInfoById($orderid);
     if (empty($orderinfo)) {
         self::$errCode = 0;
         self::$errMsg = '单号不存在!';
         return;
     }
     if ($orderinfo['orderStatus'] != PKS_WWEIGHING_EX) {
         // 该订单不在快递待称重状态
         self::$errCode = 0;
         self::$errMsg = '该发货单不在待称重组!';
         return;
     }
     $mes = 'ok!';
     if ($orderinfo['orderTypeId'] == 2) {
         // 配货单验证是否全部配货完成
         $isLast = printLabelModel::adjustIsLast($orderinfo['id']);
         $doneStr = printLabelModel::getAllOriginOrderId($orderinfo['id']);
         if ($isLast && empty($doneStr)) {
             $mes = "第一个包裹,全部打印,请输入重量";
         } elseif ($isLast && !empty($doneStr)) {
             $mes = "分包裹,全部打印!该订单和[" . $packInfo . "]为同一订单,请输入重量";
         } elseif (!$isLast && empty($doneStr)) {
             $mes = "第一个包裹,部分打印";
             self::$errCode = 0;
             self::$errMsg = $mes;
             return;
         } else {
             $mes = "分包裹,部分打印!该订单和[" . $packInfo . "]为同一订单";
             self::$errCode = 0;
             self::$errMsg = $mes;
             return;
         }
     }
     self::$errCode = 1;
     self::$errMsg = $mes;
     return;
 }
Пример #4
0
				  </tr>
			</table>
	</td>
  </tr>
</table>	


<?php 
    $n = 1;
    for ($i = 0; $i < $list[0]['num']; $i = $i + 2) {
        if ($i + 2 > $max_num * $n) {
            $print_num = $list[0]['num'] - $max_num * $n > $max_num ? $max_num : $list[0]['num'] - $max_num * $n;
            //$group_id = printLabelModel::insertPrintGroup($id,$print_num,$printId,$time);
            /*$group_id = printLabelModel::getGroupInfoByTallyListId($id);
            		var_dump($group_id);*/
            $groupInfo = printLabelModel::getGroupInfoByTallyListId($id);
            if (!empty($groupInfo)) {
                $group_id = $groupInfo[0]['id'];
            } else {
                $group_id = '';
            }
            ?>

<table width="420" border="0" cellspacing="0" cellpadding="0">
  <tr valign="middle">
    <td width="200">
    	<table width="100%" height="100" border="0" cellspacing="0" cellpadding="0">
		  <tr>
             <td height="10">&nbsp;</td>
		  </tr>
		  <tr>
Пример #5
0
 public function act_packingOrder()
 {
     $orderid = isset($_POST['orderid']) ? $_POST['orderid'] : "";
     $userId = $_SESSION['userId'];
     //先核对订单
     //兼容 EUB或者 包裹 扫描的是 trackno 而非ebayid
     $p_real_ebayid = '#^\\d+$#';
     $p_trackno_eub = '#^(LK|RA|RB|RC|RR|RF|LN)\\d+(CN|HK|DE200)$#';
     $is_eub_package_type = false;
     if (preg_match($p_real_ebayid, $orderid)) {
     } else {
         if (preg_match($p_trackno_eub, $orderid)) {
             $is_eub_package_type = true;
         } else {
             self::$errCode = "001";
             self::$errMsg = "订单号[" . $orderid . "]格式有误";
             return false;
         }
     }
     if ($is_eub_package_type === true) {
         $record = ShippingOrderModel::getShippingOrderInfo("b.*", "where a.tracknumber='{$orderid}' and a.is_delete=0");
     } else {
         $record = ShippingOrderModel::getShippingOrder("*", "where id='{$orderid}'");
     }
     //验证发货单号 以及所属状态
     if (!$record) {
         self::$errCode = 404;
         self::$errMsg = "发货单号不存在!";
         return false;
         exit;
     }
     if ($record[0]['orderStatus'] != 404) {
         self::$errCode = 405;
         self::$errMsg = "此发货单不在待包装!";
         if ($record[0]['orderStatus'] == 900) {
             self::$errMsg = "此发货单已废弃!";
         }
         if ($record[0]['orderStatus'] == 405) {
             self::$errMsg = "该订单[{$record[0]['id']}]已经经过包装扫描了!";
         }
         if ($record[0]['orderStatus'] == 403) {
             self::$errMsg = "该订单[{$record[0]['id']}]还在待复核!";
         }
         return false;
     }
     //挂号的单需要再输入挂号条码
     $carrier = CommonModel::getShipingNameById($record[0]['transportId']);
     $partion = printLabelModel::showPartionScan($record[0]['id'], $record[0]['accountId'], $carrier, $record[0]['countryName']);
     $total_num = 0;
     $skuinfos = get_realskunum($record[0]['id']);
     foreach ($skuinfos as $or_sku => $or_nums) {
         $total_num += $or_nums;
     }
     if (in_array($carrier, array("中国邮政挂号", "香港小包挂号", "德国邮政"))) {
         self::$errCode = 222;
         self::$errMsg = "请录入挂号条码!";
         $arr['partion'] = $partion;
         $arr['carrier'] = $carrier;
         return json_encode($arr);
         exit;
     }
     TransactionBaseModel::begin();
     //更新订单状态
     $msg = OmAvailableModel::updateTNameRow("wh_shipping_order", "set orderStatus=405", "where id={$record[0]['id']}");
     if (!$msg) {
         self::$errCode = 409;
         self::$errMsg = "更新发货单状态记录失败!";
         $arr['partion'] = $partion;
         $arr['carrier'] = $carrier;
         TransactionBaseModel::rollback();
         return json_encode($arr);
         exit;
     }
     //更新操作记录
     $msg = packingScanOrderModel::updateOrderRecord($record[0]['id'], $userId);
     if (!$msg) {
         self::$errCode = 406;
         self::$errMsg = "更新发货单操作记录失败!";
         TransactionBaseModel::rollback();
         return false;
     }
     //插入包装记录
     $msg = packingScanOrderModel::insertPackingRecord($record[0]['id'], $userId);
     if (!$msg) {
         self::$errCode = 407;
         self::$errMsg = "插入包装记录失败!";
         TransactionBaseModel::rollback();
         return false;
     }
     WhPushModel::pushOrderStatus($record[0]['id'], 'STATESHIPPED_BEWEIGHED', $userId, time());
     //状态推送
     $arr['partion'] = "<font color='#FF0000'>该订单属于" . $partion . ";含SKU总数:" . $total_num . "个</font><br>";
     $arr['carrier'] = $carrier;
     $arr['userName'] = $_SESSION['userName'];
     $arr['res'] = $arr['partion'] . "包装人员:" . "<font color='green'>" . $_SESSION['userCnName'] . "</font><br>" . "运输方式:" . "<font color='#FF0000'>" . $carrier . "</font> <br>扫描结果:<font color='#33CC33'>包装扫描成功!</font>";
     TransactionBaseModel::commit();
     return $arr;
 }
Пример #6
0
 public function view_printGroupOrder2()
 {
     $groupsn = isset($_GET['groupsn']) ? trim($_GET['groupsn']) : 0;
     if (empty($groupsn)) {
         echo "请指定配货清单!";
         exit;
     }
     $group_list = OmAvailableModel::getTNameList("wh_shipping_order_group", "*", "where shipOrderGroup='{$groupsn}' order by id asc");
     if (!$group_list) {
         echo "该配货清单不存在!";
         exit;
     }
     $time = time();
     $userName = $_SESSION['userName'];
     //更新今日清单打印表
     OmAvailableModel::updateTNameRow("wh_shipping_order_group_print", "set status='1',orderPrintUser='******',orderPrintTime='{$time}'", "where shipOrderGroup='{$groupsn}'");
     //获取订单对应的车号
     $orderids = array();
     foreach ($group_list as $group) {
         if (!isset($orderids[$group['shipOrderId']])) {
             $orderids[$group['shipOrderId']] = $group['carNumber'];
         }
     }
     $o_arr = array();
     foreach ($orderids as $order => $car_number) {
         $o_arr[] = $order;
     }
     $oids = implode(',', $o_arr);
     $po_obj = new PackingOrderModel();
     $ordersinfo = $po_obj->getaSetOfOrderInfo($oids);
     if (empty($ordersinfo)) {
         $data = array('data' => array('没有可打印内容!'), 'link' => 'index.php?mod=orderWaitforPrint&act=printList');
         goErrMsgPage($data);
         exit;
     }
     $sod_obj = new ShipingOrderDetailModel();
     $acc_id_arr = array();
     foreach ($ordersinfo as &$orinfval) {
         $locationinfo = array();
         $totalnum = 0;
         $package_type = '';
         $iscard = '';
         $skulisttemp = $sod_obj->getAllSkuListByOrderId($orinfval['id'], "order by pName,combineSku");
         $totalnum = $skulisttemp['totalnum'];
         $locationinfo = $skulisttemp['skuinfo'];
         if (isset($locationinfo['notcombine']) && count($locationinfo['notcombine']['info']) == 1) {
             $package_type = $skulisttemp['packagetype'];
         }
         $iscard = printLabelModel::checkprintcard($orinfval['id']);
         $pmNameStr = CommonModel::getMaterInfoById($orinfval['pmId']);
         $orinfval['finalposition'] = $locationinfo;
         $totalStr = $totalnum . " " . $pmNameStr . " " . $orinfval['calcWeight'] . "KG";
         if (!empty($package_type)) {
             $totalStr = $totalStr . " " . $package_type;
         }
         if (!empty($iscard)) {
             $totalStr = $totalStr . "  " . $iscard;
         }
         $totalStr = $totalStr . "  " . $orinfval['platformUsername'];
         $carrier = CommonModel::getShipingNameById($orinfval['transportId']);
         $orinfval['abbrshipname'] = CommonModel::getShipingAbbrNameById($orinfval['transportId']);
         $orinfval['totalStr'] = $totalStr;
         $orinfval['notes'] = $po_obj->getOrderNotesInfo($orinfval['id']);
         $orinfval['countryZh'] = CommonModel::getCountryNameCn($orinfval['countryName']);
         $orinfval['partionFromAddress'] = printLabelModel::getPartionFromAddress($orinfval['id'], $carrier, $orinfval['countryName']);
         if (!in_array($orinfval['accountId'], $acc_id_arr)) {
             array_push($acc_id_arr, $orinfval['accountId']);
         }
     }
     $salesaccountinfo = CommonModel::getAccountInfo($acc_id_arr);
     $this->smarty->assign('salesaccountinfo', $salesaccountinfo);
     $totalCount = count($ordersinfo);
     $this->smarty->assign('totalCount', $totalCount);
     $this->smarty->assign('orderids', $orderids);
     $this->smarty->assign('ordersinfo', $ordersinfo);
     $this->smarty->display('label50x100_22.htm');
 }
Пример #7
0
    ?>
</strong></font></td>

				  </tr>
			</table>
	</td>
  </tr>
</table>	


<?php 
    $n = 1;
    for ($i = 0; $i < $list[0]['num']; $i = $i + 2) {
        if ($i + 2 > $max_num * $n) {
            $print_num = $list[0]['num'] - $max_num * $n > $max_num ? $max_num : $list[0]['num'] - $max_num * $n;
            $group_id = printLabelModel::insertPrintGroup($id, $print_num, $printId, $time);
            ?>

<table width="420" border="0" cellspacing="0" cellpadding="0">
  <tr valign="middle">
    <td width="200">
    	<table width="100%" height="100" border="0" cellspacing="0" cellpadding="0">
		  <tr>
             <td height="10">&nbsp;</td>
		  </tr>
		  <tr>
			<td height="40"  valign="middle"><!--<div style="text-align:center;padding:auto auto;margin:0px 0px;"><font size="4">标签分组号:<?php 
            echo $group_id;
            ?>
</font></div>--></td>
		  </tr>
Пример #8
0
 public function act_orderPartion()
 {
     $orderid = isset($_POST['orderid']) ? trim($_POST['orderid']) : "";
     if (!is_numeric($orderid)) {
         $tracknumber = $orderid;
         $info = orderWeighingModel::selectOrderId($tracknumber);
         if (!$info) {
             self::$errCode = 501;
             self::$errMsg = "此跟踪号不存在!";
             return false;
         }
         $orderid = $info[0]['shipOrderId'];
     }
     $where = "where id={$orderid}";
     $order = orderPartionModel::selectOrder($where);
     if (!$order) {
         self::$errCode = 601;
         self::$errMsg = "此发货单不存在!";
         return false;
     }
     if (!is_numeric($orderid)) {
         $orderid = $order[0]['id'];
     }
     $msg = orderPartionModel::selectPartionRecord($orderid);
     if ($msg) {
         self::$errCode = 603;
         self::$errMsg = "此发货单已扫描!";
         return false;
     }
     if ($order[0]['orderStatus'] != 406) {
         self::$errCode = 602;
         self::$errMsg = "此发货单不在待分区!";
         return false;
     }
     $shipping = CommonModel::getShipingNameById($order[0]['transportId']);
     if (!in_array($shipping, array('中国邮政平邮', '中国邮政挂号', 'EUB', 'Global Mail', '香港小包平邮', '香港小包挂号', '德国邮政'))) {
         self::$errCode = 604;
         self::$errMsg = "此发货单不是小包!";
         return false;
     }
     $partion = $shipping;
     $platformName = CommonModel::getPlatformInfo($order[0]['platformId']);
     if ($shipping == 'Global Mail') {
         if ($platformName == '亚马逊') {
             $partion = "非德国Global Mail";
         } elseif ($platformName == '海外销售平台') {
             if ($order[0]['countryName'] == 'Deutschland') {
                 $partion = "Global Mail";
             } else {
                 $partion = "非德国Global Mail";
             }
         }
     } elseif ($shipping == '中国邮政平邮') {
         $partion = printLabelModel::showPartionScan($orderid, $order[0]['accountId'], $shipping, $order[0]['countryName']);
     } elseif ($shipping == '中国邮政挂号') {
         $partion = printLabelModel::showPartionScan($orderid, $order[0]['accountId'], $shipping, $order[0]['countryName']);
     }
     /*
     		$lists = $memc_obj->get_extral('trans_system_carrierinfo');
     		//print_r($lists);
     		foreach($lists as $list){
     			foreach($list as $value){
     			    
     				if($record[0]['channelId']==$value['channelId']){
     					
     					$countries = $value['countries'];
     					$country_arr = explode("','",$countries);
     					$country_arr[0] = str_replace("'","",$country_arr[0]);
     					$country_arr[count($country_arr)-1] = str_replace("'","",$country_arr[count($country_arr)-1]);
     					if(in_array($record[0]['countryName'],$country_arr)){
     						
     						$partionId = $value['id'];
     					}
     				}
     			}
     		}*/
     TransactionBaseModel::begin();
     $weight = orderPartionModel::selectWeight($orderid);
     if (!$weight) {
         self::$errCode = 605;
         self::$errMsg = "此发货单无重量!";
         return false;
     }
     $userId = $_SESSION['userId'];
     $result = orderPartionModel::insertRecord($orderid, $partion, $weight, $userId);
     if (!result) {
         self::$errCode = 606;
         self::$errMsg = "插入分区记录失败!";
         TransactionBaseModel::rollback();
         return false;
     }
     $ret = orderPartionModel::updateOrderRecords($orderid, $userId);
     if (!ret) {
         self::$errCode = 607;
         self::$errMsg = "更新操作记录失败!";
         TransactionBaseModel::rollback();
         return false;
     }
     $ostatus = orderPartionModel::updateOrderStatus($orderid);
     if (!ostatus) {
         self::$errCode = 608;
         self::$errMsg = "更新发货单状态失败!";
         TransactionBaseModel::rollback();
         return false;
     }
     $arr['orderid'] = $orderid;
     $arr['partion'] = urlencode($partion);
     TransactionBaseModel::commit();
     return $arr;
 }
Пример #9
0
 public function initDB()
 {
     global $dbConn;
     self::$dbConn = $dbConn;
     mysql_query('SET NAMES UTF8');
 }
Пример #10
0
 public function act_applyforB()
 {
     $pid = isset($_GET['pid']) ? trim($_GET['pid']) : 0;
     if ($pid == '') {
         self::$errCode = 0;
         self::$errMsg = '输入非法值!';
         return;
     }
     $idar = explode(',', $pid);
     foreach ($idar as $key => $idval) {
         $idar[$key] = intval($idval);
     }
     $o_count = count($idar);
     $orderist = OrderPrintListModel::getPrintList('*', ' where id in (' . implode(',', $idar) . ') and status!=1001 and storeId=2');
     $n_count = count($orderist);
     if ($o_count != $n_count) {
         self::$errCode = 0;
         self::$errMsg = '申请提货不能包含未打印地址条订单或包含A仓订单';
         return;
     }
     $oidar = array();
     //发货单id数组
     foreach ($orderist as $orlval) {
         //验证合法性
         if ($orlval['is_delete'] == 1) {
             $data = array('data' => array('包含已经删除单号!', '单号id为' . $orlval['id']), 'link' => 'index.php?mod=orderWaitforPrint&act=printList');
             goErrMsgPage($data);
             exit;
         }
         $tempar = explode(',', $orlval['orderIds']);
         $oidar = array_merge($oidar, $tempar);
     }
     $po_obj = new PackingOrderModel();
     $qresult = $po_obj->changeStatusToWaitGetGoodsB(implode(',', $oidar));
     OrderPrintListModel::deleteAsetOfPrint(implode(',', $idar));
     printLabelModel::inserRecords($oidar, $_SESSION['userId']);
     if ($qresult) {
         $time = time();
         self::$errCode = 1;
         self::$errMsg = '申请成功';
         return;
     } else {
         self::$errCode = 0;
         self::$errMsg = '失败';
         return FALSE;
     }
 }
Пример #11
0
 /**
  * PrintLabelAct::act_export()
  * 报表导出
  * @author Gary
  * @return void
  */
 function act_export()
 {
     $printer = intval(trim($_GET['checkUser']));
     $sku = trim($_GET['sku']);
     $startdate = trim($_GET['startdate']);
     $enddate = trim($_GET['enddate']);
     if (empty($checkUser) && empty($sku) && empty($startdate) && empty($enddate)) {
         echo "请选择导出条件";
         exit;
     }
     $lists = printLabelModel::getExportData($printer, $sku, $startdate, $enddate);
     $excel = new ExportDataExcel('browser', "PrintLabelData " . $startdate . '--' . $enddate . ".xls");
     $excel->initialize();
     $tharr = array("打标人", "SKU", "打标数量", '打印状态', "打标时间", "贴标人员", "贴标数量");
     $excel->addRow($tharr);
     foreach ($lists as $list) {
         $user = getUserNameById($list['printerId']);
         $sku = $list['sku'];
         $num = $list['printNum'];
         $status = $list['status'] == 1 ? '已确认' : '未确认';
         $printTime = date('Y-m-d H:i:s', $list['printTime']);
         $labelUser = $list['labelUserId'] ? getUserNameById($list['labelUserId']) : '无';
         $labelNum = $list['labelNum'] ? $list['labelNum'] : '无';
         $tdarr = array($user, $sku, $num, $status, $printTime, $labelUser, $labelNum);
         $excel->addRow($tdarr);
     }
     $excel->finalize();
     exit;
 }
Пример #12
0
 private function printDispatchOrder($oids, $type)
 {
     $po_obj = new PackingOrderModel();
     $ordersinfo = $po_obj->getaSetOfOrderInfo($oids);
     //echo "<pre>";print_r($ordersinfo);exit;
     if (empty($ordersinfo)) {
         $data = array('data' => array('没有可打印内容!'), 'link' => 'index.php?mod=orderWaitforPrint&act=printList');
         goErrMsgPage($data);
         exit;
     }
     $sod_obj = new ShipingOrderDetailModel();
     $acc_id_arr = array();
     foreach ($ordersinfo as &$orinfval) {
         $locationinfo = array();
         $totalnum = 0;
         $package_type = '';
         $iscard = '';
         $carrier = CommonModel::getShipingNameById($orinfval['transportId']);
         if ($type == 1 || $type == 6 || $type == 7) {
             //标签打印-50*100处理
             if ($type == 7) {
                 $tag = 0;
             } else {
                 $tag = 1;
             }
             $skulisttemp = $sod_obj->getAllSkuListByOrderId($orinfval['id'], "order by pName,combineSku", $tag);
             $totalnum = $skulisttemp['totalnum'];
             $locationinfo = $skulisttemp['skuinfo'];
             if (isset($locationinfo['notcombine']) && count($locationinfo['notcombine']['info']) == 1) {
                 $package_type = $skulisttemp['packagetype'];
             }
             $iscard = printLabelModel::checkprintcard($orinfval['id']);
         } elseif ($type == 8) {
             if ($carrier == 'EUB' || $carrier == 'Global Mail' || $carrier == '德国邮政') {
                 $goods_title = array();
                 $skulisttemp = $sod_obj->getSkuListByOrderId($orinfval['id'], "order by pName");
                 $eubtotal = 0;
                 $totalweight = 0;
                 $detailcount = count($skulisttemp);
                 $height = $detailcount > 1 ? intval(123 / $detailcount) : 123;
                 foreach ($skulisttemp as &$tmval) {
                     if ($carrier == 'EUB') {
                         //EUB热敏打印处理
                         $sku_info = printLabelModel::getSkuInfo($tmval['sku']);
                         if (!empty($sku_info)) {
                             $materName = CommonModel::getMaterInfoById($sku_info['pmId']);
                             //包材
                             list($goodsName) = strpos($sku_info['goodsName'], '--') !== false ? explode('--', $sku_info['goodsName']) : array($sku_info['goodsName']);
                             $price = rand(300, 600) / 100;
                             $eubtotal += $price;
                             $weight = $sku_info['goodsWeight'] * $tmval['amount'];
                             $totalweight += $weight;
                             $locationinfo['skuinfo'][] = array('sku' => $tmval['sku'], 'itemTitle' => $tmval['itemTitle'], 'goodsName' => $goodsName, 'isPacking' => $sku_info['isPacking'], 'materName' => $materName, 'pName' => $tmval['pName'], 'amount' => $tmval['amount'], 'price' => $price, 'weight' => $weight, 'height' => $height);
                             $locationinfo['eubtotal'] = $eubtotal;
                             $locationinfo['eubweight'] = $totalweight;
                         }
                         $zip = $orinfval['zipCode'];
                         $zip0 = explode("-", $zip);
                         if (count($zip0) >= 2) {
                             $zip = $zip0[0];
                             $orinfval['zipCode'] = $zip;
                         }
                         $isd = intval(substr($zip, 0, 2));
                         if ($isd >= 0 && $isd <= 34) {
                             $isd = '1';
                         } else {
                             if ($isd >= 35 && $isd <= 74) {
                                 $isd = '3';
                             } else {
                                 if ($isd >= 75 && $isd <= 93) {
                                     $isd = '4';
                                 } else {
                                     if ($isd >= 94 && $isd <= 99) {
                                         $isd = '2';
                                     } else {
                                         $isd = '1';
                                     }
                                 }
                             }
                         }
                         $orinfval['isd'] = $isd;
                         //回邮信息
                         $orinfval['pinfo'] = CommonModel::getEubAccounts($orinfval['accountId']);
                         //跟踪号
                         $orinfval['tracknumber'] = printLabelModel::getTracknumber($orinfval['id']);
                     } else {
                         if ($carrier == 'Global Mail' || $carrier == '德国邮政') {
                             //Global Mail-100*100打印
                             $title_nums = 0;
                             $title_nums = count($goods_title);
                             if ($detailcount > 3 && $title_nums < 2) {
                                 $goods_title[] = !empty($tmval['itemTitle']) ? $title_nums + 1 . ' ' . $tmval['itemTitle'] : '';
                             } else {
                                 if ($detailcount <= 3 && $title_nums == 0) {
                                     $goods_title[] = !empty($tmval['itemTitle']) ? $title_nums + 1 . ' ' . $tmval['itemTitle'] : '';
                                 }
                             }
                             $sku_info = printLabelModel::getSkuInfo($tmval['sku']);
                             if (!empty($sku_info)) {
                                 $weight = $sku_info['goodsWeight'] * $tmval['amount'];
                                 $totalweight += $weight;
                             }
                             $locationinfo[] = array('sku' => $tmval['sku'], 'isPacking' => $sku_info['isPacking'], 'pName' => $tmval['pName'], 'amount' => $tmval['amount']);
                             //重量等级
                             if ($totalweight < 0.1) {
                                 $weightmark = 'P';
                                 $ordershipfee = rand(100, 500) / 100;
                             } else {
                                 if ($totalweight < 0.5) {
                                     $weightmark = 'G';
                                     $ordershipfee = rand(501, 1000) / 100;
                                 } else {
                                     if ($totalweight < 2) {
                                         $weightmark = 'E';
                                         $ordershipfee = rand(1001, 2000) / 100;
                                     } else {
                                         $weightmark = '超重';
                                     }
                                 }
                             }
                             $orinfval['ordershipfee'] = number_format($ordershipfee / $detailcount, 2);
                             $orinfval['titleinfo'] = implode('<br />', $goods_title);
                             $orinfval['totalweight'] = $totalweight;
                             $orinfval['weightmark'] = $weightmark;
                             $salesaccountinfo = CommonModel::getAccountNameById($orinfval['accountId']);
                             $orinfval['appname'] = $salesaccountinfo['appname'];
                         } else {
                             $locationinfo[] = array('location' => $tmval['pName'], 'sku' => $tmval['sku'], 'amount' => $tmval['amount']);
                             $goods_title[] = $tmval['itemTitle'];
                             $orinfval['goods_title'] = $goods_title;
                         }
                     }
                     $totalnum += $tmval['amount'];
                 }
             } elseif ($carrier == '新加坡邮政') {
                 $skulisttemp = $sod_obj->getAllSkuListByOrderId($orinfval['id'], "order by pName,combineSku", 0);
                 $totalnum = $skulisttemp['totalnum'];
                 $locationinfo = $skulisttemp['skuinfo'];
                 if (isset($locationinfo['notcombine']) && count($locationinfo['notcombine']['info']) == 1) {
                     $package_type = $skulisttemp['packagetype'];
                 }
                 $orinfval['countryZh'] = CommonModel::getCountryNameCn($orinfval['countryName']);
                 //跟踪号
                 $orinfval['tracknumber'] = printLabelModel::getTracknumber($orinfval['id']);
             }
         } else {
             $goods_title = array();
             $skulisttemp = $sod_obj->getSkuListByOrderId($orinfval['id'], "order by pName");
             $eubtotal = 0;
             $totalweight = 0;
             $detailcount = count($skulisttemp);
             $height = $detailcount > 1 ? intval(123 / $detailcount) : 123;
             foreach ($skulisttemp as &$tmval) {
                 if ($type == 3) {
                     //EUB热敏打印处理
                     $sku_info = printLabelModel::getSkuInfo($tmval['sku']);
                     if (!empty($sku_info)) {
                         $materName = CommonModel::getMaterInfoById($sku_info['pmId']);
                         //包材
                         list($goodsName) = strpos($sku_info['goodsName'], '--') !== false ? explode('--', $sku_info['goodsName']) : array($sku_info['goodsName']);
                         $price = rand(300, 600) / 100;
                         $eubtotal += $price;
                         $weight = $sku_info['goodsWeight'] * $tmval['amount'];
                         $totalweight += $weight;
                         $locationinfo['skuinfo'][] = array('sku' => $tmval['sku'], 'itemTitle' => $tmval['itemTitle'], 'goodsName' => $goodsName, 'isPacking' => $sku_info['isPacking'], 'materName' => $materName, 'pName' => $tmval['pName'], 'amount' => $tmval['amount'], 'price' => $price, 'weight' => $weight, 'height' => $height);
                         $locationinfo['eubtotal'] = $eubtotal;
                         $locationinfo['eubweight'] = $totalweight;
                     }
                 } else {
                     if ($type == 4 || $type == 5) {
                         //Global Mail-100*100打印
                         $title_nums = 0;
                         $title_nums = count($goods_title);
                         if ($detailcount > 3 && $title_nums < 2) {
                             $goods_title[] = !empty($tmval['itemTitle']) ? $title_nums + 1 . ' ' . $tmval['itemTitle'] : '';
                         } else {
                             if ($detailcount <= 3 && $title_nums == 0) {
                                 $goods_title[] = !empty($tmval['itemTitle']) ? $title_nums + 1 . ' ' . $tmval['itemTitle'] : '';
                             }
                         }
                         $sku_info = printLabelModel::getSkuInfo($tmval['sku']);
                         if (!empty($sku_info)) {
                             $weight = $sku_info['goodsWeight'] * $tmval['amount'];
                             $totalweight += $weight;
                         }
                         $locationinfo[] = array('sku' => $tmval['sku'], 'isPacking' => $sku_info['isPacking'], 'pName' => $tmval['pName'], 'amount' => $tmval['amount']);
                     } else {
                         $locationinfo[] = array('location' => $tmval['pName'], 'sku' => $tmval['sku'], 'amount' => $tmval['amount'], 'price' => $tmval['itemPrice'], 'itemTitle' => $tmval['itemTitle']);
                         $goods_title[] = $tmval['itemTitle'];
                         $orinfval['goods_title'] = $goods_title;
                     }
                 }
                 $totalnum += $tmval['amount'];
             }
         }
         if ($type == 10) {
             $itemtitle = "";
             foreach ($locationinfo as $key => $value) {
                 $itemtitle .= $key + 1 . "、" . $value['itemTitle'] . "<br>";
             }
             $orinfval['itemTitle'] = $itemtitle;
             $orinfval['countryZh'] = CommonModel::getCountryNameCn($orinfval['countryName']);
             $account = CommonModel::getAccountNameById($orinfval['accountId']);
             $orinfval['account'] = $account['account'];
             $orinfval['notes'] = $po_obj->getOrderNotesInfo($orinfval['id']);
         }
         //$orinfval['total'] = $eubtotal;
         if ($type == 2 || $type == 33) {
             //快递A4打印需分割成小数组
             $locationinfo = array_chunk($locationinfo, 2);
             $salesaccountinfo = CommonModel::getAccountNameById($orinfval['accountId']);
             $orinfval['account'] = $salesaccountinfo['account'];
             $salesaccountinfo = CommonModel::getAccountNameById($orinfval['accountId']);
             $orinfval['appname'] = $salesaccountinfo['appname'];
             $orinfval['countryZh'] = CommonModel::getCountryNameCn($orinfval['countryName']);
             $orinfval['notes'] = $po_obj->getOrderNotesInfo($orinfval['id']);
             //				print_r($orinfval);
             //				exit;
             $pglist = array();
             foreach ($ordersinfo as $order) {
                 $pglist[] = $order['id'];
             }
             $olist = implode(",", $pglist);
             $this->smarty->assign('pglist', $olist);
         }
         if ($type == 3) {
             //EUB热敏打印
             $zip = $orinfval['zipCode'];
             $zip0 = explode("-", $zip);
             if (count($zip0) >= 2) {
                 $zip = $zip0[0];
                 $orinfval['zipCode'] = $zip;
             }
             $isd = intval(substr($zip, 0, 2));
             if ($isd >= 0 && $isd <= 34) {
                 $isd = '1';
             } else {
                 if ($isd >= 35 && $isd <= 74) {
                     $isd = '3';
                 } else {
                     if ($isd >= 75 && $isd <= 93) {
                         $isd = '4';
                     } else {
                         if ($isd >= 94 && $isd <= 99) {
                             $isd = '2';
                         } else {
                             $isd = '1';
                         }
                     }
                 }
             }
             $orinfval['isd'] = $isd;
             //回邮信息
             $orinfval['pinfo'] = CommonModel::getEubAccounts($orinfval['accountId']);
             //跟踪号
             $orinfval['tracknumber'] = printLabelModel::getTracknumber($orinfval['id']);
         }
         if ($type == 7) {
             //新加坡热敏打印
             $orinfval['countryZh'] = CommonModel::getCountryNameCn($orinfval['countryName']);
             //跟踪号
             $orinfval['tracknumber'] = printLabelModel::getTracknumber($orinfval['id']);
         }
         if ($type == 4 || $type == 5) {
             //Global Mail-100*100打印
             //重量等级
             if ($totalweight < 0.1) {
                 $weightmark = 'P';
                 $ordershipfee = rand(100, 500) / 100;
             } else {
                 if ($totalweight < 0.5) {
                     $weightmark = 'G';
                     $ordershipfee = rand(501, 1000) / 100;
                 } else {
                     if ($totalweight < 2) {
                         $weightmark = 'E';
                         $ordershipfee = rand(1001, 2000) / 100;
                     } else {
                         $weightmark = '超重';
                     }
                 }
             }
             $orinfval['ordershipfee'] = number_format($ordershipfee / $detailcount, 2);
             $orinfval['titleinfo'] = implode('<br />', $goods_title);
             $orinfval['totalweight'] = $totalweight;
             $orinfval['weightmark'] = $weightmark;
             $salesaccountinfo = CommonModel::getAccountNameById($orinfval['accountId']);
             $orinfval['appname'] = $salesaccountinfo['appname'];
         }
         $pmNameStr = CommonModel::getMaterInfoById($orinfval['pmId']);
         $orinfval['pmNameStr'] = $pmNameStr;
         $orinfval['finalposition'] = $locationinfo;
         //$carrier = CommonModel::getShipingNameById($orinfval['transportId']);
         $orinfval['carrier'] = $carrier;
         $orinfval['totalnum'] = $totalnum;
         $orinfval['package_type'] = $package_type;
         if ($type == 1 || $type == 6) {
             //标签打印-50*100处理
             $totalStr = $totalnum . " " . $pmNameStr . " " . $orinfval['calcWeight'] . "KG";
             if (!empty($package_type)) {
                 $totalStr = $totalStr . " " . $package_type;
             }
             if (!empty($iscard)) {
                 $totalStr = $totalStr . "  " . $iscard;
             }
             $totalStr = $totalStr . "  " . $orinfval['platformUsername'];
             $orinfval['abbrshipname'] = CommonModel::getShipingAbbrNameById($orinfval['transportId']);
             //$orinfval['channelname'] = ShipingTypeModel::getChannelNameByIds($orinfval['transportId'], $orinfval['channelId']);
             //$orinfval['channelname'] = CommonModel::getChannelNameByIds($orinfval['transportId'], $orinfval['countryName']);
             $orinfval['totalStr'] = $totalStr;
             $orinfval['notes'] = $po_obj->getOrderNotesInfo($orinfval['id']);
             $orinfval['countryZh'] = CommonModel::getCountryNameCn($orinfval['countryName']);
             $orinfval['partionFromAddress'] = printLabelModel::getPartionFromAddress($orinfval['id'], $carrier, $orinfval['countryName']);
         }
         if ($type == 9) {
             //部分包货打印-50*100处理
             $countryZh = CommonModel::getCountryNameCn($orinfval['countryName']);
             $isLast = printLabelModel::adjustIsLast($orinfval['id']);
             //是否是最后一个配货单
             $doneOrder = printLabelModel::getAllOriginOrderId($orinfval['id']);
             $streetInfo = "<br>" . $orinfval['username'] . "<br>" . $orinfval['street'] . "<br>" . $orinfval['state'] . "<br>" . $orinfval['zipCode'] . "<br>" . $orinfval['countryName'] . "(" . $countryZh . ")";
             if (!empty($doneOrder)) {
                 $doneStr = "<br>包含配货单单号:" . $doneOrder;
             } else {
                 $doneStr = '';
             }
             if ($isLast && empty($doneStr)) {
                 $orinfval['packinglog'] = "第一个包裹,全部打印";
                 $orinfval['streetInfo'] = $streetInfo;
             } elseif ($isLast && !empty($doneStr)) {
                 $orinfval['packinglog'] = "最后一个包裹,全部打印" . $doneStr;
                 $orinfval['streetInfo'] = $streetInfo;
             } elseif (!$isLast && empty($doneStr)) {
                 $orinfval['packinglog'] = "第一个包裹,部分打印";
                 $orinfval['streetInfo'] = '';
             } else {
                 $orinfval['packinglog'] = "分包裹,部分打印" . $doneStr;
                 $orinfval['streetInfo'] = '';
             }
         }
         if ($type == 31 || $type == 32 || $type == 311 || $type == 312) {
             $orinfval['notes'] = $po_obj->getOrderNotesInfo($orinfval['id']);
             $totalPrice = 0;
             foreach ($locationinfo as $info) {
                 $totalPrice += $info['price'] * $info['amount'];
             }
             $orinfval['totalPrice'] = $totalPrice;
         }
     }
     /*if($_SESSION['userId']==253){
     			echo "<pre>";print_r($ordersinfo);
     			echo $type;
     		}*/
     //print_r($ordersinfo);exit;
     $totalCount = count($ordersinfo);
     $this->smarty->assign('totalCount', $totalCount);
     $this->smarty->assign('ordersinfo', $ordersinfo);
     switch ($type) {
         case 1:
             //标签打印-50*100
             $this->smarty->display('label50x100.htm');
             break;
         case 6:
             //带留言标签打印-50*100
             $this->smarty->display('label50x100_2.htm');
             break;
         case 2:
             //快递A4打印
             $this->smarty->display('expressA4.htm');
             break;
         case 3:
             //国际EUB-热敏打印
             $this->smarty->display('eubprint.htm');
             break;
         case 4:
             //德国Global Mail-100*100打印
             $this->smarty->display('globalmailgerman.htm');
             break;
         case 5:
             //非德国Global Mail-100*100打印
             $this->smarty->display('unglobalmail.htm');
             break;
         case 7:
             //新加坡打印
             $this->smarty->display('singporeprint.htm');
             break;
         case 8:
             //新加坡/EUB/Global Mail
             $this->smarty->display('mixprint.htm');
             break;
         case 9:
             //部分包货打印50*100
             $this->smarty->display('bufen50x100.htm');
             break;
         case 31:
             //Finejo快递-A4(横向打印)
             $this->smarty->display('printlabelA4ForFZ.htm');
             break;
         case 32:
             //哲果发货清单-A4打印
             $this->smarty->display('printlabelA4ForZG.htm');
             break;
         case 311:
             //EB001快递-A4(横向打印)
             $this->smarty->display('printlabelA4ForEB1.htm');
             break;
         case 312:
             //EB001发货清单-A4打印
             $this->smarty->display('printlabelA4ForEB2.htm');
             break;
         case 33:
             //快递A4打印
             $this->smarty->display('expressA4UpsUs.htm');
             break;
         case 10:
             //快递50*100热敏打印
             $this->smarty->display('printLabelExpress.htm');
             break;
         default:
             redirect_to("index.php?mod=dispatchBillQuery&act=showForm&storeId=1");
             return false;
     }
 }
Пример #13
0
function get_goodsSn($lable)
{
    $code = substr($lable, 0, 7);
    $num = intval($code);
    if (is_numeric($lable) && $num > 1000000) {
        $id = $num - 1000000;
        $skuinfo = printLabelModel::getSkuInfoById($id);
        return $skuinfo['sku'];
    } else {
        return str_pad(trim($lable), 3, '0', STR_PAD_LEFT);
    }
}