Ejemplo n.º 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;
 }
Ejemplo n.º 2
0
 /**
  * 发货扫描显示箱子装的料号信息
  * Enter description here ...
  */
 public function view_chkBox()
 {
     $returnData = array('code' => 0, 'msg' => '');
     if (empty($_SESSION['userId'])) {
         //未登陆
         $returnData['msg'] = '登陆超时 请重新登陆!';
         echo json_encode($returnData);
         exit;
     }
     $orderId = isset($_GET['orderId']) ? trim($_GET['orderId']) : '';
     //补货单号
     $boxid = isset($_GET['boxId']) ? intval($_GET['boxId']) : '';
     //箱号
     if (empty($orderId) || empty($boxid)) {
         $returnData['msg'] = '缺少参数!';
         echo json_encode($returnData);
         exit;
     }
     $boxmg_obj = new BoxManageModel();
     $boxInfo = $boxmg_obj->getBaseBoxInfo($boxid);
     if (false === $boxInfo) {
         $returnData['msg'] = '不存在的箱号!';
         echo json_encode($returnData);
         exit;
     }
     $prePlen_obj = new PreplenshOrderModel();
     $orderinfo = $prePlen_obj->getPrePlenshOrderInfo($orderId);
     if (FALSE === $orderinfo) {
         $returnData['msg'] = '不存在的补货单号!';
         echo json_encode($returnData);
         exit;
     }
     if ($orderinfo['status'] != 1) {
         $returnData['msg'] = '已发货的补货单号!';
         echo json_encode($returnData);
         exit;
     }
     if ($boxInfo['status'] != 2) {
         $returnData['msg'] = '该箱子不是待发柜箱!';
         echo json_encode($returnData);
         exit;
     }
     if (empty($boxInfo['length']) || empty($boxInfo['width']) || empty($boxInfo['high']) || empty($boxInfo['grossWeight']) || empty($boxInfo['netWeight'])) {
         $returnData['msg'] = '箱号信息不完整!';
         echo json_encode($returnData);
         exit;
     }
     $boxObj = new BoxManageModel();
     $rtnInfo = $boxObj->getBoxSkuInfo($boxid);
     $returnData['code'] = 1;
     $returnData['info'] = $rtnInfo;
     echo json_encode($returnData);
     exit;
 }
Ejemplo n.º 3
0
 public function view_changePreOrderStatus()
 {
     $returnData = array('code' => 0, 'msg' => '');
     $orderId = isset($_GET['orderid']) ? intval($_GET['orderid']) : FALSE;
     //订单号
     $arriveday = isset($_GET['arriveday']) ? intval($_GET['arriveday']) : 0;
     if (FALSE === $orderId) {
         $returnData['msg'] = '不存在的订单号!';
         echo json_encode($returnData);
         exit;
     }
     $status = isset($_GET['status']) ? intval($_GET['status']) : '';
     $pre_obj = new PreplenshOrderModel();
     if (FALSE === PreplenshOrderModel::isValidStatusCode($status)) {
         $returnData['msg'] = '不正确的状态码!';
         echo json_encode($returnData);
         exit;
     }
     $change = $pre_obj->changePreOrderStatus($orderId, $status, $arriveday);
     if (FALSE === $change) {
         $returnData['msg'] = '不正确的状态码!';
         echo json_encode($returnData);
         exit;
     } else {
         $returnData['code'] = 1;
         echo json_encode($returnData);
         exit;
     }
 }