Esempio n. 1
0
 function act_getPmCount($where)
 {
     $list = PackingMaterialsModel::getPmCount($where);
     if ($list) {
         return $list;
     } else {
         self::$errCode = PackingMaterialsModel::$errCode;
         self::$errMsg = PackingMaterialsModel::$errMsg;
         return false;
     }
 }
Esempio n. 2
0
 public function view_addPmOn()
 {
     $packingMaterials = new PackingMaterialsAct();
     $pmAlias = isset($_POST['pmAlias']) ? post_check($_POST['pmAlias']) : '';
     $pmName = isset($_POST['pmName']) ? post_check($_POST['pmName']) : '';
     $pmNotes = isset($_POST['pmNotes']) ? post_check($_POST['pmNotes']) : '';
     $pmLength = isset($_POST['pmLength']) ? post_check($_POST['pmLength']) : '';
     $pmWidth = isset($_POST['pmWidth']) ? post_check($_POST['pmWidth']) : '';
     $pmHeight = isset($_POST['pmHeight']) ? post_check($_POST['pmHeight']) : '';
     $pmCost = isset($_POST['pmCost']) ? post_check($_POST['pmCost']) : '';
     $pmWeight = isset($_POST['pmWeight']) ? post_check($_POST['pmWeight']) : '';
     $pmDimension = isset($_POST['pmDimension']) ? post_check($_POST['pmDimension']) : '';
     $pmDivider = isset($_POST['pmDivider']) ? post_check($_POST['pmDivider']) : '';
     $pmRatio = isset($_POST['pmRatio']) ? post_check($_POST['pmRatio']) : '';
     if (empty($pmRatio)) {
         $pmRatio = null;
     }
     if (empty($pmAlias) || empty($pmName) || empty($pmLength) || empty($pmWidth) || empty($pmHeight) || empty($pmCost) || empty($pmWeight)) {
         $status = "添加失败,存在空数据";
         header("Location:index.php?mod=packingMaterials&act=getPmList&status={$status}");
         exit;
     }
     $countPmName = $packingMaterials->act_getPmCount("where pmName='{$pmName}' and is_delete=0");
     $countPmDivider = $packingMaterials->act_getPmCount("where pmName='{$pmDivider}' and is_delete=0");
     if ($countPmName > 0) {
         $status = "添加失败,已经存在该包材类名记录";
     } elseif (trim($pmDivider) != '' && $countPmDivider <= 0) {
         $status = " 添加失败,不存在该包材类名为 '{$pmDivider}' 的记录(包材除数)";
     } else {
         $set = "set pmAlias='{$pmAlias}',pmName='{$pmName}',pmNotes='{$pmNotes}',pmLength='{$pmLength}',pmWidth='{$pmWidth}',pmHeight='{$pmHeight}',pmCost='{$pmCost}',pmWeight='{$pmWeight}',pmDimension='{$pmDimension}',pmDivider='{$pmDivider}'";
         if (!empty($pmRatio)) {
             $set .= ",pmRatio='{$pmRatio}'";
         }
         $insertId = $packingMaterials->act_addPm($set);
         if ($insertId) {
             $status = "添加成功";
             //将新的包材信息添加到mem中
             $key = 'pc_pm_' . $insertId;
             $dataPm = array();
             $dataPm['id'] = $insertId;
             $dataPm['pmAlias'] = $pmAlias;
             $dataPm['pmName'] = $pmName;
             $dataPm['pmNotes'] = $pmNotes;
             $dataPm['pmLength'] = $pmLength;
             $dataPm['pmWidth'] = $pmWidth;
             $dataPm['pmHeight'] = $pmHeight;
             $dataPm['pmCost'] = $pmCost;
             $dataPm['pmWeight'] = $pmWeight;
             $dataPm['pmDimension'] = $pmDimension;
             $dataPm['pmRatio'] = $pmRatio;
             $value = $dataPm;
             setMemNewByKey($key, $value);
             //这里不保证能添加成功
             //更新全部包材的mem信息
             $pmList = $packingMaterials->act_getPmList('*', "WHERE is_delete=0");
             if (!empty($pmList)) {
                 setMemNewByKey('pc_pm_all', $pmList);
                 //这里不保证能添加成功
             }
         } else {
             $status = "添加失败";
         }
     }
     header("Location:index.php?mod=packingMaterials&act=getPmList&status={$status}");
 }