function act_addDefectiveProducts($set)
 {
     $list = DefectiveProductsModel::updateDefectiveProducts($set);
     if ($list) {
         return $list;
     } else {
         self::$errCode = DefectiveProductsModel::$errCode;
         self::$errMsg = DefectiveProductsModel::$errMsg;
         return false;
     }
 }
Example #2
0
 public function view_updateDefectiveProducts()
 {
     if (!isset($_SESSION['userId'])) {
         //检测用户是否登陆
         header('location:index.php?mod=login&act=index');
         exit;
     }
     $defectiveProductsAct = new DefectiveProductsAct();
     $type = isset($_POST['type']) ? $_POST['type'] : '';
     $defectiveId = isset($_POST['defectiveId']) ? post_check($_POST['defectiveId']) : '';
     $infoId = isset($_POST['infoId']) ? post_check($_POST['infoId']) : '';
     $num = isset($_POST['num']) ? post_check($_POST['num']) : '';
     //传过来的数量
     $note = isset($_POST['note']) ? post_check($_POST['note']) : '';
     if (empty($type) || empty($defectiveId) || empty($infoId) || empty($num)) {
         //为空时,跳转到列表页面,输出错误信息
         $status = '处理失败,信息不完整';
         header("location:index.php?mod=DefectiveProducts&act=getDefectiveProductsList&status={$status}");
         exit;
     }
     $scrappedStatus = 1;
     //默认报废的状态为1(内部处理为2,待退回为3)
     $select = 'defectiveNum';
     $where = "WHERE id='{$defectiveId}' AND infoId='{$infoId}'";
     $defectiveProductsList = $defectiveProductsAct->act_getDefectiveProductsList($select, $where);
     //检测记录defectiveId和infoId是否存在
     if (empty($defectiveProductsList)) {
         $status = '处理失败,不存在这条记录';
         header("location:index.php?mod=DefectiveProducts&act=getDefectiveProductsList&status={$status}");
         exit;
     }
     if ($type == 'inter') {
         $scrappedStatus = 2;
     }
     if ($type == 'return') {
         $scrappedStatus = 3;
     }
     $return = $defectiveProductsAct->act_updateDefectiveProducts($defectiveId, $infoId, $num, $note, $scrappedStatus);
     //返回0或1
     $status = '处理成功';
     if ($return == 0) {
         $status = '处理失败';
     }
     header("location:index.php?mod=DefectiveProducts&act=getDefectiveProductsList&status={$status}");
 }