Exemplo n.º 1
0
 function act_opisitionManage()
 {
     $data = array();
     $position_a = array();
     $position_d = array();
     $mark = true;
     $position = $_POST['position'];
     $x_alixs = $_POST['axis_x'];
     $y_alixs = $_POST['axis_y'];
     $floor = $_POST['floor'];
     $storeid = $_POST['storeid'];
     $storey = $_POST['storey'];
     $areaId = $_POST['areaId'];
     $position_a = explode('|', $position);
     foreach ($position_a as $po_a) {
         $position_d = explode(',', $po_a);
         $alixs = array_splice($position_d, -3);
         //print_r($position_d);exit;
         $where = array('x_alixs' => $x_alixs, 'y_alixs' => $y_alixs, 'z_alixs' => $alixs[0], 'storey' => $storey, 'areaId' => $areaId, 'storeId' => $storeid);
         $info = WhPositionDistributionModel::delete_data($where);
         //先清空该位置仓位信息
         foreach ($position_d as $pname) {
             if (!empty($pname)) {
                 $lists = PositionModel::getPositionList("*", "where pName='{$pname}' and storeId={$storeid}");
                 if (!empty($lists)) {
                     $data = array('x_alixs' => $x_alixs, 'y_alixs' => $y_alixs, 'z_alixs' => $alixs[0], 'floor' => $floor, 'storeId' => $storeid, 'storey' => $storey, 'areaId' => $areaId, 'is_enable' => $alixs[1], 'type' => $alixs[2]);
                     if (!WhPositionModel::update($data, "and id='{$lists[0]['id']}'")) {
                         $mark = false;
                     }
                 } else {
                     $list = WhPositionModel::getPositionList("*", "where pName='{$pname}' and x_alixs='{$x_alixs}' and y_alixs='{$y_alixs}' and z_alixs='{$position_d['1']}' and floor='{$floor}' and storeId={$storeid}");
                     if (!empty($list)) {
                         $data = array('pName' => $pname, 'is_enable' => $alixs[1], 'type' => $alixs[2]);
                         if (!WhPositionModel::update($data, "and id='{$list[0]['id']}'")) {
                             $mark = false;
                         }
                     } else {
                         if (!empty($pname)) {
                             $data = array('pName' => $pname, 'x_alixs' => $x_alixs, 'y_alixs' => $y_alixs, 'z_alixs' => $alixs[0], 'floor' => $floor, 'storey' => $storey, 'areaId' => $areaId, 'is_enable' => $alixs[1], 'type' => $alixs[2], 'storeId' => $storeid);
                             if (!WhPositionModel::insertRow($data)) {
                                 $mark = false;
                             }
                         }
                     }
                 }
             }
         }
         //$pname = trim($position_d[0]);
     }
     if ($mark) {
         return true;
     } else {
         self::$errCode = "003";
         self::$errMsg = "更新失败,请重试!";
         return false;
     }
 }
Exemplo n.º 2
0
 public function getPositonIndexList($select, $where)
 {
     self::initDB();
     $sql = "select {$select} from `wh_position_index` {$where} ";
     $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;
     }
 }