Ejemplo n.º 1
0
 public static function updatePrintGroup($tallyIdArr)
 {
     self::initDB();
     $log_file = 'print_label_record/' . date('Ymd') . '.txt';
     //日志文件
     $date = date('Y-m-d H:i:s');
     $userId = $_SESSION['userId'];
     $time = time();
     if (!is_array($tallyIdArr)) {
         return false;
     }
     $ids = implode(',', $tallyIdArr);
     OmAvailableModel::begin();
     /** 更新点货记录**/
     $update_tallying = "update wh_tallying_list set printerId={$userId},printTime={$time} where id in(" . $ids . ")";
     $update_tallying = self::$dbConn->query($update_tallying);
     if (!$update_tallying) {
         $log_info = sprintf("tallyinglistId:%s, 时间:%s, 信息:%s,返回值:%s, 参数:%s \r\n", $ids, $date, '更新点货信息打标时间失败', $update_tallying, "update wh_tallying_list set printerId={$userId},printTime={$time} where id in(" . $ids . ")");
         write_log($log_file, $log_info);
         OmAvailableModel::rollback();
         return false;
     }
     $log_info = sprintf("tallyinglistId:%s, 时间:%s, 信息:%s,返回值:%s, 参数:%s \r\n", $ids, $date, '更新点货信息打标时间成功', $update_tallying, "update wh_tallying_list set printerId={$userId},printTime={$time} where id in(" . $ids . ")");
     write_log($log_file, $log_info);
     /** 更新点货记录 end**/
     /** 更新打标记录**/
     //        $select_sql  = "select * from wh_print_group where tallyListId={$id} and is_delete=0 order by id desc limit 1";
     //		$select_info = self::$dbConn->fetch_first($select_sql);
     //		if(empty($select_info)){
     //            $log_info      = sprintf("tallyinglistId:%s, 时间:%s,错误信息:%s,返回值:%s, 参数:%s \r\n", $id, $date, '打标信息不存在',
     //                                is_array($select_info) ? json_encode($select_info) : $select_info , $select_sql);
     //            write_log($log_file, $log_info);
     //			OmAvailableModel::rollback();
     //			return false;
     //		}
     $update_sql = "update wh_print_group set status=1 where tallyListId in ({$ids}) and is_delete=0";
     $update_print = self::$dbConn->query($update_sql);
     if (!$update_print) {
         $log_info = sprintf("tallyinglistId:%s, 时间:%s,错误信息:%s,返回值:%s, 参数:%s \r\n", $id, $date, '更新打标记录失败', is_array($update_print) ? json_encode($update_print) : $update_print, $update_sql);
         write_log($log_file, $log_info);
         OmAvailableModel::rollback();
         return false;
     }
     $log_info = sprintf("tallyinglistId:%s, 时间:%s,错误信息:%s,返回值:%s, 参数:%s \r\n", $id, $date, '更新打标记录成功', is_array($update_print) ? json_encode($update_print) : $update_print, $update_sql);
     write_log($log_file, $log_info);
     /** 更新打标记录 end**/
     /** 推送QC**/
     //foreach($tallyIdArr as $id){
     $push = WhPushModel::pushTallyingList($ids);
     $msg = $push ? '推送成功!' : '推送失败!';
     $log_info = sprintf("tallyinglistId:%s, 时间:%s,错误信息:%s,返回值:%s \r\n", $ids, $date, $msg, is_array($push) ? json_encode($push) : $push);
     write_log($log_file, $log_info);
     //}
     OmAvailableModel::commit();
     return true;
 }