Пример #1
0
 public function addBoxToaOrder($boxId, $orderid, $opuser)
 {
     $time = time();
     $box_obj = new BoxManageModel();
     $inBox_obj = new OwInBoxStockModel();
     $skuDetail = $box_obj->getBoxSkuDetail($boxId);
     $this->dbConn->begin();
     foreach ($skuDetail as $skuInfo) {
         $tmp = $skuInfo['num'];
         $inboxInfo = $inBox_obj->getInbocStockInfo($skuInfo['sku']);
         if (FALSE === $inboxInfo) {
             //该料号没有封箱库存信息
             $this->dbConn->rollback();
             self::$errMsg = $skuInfo['sku'] . "没有封箱库存信息!";
             return FALSE;
         }
         if ($inboxInfo['num'] < $skuInfo['num']) {
             //如果封箱库存小于箱子中的库存数量 则会导致封箱库存不够扣
             $this->dbConn->rollback();
             self::$errMsg = $skuInfo['sku'] . "封箱库存小于发货数量!";
             return FALSE;
         }
         $upsql = "update wh_inboxStock set num=num-{$tmp} where sku='{$skuInfo['sku']}'";
         //扣除封箱库存
         $upquery = $this->dbConn->query($upsql);
         if (FALSE === $upquery) {
             $this->dbConn->rollback();
             self::$errMsg = $skuInfo['sku'] . "扣除封箱库存失败!";
             return FALSE;
         }
     }
     $sql = "\n                update wh_boxinuse set replenshId='{$orderid}', sendScanTime='{$time}', \n                sendScanUser='******', status='3' where boxid='{$boxId}'\n        ";
     $query = $this->dbConn->query($sql);
     if (FALSE === $query) {
         //更新状态失败
         $this->dbConn->rollback();
         self::$errMsg = '更新箱子状态失败!';
         return FALSE;
     }
     $logSql = "\n                insert into wh_boxOpLog (boxId, opcode, opuser, optime) values ('{$boxId}', 'send', '{$opuser}', '{$time}');\n                ";
     $logquery = $this->dbConn->query($logSql);
     if (FALSE === $logquery) {
         //记录日志出错
         $this->dbConn->rollback();
         self::$errMsg = '记录日志出错!';
         return FALSE;
     }
     $upd = "UPDATE wh_boxDetail SET stu = '2' WHERE boxId = '{$boxId}' AND is_delete = 0";
     $rtnUpd = $this->dbConn->query($upd);
     if ($rtnUpd === FALSE) {
         $this->dbConn->rollback();
         self::$errMsg = '更新装箱料号状态出错';
         return FALSE;
     }
     $this->dbConn->commit();
     return TRUE;
 }
Пример #2
0
 public function view_boxManage()
 {
     $ordersn = isset($_GET['ordersn']) ? trim($_GET['ordersn']) : '';
     //状态
     $status = isset($_GET['status']) ? intval($_GET['status']) : FALSE;
     //状态
     $boxId = isset($_GET['boxid']) ? trim($_GET['boxid']) : FALSE;
     //箱号
     $sku = isset($_GET['sku']) ? trim($_GET['sku']) : FALSE;
     //箱号
     $startTime = isset($_GET['startTime']) ? trim($_GET['startTime']) : FALSE;
     //开始时间
     $endTime = isset($_GET['endTime']) ? trim($_GET['trim']) : FALSE;
     //结束时间
     $whereSql = '';
     if (!empty($ordersn)) {
         $whereSql .= " and a.replenshId='{$ordersn}' ";
     }
     if (!empty($status)) {
         $whereSql .= " and a.status='{$status}' ";
     }
     if (!empty($boxId)) {
         $bxid = intval($boxId);
         $whereSql .= " and a.boxid='{$bxid}' ";
     }
     if (!empty($sku)) {
         $whereSql .= " and b.sku = '{$sku}' ";
     }
     if (!empty($startTime)) {
         $startTimeStamp = strtotime($startTime);
         $whereSql .= " and a.addtime>{$startTimeStamp} ";
     }
     if (!empty($endTime)) {
         $endTimeStamp = strtotime($endTime);
         $whereSql .= " and a.addtime<{$endTimeStamp} ";
     }
     $pageSize = 200;
     $box_obj = new BoxManageModel();
     $count = $box_obj->culCount($whereSql);
     $pageObj = new Page($count, $pageSize);
     $orderby = " ORDER BY a.boxid DESC ";
     $boxinfoList = $box_obj->getListBoxInfo($whereSql . $orderby . $pageObj->limit);
     foreach ($boxinfoList as &$boxInfo) {
         $boxInfo['timestr'] = date('Y-m-d H:i:s', $boxInfo['addtime']);
         $boxInfo['replenshId'] = empty($boxInfo['replenshId']) ? '未关联补货单' : $boxInfo['replenshId'];
         $boxInfo['sendtime'] = empty($boxInfo['sendScanTime']) ? '未发柜' : date('Y-m-d H:i:s', $boxInfo['sendScanTime']);
         $boxInfo['statusStr'] = BoxManageModel::status2Name($boxInfo['status']);
         $detailInfo = $box_obj->getBoxSkuDetail($boxInfo['boxid']);
         $boxInfo['skudetail'] = $detailInfo;
         $boxInfo['addUserName'] = getUserNameById($boxInfo['adduser']);
     }
     $navlist = array(array('url' => '', 'title' => '海外仓补货'), array('url' => '', 'title' => '箱号管理'));
     if ($count > $pageSize) {
         $pagestr = $pageObj->fpage(array(0, 2, 3, 4, 5, 6, 7, 8, 9));
     } else {
         $pagestr = $pageObj->fpage(array(0, 2, 3));
     }
     $toplevel = 2;
     //顶层菜单
     $this->smarty->assign('toplevel', $toplevel);
     $secondlevel = '214';
     //当前的二级菜单
     $this->smarty->assign('pagestr', $pagestr);
     $this->smarty->assign('boxList', $boxinfoList);
     $this->smarty->assign('navlist', $navlist);
     $this->smarty->assign('secondlevel', $secondlevel);
     $this->smarty->assign('third', 3);
     $this->smarty->assign('status', $status);
     $this->smarty->assign('orderSn', $ordersn);
     $this->smarty->assign('boxid', $boxId);
     $this->smarty->assign('sku', $sku);
     $this->smarty->assign('starttime', $startTime);
     $this->smarty->assign('endtime', $endTime);
     $this->smarty->display('owBoxManage.htm');
 }
Пример #3
0
 public function view_printBoxPageLabel()
 {
     $orderId = isset($_GET['orderId']) ? trim($_GET['orderId']) : NULL;
     if (empty($orderId)) {
         goErrMsgPage(array('data' => array('缺少参数!'), 'link' => 'index.php?mod=OwBoxManage&act=boxManage'));
         exit;
     }
     $boxObj = new BoxManageModel();
     $listData = $boxObj->getBoxData($orderId);
     //获取传递过来的箱号信息
     $listDetail = array();
     $idar = explode(",", $orderId);
     $idar = array_map('intval', $idar);
     foreach ($idar as $id) {
         $listDetail[$id] = $boxObj->getBoxSkuDetail($id);
     }
     $total = count($listData);
     include WEB_PATH . 'html/template/v1/printBoxPageLabel.htm';
 }
Пример #4
0
 /**
  * pda退箱扫描验证
  * add time:2014-05-16
  * add name:wangminwei
  * note:整箱退货,箱子状态需为已装柜,部分退货状态限制在已配货、已复核、已装柜状态;状态 1:已配货 2:已复核 3:已装柜 4:海外已收货
  */
 public function pdaCheckReturnBox($boxId, $sku, $num, $ismark)
 {
     $boxManage = new BoxManageModel();
     $this->dbConn->begin();
     if ($ismark == 'all') {
         //整箱
         $sql = "SELECT status FROM wh_boxinuse WHERE boxid = '{$boxId}'";
         $result = $this->dbConn->fetch_first($sql);
         if (!empty($result)) {
             $status = $result['status'];
             if ($status != 3) {
                 return 'noPass';
             } else {
                 $updLink = "UPDATE wh_boxinuse SET replenshId = '', sendScanTime = 0, sendScanUser = 0, status='2' WHERE boxid = '{$boxId}'";
                 $rtnUpdLink = $this->dbConn->query($updLink);
                 //去除补货清单关联
                 if ($rtnUpdLink === false) {
                     echo '1';
                     $this->dbConn->rollback();
                     return 'failure';
                 }
                 $skuInfo = $boxManage->getBoxSkuDetail($boxId);
                 $skuArr = $skuInfo[0]['sku'];
                 $stock = $skuInfo[0]['num'];
                 $updBoxStock = "UPDATE wh_inboxStock SET num = num + {$stock} WHERE sku = '{$skuArr}'";
                 $rtnUpdBoxStock = $this->dbConn->query($updBoxStock);
                 //添加封箱库存数量
                 if ($rtnUpdBoxStock === false) {
                     echo '2';
                     $this->dbConn->rollback();
                     return 'failure';
                 }
                 $time = time();
                 $logSql = "INSERT INTO wh_boxOpLog(boxId, opcode, opuser, optime) VALUES ('{$boxId}', 'return', '{$_SESSION['userId']}', '{$time}')";
                 $logQuery = $this->dbConn->query($logSql);
                 //添加退箱记录
                 if ($logQuery === false) {
                     echo '3';
                     $this->dbConn->rollback();
                     return 'failure';
                 }
                 $this->dbConn->commit();
                 return 'success';
             }
         } else {
             return 'Null';
         }
     }
     if ($ismark == 'part') {
         //部份
         $sql = "SELECT b.num FROM wh_boxinuse AS a JOIN wh_boxDetail AS b ON a.boxid = b.boxId WHERE a.boxid = '{$boxId}' AND b.sku = '{$sku}'";
         $result = $this->dbConn->fetch_first($sql);
         if (!empty($result)) {
             $qty = $result['num'];
             if ($num > $qty) {
                 return 'moreQty';
             } else {
                 if ($num == $qty) {
                     return 'sameQty';
                 } else {
                     $updBoxQty = "UPDATE wh_boxDetail SET num = num - {$num} WHERE boxId = '{$boxId}' AND sku = '{$sku}'";
                     $rtnUpdBoxQty = $this->dbConn->query($updBoxQty);
                     //扣除装箱数量
                     if ($rtnUpdBoxQty === false) {
                         $this->dbConn->rollback();
                         return 'failure';
                     }
                     $time = time();
                     $logSql = "INSERT INTO wh_boxReturnPartSku (boxId, sku, num, user, time) VALUES ('{$boxId}', '{$sku}', '{$num}', '{$_SESSION['userId']}', '{$time}')";
                     $logQuery = $this->dbConn->query($logSql);
                     //添加箱子部份退货记录
                     if ($logQuery === false) {
                         $this->dbConn->rollback();
                         return 'failure';
                     }
                     $sql = "SELECT status FROM wh_boxinuse WHERE boxid = '{$boxId}'";
                     $result = $this->dbConn->fetch_first($sql);
                     $status = $result['status'];
                     if ($status == '3') {
                         //箱子在已发柜状态
                         $updBoxStock = "UPDATE wh_inboxStock SET num = num + {$num} WHERE sku = '{$sku}'";
                         $rtnUpdBoxStock = $this->dbConn->query($updBoxStock);
                         //扣除封箱库存数量
                         if ($rtnUpdBoxStock === false) {
                             $this->dbConn->rollback();
                             return 'failure';
                         }
                     }
                     $this->dbConn->commit();
                     return 'success';
                 }
             }
         } else {
             return 'Null';
         }
     }
 }