Example #1
0
 public function view_printOptimal()
 {
     $list = isset($_GET['list']) ? post_check($_GET['list']) : '';
     $this->smarty->assign('list', $list);
     if ($_POST['route_index']) {
         $userName = $_SESSION['userName'];
         if (empty($list)) {
             echo "请选择需要生成索引的列表";
             exit;
         }
         $GroupRouteAct = new GroupRouteAct();
         $group_index = $GroupRouteAct->act_groupIndex();
         $this->smarty->assign('status', $group_index);
         $order_count = GroupRouteModel::getRouteIndexNum("where user='******'");
         $this->smarty->assign('count', $order_count);
         $this->smarty->assign('group_bool', 1);
     }
     $navlist = array(array('url' => '', 'title' => '首页'), array('url' => 'index.php?mod=orderWaitforPrint&act=printList', 'title' => '打印发货单'), array('url' => 'index.php?mod=PrintOrder&act=printOptimal', 'title' => '订单最优打印'));
     $this->smarty->assign('navlist', $navlist);
     $this->smarty->assign('toptitle', '订单最优打印');
     $this->smarty->assign('secnev', 1);
     $this->smarty->assign('curusername', $_SESSION['userName']);
     $toplevel = 2;
     //顶层菜单
     $this->smarty->assign('toplevel', $toplevel);
     $secondlevel = '22';
     //当前的二级菜单
     $this->smarty->assign('secondlevel', $secondlevel);
     $this->smarty->display('printOrder.htm');
 }
Example #2
0
<body>

<?php 
$printId = $_SESSION['userId'];
//print_r($_GET);
$max_num = 10000;
//isset($_GET['max_num'])?$_GET['max_num']:1000000;
$idarr = isset($_GET['idarr']) ? $_GET['idarr'] : array();
$idarr = explode(",", $idarr);
$lists = array();
$time = time();
foreach ($idarr as $key => $id) {
    $where = "where id={$id}";
    $list = packageCheckModel::selectList($where);
    $goodscode = get_skuGoodsCode($list[0]['sku']);
    $pname_info = GroupRouteModel::getSkuPosition("where a.sku='{$list[0]['sku']}' and b.is_delete=0");
    if (!empty($pname_info)) {
        $pname = $pname_info[0]['pName'];
    } else {
        $pname = '';
    }
    $print_num = $list[0]['num'] > $max_num ? $max_num : $list[0]['num'];
    $groupInfo = printLabelModel::getGroupInfoByTallyListId($id);
    if (!empty($groupInfo)) {
        $group_id = $groupInfo[0]['id'];
    } else {
        //没有打标ID则跳转到打标页面
        header("Location:index.php?act=printLabelPrint&mod=printLabel&max_num=10000000&idarr={$id}");
        exit;
        $group_id = '';
    }
Example #3
0
-->
</style>
</head>
<body>

<?php 
$max_num = isset($_GET['max_num']) ? $_GET['max_num'] : 100;
$str = isset($_GET['str']) ? $_GET['str'] : "";
$arr = explode(",", $str);
$lists = array();
foreach ($arr as $key => $value) {
    $value_arr = explode("*", $value);
    $sku = $value_arr[0];
    $num = $value_arr[1];
    //$lists[] = $list;
    $pname_info = GroupRouteModel::getSkuPosition("where a.sku='{$sku}' and b.is_delete=0");
    if (!empty($pname_info)) {
        $pname = $pname_info[0]['pName'];
    } else {
        $pname = '';
    }
    $skuCode = get_skuGoodsCode($sku);
    ?>




<?php 
    for ($i = 0; $i < $num; $i = $i + 2) {
        ?>
Example #4
0
$idarr = isset($_GET['idarr']) ? $_GET['idarr'] : array();
$storeId = intval(trim($_GET['storeId']));
$storeId = $storeId ? $storeId : 1;
$idarr = explode(",", $idarr);
$lists = array();
$time = time();
foreach ($idarr as $key => $id) {
    $where = "where id={$id}";
    $list = packageCheckModel::selectList($where);
    $goodscode = get_skuGoodsCode($list[0]['sku']);
    $where = "where a.sku='{$list[0]['sku']}' and b.is_delete=0";
    if ($list['0']['storeId'] == 2) {
        //B仓点货操作则添加所属仓库判断
        $where .= " and b.storeId = 2";
    }
    $pname_info = GroupRouteModel::getSkuPosition($where);
    if (!empty($pname_info)) {
        $pname = $pname_info[0]['pName'];
    } else {
        $pname = '';
    }
    $print_num = $list[0]['num'] > $max_num ? $max_num : $list[0]['num'];
    $group_id = printLabelModel::insertPrintGroup($id, $print_num, $printId, $time, $storeId);
    //$lists[] = $list;
    ?>

<table width="420" border="0" cellspacing="0" cellpadding="0" style="margin-top:2px;"> 
  <tr valign="middle">
    <td width="200">
    	<table width="100%" height="100" border="0" cellspacing="0" cellpadding="0">
		  <tr>
Example #5
0
 function act_groupGenerate()
 {
     $list_id = trim($_POST['print_list']);
     $order_all = array();
     //获取所有请求生成提货单的配货单号
     $list_info = OrderPrintListModel::getPrintList("*", "where id in({$list_id}) and storeId=2 and is_delete=0");
     if ($list_info) {
         foreach ($list_info as $info) {
             $order_arr = array();
             $order_arr = array_filter(explode(',', $info['orderIds']));
             foreach ($order_arr as $orders) {
                 $order_all[] = $orders;
             }
         }
     }
     if (empty($order_all)) {
         self::$errCode = "401";
         self::$errMsg = "配货单为空,请确认";
         return false;
     }
     if (!empty($order_all)) {
         $userName = $_SESSION['userName'];
         $create_time = strtotime(date("Y-m-d"));
         $time = time();
         $sku_arr = array();
         $status_info = GroupRouteBModel::getOrderGroupB("*", "where createdTime>'{$create_time}' and user='******' order by id desc limit 0,1");
         //当天打印次数
         if (empty($status_info)) {
             $sequence = 1;
         } else {
             $sequence = $status_info[0]['todaySequence'] + 1;
         }
         //获取当前最后一个提货单编号
         $group_info = GroupRouteBModel::getOrderGroupB("*", "order by id desc limit 0,1");
         if (empty($group_info)) {
             $num = 0;
         } else {
             $num = substr($group_info[0]['shipOrderGroup'], 3);
         }
         foreach ($order_all as $order) {
             $position_arr = GroupRouteModel::getOrderPositionID($order);
             foreach ($position_arr as $position) {
                 if ($position['storeId'] == 2) {
                     if (isset($sku_arr[$position['pName']][$position['sku']])) {
                         $sku_arr[$position['pName']][$position['sku']]['amount'] = $sku_arr[$position['pName']][$position['sku']]['amount'] + $position['amount'];
                         $sku_arr[$position['pName']][$position['sku']]['shipOrderId'] = $sku_arr[$position['pName']][$position['sku']]['shipOrderId'] . ',' . $position['shipOrderId'];
                     } else {
                         $sku_arr[$position['pName']][$position['sku']]['amount'] = $position['amount'];
                         $sku_arr[$position['pName']][$position['sku']]['shipOrderId'] = $position['shipOrderId'];
                     }
                 }
             }
         }
         ksort($sku_arr);
         $group_num = $num + 1;
         $group_num = str_pad($group_num, 9, "0", STR_PAD_LEFT);
         $group_num = "BPH" . $group_num;
         $string = "";
         foreach ($sku_arr as $position => $position_info) {
             foreach ($position_info as $sku => $sku_info) {
                 $string .= "('" . $sku . "','" . $sku_info['amount'] . "','" . $sku_info['shipOrderId'] . "','" . $group_num . "','" . $position . "','" . $sequence . "','" . $userName . "','" . $time . "'),";
             }
         }
         $string = trim($string, ",");
         if (empty($string)) {
             self::$errCode = "004";
             self::$errMsg = "没有B仓料号";
             return false;
         }
         $list_one = GroupRouteBModel::insertOrderGroupB($string);
         if ($list_one) {
             self::$errMsg = "提货单生成已完成,请打印!";
             return true;
         } else {
             self::$errCode = "003";
             self::$errMsg = "提货单生成失败,请联系it!";
             return false;
         }
     } else {
         self::$errCode = "003";
         self::$errMsg = "请选择打印列表";
         return false;
     }
 }
Example #6
0
 public function act_checkSku()
 {
     $skus = $_POST['skus'];
     $skuarray = array();
     $skulists = explode(',', $skus);
     foreach ($skulists as $skulist) {
         list($sku, $num) = array_map('trim', explode('*', $skulist));
         $skuarray[] = "'{$sku}'";
         $skukeyarray[$sku] = array('sku' => $sku);
     }
     $skuarray = array_unique($skuarray);
     $skustr = "(" . implode(',', $skuarray) . ")";
     $goodslists = OmAvailableModel::getTNameList("pc_goods", "sku,goodsName", "where sku in {$skustr} and is_delete=0");
     if (empty($goodslists)) {
         self::$errCode = 201;
         self::$errMsg = "未找到对应的料号信息!";
         return false;
     } else {
         $res = array();
         $skukeyresult = array();
         $resultskus = array();
         foreach ($goodslists as $key => $goodslist) {
             $resultskus[$goodslist['sku']] = array('');
             $pname_info = GroupRouteModel::getSkuPosition("where a.sku='{$goodslist['sku']}' and b.is_delete=0");
             if (!empty($pname_info)) {
                 $pname = $pname_info[0]['pName'];
             } else {
                 $pname = null;
             }
             $goodslists[$key]['pName'] = $pname;
         }
         foreach ($goodslists as $goodslist) {
             $skukeyarray[$goodslist['sku']] = $goodslist;
         }
         foreach ($skukeyarray as $skukey) {
             $skukeyresult[] = $skukey;
         }
         $errorskus = array_diff_key($skukeyarray, $resultskus);
         $res['res_data'] = $skukeyresult;
         $res['res_errorsku'] = count($errorskus) > 0 ? true : false;
         self::$errMsg = "料号验证成功";
         return $res;
     }
 }
Example #7
0
 function act_groupGenerate()
 {
     $k = 1;
     $group_bool = trim($_POST['group_bool']);
     if (!empty($group_bool)) {
         $userName = $_SESSION['userName'];
         $create_time = strtotime(date("Y-m-d"));
         $time = time();
         $status_info = GroupRouteModel::getOrderGroup("*", "where createdTime>'{$create_time}' and user='******' order by id desc limit 0,1");
         //当天打印次数
         if (empty($status_info)) {
             $sequence = 1;
         } else {
             $sequence = $status_info[0]['todaySequence'] + 1;
         }
         //获取当前最后一个清单编号
         $group_info = GroupRouteModel::getOrderGroup("*", "order by id desc limit 0,1");
         if (empty($group_info)) {
             $num = 0;
         } else {
             $num = substr($group_info[0]['shipOrderGroup'], 2);
         }
         $text = '';
         $bool = true;
         $group_infos = GroupRouteModel::getRouteIndex("*", "where user='******' order by id asc");
         $count = count($group_infos);
         $group_amount = ceil($count / 30);
         for ($i = 0; $i < $group_amount; $i++) {
             $sku_arr = array();
             for ($j = 0; $j < 30; $j++) {
                 $route_id = $j + 30 * $i;
                 if ($route_id == $count) {
                     break;
                 }
                 $car_number = $j + 1;
                 $shipOrderId = $group_infos[$route_id]['shipOrderId'];
                 $sku_array = GroupRouteModel::getOrderPositionIDGroup($shipOrderId);
                 foreach ($sku_array as $sku_detail) {
                     $sku_arr[$sku_detail['pName']][] = array('sku' => $sku_detail['sku'], 'amount' => $sku_detail['total'], 'orders' => $shipOrderId, 'car_number' => $car_number);
                 }
             }
             ksort($sku_arr);
             $group_num = $num + $k;
             $group_num = str_pad($group_num, 9, "0", STR_PAD_LEFT);
             $group_num = "PH" . $group_num;
             $string = "";
             foreach ($sku_arr as $position => $position_info) {
                 foreach ($position_info as $sku_info) {
                     $string .= "('" . $sku_info['sku'] . "','" . $sku_info['amount'] . "','" . $sku_info['orders'] . "','" . $group_num . "','" . $sku_info['car_number'] . "','" . $sequence . "','" . $userName . "','" . $time . "','" . $position . "'),";
                 }
             }
             $string = trim($string, ",");
             $list_one = GroupRouteModel::insertOrderGroup($string);
             if ($list_one) {
                 $text .= $group_num . "配货清单生成成功;";
             } else {
                 $text .= $group_num . "配货清单生成失败;";
                 $bool = false;
             }
             $k++;
         }
         if ($bool) {
             self::$errMsg = "订单配货分组完成,请打印";
             return true;
         } else {
             self::$errCode = "003";
             self::$errMsg = $text;
             return false;
         }
     } else {
         self::$errCode = "003";
         self::$errMsg = "请先生成订单最优配货索引";
         return false;
     }
 }
Example #8
0
 function act_searchSku()
 {
     $sku = trim($_POST['sku']);
     $sku = get_goodsSn($sku);
     $eosr_arr = whShelfModel::selectSkuNums($sku);
     if (empty($eosr_arr)) {
         self::$errCode = "401";
         self::$errMsg = "找不到该料号的库存信息!";
         return false;
     } else {
         $info = GroupRouteModel::getSkuPosition("where a.sku='{$sku}' and b.is_delete=0");
         self::$errCode = "400";
         self::$errMsg = '成功搜索该料号信息!' . $sku;
         return $info;
     }
 }
Example #9
0
 public static function getOrderPositionIDGroup($order)
 {
     self::initDB();
     //$sql   = "select a.positionId,a.pName,a.sku,a.amount from `wh_shipping_orderdetail` as a left join `wh_shipping_order` as b
     //		  on a.shipOrderId=b.id where b.id='$order'";
     $sql = "select positionId,pName,sku,sum(amount) as total from `wh_shipping_orderdetail` where shipOrderId='{$order}' group by pName,sku";
     $query = self::$dbConn->query($sql);
     if ($query) {
         $ret = self::$dbConn->fetch_array_all($query);
         return $ret;
     } else {
         self::$errCode = "003";
         self::$errMsg = "error";
         return false;
     }
 }
Example #10
0
 function act_searchSku()
 {
     $order_id = $_POST['ebay_id'];
     $sku = trim($_POST['sku']);
     $sku = get_goodsSn($sku);
     $now_pname = trim($_POST['now_pname']);
     $state_status = array(402);
     //准备状态
     $final_status = array(403);
     //配货完成状态
     $no_express_delivery = array('中国邮政平邮', '中国邮政挂号', '香港小包平邮', '香港小包挂号', '德国邮政', '新加坡邮政', 'EUB', 'Global Mail');
     //先核对订单
     //兼容 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, $order_id)) {
     } else {
         if (preg_match($p_trackno_eub, $order_id)) {
             $is_eub_package_type = true;
         } else {
             self::$errCode = "001";
             self::$errMsg = "订单号[" . $order_id . "]格式有误";
             return false;
         }
     }
     if ($is_eub_package_type === true) {
         $ordercheck = ShippingOrderModel::getShippingOrderInfo("b.*", "where a.tracknumber='{$order_id}' and a.is_delete=0");
     } else {
         $ordercheck = ShippingOrderModel::getShippingOrder("*", "where id='{$order_id}'");
     }
     if (empty($ordercheck)) {
         self::$errCode = '001';
         self::$errMsg = '未找到订单/跟踪号[' . $order_id . ']';
         return false;
     } else {
         $ebay_carrier = CommonModel::getShipingNameById($ordercheck[0]['transportId']);
         //$ebay_carrier = '中国邮政平邮';
         if (!in_array($ebay_carrier, $no_express_delivery)) {
             self::$errCode = '001';
             self::$errMsg = '请选择非快递订单!';
             return false;
         }
     }
     if ($ordercheck[0]['orderStatus'] == 900) {
         self::$errCode = '002';
         self::$errMsg = "该发货单[{$order_id}][已经废弃]!";
         return false;
     } else {
         if (in_array($ordercheck[0]['orderStatus'], $final_status)) {
             self::$errCode = '005';
             self::$errMsg = "该发货单已经扫描完成!";
             return false;
         }
     }
     if (!in_array($ordercheck[0]['orderStatus'], $state_status)) {
         self::$errCode = '002';
         self::$errMsg = "该发货单[{$order_id}][不在待配货]!";
         return false;
     }
     //配货单所有料号及数量
     $skuinfos = array();
     $skuinfo = GroupRouteModel::getOrderPositionID($ordercheck[0]['id']);
     foreach ($skuinfo as $info) {
         $s_key = $info['sku'] . "-" . $info['pName'];
         $skuinfos[$s_key] = $info['amount'];
     }
     $eosr_arr = OrderPickingRecordsModel::getPickingRecords("*", "where shipOrderId={$ordercheck[0]['id']} and sku='{$sku}' and is_delete=0");
     if (!$eosr_arr) {
         self::$errCode = "012";
         self::$errMsg = "请扫描正确料号!";
         return false;
     } else {
         $sku_stock = GroupRouteModel::getSkuPosition("where a.sku='{$sku}' and c.pName='{$now_pname}' and b.is_delete=0");
         $s_key = $sku . "-" . $now_pname;
         $goods_sn = array();
         //$gsi = get_sku_info($sku);
         $goods_sn['sku'] = $sku;
         //$goods_sn['gc'] = $gsi['realnums'];
         $goods_sn['gc'] = isset($sku_stock[0]['nums']) ? $sku_stock[0]['nums'] : 0;
         //$goods_sn['day']= floor($gsi['realnums']/$gsi['everyday_sale']); //库存天数
         $goods_sn['day'] = "";
         //库存天数
         $goods_sn['nums'] = $skuinfos[$s_key];
         $goods_sn['is_scan'] = $eosr_arr[0]['isScan'] == 1 ? "已扫描" : "未扫描";
         //$eg  = GroupRouteModel::getSkuPosition("where a.sku='$sku'");
         $goods_sn['gl'] = $now_pname;
         self::$errCode = "400";
         self::$errMsg = '成功搜索该料号信息!' . $sku;
         return $goods_sn;
     }
 }
Example #11
0
 function act_getGroupInfo()
 {
     $userId = $_SESSION['userId'];
     $shipOrderGroup = $_POST['order_group'];
     $group_sql = GroupRouteModel::getOrderGroup("*", "where shipOrderGroup='{$shipOrderGroup}'");
     if (empty($group_sql)) {
         self::$errCode = "003";
         self::$errMsg = "该配货清单号不存在,请重新输入!";
         return false;
     } else {
         $scan_sql = GroupDistributionModel::getGroupDistList("shipOrderGroup", "where shipOrderGroup='{$shipOrderGroup}'");
         if (empty($scan_sql)) {
             $string = "";
             $time = strtotime(date('Y-m-d H:i:s'));
             foreach ($group_sql as $info) {
                 $string .= "('" . $info['shipOrderGroup'] . "','" . $info['sku'] . "','" . $info['id'] . "','" . $info['skuAmount'] . "','" . $info['shipOrderId'] . "','0','0','" . $info['carNumber'] . "','" . $info['pName'] . "','" . $userId . "','" . $time . "'),";
             }
             $string = trim($string, ",");
             //插入配货清单表
             $insert_info = GroupDistributionModel::insertGroupDist($string);
             if ($insert_info) {
                 $show_info = array();
                 $show_sql = GroupDistributionModel::getGroupSkuInfo("and a.shipOrderGroup='{$shipOrderGroup}' and a.status=0 group by a.pName order by a.groupId asc");
                 if (!empty($show_sql)) {
                     foreach ($show_sql as $show) {
                         $order_sku_info = $this->get_valid_order($show['shipOrderGroup'], $show['sku'], $show['pName']);
                         if ($order_sku_info['sku_amount'] != 0) {
                             $show_info['group_id'] = $show['groupId'];
                             $show_info['sku'] = $show['sku'];
                             $show_info['sku_amount'] = $order_sku_info['sku_amount'];
                             $show_info['goods_location'] = $show['pName'];
                             break;
                         }
                     }
                 }
                 if (empty($show_info)) {
                     self::$errCode = "003";
                     self::$errMsg = "该清单不在等待配货状态,请确认!";
                     return false;
                 } else {
                     self::$errMsg = "请扫描该配货清单下的料号!";
                     return $show_info;
                 }
             } else {
                 self::$errCode = "003";
                 self::$errMsg = "订单料号初始化出错,请重试";
                 return false;
             }
         } else {
             $iscan = GroupDistributionModel::getGroupDistList("*", "where shipOrderGroup='{$shipOrderGroup}' and status=0");
             if (empty($iscan)) {
                 self::$errCode = "003";
                 self::$errMsg = "该清单已扫描配货完成,请扫描其他清单!";
                 return false;
             } else {
                 //更新配货人
                 $data = array('userID' => $userId);
                 GroupDistributionModel::update($data, "and shipOrderGroup='{$shipOrderGroup}' and status=0");
                 //检查是否有出库过
                 $isout = GroupDistributionModel::getGroupDistList("*", "where shipOrderGroup='{$shipOrderGroup}' and status=1");
                 $show_info = array();
                 $show_sql = GroupDistributionModel::getGroupSkuInfo("and a.shipOrderGroup='{$shipOrderGroup}' and a.status=0 group by a.pName order by a.groupId asc");
                 if (!empty($show_sql)) {
                     foreach ($show_sql as $show) {
                         $order_sku_info = $this->get_valid_order($show['shipOrderGroup'], $show['sku'], $show['pName']);
                         if ($order_sku_info['sku_amount'] != 0) {
                             $show_info['group_id'] = $show['groupId'];
                             $show_info['sku'] = $show['sku'];
                             $show_info['sku_amount'] = $order_sku_info['sku_amount'];
                             $show_info['goods_location'] = $show['pName'];
                             break;
                         }
                     }
                 }
                 if (empty($show_info)) {
                     if (empty($isout)) {
                         self::$errCode = "003";
                         self::$errMsg = "该清单不在等待配货状态,请确认!";
                         return false;
                     } else {
                         self::$errCode = "003";
                         self::$errMsg = "该清单已扫描配货完成,请扫描其他清单!";
                         return false;
                     }
                 } else {
                     self::$errMsg = "请扫描该配货清单下的料号!";
                     return $show_info;
                 }
             }
         }
     }
 }