Example #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 = intval(trim($_POST['storey']));
     $position_a = explode('|', $position);
     foreach ($position_a as $po_a) {
         $position_d = explode(',', $po_a);
         $pname = trim($position_d[0]);
         if (!empty($pname)) {
             $lists = PositionModel::getPositionList("*", "where pName='{$pname}' and storeId={$storeid} and storey = '{$storey}'");
             if (!empty($lists)) {
                 $data = array('x_alixs' => $x_alixs, 'y_alixs' => $y_alixs, 'z_alixs' => $position_d[1], 'floor' => $floor, 'is_enable' => $position_d[2], 'type' => $position_d[3]);
                 if (!PositionModel::update($data, "and id='{$lists[0]['id']}'")) {
                     $mark = false;
                 }
             } else {
                 $list = PositionModel::getPositionList("*", "where x_alixs='{$x_alixs}' and y_alixs='{$y_alixs}' and z_alixs='{$position_d['1']}' and floor='{$floor}' and storeId={$storeid} and storey='{$storey}'");
                 if (!empty($list)) {
                     $data = array('pName' => $position_d[0], 'is_enable' => $position_d[2], 'type' => $position_d[3]);
                     if (!PositionModel::update($data, "and id='{$list[0]['id']}'")) {
                         $mark = false;
                     }
                 } else {
                     if (!empty($position_d[0])) {
                         $data = array('pName' => $position_d[0], 'x_alixs' => $x_alixs, 'y_alixs' => $y_alixs, 'z_alixs' => $position_d[1], 'floor' => $floor, 'is_enable' => $position_d[2], 'type' => $position_d[3], 'storeId' => $storeid, 'storey' => $storey);
                         if (!PositionModel::insertRow($data)) {
                             $mark = false;
                         }
                     }
                 }
             }
         }
     }
     if ($mark) {
         return true;
     } else {
         self::$errCode = "003";
         self::$errMsg = "更新失败,请重试!";
         return false;
     }
 }