Exemplo n.º 1
0
 function inser_scan_record_by_sku($orderid, $sku, $sku_num, $userid)
 {
     $data = array();
     $time = time();
     $sku_info = OmAvailableModel::getTNameList("wh_shipping_orderdetail", "*", "where shipOrderId='{$orderid}' and sku='{$sku}' order by combineSku desc");
     foreach ($sku_info as $info) {
         $scan_exist = OrderPickingRecordsModel::getPickingRecords("*", "where shipOrderId='{$orderid}' and sku='{$sku}' and shipOrderdetailId='{$info['id']}' and is_delete=0");
         if (empty($scan_exist)) {
             $data = array('shipOrderId' => $orderid, 'shipOrderdetailId' => $info['id'], 'sku' => $sku, 'amount' => $info['amount'], 'totalNums' => $info['amount'], 'scanTime' => $time, 'scanUserId' => $userid, 'isScan' => 1);
             OrderPickingRecordsModel::insertRow($data);
         } else {
             $data = array('amount' => $info['amount'], 'scanTime' => $time, 'scanUserId' => $userid, 'isScan' => 1);
             OrderPickingRecordsModel::update($data, "and shipOrderId='{$orderid}' and sku='{$sku}' and shipOrderdetailId='{$info['id']}' and is_delete=0");
         }
     }
 }
Exemplo n.º 2
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;
     }
 }